支持添加 log 频道

This commit is contained in:
xtaodada 2021-06-20 18:21:43 +08:00
parent 2fa5cae93b
commit 58f58a1f9a
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
2 changed files with 4 additions and 10 deletions

View File

@ -82,10 +82,7 @@ def rank(update, context):
r.expireat("{}_frequency_limit".format(chat_id), ex_time) r.expireat("{}_frequency_limit".format(chat_id), ex_time)
count = int(r.get("{}_frequency_limit".format(chat_id))) count = int(r.get("{}_frequency_limit".format(chat_id)))
if count > LIMIT_COUNT: if count > LIMIT_COUNT:
try:
bot.edit_message_text(chat_id=chat_id, message_id=msg.message_id, text="该群组在这个小时内的生成配额已经用完,请稍后再试~") bot.edit_message_text(chat_id=chat_id, message_id=msg.message_id, text="该群组在这个小时内的生成配额已经用完,请稍后再试~")
except:
pass
return return
add_task(chat_id) add_task(chat_id)
print("群组: {},用户: {}|{} 发起了主动触发请求".format(chat_id, username, user_id, )) print("群组: {},用户: {}|{} 发起了主动触发请求".format(chat_id, username, user_id, ))
@ -94,11 +91,8 @@ def rank(update, context):
f'群组 ID`{chat_id}`\n' \ f'群组 ID`{chat_id}`\n' \
f'用户 ID`{user_id}' \ f'用户 ID`{user_id}' \
f'执行操作:`主动生成词云`\n' f'执行操作:`主动生成词云`\n'
bot.send_message(chat_id=chat_id, text=ctext, parse_mode="Markdown") bot.send_message(chat_id=CHANNEL, text=ctext, parse_mode="Markdown")
try:
bot.edit_message_text(chat_id=chat_id, message_id=msg.message_id, text="统计数据将在分析完毕后发送到当前群组,请稍等~") bot.edit_message_text(chat_id=chat_id, message_id=msg.message_id, text="统计数据将在分析完毕后发送到当前群组,请稍等~")
except:
pass
except Exception as e: except Exception as e:
print("主动触发任务失败,请检查") print("主动触发任务失败,请检查")
print(e) print(e)

View File

@ -53,7 +53,7 @@ def do_task():
f'群组 ID`{group}`\n' \ f'群组 ID`{group}`\n' \
f'执行操作:`生成词云`\n' \ f'执行操作:`生成词云`\n' \
f'结果:`成功`\n' \ f'结果:`成功`\n' \
f'处理耗时:`{(stop_time - start_time)[:5]}`' f'处理耗时:`{str(stop_time - start_time)[:5]}`'
except Exception as e: except Exception as e:
print("群组: {} | 处理失败,可能是机器人已经被移出群组,请检查报错!".format(group)) print("群组: {} | 处理失败,可能是机器人已经被移出群组,请检查报错!".format(group))
print(e) print(e)