Building a Discord Bot for ChatOps, Pentesting or Server Automation (Part 1)

Jose Figueredo
Chatbots Life

--

In this step by step tutorial we will create fully functional bot from scratch in which you can execute any command or cli program you like on your server or integrate with any API that you have access for example Jira. This is the part #1 of the series.

Prerequisites

  • A discord account
  • A discord client: web, desktop app or mobile app
  • A discord server. You can create one inside your discord client of choice

Part #1: Discord setup

Create the discord application

In your preferred browser go to

https://discord.com/developers/applications

Click on the “New Application” button

Enter your app name and press the “Create” button

Copy the “Client Id” because we are going to use it later

Trending Chatbot Articles:

1. Knowledge graphs and Chatbots — An analytical approach.

2. 🤖 How to talk to Computers: A Framework for building Conversational Agents — Part 1

3. Sentiment Analysis Voice Bot

4. Top 5 NLP Chatbot Platforms

Click the “Click to reveal” blue text

Copy the “Client Secret” token

Go to the bot section in the side panel

Press the “Add Bot” button

Read the disclaimer and press the “Yes, do it!” button

Click the “Click to Reveal Token” blue text

Take note of the Token. We will call it Bot Token in the future and will be used in our code to login to a discord server

For security reasons verify that the toggle “Public Bot” is off and if it isn’t turn it off. Press the “Save Changes” button

Read the available Bot Permissions

Assign at least some text permissions for our coding tests

We will use now the Client Id value that we saved early. Open a browser and paste this url:

https://discordapp.com/api/oauth2/authorize?scope=bot&client_id=

and concatenate at the end your “Client Id” and press enter. In my case:

https://discordapp.com/api/oauth2/authorize?scope=bot&client_id=720301035486183534

Select the server in which you want to include the bot

Press the “Authorize” button

We will receive a new notification in our discord server’s general channel that the bot is in the server

This only indicates that we created a bot, but until we code it we will only see it as offline and we cannot interact with it.

We are all set for this step. In Part #2 we will start programing a basic Discord Bot in Python. When I publish the second part I will paste a link here.

Note:

If you encounter typos or something doesn’t work no more write me a comment and I will keep this guide updated. Last update June 11 2020.

Don’t forget to give us your 👏 !

--

--