nitrous Posted May 7, 2018 Group: Developer Topic Count: 4 Topics Per Day: 0.00 Content Count: 141 Reputation: 46 Joined: 08/14/12 Last Seen: April 5 Share Posted May 7, 2018 (edited) Story Time: 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. Until now. 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. "So?" 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!" Exactly! How it looks: Installation: 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 Disclaimers: 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. Code: The code is here: https://pastebin.com/Z82M9ssf Edited May 9, 2018 by nitrous 7 1 1 2 Quote Link to comment Share on other sites More sharing options...
Litro Endemic Posted May 8, 2018 Group: Members Topic Count: 25 Topics Per Day: 0.01 Content Count: 283 Reputation: 79 Joined: 06/13/13 Last Seen: June 7, 2023 Share Posted May 8, 2018 wow it's good add on, there is this topic that can send chat in game to discord and vice versa, discord is hot commodity for gamer nowadays and it will be goodies if real time message can be made then on server side instead hooking on client, rep up for you Quote Link to comment Share on other sites More sharing options...
nadomendes2 Posted January 4, 2021 Group: Members Topic Count: 1 Topics Per Day: 0.00 Content Count: 5 Reputation: 0 Joined: 01/04/21 Last Seen: April 10 Share Posted January 4, 2021 (edited) is it possible to do by script command? ex: @sendrest Edited January 4, 2021 by nadomendes2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.