Part 2:

Let’s finish this once and for all

Nithil Krishnaraj
7 min readJun 29, 2022

Welcome to Part 2 of the tutorial. We’re going to be finishing up our bot by adding complex commands! Of course, make sure you have the prerequisites.

Prerequisites

Resuming Step 3: Coding the bot

If you followed Part 1, your code should look like this:

Okay, so now, let’s create some more complex commands. If you’re making a moderation bot, the commands we make will be quite useful.

Let’s say someone on your server keeps deleting their messages. You can create a command on your bot that will alert that user to stop deleting their messages. Let’s create a .on()function that listens for any messages being deleted. It’s going to listen for "messageDelete" and will accept the parameter of msgso we can send messages in the channel.

client.on("messageDelete", msg => {// Code goes here})

Alright, now that we set up our function, we can make it send a message when the user deletes a message. For this, I am going to be using…

--

--

Nithil Krishnaraj

Co-founder and Writer of TechTalkers. Learning about technology and photography are my passions!