[MODULE] Discord module for SqMod


  • Full Member
  • Posts: 110
[MODULE] Discord module for SqMod
«  »Last edited
Discord module for SqMod using sleepy-discord library.

This plugin is a multi-bot plugin.

Wiki: https://github.com/Luckshya/sleepydiscord-sqmod/wiki/
Example code: Available on wiki

Sleepy-Discord: https://github.com/yourWaifu/sleepy-discord
Plugin Source: https://github.com/Luckshya/sleepydiscord-sqmod


Install OpenSSL from here: https://slproweb.com/products/Win32OpenSSL.html
Don't change any options while installing openssl.

Binaries: https://github.com/Luckshya/sleepydiscord-sqmod/releases

Code: [Select]
apt-get install libssl-dev

Binaries: https://github.com/Luckshya/sleepydiscord-sqmod/releases
(32 bit not available for now)

The most important thing:
  • @. (SLC): I've learnt a lot from his code and I've also implemented and used his code. He has also helped me throughout the problems including my stupid problems or whatever. He's just like the author of the plugin tbh.
  • @Doom_Kill3R
  • @EK.IceFlake
  • @Sebastian
  • @Xmair

NOTE: You need to take care of the Discord rate limit yourself.


  • VC:MP Beta Tester
  • Infinite loops defy infinity by overflowing memory
  • Posts: 1,168
[MODULE] Re: Discord module for SqMod
« Reply #1,  »Last edited
There has been alot of effort put into this, one way or the other, great job!


  • Full Member
  • Posts: 110
[MODULE] Re: Discord module for SqMod
« Reply #3,  »
Added function Regex_Match to check for special character/symbols for discord. More details in the main post.
[MODULE] Re: Discord module for SqMod
« Reply #4,  »
Fixed issue that crashes the server while closing. Make sure you update the binaries from the latest release on the repo.
[MODULE] Re: Discord module for SqMod
« Reply #5,  »
A new update 0.2 has been released that brings the following changes.
  • Fixed an issue that causes server to crash when a DM is received by the bot.
  • Added param authorID to the event onMessage as updated in the example code.

Make sure you update the binaries from the latest release on the repo.
[MODULE] Re: Discord module for SqMod
« Reply #6,  »
Update v0.2.1 changelog.
  • Added param authorNick to event onMessage
  • Added function GetRoleName to get the name of role using server ID and role ID
  • Fixed an issue of updating roles and other things in Sleepy-Discord version

Example scripts have been updated.
Make sure you get the latest binaries from the latest release on the repo.
[MODULE] Re: Discord module for SqMod
« Reply #7,  »Last edited
Update v0.2.2 changelog.
  • Added function SetActivity. More information about it in main post.
  • Fixed several bugs

NOTE: libdiscord users should not send empty messages or the message like "" or "\n" or "msg\n" or the server will crash. Support for it may be released in the next version.
Valid message can be: "\nmessage", "msg1\nmsg2"
[MODULE] Re: Discord module for SqMod
« Reply #11,  »Last edited
Update v0.4.3 changelog :-
  • Switched to lock-free queues instead of mutex locks on server thread, so a boost in performance
  • Added an option to toggle internal cache
  • Added cache events (see wiki for more info)
  • Changed message event function parameters
  • Added new script objects to identify discord objects like Guild, Channel, User, ServerMember, Role, Message
  • Added GetGuild and GetOtherChannel functions (more info about them on wiki)
  • Event callbacks are now made through lock free queue
  • Added new constants for Discord ChannelType and MessageType

Wiki has been restructured and newly added features have been added it. Make sure to see the wiki before using them.
Added example code for both internal cache enabled and disabled on wiki.

Wiki: https://github.com/Luckshya/sleepydiscord-sqmod/wiki
Release: https://github.com/Luckshya/sleepydiscord-sqmod/releases/

I recommend to keep the internal cache disabled and manage cache yourself. I have also provided an example script on wiki to cache data.