SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 07/11/2017, 04:50 AM   #111
Sgt.TheDarkness
Huge Clucker
 
Sgt.TheDarkness's Avatar
 
Join Date: Jun 2012
Location: Moscow, Russia.
Posts: 265
Reputation: 50
Default Re: Discord Connector

Not sure why I keep having this issue, but I'll get about 15-20 minutes of uptime before the server crashes/infinite loops due to an issue with this plugin. I always have to kill the process, see below. The message never made it to my discord server either, it started hanging before it reached.


Also note I'm not running the plugin in debug mode as I cannot compile it on CentOS 7 due to CMake not being able to find the OpenSSL libraries although CMake reports it is installed on the system (1.0.2k), some enlightenment on that would be nice.

From server log:
Code:
[23:43:17] [chat] [TheDarkness]: test
[23:44:56] [debug] Server received interrupt signal while executing SFSE.amx
[23:44:56] [debug] AMX backtrace:
[23:44:56] [debug] #0 native DCC_SendChannelMessage () from discord-connector.so
[23:44:56] [debug] #1 0026ac88 in public OnPlayerText (playerid=1, text[][email protected] "test") at SFSE.pwn:1652
[23:44:56] [debug] Native backtrace:
[23:44:56] [debug] #0 f60d555b in _ZN10StackTraceC2EPv () from plugins/crashdetect.so
[23:44:56] [debug] #1 f60ce5df in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so
[23:44:56] [debug] #2 f60cf7a2 in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[23:44:56] [debug] #3 f60cfb46 in _ZN11CrashDetect11OnInterruptEPv () from plugins/crashdetect.so
[23:44:56] [debug] #4 f60d529c in ?? () from plugins/crashdetect.so
[23:44:56] [debug] #5 f7782410 in ?? ()
[23:44:56] [debug] #6 f7782425 in ?? ()
[23:44:56] [debug] #7 f772e722 in ?? () from /lib/libpthread.so.0
[23:44:56] [debug] #8 f7729cd8 in ?? () from /lib/libpthread.so.0
[23:44:56] [debug] #9 f7729bb0 in __pthread_mutex_lock () from /lib/libpthread.so.0
[23:44:56] [debug] #10 f5ddab18 in ?? () from plugins/discord-connector.so
[23:44:56] [debug] #11 f5ddaf94 in ?? () from plugins/discord-connector.so
[23:44:56] [debug] #12 f5dbed9f in ?? () from plugins/discord-connector.so
[23:44:56] [debug] #13 f5e2e5c7 in ?? () from plugins/discord-connector.so
[23:44:56] [debug] #14 080950e4 in ?? () from ./samp03svr
[23:44:56] [debug] #15 f60d12eb in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[23:44:56] [debug] #16 f60d4318 in ?? () from plugins/crashdetect.so
[23:44:56] [debug] #17 f60d7e76 in amx_Exec () from plugins/crashdetect.so
[23:44:56] [debug] #18 f60d05a6 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[23:44:56] [debug] #19 f60d4079 in ?? () from plugins/crashdetect.so
[23:44:56] [debug] #20 f600d5b1 in ?? () from plugins/streamer.so
From logs/plugins/discord-connector.log
Code:
[11/06/17 23:43:17] [DEBUG] DCC_SendChannelMessage(7, "[23:43:17] TheDarkness(1): test") (SFSE.pwn:1652)
[11/06/17 23:43:17] [DEBUG] Http::Post
[11/06/17 23:43:17] [DEBUG] Http::SendRequest
[11/06/17 23:43:17] [DEBUG] Http::PrepareRequest
[11/06/17 23:43:47] [DEBUG] WebSocket::DoHeartbeat
[11/06/17 23:43:47] [DEBUG] sending heartbeat
[11/06/17 23:43:47] [DEBUG] WebSocket::OnWsRead
[11/06/17 23:43:47] [DEBUG] heartbeat ACK
[11/06/17 23:43:47] [DEBUG] WebSocket::WsRead
[11/06/17 23:44:29] [DEBUG] WebSocket::DoHeartbeat
[11/06/17 23:44:29] [DEBUG] sending heartbeat
[11/06/17 23:44:29] [DEBUG] WebSocket::OnWsRead
[11/06/17 23:44:29] [DEBUG] heartbeat ACK
[11/06/17 23:44:29] [DEBUG] WebSocket::WsRead
[11/06/17 23:45:10] [DEBUG] WebSocket::DoHeartbeat
[11/06/17 23:45:10] [DEBUG] sending heartbeat
[11/06/17 23:45:10] [DEBUG] WebSocket::OnWsRead
[11/06/17 23:45:10] [DEBUG] heartbeat ACK
[11/06/17 23:45:10] [DEBUG] WebSocket::WsRead
__________________
Sgt.TheDarkness is offline   Reply With Quote
Old 15/11/2017, 02:34 PM   #112
Pizzy
Huge Clucker
 
Join Date: May 2012
Posts: 460
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?
__________________


We are relaunching VERY soon!

Sign up on our forum - http://samp-bf.net

Join the battle today.
Pizzy is offline   Reply With Quote
Old 15/11/2017, 04:01 PM   #113
maddinat0r
Gangsta
 
maddinat0r's Avatar
 
Join Date: Jun 2010
Location: Germany
Posts: 881
Reputation: 459
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   #114
Pizzy
Huge Clucker
 
Join Date: May 2012
Posts: 460
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?
__________________


We are relaunching VERY soon!

Sign up on our forum - http://samp-bf.net

Join the battle today.

Last edited by Pizzy; 15/11/2017 at 06:57 PM.
Pizzy is offline   Reply With Quote
Old 15/11/2017, 07:58 PM   #115
denNorske
Gangsta
 
denNorske's Avatar
 
Join Date: Nov 2011
Location: Narvik, Norway
Posts: 722
Reputation: 49
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   #116
maddinat0r
Gangsta
 
maddinat0r's Avatar
 
Join Date: Jun 2010
Location: Germany
Posts: 881
Reputation: 459
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
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 314 09/06/2017 08:46 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 05:22 PM.


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