Tutorial by: KiritoMC_


Hello! Today, I will be teaching you how to use Skript in order to make a Discord bot that runs our your Minecraft server! So, before we start, we are going to need a couple things to make this work. First, get latest versions of Skript and Vixio. Next, go to Discord Developers Page, login to your account and click "Create an application"
.

Skript 2.2-dev37c: https://github.com/SkriptLang/Skript/releases/tag/dev37c
Vixio: https://github.com/iBlitzkriegi/Vixio/releases (Vixio 1.1.5 is not the latest version! 2.0 is out.)

Now, give your bot a name and picture by clicking "Bot" and boom your done but keep the Developers page open.

Now, drag Skript and Vixio to your plugins folder and boot up your server with your Start.bat. After this is done, shut your server down, and you will see why we do this in a bit. Next, go to your Skript folder inside of the plugin folder, and you will see a folder called "scripts". Go into that folder. Now, here is some good future info if you haven't already done this. Go to the top of your folder, click "View", and check off "File Name Extensions". Doing this will allow you to use Skript's special file format that it uses to read your code. Now, left click, create a new text document, and delete all of it, including the ".txt" and rename it whatever you want but with ".sk" at the end. And that's all for this step! Up next is the code.

Now, open up the file you just created and we are gonna write your code:

on skript load: 
    login to "Bot Token Here" with the name "Your Bot's Name"

Now, go back to the Discord Developers site, the bot section and go to "Token" and click "Copy". WARNING: NEVER, EVER, give anyone your bot's token! Also, still don't close the developer site! It's still needed!

Now, paste your token where I put "Bot Token Here". Now, go back to the developers page, go to "OAuth2" , click the bot box, and copy the link at the bottom and follow the other steps to inviting the bot! Now, start up your server and you should see your bot come online!


And finally, the good stuff: Connecting Discord to Minecraft
In order to send Minecraft chat to a Discord channel we need to use the on chat: event.
So here is the code:

on chat:
    send "%player%: %message%" to channel with id "channel id here"

Now to get a channel id, go to Discord, User Settings, Appearance, and toggle developer settings. Left click on whatever channel you want to use, and click copy id and paste the id where i put "channel id here" .

For sending Discord chat to Minecraft, we have to use the on guild message received seen by event-bot: Pretty much what event-bot is, is the current logged in bot, so that's easy! So here's what the code should look like:

on guild message received seen by bot:
    broadcast "%name of event-user%: %event-message%"

And that's all! You should now have a working Minecraft -> Discord -> Minecraft chat way! If you need anymore support, there is an Official Vixio discord or just dm me, Zero Two#0618! Thanks for reading! If you want another example, go check out BlueEyescat's GitHub example https://github.com/Blueyescat/Discord-Bot-Skript.


Did you find KiritoMC_'s tutorial helpful?


You must be logged in to comment