Discord chatbot in less than 30 minutes? Yes, you read it right. In this blog we will take you through a very smooth process for creating a simple Discord chatbot in just 30 minutes isn’t it amazing? ?

Why a chatbot?

Have you ever thought about why do companies have chatbots on their websites?

There are many perks of having a chatbot such as

  1. They give Face to Your Company–>Chatbots can help you present your company to your customers by giving your company a face. For many users, the chatbot is the first touchpoint with your business, which can be much more personal than a conversation by mail or phone.
  2. You are immediately available–> If a customer needs some information and you our any member of your teams is not available the chatbot can easily answer the questions of the customer.
  3. They can help to increase your sales–> If you manage to get the right information and offers to your potential customers at the right time, you can significantly increase your sales
  4. The most important perk –> Chat bot can have a wide range of applications.

Topic for Chatbot is Sentiment Prediction

What is sentiment?

It is the emotion behind your words for example (happy, sad).

In this case, we will be using classification to predict the (Good, Bad) nature of the review given by the users.

Problem Statement

As we know every company needs some feedback either for their service, product or for the overall company’s performance so that they can make certain changes and make their customers happy and satisfy them.

so reading huge text comments/review and then evaluate if it’s a good or bad review it’s a tough task so it’s easy to take help of computers which will easily help us to overcome this problem.

So lets Dive into the Process of creating a chatbot

Tools we will use

  1. Discord
  2. Replit
  3. Python ?

Discord

Why use Discord bots?

Bots on Discord, the group messaging platform, are helpful artificial intelligence that can perform several useful tasks on your server automatically. That includes welcoming any new members, banning troublemakers, and moderating the discussion. Some bots even add music or games to your server.

If you don’t have and discord account please create one

There are few important steps we need to take good care:

Step-1 Creating a new server

Step-2 Click on Create my Own

Step-3 Click for me and my Friends

Step-4 Give the server a name.

Step-5 Go to the Discord Developer Portal and click NEW APPLICATION

Step-6 Give a name to the bot(Sentiment)

Step-7 Got to the BOT section and click Add Bot

Step-8 Go in to the OAuth2 section and click bot as shown below.

Step-9 Scroll down a bit until you get here

Note: DON’T CLICK ANY OTHER CHECK BOX and if some checkboxes are not there don’t worry.

Step-10 There will be a tab below called (Generate URL) ,copy the url and paste it on google.

Step-11 Then Click the server name that we created on Step 4 and complete the authorisations processes.

Hurray?? Check Your Discord Server you will see the bot in the offline mode

Replit

Step-1 Log-in and Sign-up

Step-2 Click here

Step-3 Choose Python as the language and name your repl

Step-4 This is how your screen needs to look

⚠️Note Repl is public so to keep it private we need to use the bot token as the env variable.⚠️

Step-5 Most important step go back to the Discord Developer Portal page open the bot section and you will see button copy as below click it and don’t share this with anyone.

Step-6 Go to the repl site and click on the lock button.

Step-7 Give token as input in key box and paste the url we copied in step5 and create the variable

Step-8 If you scroll a bit down you will see the code for getting the token for our python code

Now we will have to do some coding ?

Here is the code and its explanation.

After you wrote the code press Run

You should get something like this

We can see if your bot is online or not

ARE YOU EXCITED TO TEST OUR BOT????

?Yes You did it ?

?Created a Discord Chatbot in less than 30 minutes so easily kudos to you ?

Conclusion

This blog helped you to make a simple chatbot using only a few lines of code

Let us know your feedback in the comments!!

if you want to know more about the Chatbot development framework have a look at this BLOG.