Answer the question
In order to leave comments, you need to log in
AttributeError: 'Bot' object has no attribute 'members'?
I am making an economic bot on D.py, I wrote an event and tried to start the bot but gave an error
@bot.event
async def on_ready():
await bot.change_presence(status=discord.Status.online, activity=discord.Streaming(name="!help > discord.gg/-----", url="url"))
cur.execute("""CREATE TABLE IF NOT EXISTS users (
name TEXT,
id INT,
cash BIGINT,
rep INT,
hp INT,
lvl INT
)""")
connection.commit()
for guild in bot.guilds:
for member in bot.members:
if cur.execute(f"SELECT id FROM users WHERE id = {member.id}").fetchone() is None:
cur.execute(f"INSERT INTO users VALUES ('{member}', {member.id}, 0, 25, 0)")
else:
pass
connection.commit()
print(f"Succesfully logined as {bot.name}")
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