1
votes

It worked at first, but then somewhy it started to give the answers 4-5 times at once, any idea why?

import discord
from discord.ext import commands

client = commands.Bot(command_prefix = '.')

@client.event
async def once_ready():
    print('Bot is ready.')

@client.event
async def on_member_join(member):
    print(f'{member} has joined the server.')

@client.event
async def on_member_remove(member):
    print(f'{member} has left the server.')

@client.command()
async def ping(ctx):
    await ctx.send('Pong!')

client.run('my token here')
1
I also tried to reset the bot on my server but it didn't help.y_os
Does this answer your question? stackoverflow.com/questions/60750793/…chluebi
Hi, thanks for the help. I indeed have the exact same problem, but I write it in Atom and I can't see anything to close already running instancesy_os
Sadly I do not know enough about Atom to help you with this problem. Your best bet is probably asking in the "atom" tag.chluebi
Yeah, I tried on Reddit as well, but probably I'm just gonna move to another compiler because I, along with others have no idea how to "fix" this. :C Thanks for your help tho :)y_os

1 Answers

1
votes

So, the problem was that I couldn't shut down the already running bots in Atom.

  • If you add the code that I wrote down there (that only the owner can use) will shut down the already running bots (write /shutdown in discord server or whatever your prefix is).

However, you may need a PC restart after saving the bot with this code.

@client.command()
@commands.is_owner()
async def shutdown(ctx):
    await ctx.bot.logout()
  • So every time if you want to edit your command, you write /shutdown and edit it, after that, you can start it again.

I hope this works for you and that I could help if you had the same problem.