AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [ANY] Discord API (Send/Retrieve messages, list Guilds/Channels) UPDATE: 10/1/17 (https://forums.alliedmods.net/showthread.php?t=292448)

Deathknife 01-06-2017 15:45

[ANY] Discord API (Send/Retrieve messages, list Guilds/Channels) UPDATE: 10/1/17
 
1 Attachment(s)
About:
Provides an API that allows plugins to:
- Listen to messages on Channel
- Send Messages to a Channel
- Get Guilds
- Get Channels for a Guild

It's barebone now, just the basics. If people are interested I can add more features. Check github page for some documentation.

Bot token can be obtained from https://discordapp.com/developers/applications/me

Dependencies:

SteamWorks
smjansson

Changelog:
Quote:

v0.1.12
* Fixed Guild Channels list error 429 support
* Made requests retry in two seconds if it fails to create HTTP request. This usually happens when server just launched.

v0.1.10
- Removed unnecessary includes that are not used. (cstrike include prevented it from running on TF2) Should be fine now
+ Added support if discord returns too many requests. Running plugin on multiple servers should no longer be an issue.

v0.1.1
+ Added Support for x-rate-limit (not global yet)

v0.1.0
+ Initial Release
Github Repository

EXAMPLES (Call admin, server announcements from discord)

headline 01-06-2017 16:50

Re: Discord API (Send/Retrieve messages, list Guilds/Channels)
 
Really cool! :bacon!:

skinheadxtreme 01-07-2017 08:19

Re: Discord API (Send/Retrieve messages, list Guilds/Channels)
 
could you show some screens? :D

Deathknife 01-07-2017 10:57

Re: Discord API (Send/Retrieve messages, list Guilds/Channels)
 
Added some examples & support for x-rate-limiting

Quote:

Originally Posted by skinheadxtreme (Post 2484308)
could you show some screens? :D

Here's a video https://www.youtube.com/watch?v=3jgqg96i77E

Aymeric VII 01-07-2017 13:14

Re: Discord API (Send/Retrieve messages, list Guilds/Channels)
 
Damn thats fucking sweet, thanks for this.

my11 01-07-2017 13:19

Re: Discord API (Send/Retrieve messages, list Guilds/Channels)
 
Nice!!

Xenoadria 01-08-2017 21:38

Re: [ANY] Discord API (Send/Retrieve messages, list Guilds/Channels)
 
Seems great. Planning to get this work first thing tommorow, however I am having some concerns.
I'm having more than 1 server, 4 to be exact. Making a configuration, and putting the same configuration on all the servers would make all calladmin messages arrive at same channel on discord meaning I wouldnt be able to recognize from which server the report came ? Same thing goes for the announcements, if it's same configuration, writing an announcement on the discord would send the announcement on every server ?
Am I mistaking somewhere ?
So I'm asking, is it possible somehow to make this plugin to "search" for different named channels to send messages on discord (meaning I need to create only more channels on discord) or for the specific situation that I am having (4 servers and would like to have calladmin and announcements on all of them seperatly), I would need to make 4 bots with more differently named channels?

Maybe some of this is stupid, but I was just curiuos. Once again I love this and good job for the idea.

Suggestion for call admin (if its possible). When !calladmin in game is written. A menu pops up to select a player which you want to report, afterwards you pick a reason and then report comes on discord. It would help admins know for what exactly they are being called.

Best regards

Maxximou5 01-08-2017 23:48

Re: [ANY] Discord API (Send/Retrieve messages, list Guilds/Channels)
 
Really awesome to have!
Should prove really useful with adding it's functionality to other plugins.

Deathknife 01-09-2017 12:30

Re: [ANY] Discord API (Send/Retrieve messages, list Guilds/Channels)
 
Quote:

Originally Posted by Xenoadria (Post 2484846)
Seems great. Planning to get this work first thing tommorow, however I am having some concerns.
I'm having more than 1 server, 4 to be exact. Making a configuration, and putting the same configuration on all the servers would make all calladmin messages arrive at same channel on discord meaning I wouldnt be able to recognize from which server the report came ? Same thing goes for the announcements, if it's same configuration, writing an announcement on the discord would send the announcement on every server ?
Am I mistaking somewhere ?
So I'm asking, is it possible somehow to make this plugin to "search" for different named channels to send messages on discord (meaning I need to create only more channels on discord) or for the specific situation that I am having (4 servers and would like to have calladmin and announcements on all of them seperatly), I would need to make 4 bots with more differently named channels?

Maybe some of this is stupid, but I was just curiuos. Once again I love this and good job for the idea.

Suggestion for call admin (if its possible). When !calladmin in game is written. A menu pops up to select a player which you want to report, afterwards you pick a reason and then report comes on discord. It would help admins know for what exactly they are being called.

Best regards

The call admin sends the server name & IP along with the message so it shouldn't be much of a problem. Either way, if you want to send messages to different channels, just replace "call-admin" and "server-"(whatever it was, I forgot) in the .sp with your channel name of choosing and compile. They can all use the same bot.

However that said, currently there's a certain limitation when running more than one server on the same Bot. Discord has x-rate-limits (for example, getting guilds, 1 max every few seconds). While I implemented x-rate-limit support, it will only work fully if there's one server as my implementation of the x-rate-limit depends on each request to succeed. For example, If two servers launch at the same time and send guild list request at same time, one will succeed and the other won't. This is because server 2 was returned an error 429 instead of guilds list. I will implement support for this when I get time, possibly tomorrow. Until then, if you are running more than one server, try starting up the plugins at different time.

It's a good idea, for now I'm keeping it barebone as it's just meant to be an example. I will probably later on expand it and possibly add that though.

MrDanne 01-10-2017 04:43

Re: [ANY] Discord API (Send/Retrieve messages, list Guilds/Channels)
 
Nice plugin, looking forward to try this on my server.

Do you have any plan on making it work with sourcebans++ ?


All times are GMT -4. The time now is 20:59.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.