Discord Plug-in

Questions, comments, and news on the server side plug-ins and it's API
Post Reply
User avatar
FiringSquad
Sergeant
Sergeant
Posts: 843
Joined: Thu Jan 26, 2006 5:53 pm
Location: Ireland

Discord Plug-in

Post by FiringSquad » Sun Jun 23, 2019 10:47 pm

Writing a plug-in to inform the user on their Discord client when a server is active.

This will involve the plug-in making a http call (probably POST, but whatever's easiest) to let the service know when a player joins/leaves.
At the early stages, so just doing some research.

The idea is that the plug-in can post messages (fire & forget) to my service authenticated by an api-key.
The service will then inform any subscribers if their favourite servers are active.

I'm assuming that I can link to libcurl and expect that the binary will be provided by the server.

Anybody else try to make a http call from a plug-in before?
Any gotchas/advice/examples?

A rough proposed architecture diagram is attached.
It's a bit overkill, but it's for a course project that needs to be suitable for high-availability.
I can simplify it after the project is complete (if anyone's interested)
Attachments
ProposedService.png
(110.99 KiB) Not downloaded yet

User avatar
blast
General
General
Posts: 4729
Joined: Fri Mar 21, 2003 3:49 pm
Location: playing.cxx
Contact:

Re: Discord Plug-in

Post by blast » Mon Jun 24, 2019 12:18 am

The bzfs API itself provides "URL jobs" which let you make HTTP requests. Use that instead of directly linking your plugin to libcurl. I have an example of that in an old plugin I wrote. There's also other examples on some Github repos.

https://bitbucket.org/blast007/bz_playe ... ayerdb.cpp
https://github.com/search?q=bz_addURLJob&type=Code
"In addition to knowing the secrets of the Universe, I can assure you that I am also quite potty trained." -Koenma (Yu Yu Hakusho)

Image

User avatar
tainn
Private First Class
Private First Class
Posts: 150
Joined: Sun Nov 18, 2018 7:25 pm
Location: zone of the phantoms

Re: Discord Plug-in

Post by tainn » Mon Jun 24, 2019 8:35 am

Do you plan on utilizing any of the discord API libs that the communities have built and if yes, which?

User avatar
FiringSquad
Sergeant
Sergeant
Posts: 843
Joined: Thu Jan 26, 2006 5:53 pm
Location: Ireland

Re: Discord Plug-in

Post by FiringSquad » Mon Jun 24, 2019 11:25 am

blast wrote:
Mon Jun 24, 2019 12:18 am
The bzfs API itself provides "URL jobs" which let you make HTTP requests. Use that instead of directly linking your plugin to libcurl. I have an example of that in an old plugin I wrote. There's also other examples on some Github repos.

https://bitbucket.org/blast007/bz_playe ... ayerdb.cpp
https://github.com/search?q=bz_addURLJob&type=Code
Thanks blast! That's perfect.

Blast clears a path for easier development

User avatar
FiringSquad
Sergeant
Sergeant
Posts: 843
Joined: Thu Jan 26, 2006 5:53 pm
Location: Ireland

Re: Discord Plug-in

Post by FiringSquad » Mon Jun 24, 2019 11:35 am

tainn wrote:
Mon Jun 24, 2019 8:35 am
Do you plan on utilizing any of the discord API libs that the communities have built and if yes, which?
I'm creating a Discord bot that I'm hosting, which will be able to DM anyone registered with the service.

Might also be useful for server owners or admins, but I haven't thought much about that.

User avatar
allejo
Breaker of Builds
Breaker of Builds
Posts: 754
Joined: Sun Feb 17, 2008 10:01 pm
Location: /dev/null
Contact:

Re: Discord Plug-in

Post by allejo » Tue Jun 25, 2019 12:07 am

Here's my personal website and my open source projects are available on GitHub; I work on a lot of cool things.

Image

User avatar
FiringSquad
Sergeant
Sergeant
Posts: 843
Joined: Thu Jan 26, 2006 5:53 pm
Location: Ireland

Re: Discord Plug-in

Post by FiringSquad » Tue Jun 25, 2019 8:21 pm

Thx :)

User avatar
Zehra
Private First Class
Private First Class
Posts: 582
Joined: Sun Oct 18, 2015 3:36 pm
Location: Arctic

Re: Discord Plug-in

Post by Zehra » Wed Jun 26, 2019 10:03 pm

You also may wish to look into OneVsOne plug-in may as well.

Some ideas to possibly look into adding after it is completed, if not currently planned.
  • Minimum player count configuration option. (a.k.a. "Don't notify player unless there is at least X players".)
  • Not including 'solo' bots in player counts.
  • Message updating up to 5 minutes after send. (Reduces the possibility of spamming the player if several servers get popular at once.)
  • Option for notifications while on servers. (Players may or may not want to be notified while they are currently on a server.)
  • "Playing 'x'" status on bot may provide some data on currently active and subscribed servers. "[] servers active out of []"
  • Option of excluding observers from notifications. (If only players are being counted, disregard this one.)
-Zehra
Those who are critical of me, I'll likely be the same of them. ~Zehra
There's always something to remember and it's been a game I love. ~Zehra
The time spent is a time which can never be regained, so it's a time to enjoy. ~Zehra
The decisions we make are the ones we look forward too and the ones we regret. ~Zehra
There's a difference between knowing my name and knowing me, one shows respect to my name and the other is to who I am. ~Zehra

See where I've last been active at Strayers.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest