Discord chatbot ๐Ÿค– with IBM Watson

ivanadokic

Ivana

Posted on November 9, 2020

Discord chatbot ๐Ÿค– with IBM Watson

Not really that I was going to create a custom chatbot for my son's Discord friends as they play a new season of Fortnite ๐Ÿ˜„, but more likely to enhance it with AI services based on IBM Watson and give a head start with Watson Assistant - a comprehensive chatbot framework with built-in machine learning capabilities.

And this is how it all started...

Alt Text

Letโ€™s learn more about:

Discord

Discord is an American VoIP, instant messaging, and digital distribution platform designed for creating communities used by over a hundred million people to hang out and talk with their friends and communities.

Since its launch in 2015, Discord has been growing explosively โ€“ with over 14 million active daily users, which is more than Slack which has just 10 million daily active users. In May 2019, Discord reached over 250 million users.

Chatbot

A chatbot is a software application that simulates human conversation through voice commands or text chats or both. Chatbot, short for chatterbot, is an Artificial Intelligence (AI) feature that can be embedded and used through any major messaging applications.

IBM Watson

Use IBM Watson Assistant to build your own branded live chatbot into any device, application, or channel.

You will use free of charge AI-based chatbot engine with Watson Assistant from IBM Cloud.

Now, letโ€™s get started with:

-How to add a chatbot to Discord using IBM Watson
-Intro to IBM Watson Assistant
-Deploying the chatbot in IBM Cloud

STEP 1. Connect to Discord service

Simply log in to your Discord account, or create a new one, and navigate to https://discordapp.com/developers/applications/

After making your new Discord server add the bot there:

Alt Text

Follow the next few steps to add the bot to your server, this is the URL to follow and add the bot:

https://discord.com/oauth2/authorize?client_id=CLIENT_ID&scope=bot

You can find and copy CLIENT-ID in the General Information tab:

Alt Text

The following step is to click Authorize:
Alt Text

After you click Authorize the bot should be in the list of the users:
Alt Text

STEP 2. Getting the Ping-Pong BOT in Node.js, the Discord Node JavaScript library

About Node.js

Node.js allows you to run JavaScript on the server. It's an open-source server environment and one of the most popular technologies nowadays to build scalable and efficient REST API's. Essentially, Node.js is a server-side runtime environment that allows us to execute JS outside the browser's domain.
Node.js popularity around the world is constantly growing. Itโ€™s no wonder that over 177,393 websites (some of them being the BIGGEST players on the market) already put Node.js on their backend, such as:

  • Netflix, the world's leading Internet television network is one of those top companies that trusted its servers to Node.js

  • Uber has built its massive matching system on Node.js

  • PayPal, one of the largest fintech leaders, has also trusted their back-end development to Node.js

  • LinkedIn, the worldโ€™s biggest professional social network, too, shifted its server-side code entirely to Node.js

  • Ebay, a multinational e-commerce company

Let's start with:

Setting Up npm (Node Package Manager) and before we continue, let's make sure your environment is all set to work with npm that is automatically installed along with Node.js. To confirm you have node installed, enter the following into your command line:
node -v

If a version appears, you have Node.js. If, by chance, you do not have Node.js installed, you can use the Node Version Manager to install Node.js and keep it up to date.

The next step would be:

mkdir mybot
cd mybot
npm install discord.js

Create file index.js with the Example content (following the documentation here https://discord.js.org/#/

Alt Text

Now you can replace the token with the token of your bot (It's NOT recommended to share the token ๐Ÿ˜„ and then run it with:

node index.js

If everything is connected correctly you have the bot online (Logged in as ivana#7035!):

Alt Text

STEP 3. Chatbot AI features with IBM Watson Assistant

  1. Adding the AI-powered chatbot backend

In order to create an AI-based chatbot engine, you will need the FREE Lite Account in IBM Cloud. Try Watson Assistant, just use this link to invoke IBM Cloud registration/signup/login page.

I used this URL, it gives to Speaker of Discord chatbot with IBM Watson on IBM Cloud Webinar Marek Sadowski some brownie points ๐Ÿ˜„

You can simply go to Catalog and choose Watson Assistant:

Alt Text

After you choose and create Watson Assistant from IBM Cloud Catalog, the AI-powered engine from IBM is ready to be tested.

For more details you should follow the documentation how to Create your first Assistant-powered chatbot:

Alt Text

Next steps

To learn more check Discord chatbot with IBM Watson on IBM Cloud Webinar 3 part series register here .

To connect with me please check my Github, LinkedIn or Twitter.

Thank you for reading!

๐Ÿ’– ๐Ÿ’ช ๐Ÿ™… ๐Ÿšฉ
ivanadokic
Ivana

Posted on November 9, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Discord chatbot ๐Ÿค– with IBM Watson
javascript Discord chatbot ๐Ÿค– with IBM Watson

November 9, 2020

ยฉ TheLazy.dev

About