Answer the question
In order to leave comments, you need to log in
How to get list of games from all discord py users?
Good day, I have a piece of code:
@commands.command()
async def gameinfo(self, ctx):
game_list = []
for member in ctx.guild.members:
game_list += member.activities
print(game_list['Game name'])
[<CustomActivity name='беги' emoji=None>, <Game name='Visual Studio Code'>]
Answer the question
In order to leave comments, you need to log in
If you don't know what attributes an object has, dir() and the documentation will help.
activities = sum([], (member.activities for member in ctx.guild.members))
game_names = [item.name for item in activities if instanceof(item, discord.Game)]
#если нужно только уникальные:
game_names = set(game_names)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question