• Hi, Guest!
    Some images might be missing as we move away from using embedded images, sorry for the mess!
    From now on, you'll be required to use a third party to host images. You can learn how to add images here, and if your thread is missing images you can request them here.
    Do not use Discord to host any images you post, these links expire quickly!
Post Data to Discord Webhooks

Post Data to Discord Webhooks 1.0

Pokémon Essentials Version
Non-applicable
Hidden Text


Z9H8QIt.png

Hidden Text



DISCLAIMER


Compatible with all Essentials versions.

The following adds the ability to post data directly to a Discord Webhook. What possibly could you use this for? I have no idea. Maybe to troll your own server with your game, or create a channel with in-game user achievements that get broadcast into it. The possibilities boil down to your imagination.

Carefully read all the instructions .


Using the script


This script utilizes the functionality of cURL and CMD to make a proper post request to send data to a Discord Webhook. Before you even attempt to use this script you need to ensure that you have cURL on your device. The newer Windows 10 updates come with cURL natively in the system, namely:
Code:
Windows 10 build 1803 (released early May 2018)
but your mileage may vary. To see whether or not you have cURL on your device, simply open CMD and try to run the curl command and see if you get a "not recognized" error. If you don't, it means you have cURL ready for usage. This isn't only applicable for your development environment. Any potential player (should you utilize this in your fan-games) would need the cURL environment to be able to post to Discord Webhooks. Luckily, since this functionality is done externally through CMD and not from the game itself, you won't run into any crashes or errors should the players not have cURL. The posts simply won't happen. Hovewer, if you're planning on utilizing this in your games, you should let your players know.

The script is actually very simple to use. You simply need to define a target URL and a Data Hash and reference the proper function name. Be sure to check up on the Webhook documentation to see exactly what data parameters are accepted when posting to a Webhook.

You can see an example of how to use the script below:
Ruby:
url = "https://discordapp.com/api/webhooks/#{WEBHOOKIDCODE}"
data = {
    "username" => "Game Dev Café",
    "content" => "Feel free to grab the new EPI. Marin approved this message.",
    "embeds" => [
            {
                "title" => "Essentials Plugin Installer",
                "url" => "http://resources.luka-sj.com",
                "color" => 4039390
            }
    ]
}

DiscordWebhooks.post(url,data)

Direct link to script if you don't feel like going through the EPI.
Credits
Luka S.J.
Author
Luka S.J.
Downloads
780
Views
2,011
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Luka S.J.

Back
Top