From f9d886d31fb3c30b18b3fc07a7afe6ce3f9aedb5 Mon Sep 17 00:00:00 2001 From: Frederic Aust <frederic.aust@stud.hs-bochum.de> Date: Thu, 24 Mar 2022 16:49:20 +0100 Subject: [PATCH] =?UTF-8?q?Datei=20aufger=C3=A4umt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- signalbot.py | 84 +--------------------------------------------------- 1 file changed, 1 insertion(+), 83 deletions(-) diff --git a/signalbot.py b/signalbot.py index 09e955b..d674abf 100755 --- a/signalbot.py +++ b/signalbot.py @@ -26,10 +26,9 @@ from mod_tex import ModuleTex from mod_eventreminder import ModuleEventReminder from mod_today import ModuleToday -# @TODO README Schreiben mit signal-cli Raspberry Pi Installationsanleitung + signal-cli Systembus Einrichtung + Systemd für den Signalbot # @TODO Einfacher Wrapper zum senden von Nachrichten per shell # @TODO Config Programm bot-config.py mit dem allgemeine Einstellungen wie Profilname oder Profilbild angepasst werden können -# --> Bot umbenennen evtl in den Bot Emoji + # create logger log = logging.getLogger('signalbot') @@ -48,13 +47,6 @@ fh.setFormatter(formatter) # add handlers to logger log.addHandler(fh) -### how to use your logger ### -# logger.info('info message') -# logger.warning('warn message') -# logger.error('error message') -# logger.critical('critical message') -# logger.debug('debug message') - # load modules gn = None quotes = None @@ -161,80 +153,6 @@ def handle_action(timestamp, source, groupID, message, attachments): log.critical(f'Unknown error:"{ex}", timestamp="{timestamp}", source="{source}", groupID="{groupID}", ' f'message="{message}", attachments="{attachments}"') - - ######## - - ''' - try: - message = message[1:].strip() - msg_splitted = message.split(" ") - action = msg_splitted[0].lower() - if len(action) == 0: - return - - if action in ["help", "list"]: - help_func(receiver, " ".join(str(x) for x in msg_splitted[1:]).strip(), groupInfo) - elif action == "remusfeinste" and (groupInfo is None or action in groupInfo["COMMANDS"]): - remus_feinste(receiver) - elif action == "trueamerican" and (groupInfo is None or action in groupInfo["COMMANDS"]): - true_american(receiver) - elif (action == "yesno" or action == "yn") and (groupInfo is None or action in groupInfo["COMMANDS"]): - yes_no_wtf(receiver, action) - elif action == "dadjoke" and (groupInfo is None or action in groupInfo["COMMANDS"]): - dadjoke(receiver) - elif action == "links" and (groupInfo is not None and action in groupInfo["COMMANDS"]): - links(receiver, groupInfo) - elif action in FUN_DICT: - echo(action, receiver) - elif (action in ["savequote", "addquote", "createquote"]) and ( - groupInfo is not None and action in groupInfo["COMMANDS"]): - save_quote(receiver, " ".join(str(x) for x in msg_splitted[1:]), groupInfo) - elif action == "randomquote" and (groupInfo is not None and action in groupInfo["COMMANDS"]): - random_quote(receiver, groupInfo) - elif action == "credits": - credits(receiver) - elif action == "freegames" and (groupInfo is None or action in groupInfo["COMMANDS"]): - free_games(receiver) - elif (action == "gn" or action == "genderneutral") and (groupInfo is None or action in groupInfo["COMMANDS"]): - genderneutral(receiver, " ".join(str(x) for x in msg_splitted[1:])) - elif (action == "schlücke" or action == "sips") and (groupInfo is None or action in groupInfo["COMMANDS"]): - sips(receiver) - elif action == "roll" and (groupInfo is None or action in groupInfo["COMMANDS"]): - roll(receiver, " ".join(str(x) for x in msg_splitted[1:])) - elif action == "request": - request(receiver, " ".join(str(x) for x in msg_splitted[1:])) - elif action == "challenge" and (groupInfo is None or action in groupInfo["COMMANDS"]): - get_random_challenge(receiver) - elif action in ["savebirthday", "addbirthday", "createbirthday"] and ( - groupInfo is not None and action in groupInfo["COMMANDS"]): - save_birthday(receiver, " ".join(str(x) for x in msg_splitted[1:]), groupInfo) - elif action == "allbirthdays" and (groupInfo is not None and action in groupInfo["COMMANDS"]): - get_all_birthdays(receiver, groupInfo) - elif action == "nextbirthday" and (groupInfo is not None and action in groupInfo["COMMANDS"]): - get_next_birthday(receiver, groupInfo) - elif action in ["saveevent", "addevent", "createevent"] and ( - groupInfo is not None and action in groupInfo["COMMANDS"]): - save_event(receiver, " ".join(str(x) for x in msg_splitted[1:]), groupInfo) - elif action == "allevents" and (groupInfo is not None and action in groupInfo["COMMANDS"]): - get_all_events(receiver, groupInfo) - elif action == "nextevent" and (groupInfo is not None and action in groupInfo["COMMANDS"]): - get_next_event(receiver, groupInfo) - elif action == "tex" and (groupInfo is None or action in groupInfo["COMMANDS"]): - get_tex_formula(receiver, " ".join(str(x) for x in msg_splitted[1:])) - elif action == "deepl" and (groupInfo is None or action in groupInfo["COMMANDS"]): - get_deepl_translation(receiver, " ".join(str(x) for x in msg_splitted[1:])) - elif action == "kingscup" and (groupInfo is None or action in groupInfo["COMMANDS"]): - get_kings_cup(receiver) - elif action == "today" and (groupInfo is None or action in groupInfo["COMMANDS"]): - get_today(receiver) - else: - unknown_command(receiver, - message) # wenn nicht berechtigt, dann "ich seh nix, ich weiss nix, ich hör nix" => unbekannter befehl - except Exception as ex: - log.critical(f'Unknown error:"{ex}", timestamp="{timestamp}", source="{source}", groupID="{groupID}", ' - f'message="{message}", attachments="{attachments}"') - ''' - def send(message, receiver): if not receiver: return -- GitLab