From 0a1f1a9e731cf5407209e3321e8266a722ef72b2 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Fri, 8 Jan 2021 13:55:52 -0500 Subject: [PATCH] added connection closing statements to most database.py functions --- database.py | 17 +++++++++++++++-- the_prestige.py | 1 - 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/database.py b/database.py index d10a056..1dd1c90 100644 --- a/database.py +++ b/database.py @@ -186,9 +186,13 @@ def get_user_player_conn(conn, user): except TypeError: return False else: - print(conn) + conn.close() + return False except: - print(conn) + conn.close() + return False +conn.close() +return False def get_user_player(user): conn = create_connection() @@ -211,6 +215,8 @@ def save_team(name, team_json_string, user_id): return False except: return False + conn.close() + return False def update_team(name, team_json_string): conn = create_connection() @@ -225,7 +231,10 @@ def update_team(name, team_json_string): conn.close() return False except: + conn.close() return False + conn.close() + return False def get_team(name, owner=False): conn = create_connection() @@ -258,6 +267,8 @@ def delete_team(team): except: conn.close() return False + conn.close() + return False def assign_owner(team_name, owner_id): conn = create_connection() @@ -271,6 +282,8 @@ def assign_owner(team_name, owner_id): except: conn.close() return False + conn.close() + return False def get_all_teams(): conn = create_connection() diff --git a/the_prestige.py b/the_prestige.py index fa0206d..5a70a76 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -489,7 +489,6 @@ class AssignOwnerCommand(Command): async def execute(self, msg, command): new_owner = msg.mentions[0] team_name = command.strip().split(new_owner.mention+" ")[1] - print(team_name) if db.assign_owner(team_name, new_owner.id): await msg.channel.send(f"{team_name} is now owned by {new_owner.display_name}. Don't break it.") else: