Beta!

Mods / VSChatBot - Discord bot

Category: #Other
Author: Capsup
Side: Server
Created: Feb 16th
Last modified: Apr 29th
Downloads: 191

Here's a Discord Bot for those of you who want to engage your community more by allowing them to see what goes on in-game, all from the safety of their favourite chat application, Discord!
I've been developing it in cooperation with the awesome community of RabbitTech, so a big shout-out to those guys (especially TechRabbit himself) for dealing with the silly bugs and giving feedback. 

Features

  • Send text messages from the General chat in-game, directly to a discord channel 
  • Send messages from the same Discord channel, directly to the General chat in-game 
  • Assuming storms are enabled, storm notifications will be sent when they approach, begin and end
  • Optional death messages
  • Optional server up/down messages
  • Various utility commands like !help, !time, !players and !lastseen

Installation

It's a discord client wrapped as a regular mod, so installing it is like any other regular VS server-side mod. 

  1. Download the zip package for the latest release here on the modhub
  2. Drop the zip directly into %appdata%\VintageStoryData\Mods (or where ever your VS data is installed to)
  3. Don't extract it

You will, however, have to manually create a bot at https://discord.com/developers/applications

  1. Create a new application and name it something appropriate
  2. Go into the Bot tab and 'Add Bot'
  3. Optionally disallow 'public bot' which seems to be the default
  4. Go into the OAuth2 tab
  5. Scroll down and give it the 'bot' scope
  6. Scroll further down after clicking and add the 'send messages' text permission
  7. Scroll up again and copy the link that Discord has generated into a new browser window
  8. Add it to the respective server you want
  9. You should now see a bot connect to your Discord server
  10. Go back to the Bot tab and keep it open for when you need to copy your Bot token into the config file

Once this is done, you can take the vschatbot.zip and put into your mods folder.
On the first start-up, the mod will create a vschatbot.json config file in your ModConfig folder and then shut down. This needs to be filled otherwise the bot will not function.

The 3 mandatory fields are:

  • "Token" which is the token generated by the Discord application. Must be a string, so surrounded by "".
  • "ServerId" which is the id of the discord server you want it to connect to. Make sure this remains a number (so no "")!
  • "ChannelId" which is the id of the channel on the discord server you want it to send messages from in-game to, and take from. Make sure this remains a number!

ServerId and ChannelId are the identifiers given by Discord to your server and channel. You can find them directly in Discord if you enable developer mode and then right click -> 'copy id'.

Once these are filled, you can restart the server and you should see the following message as part of start-up in server-main.txt in your log files:

[Notification] vschatbot: connected to discord and ready!
image

If not, something went wrong, most likely during configuration of the Discord bot.

Commands

The bot have several commands available, but all are out-of-game. They can be triggered by prefixing your message with ! or @mentioning the bot

  • !help [string] - shows all the available commands if sent with no arguments. If sent with argument, will show the command help of that particular command.
  • !players - shows all online players at the time
  • !time - shows the current time of the server and the current season. The time of the server respects the server config of additional days per month and more, so you will see dates like 35. March. This is to be expected and is how the game calendar works.
  • !lastseen [playername] - allows you to look up when the given playername was last seen online (only works after the bot has been installed obviously).
  • !stats [playername] - shows more detailed stats for an individual (only total play time + deaths atm, more coming as I develop my player stats mod)

 

Contribute

  • Want more awesome Vintage Story content? Help me spend more time developing mods than enterprise software, by becoming a patron or donating straight to paypal!

Version For Game version Downloads Release date Changelog Download
v1.2.0 76 Apr 29th Show vschatbot_v1.2.0.zip
v1.1.1 114 Feb 16th Show vschatbot_1.1.1.zip

2 Comments

Tech_Rabbit, Feb 28th

This is easily one of the most important mods for a server! Thank you Capsup for creating and maintaining this.

Capsup, Feb 16th
delete edit