A lot of players run into problems. They disconnected in an instance, they bought the wrong item, someone is being a nuisance in battlegrounds. After cursing, they usually type `@request`. But alas, none of the GMs you hired are online! You need to dock their pay. The message is lost in the void.
Discord has support for webhooks, which is a way to associate callbacks to HTTP requests. Their developer docs for webhooks can be found here. Basically, you can send a POST to your discord webhook url, and the contents will be printed to the associated channel.
When someone uses `@request`, the message is sent from the map server to the character server, which then sends it back to all map servers, and the map servers send the message to all connected GMs.
Because it sends it to the character server, we're able to send the POST request from the character server. This helps performance, since the map server is constantly doing things and the character server generally uses less resources.
"That's great! But how do we send this POST request? Do I need a stamp?"
If you're on Linux, there's a great command line tool called `curl`. It's mostly used to download files from a server, but it also has support for all other HTTP methods.
"Command line? How do we put it in rathena?"
Curl also comes with a library called libcurl that we can use in c/c++ programs!
"I see, so we use libcurl to send the message to the discord webhook!"
How it looks:
Two config options are added in this patch: gm_whisp_webhook and gm_whisp_webhook_url
This makes a change to configure, and adds a new flag. You need to add --with-lcurl to your arguments. Example: ./configure --enable-prere --enable-vip --enable-packetver=20170614 --with-lcurl
This only works on linux. I don't run rAthena servers on windows, and neither should you. (personal opinion)
You need to install libcurl-devel. On some OSes it could be called something else; on Ubuntu, it's libcurl4-openssl-dev.
Don't ask me for a lot of help if you can't get it to work. This is supposed to be a showcase, but I'm giving the code out.
I made this in a day, it's not the greatest code. Initializing curl and cleaning up on every call is not the greatest, but unless you are getting 100 requests a minute, it should be ok for now.
Eventually, I want to add it to src/common or something. But that'll happen in a future weekend.
The code is here: https://pastebin.com/Z82M9ssf