|
|
@ -6,7 +6,6 @@ from discord.ext.commands import BucketType, command, cooldown
|
|
|
|
|
|
|
|
|
|
|
|
# Set up the Cog
|
|
|
|
# Set up the Cog
|
|
|
|
import db
|
|
|
|
import db
|
|
|
|
from settings import enso_guild_ID
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Relationship(commands.Cog):
|
|
|
|
class Relationship(commands.Cog):
|
|
|
@ -21,10 +20,6 @@ class Relationship(commands.Cog):
|
|
|
|
# Getting the guild of the user
|
|
|
|
# Getting the guild of the user
|
|
|
|
guild = ctx.author.guild
|
|
|
|
guild = ctx.author.guild
|
|
|
|
|
|
|
|
|
|
|
|
# Make sure the guild is Enso
|
|
|
|
|
|
|
|
if guild.id != enso_guild_ID:
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Use database connection
|
|
|
|
# Use database connection
|
|
|
|
with db.connection() as conn:
|
|
|
|
with db.connection() as conn:
|
|
|
|
|
|
|
|
|
|
|
@ -42,7 +37,7 @@ class Relationship(commands.Cog):
|
|
|
|
await ctx.send("Senpaii! ˭̡̞(◞⁎˃ᆺ˂)◞*✰ You can't possibly marry yourself!")
|
|
|
|
await ctx.send("Senpaii! ˭̡̞(◞⁎˃ᆺ˂)◞*✰ You can't possibly marry yourself!")
|
|
|
|
return
|
|
|
|
return
|
|
|
|
# Make sure that the person is not already married to someone else within the server
|
|
|
|
# Make sure that the person is not already married to someone else within the server
|
|
|
|
elif result[2] is not None:
|
|
|
|
elif result[3] is not None:
|
|
|
|
member = guild.get_member(int(result[2]))
|
|
|
|
member = guild.get_member(int(result[2]))
|
|
|
|
await ctx.send(f"((╬◣﹏◢)) You're already married to {member.mention}!")
|
|
|
|
await ctx.send(f"((╬◣﹏◢)) You're already married to {member.mention}!")
|
|
|
|
return
|
|
|
|
return
|
|
|
@ -68,9 +63,9 @@ class Relationship(commands.Cog):
|
|
|
|
message_time = msg.created_at.strftime("%a, %b %d, %Y")
|
|
|
|
message_time = msg.created_at.strftime("%a, %b %d, %Y")
|
|
|
|
|
|
|
|
|
|
|
|
# Update the existing records in the database with the user that they are marrying along with the time of the accepted proposal
|
|
|
|
# Update the existing records in the database with the user that they are marrying along with the time of the accepted proposal
|
|
|
|
update_query = """UPDATE members SET married = (?), marriedDate = (?) WHERE discordID = (?)"""
|
|
|
|
update_query = """UPDATE members SET married = (?), marriedDate = (?) WHERE discordID = (?) AND guildID = (?)"""
|
|
|
|
proposer = member.id, message_time, ctx.author.id,
|
|
|
|
proposer = member.id, message_time, ctx.author.id, guild.id,
|
|
|
|
proposee = ctx.author.id, message_time, member.id,
|
|
|
|
proposee = ctx.author.id, message_time, member.id, guild.id,
|
|
|
|
cursor = conn.cursor()
|
|
|
|
cursor = conn.cursor()
|
|
|
|
|
|
|
|
|
|
|
|
# Execute the SQL Query's
|
|
|
|
# Execute the SQL Query's
|
|
|
@ -106,10 +101,6 @@ class Relationship(commands.Cog):
|
|
|
|
# Getting the guild of the user
|
|
|
|
# Getting the guild of the user
|
|
|
|
guild = ctx.author.guild
|
|
|
|
guild = ctx.author.guild
|
|
|
|
|
|
|
|
|
|
|
|
# Make sure the guild is Enso
|
|
|
|
|
|
|
|
if guild.id != enso_guild_ID:
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Use database connection
|
|
|
|
# Use database connection
|
|
|
|
with db.connection() as conn:
|
|
|
|
with db.connection() as conn:
|
|
|
|
|
|
|
|
|
|
|
@ -127,12 +118,12 @@ class Relationship(commands.Cog):
|
|
|
|
await ctx.send("Senpaii! ˭̡̞(◞⁎˃ᆺ˂)◞*✰ You can't possibly divorce yourself!")
|
|
|
|
await ctx.send("Senpaii! ˭̡̞(◞⁎˃ᆺ˂)◞*✰ You can't possibly divorce yourself!")
|
|
|
|
return
|
|
|
|
return
|
|
|
|
# Make sure that the person trying to divorce is actually married to the user
|
|
|
|
# Make sure that the person trying to divorce is actually married to the user
|
|
|
|
elif result[2] is None:
|
|
|
|
elif result[3] is None:
|
|
|
|
await ctx.send(f"((╬◣﹏◢)) You must be married in order to divorce someone! Baka!")
|
|
|
|
await ctx.send(f"((╬◣﹏◢)) You must be married in order to divorce someone! Baka!")
|
|
|
|
return
|
|
|
|
return
|
|
|
|
# Make sure the person is married to the person that they're trying to divorce
|
|
|
|
# Make sure the person is married to the person that they're trying to divorce
|
|
|
|
elif result[2] != str(member.id):
|
|
|
|
elif result[3] != str(member.id):
|
|
|
|
member = guild.get_member(int(result[2]))
|
|
|
|
member = guild.get_member(int(result[3]))
|
|
|
|
await ctx.send(f"(ノ ゜口゜)ノ You can only divorce the person that you're married!"
|
|
|
|
await ctx.send(f"(ノ ゜口゜)ノ You can only divorce the person that you're married!"
|
|
|
|
f"\n That person is {member.mention}")
|
|
|
|
f"\n That person is {member.mention}")
|
|
|
|
return
|
|
|
|
return
|
|
|
@ -158,9 +149,9 @@ class Relationship(commands.Cog):
|
|
|
|
with db.connection() as conn:
|
|
|
|
with db.connection() as conn:
|
|
|
|
|
|
|
|
|
|
|
|
# Update the existing records in the database with the user that they are marrying along with the time of the accepted proposal
|
|
|
|
# Update the existing records in the database with the user that they are marrying along with the time of the accepted proposal
|
|
|
|
update_query = """UPDATE members SET married = null, marriedDate = null WHERE discordID = (?)"""
|
|
|
|
update_query = """UPDATE members SET married = null, marriedDate = null WHERE discordID = (?) and guildID = (?)"""
|
|
|
|
divorcer = ctx.author.id,
|
|
|
|
divorcer = ctx.author.id, guild.id,
|
|
|
|
divorcee = member.id,
|
|
|
|
divorcee = member.id, guild.id,
|
|
|
|
cursor = conn.cursor()
|
|
|
|
cursor = conn.cursor()
|
|
|
|
|
|
|
|
|
|
|
|
# Execute the SQL Query's
|
|
|
|
# Execute the SQL Query's
|
|
|
|