feat(bot.py): 增加 mod_friend 修改朋友名字功能

增加 mod_friend 修改朋友名字功能

Signed-off-by: Ching <loooching@gmail.com>
This commit is contained in:
Ching 2023-09-24 19:00:37 +08:00
parent f23a4d351a
commit a8825db196

View File

@ -63,6 +63,17 @@ async def get_friends(ctx):
msg += f'{friend.name} {friend.steam_id}\n' msg += f'{friend.name} {friend.steam_id}\n'
await ctx.respond(content=msg) 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) @tasks.loop(minutes=1)
async def heartbeat(): async def heartbeat():
utils.heartbeat() utils.heartbeat()