DEV Community

Cover image for Create Custom Company Chat bots on Discord
Derrick Sherrill for WayScript

Posted on

Create Custom Company Chat bots on Discord

Introduction

Bots today are an important part of Customer help services. With services used by millions of people, it’s difficult for Customer service people to handle all the problems addressed to them. Bots can be easily built and integrated into any services if you are using the Wayscript platform.

So today, we are going to build a Customer help Bot for Discord.

Prerequisites

No prerequisites for this tutorial. However, you can read about the module we are going to use in this post.

  • Working with Discord Trigger
  • Working with conditionals
  • Working with Discord module

Trigger

When someone will write a message in the help channel, we’ll capture the message and perform actions on it, and later send a response. For this purpose, we’ll use the Discord Trigger.

Adding the Trigger

Well, The trigger will depend on the action I add on the discord channel. It’s a pinned message.

Pinned messages

So basically we have three actions. But first, we have to configure the Trigger.

Configuration of the trigger

For the output, be sure to have Discord Message selected. This list contains information we’ll use to perform actions.

The conditions

Here we have three conditions, but exactly four. A message will be displayed if the user hasn’t entered a valid action, I mean a valid action is A, B or C. Nothing else. First, add the If/Else module.

Adding If/Else module

Once it’s done, we can add the conditions.

Adding a condition

If you want to add another condition, just click on Add Else if.

Adding all the conditions

Now we have different branches for our scenario. We are going to create a string variable where we’ll store the message we want to send.

Then in the first branch concerning action A, add Create Variable module.

Adding Variable module

And then add this variable and text message.

Text message A

We are going to do the same for the second branch and the third branch.

Text message B

Text message C

Great. But it’s not finished yet. As I said earlier, we have four conditions. The Else will be executed if the message typed by the user is not equal to A, B, or C. Then we can add a custom message for this branch too.

Text message Else

Now that we have the text message, we can easily respond now via our Discord bot.

Discord Bot

Wayscript provides a Discord module you can use to read or write messages. Then, we can use this module to create the Help Bot.

Adding Discord Module

Once it’s added and you have configured the server, be sure to have a separate channel for this bot. In my case, I called it help.

Configuring Discord Module

Now, we can add inputs. Most importantly, we need the name of the Bot and the message. You can add an image to if you want to give a face to your Bot. ;)

Discord Inputs

Great! The Bot is ready and if you’ve followed exactly this tutorial your result will look like this.

Wrong Message

Feel free to clone this script and modify it as you want. You can create many actions as you can. The sky is the limit.

Conclusion

Questions about this script or anything else? Join our discord. We're always around to help. If you want to work the full script template, just find it here.

Latest comments (0)