SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 15/11/2017, 02:34 PM   #111
Pizzy
Huge Clucker
 
Join Date: May 2012
Posts: 469
Reputation: 113
Default Re: Discord Connector

When sending multiple discord messages at once, lag and issues are caused. I am very skeptical about using this with 20+ players online (sending discord messages every time a player is killed, connects, disconnects etc).

Has anyone tried this with a fair amount of players, sending a decent amount of messages per second?
__________________


Join the battle today.

play.samp-bf.net:7777

x2 EXP & CASH for all NEW players (first 20 minutes)
Pizzy is offline   Reply With Quote
Old 15/11/2017, 04:01 PM   #112
maddinat0r
Gangsta
 
maddinat0r's Avatar
 
Join Date: Jun 2010
Location: Germany
Posts: 888
Reputation: 460
Default Re: Discord Connector

Discord bots are not meant to spam channels. Discord itself has rate limits in place to prevent this. If you send too many messages and hit the rate limit, the plugin will queue all other messages until the rate limit delay passed.
If you continue spamming messages, and thus always hit the rate limit, your bot will eventually be banned by Discord itself.
maddinat0r is offline   Reply With Quote
Old 15/11/2017, 06:19 PM   #113
Pizzy
Huge Clucker
 
Join Date: May 2012
Posts: 469
Reputation: 113
Default Re: Discord Connector

Quote:
Originally Posted by maddinat0r View Post
Discord bots are not meant to spam channels. Discord itself has rate limits in place to prevent this. If you send too many messages and hit the rate limit, the plugin will queue all other messages until the rate limit delay passed.
If you continue spamming messages, and thus always hit the rate limit, your bot will eventually be banned by Discord itself.
So having it as sort of like an IRC bot, to talk to players ingame to discord channels, vice versa - it's not ideal?

It takes the requests fine, but with a few requests, the server pauses till it's finished doing the requests, which makes it sort of unplayable.

What is the recommended usage for this then? I had it setup like an IRC bot - using commands and ability to speak ingame & vice versa, but even with 6 players as a test, there were noticeable pauses which is disappointing


EDIT: I've tried finding the limits of the bot, but can't seem to find any official documentation. Any tests you've done which may sort of give a rough guide of the limits the bots can handle without being banned or flagged?
__________________


Join the battle today.

play.samp-bf.net:7777

x2 EXP & CASH for all NEW players (first 20 minutes)

Last edited by Pizzy; 15/11/2017 at 06:57 PM.
Pizzy is offline   Reply With Quote
Old 15/11/2017, 07:58 PM   #114
denNorske
Gangsta
 
denNorske's Avatar
 
Join Date: Nov 2011
Location: Narvik, Norway
Posts: 737
Reputation: 52
Default Re: Discord Connector

Wouldn't it be possible to connect multiple bots, such as IRC? IRC also rate limits at a certain amount of messages per x seconds.

Rotate the bots, make them send one message each and somehow get around the problem It's just an idea, as I haven't tested it myself.
__________________
OBJECT PARTITIONER
Ever wondered how to split up maps easily from one file? Check: Online Map Object Partitioner (Click)
[Filterscript] Circle Speedo: http://forum.sa-mp.com/showthread.php?p=3861785

You have the people that asks for rep, and those who doesn't like it at all:


Server Trailer: https://www.youtube.com/watch?v=jSKhbMFvAUs
denNorske is offline   Reply With Quote
Old 15/11/2017, 08:11 PM   #115
maddinat0r
Gangsta
 
maddinat0r's Avatar
 
Join Date: Jun 2010
Location: Germany
Posts: 888
Reputation: 460
Default Re: Discord Connector

Quote:
Originally Posted by Pizzy View Post
So having it as sort of like an IRC bot, to talk to players ingame to discord channels, vice versa - it's not ideal?

It takes the requests fine, but with a few requests, the server pauses till it's finished doing the requests, which makes it sort of unplayable.

What is the recommended usage for this then? I had it setup like an IRC bot - using commands and ability to speak ingame & vice versa, but even with 6 players as a test, there were noticeable pauses which is disappointing


EDIT: I've tried finding the limits of the bot, but can't seem to find any official documentation. Any tests you've done which may sort of give a rough guide of the limits the bots can handle without being banned or flagged?
There are no hardcoded limits - the rate limit system is dynamic.
But as a rule of thumb I'd say around 5 messages every ~3 seconds are okay.

Quote:
Originally Posted by denNorske View Post
Wouldn't it be possible to connect multiple bots, such as IRC? IRC also rate limits at a certain amount of messages per x seconds.

Rotate the bots, make them send one message each and somehow get around the problem It's just an idea, as I haven't tested it myself.
I'm no lawyer, but this might go against Discord's developer terms of service, specifically point 2.7:
Quote:
You will not [...] exceed or circumvent any limitation on the API calls you may make, or otherwise use the SDK or API in a manner that exceeds reasonable request volume, or constitutes excessive or abusive usage (“Rate Limits”).
They'd probably very quickly find out if several different bots are accessing the same API route from a single IP address (the SA-MP server).
maddinat0r is offline   Reply With Quote
Old 20/11/2017, 07:34 PM   #116
ISmokezU
Gangsta
 
Join Date: Aug 2016
Posts: 518
Reputation: 66
Default Re: Discord Connector

There's a lag I think with the messaging from the bots.

Scenario:

a server uses #chat to display in-game chats to the Discord server. The server gets at least 30 players, over 100 things are being said. Eventually, the bot delays at least 15-25 of those messages and maybe send them at a later date/time.

Is this Expected - Or a Bug?

Question:

Is there a limit to how many Bots you can use to send messages? For Instance, 1 Bot sends Chat Logs the other Command Logs, Is it recommended?
ISmokezU is offline   Reply With Quote
Old 21/11/2017, 12:40 AM   #117
JR_Junior
Big Clucker
 
Join Date: Nov 2011
Location: Brazil
Posts: 166
Reputation: 43
Default Re: Discord Connector

Is not possible to use the plugin to validate users only? The member type /discord and check if the server account email is the same of dircord account email.
JR_Junior is offline   Reply With Quote
Old 21/11/2017, 01:16 AM   #118
Kar
High-roller
 
Kar's Avatar
 
Join Date: May 2010
Location: Black Asylum
Posts: 3,169
Reputation: 471
Default Re: Discord Connector

Quote:
Originally Posted by ISmokezU View Post
There's a lag I think with the messaging from the bots.

Scenario:

a server uses #chat to display in-game chats to the Discord server. The server gets at least 30 players, over 100 things are being said. Eventually, the bot delays at least 15-25 of those messages and maybe send them at a later date/time.

Is this Expected - Or a Bug?

Question:

Is there a limit to how many Bots you can use to send messages? For Instance, 1 Bot sends Chat Logs the other Command Logs, Is it recommended?
It's expected. Discord bots are not meant for in-game relays with so many players.
Kar is offline   Reply With Quote
Old 21/11/2017, 03:10 AM   #119
ISmokezU
Gangsta
 
Join Date: Aug 2016
Posts: 518
Reputation: 66
Default Re: Discord Connector

Quote:
Originally Posted by Kar View Post
It's expected. Discord bots are not meant for in-game relays with so many players.
This makes sense, and after reading what pervious person and Maddinat0r said it's completely clear.

This is expected because of the rate limit to prevent spamming.

However, some logging could still take place. For instance Vehicle Purchasing Log. It's highly unlikely that a player could buy x amounts of vehicles before the rate limit activates.


Thank You.
ISmokezU is offline   Reply With Quote
Old 26/11/2017, 08:15 PM   #120
Pizzy
Huge Clucker
 
Join Date: May 2012
Posts: 469
Reputation: 113
Default Re: Discord Connector

What you can do is merge multiple messages into one string, so instead of sending a message each time someone speaks, put all the messages in one string and send it once every 2 seconds or so.

That's what I am doing, but overall seeing as SAMP servers are single threaded, lag/pausing is very common, which is very annoying.

Think I will be moving to a PHP Discord bot instead to send the messages, very inefficient with this plugin unfortunately (but is a huge shame as really like this. If SAMP wasn't single threaded it would be fine!)
__________________


Join the battle today.

play.samp-bf.net:7777

x2 EXP & CASH for all NEW players (first 20 minutes)
Pizzy is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Plugin] Teamspeak Connector maddinat0r Plugin Development 318 14/01/2018 06:20 AM
Route Connector James_Braga Русский/Russian 9 15/05/2015 09:24 AM
[Map] Connector Gas Tellken Maps 4 01/06/2012 04:04 AM
PSU connector help! patchkinson Everything and Nothing 3 20/03/2010 10:24 PM


All times are GMT. The time now is 08:17 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.