A
A
ARKRAFTER2020-12-19 23:42:45
Python
ARKRAFTER, 2020-12-19 23:42:45

Does not ban the user on the discord server, how to fix it?

sqlite3 imported

Code:

db = sqlite3.connect('users.db')
sql = db.cursor()

sql.execute("""CREATE TABLE IF NOT EXISTS badusers (
       userid INT
  )""")
  
db.commit()

@client.event
async def on_ready():
  print('bot connected')

@client.event
async def on_member_join(member:discord.member):
  sql.execute(f"SELECT userid FROM badusers")
  if sql.fetchone() is None:
    print('пропуск')
  else:
    await member.ban(reason='Этот пользователь в черном списке бота(крашер или рейдер)')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2020-12-19
@ARKRAFTER

I didn’t look at the framework in python, but check if the on_member_join function is triggered at all, maybe intents need to be added there. And the second is trite to check the rights to the ban.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question