Only married users can kiss/cuddle

Only you can kiss/cuddle yourself
pull/8/head
sgoudham 5 years ago
parent 946dffc1dc
commit b0cb96fe05

@ -5,6 +5,7 @@ from discord import Colour, Embed, Member
from discord.ext import commands
from discord.ext.commands import cooldown, command, BucketType
import db
import settings
from settings import time, colour_list, enso_ensochancommands_Mention
@ -34,6 +35,29 @@ class Interactive(commands.Cog):
async def kiss(self, ctx, target: Member):
"""Allows users to kiss a person in the server"""
# Use database connection
with db.connection() as conn:
# Get the author's row from the Members Table
select_query = """SELECT * FROM members WHERE discordID = (?)"""
val = ctx.author.id,
cursor = conn.cursor()
# Execute the SQL Query
cursor.execute(select_query, val)
result = cursor.fetchone()
# Error handling to make sure that the user can kiss themselves
if target.id == ctx.author.id:
cuddle = False
else:
cuddle = True
# Make sure the user isn't trying to kiss someone else besides their partner
if not target.id == int(result[2]) and cuddle:
await ctx.send("Σ(‘◉⌓◉’) You can only cuddle your partner! Baka!")
return
# Surround with try/except to catch any exceptions that may occur
try:
@ -120,6 +144,29 @@ class Interactive(commands.Cog):
async def cuddle(self, ctx, target: Member):
"""Allows users to cuddle a person in the server"""
# Use database connection
with db.connection() as conn:
# Get the author's row from the Members Table
select_query = """SELECT * FROM members WHERE discordID = (?)"""
val = ctx.author.id,
cursor = conn.cursor()
# Execute the SQL Query
cursor.execute(select_query, val)
result = cursor.fetchone()
# Error handling to make sure that the user can cuddle themselves
if target.id == ctx.author.id:
cuddle = False
else:
cuddle = True
# Make sure the user isn't trying to cuddle someone else besides their partner
if not target.id == int(result[2]) and cuddle:
await ctx.send("Σ(‘◉⌓◉’) You can only cuddle your partner! Baka!")
return
# Surround with try/except to catch any exceptions that may occur
try:

Loading…
Cancel
Save