Answer the question
In order to leave comments, you need to log in
How to run discord.py without creating your own class?
As we know, in order to work with the discord api in the discord.py library, we need to create a class and then run it
client = MyClient()
client.run('token')
async def on_message(self, message):
print("Message from {0.author}: {0.content}".format(message))
text = message.content.lower()
if "!users" in text and message.author.bot is False:
b = client.get_guild(699352136273887292)
users = []
for member in b.members:
user = client.get_user(member.id)
if user.bot:
continue
users.append(str(member.id))
print(users)
Answer the question
In order to leave comments, you need to log in
create a class and then run it
client = MyClient()
client.run('token')
make a single request, I need to get the id of all users of the channel in the API
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question