From 5c3f9031dc379c374194d7184fc6a630b43b543c Mon Sep 17 00:00:00 2001 From: n Date: Fri, 31 Jan 2025 20:54:58 -0600 Subject: [PATCH] Finish debug mode --- bot.py | 50 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/bot.py b/bot.py index af443f0..69c5e35 100644 --- a/bot.py +++ b/bot.py @@ -15,6 +15,11 @@ except FileNotFoundError: except: print("Something bad and unforseen happened, please report the bug to @n:everypizza.im") +if config['bot']['debugMode'] == True: + debugMode = True +else: + debugMode = False + print("Logging in…") credentials = botLibrary.Creds(config['matrix']['server'], config['matrix']['userid'], config['matrix']['password']) bot = botLibrary.Bot(credentials) @@ -27,16 +32,31 @@ async def help_message(room, message): if not (match.is_not_from_this_bot() and match.prefix() and match.command("help")): return + if debugMode == False: + message = (f""" + Help + ============================ + A work-in-progress Python rewrite of the original quotes bot, aiming for a mostly complete remake. + {PREFIX} help - show this message + {PREFIX} get - fetch a image from the defined instance + {PREFIX} source - send a link to the source code + {PREFIX} version - show the bot version + """) + else: + message = (f""" + Help + ============================ + A work-in-progress Python rewrite of the original quotes bot, aiming for a mostly complete remake. + {PREFIX} help - show this message + {PREFIX} get - fetch a image from the defined instance + {PREFIX} source - send a link to the source code + {PREFIX} version - show the bot version + + --- + + NOTE: Debug mode is on. Output will be more verbose. + """) - message = (f""" - Help - ============================ - A work-in-progress Python rewrite of the original quotes bot, aiming for a mostly complete remake. - {PREFIX} help - show this message - {PREFIX} get - fetch a image from the defined instance - {PREFIX} source - send a link to the source code - {PREFIX} version - show the bot version - """) await bot.api.send_text_message(room.room_id, message) @@ -53,10 +73,14 @@ async def make_choice(room, message): id = match.args() id = str(id[1]) quoteImage = fetch.fetchQuote(id) - message = (f""" - Command recived (DEBUG). - (We're supposed to fetch quote number {id} now.) - """) + + if debugMode == False: + pass + else: + message = (f""" + Command recived (DEBUG). + (We're supposed to fetch quote number {id} now.) + """) await bot.api.send_text_message(room.room_id, message) imageMessage = (quoteImage)