Replacing marriage info with cache

pull/8/head
sgoudham 4 years ago
parent a5cef11a2b
commit d74d4bc3d4

@ -282,31 +282,22 @@ class Relationship(Cog):
# Getting the guild of the user # Getting the guild of the user
guild = member.guild guild = member.guild
# Setup pool # Get the author from the cache
pool = self.bot.db result = await self.bot.check_cache(member.id, ctx.guild.id)
# TODO: Replace this entire section with retrieving from cache user = result["married"]
marriage_date = result["married_date"]
# Setup pool connection and cursor
async with pool.acquire() as conn: # Set empty values for non-married users
# Get the author's row from the Members Table if not user:
select_query = """SELECT * FROM members WHERE member_id = $1 and guild_id = $2""" married = False
marriedUser = ""
# Execute the SQL Query marriedDate = ""
result = await conn.fetchrow(select_query, member.id, guild.id) # Set the member, date married and setting married status
user = result["married"] else:
marriage_date = result["married_date"] married = True
marriedUser = guild.get_member(user)
# Set empty values for non-married users marriedDate = marriage_date
if not user:
married = False
marriedUser = ""
marriedDate = ""
# Set the member, date married and setting married status
else:
married = True
marriedUser = guild.get_member(user)
marriedDate = marriage_date
# Get the current date of the message sent by the user # Get the current date of the message sent by the user
currentDate = ctx.message.created_at.strftime("%a, %b %d, %Y") currentDate = ctx.message.created_at.strftime("%a, %b %d, %Y")

Loading…
Cancel
Save