Skip to content

Commit

Permalink
feat: help message
Browse files Browse the repository at this point in the history
  • Loading branch information
RockChinQ committed Apr 22, 2024
1 parent 6235b56 commit e537dce
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
15 changes: 8 additions & 7 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
HOST=0.0.0.0 # 配置 NoneBot 监听的 IP / 主机名
PORT=8080 # 配置 NoneBot 监听的端口
COMMAND_START=["#"] # 配置命令起始字符
COMMAND_SEP=["."] # 配置命令分割字符
HOST=0.0.0.0
PORT=8080
COMMAND_START=["#"]
COMMAND_SEP=["."]

CAMPUX_API="https://sample.com" # 配置 Campux API 地址
CAMPUX_TOKEN="campux" # 配置 Campux Token
CAMPUX_API="https://sample.com"
CAMPUX_TOKEN="campux"
CAMPUX_REDIS_ADDR="localhost:6379"
CAMPUX_REDIS_PASSWORD=""
CAMPUX_REDIS_PUBLISH_POST_STREAM="campux_publish_post"
CAMPUX_REDIS_PUBLISH_POST_STREAM="campux_publish_post"
CAMPUX_HELP_MESSAGE="填写未匹配指令时的帮助信息"
8 changes: 7 additions & 1 deletion campux/imbot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import nonebot
import nonebot.exception
from nonebot.rule import to_me
from nonebot.plugin import on_command
from nonebot.plugin import on_command, on_regex
from nonebot.adapters import Event

from ..api import api
Expand All @@ -12,6 +12,8 @@
sign_up = on_command("注册账号", rule=to_me(), priority=10, block=True)
reset_password = on_command("重置密码", rule=to_me(), priority=10, block=True)

any_message = on_regex(r".*", rule=to_me(), priority=100, block=True)

@sign_up.handle()
async def sign_up_func(event: Event):

Expand All @@ -34,3 +36,7 @@ async def reset_password_func(event: Event):
return
traceback.print_exc()
await reset_password.finish(str(e))

@any_message.handle()
async def any_message_func(event: Event):
await any_message.finish(nonebot.get_driver().config.campux_help_message)

0 comments on commit e537dce

Please sign in to comment.