From b283f66bb8b0fae3a15d5c86fb69eb34b3104549 Mon Sep 17 00:00:00 2001 From: plate Date: Sun, 2 Feb 2025 07:32:06 +0000 Subject: [PATCH] shorten code for die command --- bot.py | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/bot.py b/bot.py index f4d4b98..b6ee9d8 100644 --- a/bot.py +++ b/bot.py @@ -145,25 +145,11 @@ async def help_message(room, message): @bot.listener.on_message_event async def help_message(room, message): match = botLibrary.MessageMatch(room, message, bot, PREFIX) - if not (match.is_not_from_this_bot() and match.prefix() and match.is_from_userid(admin) - and match.command("die")): - return - - message = ("Ok") - - await bot.api.send_text_message(room.room_id, message) - exit(0) - -# We should find a better way to do this. -@bot.listener.on_message_event -async def help_message(room, message): - match = botLibrary.MessageMatch(room, message, bot, PREFIX) - if not (match.is_not_from_this_bot() and match.prefix() and not match.is_from_userid(admin) - and match.command("die")): - return - - message = ("You don't have permissions for that.") - - await bot.api.send_text_message(room.room_id, message) + if match.is_not_from_this_bot() and match.prefix() and match.command("die"): + if match.is_from_userid(admin): + await bot.api.send_text_message(room.room_id, "Ok") + exit(0) + else: + await bot.api.send_text_message(room.room_id, "You don't have permissions for that.") bot.run()