SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 15/11/2017, 03:01 PM   #111
maddinat0r
Gangsta
 
maddinat0r's Avatar
 
Join Date: Jun 2010
Location: Germany
Posts: 895
Reputation: 479
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, 05:19 PM   #112
Pizzy
Huge Clucker
 
Join Date: May 2012
Posts: 453
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 05:57 PM.
Pizzy is offline   Reply With Quote
Old 15/11/2017, 06:58 PM   #113
denNorske
Gangsta
 
denNorske's Avatar
 
Join Date: Nov 2011
Location: Oslo, Norway
Posts: 784
Reputation: 74
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.
denNorske is offline   Reply With Quote
Old 15/11/2017, 07:11 PM   #114
maddinat0r
Gangsta
 
maddinat0r's Avatar
 
Join Date: Jun 2010
Location: Germany
Posts: 895
Reputation: 479
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, 06:34 PM   #115
ISmokezU
Gangsta
 
Join Date: Aug 2016
Posts: 573
Reputation: 73
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 20/11/2017, 11:40 PM   #116
JR_Junior
Huge Clucker
 
Join Date: Nov 2011
Location: Brazil
Posts: 228
Reputation: 54
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, 12:16 AM   #117
Kar
High-roller
 
Kar's Avatar
 
Join Date: May 2010
Location: Black Asylum
Posts: 3,182
Reputation: 504
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, 02:10 AM   #118
ISmokezU
Gangsta
 
Join Date: Aug 2016
Posts: 573
Reputation: 73
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, 07:15 PM   #119
Pizzy
Huge Clucker
 
Join Date: May 2012
Posts: 453
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
Old 27/11/2017, 05:54 PM   #120
maddinat0r
Gangsta
 
maddinat0r's Avatar
 
Join Date: Jun 2010
Location: Germany
Posts: 895
Reputation: 479
Default Re: Discord Connector

The plugin is doing all networking in an extra thread, not the main AMX thread. The only source of lags could be the logging, because full logging is forcefully enabled. Disabling this will be possible in the next version.
maddinat0r 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 325 08/09/2018 07:04 PM
Route Connector James_Braga Русский/Russian 9 15/05/2015 08:24 AM
[Map] Connector Gas Tellken Maps 4 01/06/2012 03:04 AM
PSU connector help! patchkinson Everything and Nothing 3 20/03/2010 09:24 PM


All times are GMT. The time now is 11:04 AM.


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