user13221947
user13221947

Reputation: 11

How do I remove code from my discord bot?

Can someone please explain how to properly remove code from your discord bot?

So, recently, I started coding a discord bot. So far the only command I've made was, when I say "ping", it replies with "pong." BUT. It would mention you with the "@" symbol. I didn't like that so I removed the function and instead made it just say "pong" without mentioning you. But, when I tested it, it would mention me and say pong. AND it would also just send a message that said pong. So I removed the whole code. NOPE it still kept replying to my message so I even removed the bot login method but it still kept replying with pong.

If there is something I need to fix in my code, then this is the code (and yes I made a variable for "bot"):

bot.on('message', message =>{
   let args = message.content.substring(PREFIX.length).split(" ");
   switch(args[0]){
       case 'ping':
           message.reply('pong!')
       break;
   }
})

Upvotes: 1

Views: 193

Answers (2)

user13221947
user13221947

Reputation: 11

Okay. So like, I'm actually dumb. All I had to do was restart visual studio

Upvotes: 0

Aci
Aci

Reputation: 566

It's because you're using message.reply(). This will always mention the original author. Use message.channel.send() instead.

Upvotes: 1

Related Questions