From: Georgios Atheridis Date: Tue, 17 Jan 2023 09:26:26 +0000 (+0000) Subject: formatted with black X-Git-Url: https://git.atheridis.org/?a=commitdiff_plain;h=d5611ce67cb7d5ddbc0097165795a5fc3a8de49f;p=ihaspeks%2Faptbot-ihaspeks.git formatted with black --- diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..541e00a --- /dev/null +++ b/.flake8 @@ -0,0 +1,3 @@ +[flake8] +ignore = E203, W503 +max-line-length = 88 diff --git a/ihaspeks/auto_messages/.jokes.py b/ihaspeks/auto_messages/.jokes.py index a972958..0646ab0 100644 --- a/ihaspeks/auto_messages/.jokes.py +++ b/ihaspeks/auto_messages/.jokes.py @@ -21,6 +21,4 @@ def main(bot: Bot, message: Message): data = json.loads(r.data.decode("utf-8")) joke = data["joke"].replace("\r\n", " ") - tools.smart_privmsg.send( - bot, message, f"{joke} ||| Get more jokes by typing ?joke" - ) + tools.smart_privmsg.send(bot, message, f"{joke} ||| Get more jokes by typing ?joke") diff --git a/ihaspeks/auto_messages/give_permission.py b/ihaspeks/auto_messages/give_permission.py index 2347876..ed37c80 100644 --- a/ihaspeks/auto_messages/give_permission.py +++ b/ihaspeks/auto_messages/give_permission.py @@ -5,7 +5,9 @@ END_TIME = 0 def main(bot: Bot, message: Message): - msg = "I collect data and occasionally post interesting statistics on peks' discord. " + msg = ( + "I collect data and occasionally post interesting statistics on peks' discord. " + ) msg += "The type of data you should expect to see is 'Chat frequency', 'Most used emotes', " msg += "'Most active time and day', 'Reply graphs', etc. " bot.send_privmsg(message.channel, msg) diff --git a/ihaspeks/auto_messages/update_queue.py b/ihaspeks/auto_messages/update_queue.py index e7da3f9..59525c5 100644 --- a/ihaspeks/auto_messages/update_queue.py +++ b/ihaspeks/auto_messages/update_queue.py @@ -34,7 +34,10 @@ def main(bot: Bot, message: Message): ) c.execute(f"DELETE FROM {table} WHERE time_remaining < 0;") if c.rowcount: - bot.send_privmsg(message.channel, f"/announce {c.rowcount} user{'s were' if c.rowcount > 1 else ' was'} just removed from {table if table != 'lol_queue' else 'lol'} queue.") + bot.send_privmsg( + message.channel, + f"/announce {c.rowcount} user{'s were' if c.rowcount > 1 else ' was'} just removed from {table if table != 'lol_queue' else 'lol'} queue.", + ) conn.commit() diff --git a/ihaspeks/commands/.info.py b/ihaspeks/commands/.info.py index 516d02d..20c6f48 100644 --- a/ihaspeks/commands/.info.py +++ b/ihaspeks/commands/.info.py @@ -15,4 +15,3 @@ def main(bot: Bot, message: Message): else: msg = r"Peks is live so he can awnser that KEKW but here is the link just in case BASED https://strms.net/warships_ihaspeks" tools.smart_privmsg.send_safe(bot, message.channel, msg) - diff --git a/ihaspeks/commands/9ball.py b/ihaspeks/commands/9ball.py index cc8d056..3e81324 100644 --- a/ihaspeks/commands/9ball.py +++ b/ihaspeks/commands/9ball.py @@ -12,6 +12,7 @@ GLOBAL_COOLDOWN = 20 openai.api_key = os.getenv("OPENAI_API") + def main(bot: Bot, message: Message): replied_message = message.tags.get("reply-parent-msg-body", None) if replied_message: @@ -19,8 +20,7 @@ def main(bot: Bot, message: Message): replied_msg_id = message.tags["reply-parent-msg-id"] else: msg = " ".join(message.value.split(" ")[1:]) - replied_msg_id = message.tags['id'] - + replied_msg_id = message.tags["id"] try: response = openai.Completion.create( @@ -35,7 +35,12 @@ def main(bot: Bot, message: Message): stop=[" END"], ) except RateLimitError: - tools.smart_privmsg.send_safe(bot, message.channel, "UwU Sowwy. The sevwews awe ovewloaded :( Twy again in a few minutes OwO", reply=replied_msg_id) + tools.smart_privmsg.send_safe( + bot, + message.channel, + "UwU Sowwy. The sevwews awe ovewloaded :( Twy again in a few minutes OwO", + reply=replied_msg_id, + ) print(response) if response: diff --git a/ihaspeks/commands/Q.py b/ihaspeks/commands/Q.py index 897c07e..52bc20d 100644 --- a/ihaspeks/commands/Q.py +++ b/ihaspeks/commands/Q.py @@ -18,6 +18,7 @@ GLOBAL_COOLDOWN = 15 PATH = os.path.dirname(os.path.realpath(__file__)) PATH = os.path.join(PATH, "..") + def check_queue(bot: Bot, message: Message, table: str): if random.random() < 0.02: q = [ @@ -149,14 +150,14 @@ def parse(query): d = dict() for i in shlex.split(query): try: - d[i.split('=')[0]] = i.split('=')[1] + d[i.split("=")[0]] = i.split("=")[1] except: pass return d def scrub(table_name): - return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_') + return "".join(chr for chr in table_name if chr.isalnum() or chr == "_") def main(bot: Bot, message: Message): diff --git a/ihaspeks/commands/accept_share.py b/ihaspeks/commands/accept_share.py index 80a7f6e..526c130 100644 --- a/ihaspeks/commands/accept_share.py +++ b/ihaspeks/commands/accept_share.py @@ -25,4 +25,3 @@ def main(bot: Bot, message: Message): with open(accepted_path, "a") as f: f.write(f"{message.tags['user-id']}\n") tools.smart_privmsg.send(bot, message, "Thank you for giving permission") - diff --git a/ihaspeks/commands/cannon.py b/ihaspeks/commands/cannon.py index da342b6..b1e01e8 100644 --- a/ihaspeks/commands/cannon.py +++ b/ihaspeks/commands/cannon.py @@ -18,6 +18,7 @@ GLOBAL_COOLDOWN = 5 PATH = os.path.dirname(os.path.realpath(__file__)) PATH = os.path.join(PATH, "..") + def check_queue(bot: Bot, message: Message, table: str): conn = sqlite3.connect(os.path.join(PATH, "database.db")) c = conn.cursor() @@ -47,7 +48,7 @@ def check_queue(bot: Bot, message: Message, table: str): f""" UPDATE varvalues SET val = ? WHERE id = 'cannon'; """, - (val,) + (val,), ) msg = f"Peks is at cannon {val % 1000} of prestige {val // 1000}" @@ -67,7 +68,7 @@ def check_queue(bot: Bot, message: Message, table: str): f""" UPDATE varvalues SET val = ? WHERE id = 'cannon'; """, - (val,) + (val,), ) msg = f"Peks is at cannon {val % 1000} of prestige {val // 1000}" @@ -96,14 +97,14 @@ def parse(query): d = dict() for i in shlex.split(query): try: - d[i.split('=')[0]] = i.split('=')[1] + d[i.split("=")[0]] = i.split("=")[1] except: pass return d def scrub(table_name): - return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_') + return "".join(chr for chr in table_name if chr.isalnum() or chr == "_") def main(bot: Bot, message: Message): diff --git a/ihaspeks/commands/cleanqueue.py b/ihaspeks/commands/cleanqueue.py index ed3d447..9ab1910 100644 --- a/ihaspeks/commands/cleanqueue.py +++ b/ihaspeks/commands/cleanqueue.py @@ -75,14 +75,14 @@ def parse(query): d = dict() for i in shlex.split(query): try: - d[i.split('=')[0]] = i.split('=')[1] + d[i.split("=")[0]] = i.split("=")[1] except: pass return d def scrub(table_name): - return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_') + return "".join(chr for chr in table_name if chr.isalnum() or chr == "_") def main(bot: Bot, message: Message): diff --git a/ihaspeks/commands/deadge.py b/ihaspeks/commands/deadge.py index 3c16538..035021c 100644 --- a/ihaspeks/commands/deadge.py +++ b/ihaspeks/commands/deadge.py @@ -18,6 +18,7 @@ GLOBAL_COOLDOWN = 5 PATH = os.path.dirname(os.path.realpath(__file__)) PATH = os.path.join(PATH, "..") + def check_queue(bot: Bot, message: Message, table: str): conn = sqlite3.connect(os.path.join(PATH, "database.db")) c = conn.cursor() @@ -47,7 +48,7 @@ def check_queue(bot: Bot, message: Message, table: str): f""" UPDATE varvalues SET val = ? WHERE id = 'deadge_sekiro'; """, - (val,) + (val,), ) msg = f"Peks has currently died {val} times" @@ -67,7 +68,7 @@ def check_queue(bot: Bot, message: Message, table: str): f""" UPDATE varvalues SET val = ? WHERE id = 'deadge_sekiro'; """, - (val,) + (val,), ) msg = f"Peks has currently died {val} times" @@ -96,14 +97,14 @@ def parse(query): d = dict() for i in shlex.split(query): try: - d[i.split('=')[0]] = i.split('=')[1] + d[i.split("=")[0]] = i.split("=")[1] except: pass return d def scrub(table_name): - return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_') + return "".join(chr for chr in table_name if chr.isalnum() or chr == "_") def main(bot: Bot, message: Message): diff --git a/ihaspeks/commands/forcehere.py b/ihaspeks/commands/forcehere.py index 0c27769..fff2352 100644 --- a/ihaspeks/commands/forcehere.py +++ b/ihaspeks/commands/forcehere.py @@ -266,14 +266,14 @@ def parse(query): d = dict() for i in shlex.split(query): try: - d[i.split('=')[0]] = i.split('=')[1] + d[i.split("=")[0]] = i.split("=")[1] except: pass return d def scrub(table_name): - return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_') + return "".join(chr for chr in table_name if chr.isalnum() or chr == "_") def main(bot: Bot, message: Message): diff --git a/ihaspeks/commands/forcejoin.py b/ihaspeks/commands/forcejoin.py index df60a98..1647dc8 100644 --- a/ihaspeks/commands/forcejoin.py +++ b/ihaspeks/commands/forcejoin.py @@ -93,14 +93,14 @@ def parse(query): d = dict() for i in shlex.split(query): try: - d[i.split('=')[0]] = i.split('=')[1] + d[i.split("=")[0]] = i.split("=")[1] except: pass return d def scrub(table_name): - return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_') + return "".join(chr for chr in table_name if chr.isalnum() or chr == "_") def main(bot: Bot, message: Message): diff --git a/ihaspeks/commands/forceleave.py b/ihaspeks/commands/forceleave.py index 62cce65..2e9b788 100644 --- a/ihaspeks/commands/forceleave.py +++ b/ihaspeks/commands/forceleave.py @@ -67,14 +67,14 @@ def parse(query): d = dict() for i in shlex.split(query): try: - d[i.split('=')[0]] = i.split('=')[1] + d[i.split("=")[0]] = i.split("=")[1] except: pass return d def scrub(table_name): - return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_') + return "".join(chr for chr in table_name if chr.isalnum() or chr == "_") def main(bot: Bot, message: Message): diff --git a/ihaspeks/commands/forcenothere.py b/ihaspeks/commands/forcenothere.py index 4944b66..558e4ef 100644 --- a/ihaspeks/commands/forcenothere.py +++ b/ihaspeks/commands/forcenothere.py @@ -71,14 +71,14 @@ def parse(query): d = dict() for i in shlex.split(query): try: - d[i.split('=')[0]] = i.split('=')[1] + d[i.split("=")[0]] = i.split("=")[1] except: pass return d def scrub(table_name): - return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_') + return "".join(chr for chr in table_name if chr.isalnum() or chr == "_") def main(bot: Bot, message: Message): diff --git a/ihaspeks/commands/here.py b/ihaspeks/commands/here.py index 2002cb5..b11073b 100644 --- a/ihaspeks/commands/here.py +++ b/ihaspeks/commands/here.py @@ -263,14 +263,14 @@ def parse(query): d = dict() for i in shlex.split(query): try: - d[i.split('=')[0]] = i.split('=')[1] + d[i.split("=")[0]] = i.split("=")[1] except: pass return d def scrub(table_name): - return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_') + return "".join(chr for chr in table_name if chr.isalnum() or chr == "_") def main(bot: Bot, message: Message): diff --git a/ihaspeks/commands/join.py b/ihaspeks/commands/join.py index 8484186..62e5876 100644 --- a/ihaspeks/commands/join.py +++ b/ihaspeks/commands/join.py @@ -90,14 +90,14 @@ def parse(query): d = dict() for i in shlex.split(query): try: - d[i.split('=')[0]] = i.split('=')[1] + d[i.split("=")[0]] = i.split("=")[1] except: pass return d def scrub(table_name): - return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_') + return "".join(chr for chr in table_name if chr.isalnum() or chr == "_") def main(bot: Bot, message: Message): diff --git a/ihaspeks/commands/leave.py b/ihaspeks/commands/leave.py index ac7fefe..3f94afb 100644 --- a/ihaspeks/commands/leave.py +++ b/ihaspeks/commands/leave.py @@ -66,14 +66,14 @@ def parse(query): d = dict() for i in shlex.split(query): try: - d[i.split('=')[0]] = i.split('=')[1] + d[i.split("=")[0]] = i.split("=")[1] except: pass return d def scrub(table_name): - return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_') + return "".join(chr for chr in table_name if chr.isalnum() or chr == "_") def main(bot: Bot, message: Message): diff --git a/ihaspeks/commands/movedown.py b/ihaspeks/commands/movedown.py index e64d3ed..baa12fa 100644 --- a/ihaspeks/commands/movedown.py +++ b/ihaspeks/commands/movedown.py @@ -115,14 +115,14 @@ def parse(query): d = dict() for i in shlex.split(query): try: - d[i.split('=')[0]] = i.split('=')[1] + d[i.split("=")[0]] = i.split("=")[1] except: pass return d def scrub(table_name): - return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_') + return "".join(chr for chr in table_name if chr.isalnum() or chr == "_") def main(bot: Bot, message: Message): diff --git a/ihaspeks/commands/moveup.py b/ihaspeks/commands/moveup.py index 42b7f12..9ce90c9 100644 --- a/ihaspeks/commands/moveup.py +++ b/ihaspeks/commands/moveup.py @@ -115,14 +115,14 @@ def parse(query): d = dict() for i in shlex.split(query): try: - d[i.split('=')[0]] = i.split('=')[1] + d[i.split("=")[0]] = i.split("=")[1] except: pass return d def scrub(table_name): - return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_') + return "".join(chr for chr in table_name if chr.isalnum() or chr == "_") def main(bot: Bot, message: Message): diff --git a/ihaspeks/commands/newteams.py b/ihaspeks/commands/newteams.py index a7a3c64..9345454 100644 --- a/ihaspeks/commands/newteams.py +++ b/ihaspeks/commands/newteams.py @@ -108,14 +108,14 @@ def parse(query): d = dict() for i in shlex.split(query): try: - d[i.split('=')[0]] = i.split('=')[1] + d[i.split("=")[0]] = i.split("=")[1] except: pass return d def scrub(table_name): - return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_') + return "".join(chr for chr in table_name if chr.isalnum() or chr == "_") def main(bot: Bot, message: Message): diff --git a/ihaspeks/commands/nothere.py b/ihaspeks/commands/nothere.py index f82bb68..26d26df 100644 --- a/ihaspeks/commands/nothere.py +++ b/ihaspeks/commands/nothere.py @@ -68,14 +68,14 @@ def parse(query): d = dict() for i in shlex.split(query): try: - d[i.split('=')[0]] = i.split('=')[1] + d[i.split("=")[0]] = i.split("=")[1] except: pass return d def scrub(table_name): - return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_') + return "".join(chr for chr in table_name if chr.isalnum() or chr == "_") def main(bot: Bot, message: Message): diff --git a/ihaspeks/commands/opgg.py b/ihaspeks/commands/opgg.py index aabf5c2..c6fd15e 100644 --- a/ihaspeks/commands/opgg.py +++ b/ihaspeks/commands/opgg.py @@ -21,6 +21,7 @@ GLOBAL_COOLDOWN = 15 PATH = os.path.dirname(os.path.realpath(__file__)) PATH = os.path.join(PATH, "..") + def find_champion(champ_id: int) -> str: with open(os.path.join(PATH, "data/champion.json"), "r") as f: champion_data = json.load(f) @@ -31,6 +32,7 @@ def find_champion(champ_id: int) -> str: return champion_data[champion]["name"] return "404" + def main(bot: Bot, message: Message): index_skip = 0 if message.tags.get("reply-parent-user-id", None): @@ -40,19 +42,19 @@ def main(bot: Bot, message: Message): except IndexError: twitch_user = message.tags.get("reply-parent-display-name", message.channel) twitch_id = message.tags.get( - "reply-parent-user-id", - ttv_api.users.get_users(user_logins=[message.channel]), - ) + "reply-parent-user-id", + ttv_api.users.get_users(user_logins=[message.channel]), + ) else: twitch_id = ttv_api.users.get_users(user_logins=[twitch_user]) if not twitch_id: logger.warning( - f"There was an issue getting twitch data for user {twitch_id}; message id was: {message.tags['id']}" - ) + f"There was an issue getting twitch data for user {twitch_id}; message id was: {message.tags['id']}" + ) smart_privmsg.send( - bot, message, "Couldn't retrieve data", reply=message.tags["id"] - ) + bot, message, "Couldn't retrieve data", reply=message.tags["id"] + ) return if not isinstance(twitch_id, str): @@ -64,26 +66,26 @@ def main(bot: Bot, message: Message): c = conn.cursor() c.execute( - """ + """ SELECT summoner_id, puuid FROM accounts WHERE twitch_id = ?; """, (twitch_id,), - ) + ) fetched = c.fetchall() c.execute( - """ + """ SELECT twitch_id, summoner_id FROM accounts; """, - ) + ) fetched_all = c.fetchall() if not fetched: smart_privmsg.send( - bot, - message, - f"No summoners added for {twitch_user}", - reply=message.tags["id"], - ) + bot, + message, + f"No summoners added for {twitch_user}", + reply=message.tags["id"], + ) conn.close() return @@ -97,11 +99,11 @@ def main(bot: Bot, message: Message): break else: smart_privmsg.send( - bot, - message, - f"{twitch_user} is currently not in game. These are all of their summoners: {summoner_names}", - reply=message.tags["id"], - ) + bot, + message, + f"{twitch_user} is currently not in game. These are all of their summoners: {summoner_names}", + reply=message.tags["id"], + ) conn.close() return @@ -111,7 +113,9 @@ def main(bot: Bot, message: Message): if summoner.summoner_id == f[1] and summoner.summoner_id != fetched[0][0]: play_with.append( { - "name": ttv_api.users.get_users(user_ids=[f[0]])[0].display_name, + "name": ttv_api.users.get_users(user_ids=[f[0]])[ + 0 + ].display_name, "champion": find_champion(summoner.champion_id), }, ) @@ -122,11 +126,11 @@ def main(bot: Bot, message: Message): for player in play_with: msg += f" {player['name']} on {player['champion']} |" msg = msg[:-1] + "." - + smart_privmsg.send( - bot, - message, - msg, - reply=message.tags["id"], - ) + bot, + message, + msg, + reply=message.tags["id"], + ) conn.close() diff --git a/ihaspeks/commands/penta.py b/ihaspeks/commands/penta.py index 01f4219..13be4e9 100644 --- a/ihaspeks/commands/penta.py +++ b/ihaspeks/commands/penta.py @@ -18,6 +18,7 @@ GLOBAL_COOLDOWN = 5 PATH = os.path.dirname(os.path.realpath(__file__)) PATH = os.path.join(PATH, "..") + def check_queue(bot: Bot, message: Message, table: str): conn = sqlite3.connect(os.path.join(PATH, "database.db")) c = conn.cursor() @@ -47,7 +48,7 @@ def check_queue(bot: Bot, message: Message, table: str): f""" UPDATE varvalues SET val = ? WHERE id = 'cannon'; """, - (val,) + (val,), ) msg = f"Peks has gotten {val} pentas!" @@ -67,7 +68,7 @@ def check_queue(bot: Bot, message: Message, table: str): f""" UPDATE varvalues SET val = ? WHERE id = 'cannon'; """, - (val,) + (val,), ) msg = f"Peks has gotten {val} pentas!" @@ -96,14 +97,14 @@ def parse(query): d = dict() for i in shlex.split(query): try: - d[i.split('=')[0]] = i.split('=')[1] + d[i.split("=")[0]] = i.split("=")[1] except: pass return d def scrub(table_name): - return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_') + return "".join(chr for chr in table_name if chr.isalnum() or chr == "_") def main(bot: Bot, message: Message): diff --git a/ihaspeks/commands/quadra.py b/ihaspeks/commands/quadra.py index ede98b1..4f473c9 100644 --- a/ihaspeks/commands/quadra.py +++ b/ihaspeks/commands/quadra.py @@ -18,6 +18,7 @@ GLOBAL_COOLDOWN = 5 PATH = os.path.dirname(os.path.realpath(__file__)) PATH = os.path.join(PATH, "..") + def check_queue(bot: Bot, message: Message, table: str): conn = sqlite3.connect(os.path.join(PATH, "database.db")) c = conn.cursor() @@ -47,7 +48,7 @@ def check_queue(bot: Bot, message: Message, table: str): f""" UPDATE varvalues SET val = ? WHERE id = 'cannon'; """, - (val,) + (val,), ) msg = f"Peks has missed out on {val} pentas!" @@ -67,7 +68,7 @@ def check_queue(bot: Bot, message: Message, table: str): f""" UPDATE varvalues SET val = ? WHERE id = 'cannon'; """, - (val,) + (val,), ) msg = f"Peks has missed out on {val} pentas!" @@ -96,14 +97,14 @@ def parse(query): d = dict() for i in shlex.split(query): try: - d[i.split('=')[0]] = i.split('=')[1] + d[i.split("=")[0]] = i.split("=")[1] except: pass return d def scrub(table_name): - return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_') + return "".join(chr for chr in table_name if chr.isalnum() or chr == "_") def main(bot: Bot, message: Message): diff --git a/ihaspeks/commands/teams.py b/ihaspeks/commands/teams.py index c35e65b..9b88e16 100644 --- a/ihaspeks/commands/teams.py +++ b/ihaspeks/commands/teams.py @@ -95,14 +95,14 @@ def parse(query): d = dict() for i in shlex.split(query): try: - d[i.split('=')[0]] = i.split('=')[1] + d[i.split("=")[0]] = i.split("=")[1] except: pass return d def scrub(table_name): - return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_') + return "".join(chr for chr in table_name if chr.isalnum() or chr == "_") def main(bot: Bot, message: Message): diff --git a/ihaspeks/commands/teamsize.py b/ihaspeks/commands/teamsize.py index ce910c5..6839c86 100644 --- a/ihaspeks/commands/teamsize.py +++ b/ihaspeks/commands/teamsize.py @@ -63,14 +63,14 @@ def parse(query): d = dict() for i in shlex.split(query): try: - d[i.split('=')[0]] = i.split('=')[1] + d[i.split("=")[0]] = i.split("=")[1] except: pass return d def scrub(table_name): - return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_') + return "".join(chr for chr in table_name if chr.isalnum() or chr == "_") def main(bot: Bot, message: Message): diff --git a/ihaspeks/database_manager.py b/ihaspeks/database_manager.py index ee653c3..ebc7bbf 100644 --- a/ihaspeks/database_manager.py +++ b/ihaspeks/database_manager.py @@ -173,7 +173,6 @@ def create_database(): ) logger.info(f"created table varvalues") - c.execute( """ CREATE TABLE IF NOT EXISTS clips ( diff --git a/ihaspeks/scripts/chat.py b/ihaspeks/scripts/chat.py index 26dbd19..f01edee 100644 --- a/ihaspeks/scripts/chat.py +++ b/ihaspeks/scripts/chat.py @@ -5,8 +5,9 @@ import os openai.api_key = os.getenv("OPENAI_API") + def chat(bot: Bot, message: Message): - if not message.nick in {'skgyorugo', 'ihaspeks'}: + if not message.nick in {"skgyorugo", "ihaspeks"}: return if not message.value.startswith("# "): return @@ -17,7 +18,7 @@ def chat(bot: Bot, message: Message): replied_msg_id = message.tags["reply-parent-msg-id"] else: msg = " ".join(message.value.split(" ")[1:]) - replied_msg_id = message.tags['id'] + replied_msg_id = message.tags["id"] response = openai.Completion.create( model="text-davinci-003", diff --git a/ihaspeks/scripts/clip_server.py b/ihaspeks/scripts/clip_server.py index 57d521b..fb51cd3 100644 --- a/ihaspeks/scripts/clip_server.py +++ b/ihaspeks/scripts/clip_server.py @@ -17,6 +17,7 @@ app.add_middleware( allow_headers=["*"], ) + @app.get("/clip") async def root(): clips = [ @@ -25,6 +26,7 @@ async def root(): ] return random.choice(clips) + # logger = logging.getLogger(__name__) # PATH = os.path.dirname(os.path.realpath(__file__)) diff --git a/ihaspeks/scripts/crylaugh.py b/ihaspeks/scripts/crylaugh.py index a6e2658..343ca7a 100644 --- a/ihaspeks/scripts/crylaugh.py +++ b/ihaspeks/scripts/crylaugh.py @@ -12,5 +12,7 @@ def crylaugh(bot: Bot, message: Message): replied_msg_id = message.tags["id"] except KeyError: replied_msg_id = None - msg = "Oh 😂 look 😂 at 😂 me 😂 I 😂 use 😂 this 😂 funny 😂 emoji 😂 hahahaha 😂😂😂😂😂 lit 💯 👌" + msg = ( + "Oh 😂 look 😂 at 😂 me 😂 I 😂 use 😂 this 😂 funny 😂 emoji 😂 hahahaha 😂😂😂😂😂 lit 💯 👌" + ) tools.smart_privmsg.send(bot, message, msg, reply=replied_msg_id)