feat(models): Add activate_friend command to enable friends

This commit is contained in:
Ching 2024-02-08 16:21:01 +08:00
parent 309b4989e7
commit 30403d02c0

View File

@ -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():