diff --git a/discord_bot.py b/discord_bot.py index 8295ce3..9d5bc02 100644 --- a/discord_bot.py +++ b/discord_bot.py @@ -51,6 +51,17 @@ async def get_friends_recent_matches(ctx, name, match_count=5): # a slash comman data = dota.Friend.serialize_recent_matches_for_discord(friends, match_count) await ctx.respond(content=data['content'], embeds=[discord.Embed.from_dict(embed) for embed in data['embeds']]) +@bot.command(description='获取朋友', name='list_friends') +async def get_friends(ctx): + logger.info(f'get_friends') + friends = dota.Friend.select() + msg = '' + if friends.count() == 0: + msg = '没有朋友' + else: + for friend in friends: + msg += f'{friend.name} {friend.steam_id}\n' + await ctx.respond(content=msg) @tasks.loop(minutes=1) async def heartbeat():