feat(discord_bot): 增加添加朋友功能
增加添加朋友功能 Signed-off-by: Ching <loooching@gmail.com>
This commit is contained in:
parent
fa6bef2c73
commit
fa94f38536
@ -75,6 +75,16 @@ async def mod_friend(ctx, steam_id, name):
|
||||
else:
|
||||
await ctx.respond(content=f'找不到 {steam_id}')
|
||||
|
||||
@bot.command(description='添加朋友', name='add_friend')
|
||||
async def add_friend(ctx, steam_id, name):
|
||||
logger.info(f'add_friend {steam_id} {name}')
|
||||
friend = dota.Friend.get_or_none(steam_id=steam_id)
|
||||
if friend:
|
||||
await ctx.respond(content=f'已经存在 {steam_id} {name}')
|
||||
else:
|
||||
friend = dota.Friend.create(steam_id=steam_id, name=name)
|
||||
await ctx.respond(content=f'添加成功 {steam_id} {name}')
|
||||
|
||||
@tasks.loop(minutes=1)
|
||||
async def heartbeat():
|
||||
utils.heartbeat()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user