@commands.Cog.listener()
async def on_message(self, message):
if not message.author.bot:
if not message.content.startswith('*'):
base = sqlite3.connect('cogs/Warn.db')
cur = base.cursor()
cur.execute("""CREATE TABLE IF NOT EXISTS users(
guildid INT,
id INT,
messages INT)
""")
base.commit()
messages = cur.execute(f"SELECT id FROM users WHERE guildid = {message.guild.id} and id={message.author.id}")
if messages == None:
cur.execute(f"INSERT INTO users VALUES ({guild.id}, {author.id}, 0)")
base.commit()
cur.execute(f"UPDATE users SET messages + 1 WHERE guildid = {message.guild.id} and id={message.author.id}")
base.commit()
else:
cur.execute(f"SELECT id FROM users where guildid = {message.guild.id} and id={message.author.id}")
if len(message.content) >= 1:
cur.execute(f"UPDATE users SET messages = messages + 1 WHERE guildid = {message.guild.id} and id={message.author.id}")
base.commit()