|
|
|
@ -1,3 +1,19 @@
|
|
|
|
|
# Ensō~Chan - A Multi Purpose Discord Bot That Has Everything Your Server Needs!
|
|
|
|
|
# Copyright (C) 2020 Goudham Suresh
|
|
|
|
|
|
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
# (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
import asyncio
|
|
|
|
|
import datetime
|
|
|
|
|
import random
|
|
|
|
@ -62,6 +78,11 @@ class Relationship(Cog):
|
|
|
|
|
# Setup pool
|
|
|
|
|
pool = self.bot.db
|
|
|
|
|
|
|
|
|
|
# Make sure that the user cannot marry themselves
|
|
|
|
|
if member.id == ctx.author.id:
|
|
|
|
|
await ctx.send("**Senpaii! ˭̡̞(◞⁎˃ᆺ˂)◞*✰ You can't possibly marry yourself!**")
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
# Setup pool connection and cursor
|
|
|
|
|
async with pool.acquire() as conn:
|
|
|
|
|
async with conn.cursor() as author_cursor:
|
|
|
|
@ -75,12 +96,8 @@ class Relationship(Cog):
|
|
|
|
|
author_result = await author_cursor.fetchone()
|
|
|
|
|
married_user = author_result[1]
|
|
|
|
|
|
|
|
|
|
# Make sure that the user cannot marry themselves
|
|
|
|
|
if member.id == ctx.author.id:
|
|
|
|
|
await ctx.send("**Senpaii! ˭̡̞(◞⁎˃ᆺ˂)◞*✰ You can't possibly marry yourself!**")
|
|
|
|
|
return
|
|
|
|
|
# Make sure that the person is not already married to someone else within the server
|
|
|
|
|
elif married_user is not None:
|
|
|
|
|
if married_user is not None:
|
|
|
|
|
member = guild.get_member(int(married_user))
|
|
|
|
|
await ctx.send(f"**((╬◣﹏◢)) You're already married to {member.mention}!**")
|
|
|
|
|
return
|
|
|
|
@ -159,6 +176,11 @@ class Relationship(Cog):
|
|
|
|
|
# Setup pool
|
|
|
|
|
pool = self.bot.db
|
|
|
|
|
|
|
|
|
|
# Make sure that the user cannot divorce themselves
|
|
|
|
|
if member.id == ctx.author.id:
|
|
|
|
|
await ctx.send("**Senpaii! ˭̡̞(◞⁎˃ᆺ˂)◞*✰ You can't possibly divorce yourself!**")
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
# Setup pool connection and cursor
|
|
|
|
|
async with pool.acquire() as conn:
|
|
|
|
|
async with conn.cursor() as cur:
|
|
|
|
@ -171,12 +193,8 @@ class Relationship(Cog):
|
|
|
|
|
result = await cur.fetchone()
|
|
|
|
|
married_user = result[1]
|
|
|
|
|
|
|
|
|
|
# Make sure that the user cannot divorce themselves
|
|
|
|
|
if member.id == ctx.author.id:
|
|
|
|
|
await ctx.send("**Senpaii! ˭̡̞(◞⁎˃ᆺ˂)◞*✰ You can't possibly divorce yourself!**")
|
|
|
|
|
return
|
|
|
|
|
# Make sure that the person trying to divorce is actually married to the user
|
|
|
|
|
elif married_user is None:
|
|
|
|
|
if married_user is None:
|
|
|
|
|
await ctx.send(f"**((╬◣﹏◢)) You must be married in order to divorce someone! Baka!**")
|
|
|
|
|
return
|
|
|
|
|
# Make sure the person is married to the person that they're trying to divorce
|
|
|
|
|