diff --git a/discord_bot.py b/discord_bot.py index 9d5bc02..c94c296 100644 --- a/discord_bot.py +++ b/discord_bot.py @@ -63,6 +63,17 @@ async def get_friends(ctx): msg += f'{friend.name} {friend.steam_id}\n' await ctx.respond(content=msg) +@bot.command(description='修改朋友信息', name='mod_friend') +async def mod_friend(ctx, steam_id, name): + logger.info(f'mod_friend {steam_id} {name}') + friend = dota.Friend.get_or_none(steam_id=steam_id) + if friend: + friend.name = name + friend.save() + await ctx.respond(content=f'修改成功 {steam_id} {name}') + else: + await ctx.respond(content=f'找不到 {steam_id}') + @tasks.loop(minutes=1) async def heartbeat(): utils.heartbeat()