Discord.py - Getting data from SQL file doesn't work
So I want my bot to check the database file for a number(0 means off, 1 means on). I have this
@client.event
async def on_message_delete(msg):
db = await asqlite.connect("servers.db")
cursor = await db.cursor()
await cursor.execute(f"SELECT ENABLE_OR_DISABLE_ON_MSG_DELETE FROM Servers WHERE Guild_ID = {msg.guild.id}")
result = await cursor.fetchone()
if result == 0:
return
if result == 1:
myembed = discord.Embed(title= "Deleted Message")
myembed.add_field(name= f'{msg.author} deleted a message(if you want to disable this, just do >disable-del)', value= f'{msg.content}')
await msg.channel.send(embed=myembed)
if msg.author.id == msg.author.bot:
pass
But it doesn't work when I set the value in the db file to 1(whereas it should send a message when someone deletes a message). There's no error either.
from Recent Questions - Stack Overflow https://ift.tt/3nizdze
https://ift.tt/eA8V8J
Comments
Post a Comment