Merge pull request 'debug/stop-command' (#3) from debug/stop-command into master

Reviewed-on: aaron/shbot#3
This commit is contained in:
Aaron Riedel 2022-01-29 18:49:35 +01:00
commit 448a31aff8
2 changed files with 7 additions and 3 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
start_id.txt

7
bot.py
View file

@ -56,7 +56,10 @@ bot.help_command = commands.DefaultHelpCommand(dm_help=False, no_category="Befeh
@bot.event @bot.event
async def on_command_error(ctx, error): async def on_command_error(ctx, error):
try:
await ctx.message.delete() await ctx.message.delete()
except:
print("message not found")
print(error) print(error)
em = discord.Embed(title="Error", description=error, colour=0xFF0000) em = discord.Embed(title="Error", description=error, colour=0xFF0000)
await ctx.send(content="ups, da ist wohl was schief gegangen :( traurige Bot Geräusche...", embed=em, delete_after=20) await ctx.send(content="ups, da ist wohl was schief gegangen :( traurige Bot Geräusche...", embed=em, delete_after=20)
@ -256,8 +259,8 @@ async def stop(ctx):
start_id = text_file.read() start_id = text_file.read()
text_file.close() text_file.close()
start_msg = await bot.get_channel(435501602485305345).fetch_message(start_id) start_msg = await bot.get_channel(435501602485305345).fetch_message(start_id)
now_time = datetime.datetime.utcnow().replace(microsecond=0) now_time = datetime.datetime.utcnow().replace(microsecond=0, tzinfo=datetime.timezone.utc)
then_time = start_msg.created_at.replace(microsecond=0) then_time = start_msg.created_at.replace(microsecond=0, tzinfo=datetime.timezone.utc)
dauer = str(now_time - then_time) dauer = str(now_time - then_time)
for m in bot.get_channel(435869507123281920).members: for m in bot.get_channel(435869507123281920).members:
await m.move_to(bot.get_channel(801869864745697280)) await m.move_to(bot.get_channel(801869864745697280))