Making Marry command Owner Only

Inserting UserIDs
Iterating through Every Row In Table
pull/8/head
sgoudham 5 years ago
parent 49513d1c1b
commit e1dcc212a8

@ -3,7 +3,7 @@ import random
from discord import Colour, Embed, Member from discord import Colour, Embed, Member
from discord.ext import commands from discord.ext import commands
from discord.ext.commands import cooldown, command, BucketType from discord.ext.commands import cooldown, command, BucketType, is_owner
import db import db
import settings import settings
@ -374,6 +374,7 @@ class Interactive(commands.Cog):
print(e) print(e)
@command(name="marry", aliases=["Marry"]) @command(name="marry", aliases=["Marry"])
@is_owner()
@cooldown(1, 1, BucketType.user) @cooldown(1, 1, BucketType.user)
async def marry(self, ctx, member: Member): async def marry(self, ctx, member: Member):
"""Allows the bot to wed two young lovers together""" """Allows the bot to wed two young lovers together"""
@ -397,6 +398,15 @@ class Interactive(commands.Cog):
# Using connection to the database # Using connection to the database
with db.connection() as conn: with db.connection() as conn:
select_query = """SELECT * FROM marriages"""
cursor = conn.cursor()
cursor.execute(select_query)
result = cursor.fetchall()
for row in result:
print(row[1], row[2])
conn.commit()
# Define the Insert Into Statement inserting into the database # Define the Insert Into Statement inserting into the database
insert_query = """INSERT INTO marriages (proposerID, proposeeID) VALUES (?, ?)""" insert_query = """INSERT INTO marriages (proposerID, proposeeID) VALUES (?, ?)"""
val = ctx.author.id, member.id val = ctx.author.id, member.id

Loading…
Cancel
Save