Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Discord code is running multiple times for no reason

So I have this piece of code which is running on a discord bot which should repeat what the user says after a command. It does this but repeats it another 7 times after making 8 total runs through that script. Can anyone spot why this might be happening?

Note: The code that actually runs starts from the elif but I put in everything just in case something prior was messing with it.

@Client.event 
async def on_message(message):
  if message.content == "s!ping":
    userID = message.author.id
    Client.send_message(message.channel, "<@%s>" % (userID))
  elif message.content.startswith == "s!say":
    args = message.content.split(" ")
    Client.send_message(message.channel, "%s" % (args[1:]))

Image to show test input and output

like image 767
Umair Ahmed Avatar asked Oct 29 '22 06:10

Umair Ahmed


1 Answers

I'm the CEO of Repl.it. I think this might be a bug with scaling on our service where we might run multiple instances of your server. We'll have a fix for this soon. Meanwhile, I think some other Repl.it users had a fixe for this. Join us on our Discord, there are lots of bot developers there that can help you with this https://discord.gg/xa6S23

like image 91
Amjad Masad Avatar answered Nov 15 '22 07:11

Amjad Masad