From 30403d02c03f635a2bc0478a2a38454e3abc4546 Mon Sep 17 00:00:00 2001 From: Ching Date: Thu, 8 Feb 2024 16:21:01 +0800 Subject: [PATCH] feat(models): Add activate_friend command to enable friends --- discord_bot.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/discord_bot.py b/discord_bot.py index f8da974..74910d9 100644 --- a/discord_bot.py +++ b/discord_bot.py @@ -96,6 +96,16 @@ async def deactivate_friend(ctx, steam_id): else: await ctx.respond(content=f'找不到 {steam_id}') +@bot.command(description='启用朋友', name='activate_friend') +async def activate_friend(ctx, steam_id): + logger.info(f'activate_friend {steam_id}') + friend = dota.Friend.get_or_none(steam_id=steam_id) + if friend: + friend.active = True + friend.save() + await ctx.respond(content=f'启用成功 {steam_id}') + else: + await ctx.respond(content=f'找不到 {steam_id}') @tasks.loop(minutes=1) async def heartbeat():