Database connections are now more efficient

pull/8/head
sgoudham 4 years ago
parent 80a1efbb2b
commit 94d1aacd5e

@ -2,6 +2,7 @@ import asyncio
import datetime
import os
import random
from contextlib import closing
import discord
from discord import Embed
@ -167,13 +168,12 @@ class Modmail(commands.Cog, command_attrs=dict(hidden=True)):
# Get the author's row from the Members Table
select_query = """SELECT * FROM moderatormail WHERE guildID = (?)"""
val = guildid,
cursor = conn.cursor()
with closing(conn.cursor()) as cursor:
# Execute the SQL Query
cursor.execute(select_query, val)
result = cursor.fetchone()
# Adding error handling
# Adding error handlingpip3 install
if result is None:
return

Loading…
Cancel
Save