Answer the question
In order to leave comments, you need to log in
How to write all users to db when joining bot?
I know I'm dumb again.
@client.event
async def on_guild_join(guild):
cur.execute(f"INSERT INTO prefix(guild, prefix) VALUES({guild.id}, '*')")
con.commit()
for member in client.get_all_members():
user = str(member.id)
guildid = str(member.guild.id)
ult2 = f"{user}{guildid}"
cur.execute(f"SELECT guild FROM users WHERE guild = '{ult2}'")
if cur.fetchone() == None:
cur.execute(f"INSERT INTO users(guild) VALUES({ult2})")
else:
print("No")
con.commit()
print("Yes")
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question