Reputation: 290
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')
Upvotes: 1
Views: 1597
Reputation: 290
So, the problem was that I couldn't shut down the already running bots in Atom.
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()
I hope this works for you and that I could help if you had the same problem.
Upvotes: 1