mirror of
https://github.com/ClovertaTheTrilobita/SanYeCao-Nonebot.git
synced 2026-04-01 22:04:51 +00:00
init
This commit is contained in:
parent
ad8fc7b52e
commit
cf421a1d12
5 changed files with 43 additions and 5 deletions
|
|
@ -9,3 +9,5 @@
|
|||
## Documentation
|
||||
|
||||
See [Docs](https://nonebot.dev/)
|
||||
|
||||
pip install -r requirements.txt
|
||||
|
|
|
|||
4
bot.py
4
bot.py
|
|
@ -1,14 +1,10 @@
|
|||
import nonebot
|
||||
from nonebot.adapters.qq import Adapter as QQAdapter
|
||||
from nonebot.adapters.onebot.v11 import Adapter as OneBotV11Adapter
|
||||
from src.qq_plugins.data_init import data_init # 导入QQ插件
|
||||
|
||||
nonebot.init()
|
||||
driver = nonebot.get_driver()
|
||||
driver.register_adapter(QQAdapter) # 注册QQ适配器
|
||||
# driver.register_adapter(OneBotV11Adapter) # 注册OneBot V11适配器
|
||||
|
||||
# nonebot.load_builtin_plugins('echo', 'single_session')
|
||||
nonebot.load_from_toml("pyproject.toml")
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,5 +10,5 @@ adapters = [
|
|||
{ name = "QQ", module_name = "nonebot.adapters.qq" }
|
||||
]
|
||||
plugins = []
|
||||
plugin_dirs = ["src/plugins"]
|
||||
plugin_dirs = ["src/qq_plugins"]
|
||||
builtin_plugins = ["echo"]
|
||||
|
|
|
|||
17
requirements.txt
Normal file
17
requirements.txt
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
nonebot2
|
||||
nonebot_adapter_qq
|
||||
nonebot2[fastapi]
|
||||
nonebot2[httpx]
|
||||
nonebot2[websockets]
|
||||
|
||||
sqlalchemy
|
||||
autopep8
|
||||
graiax-silkcoder
|
||||
Crypto
|
||||
fake_useragent
|
||||
pycryptodome
|
||||
PyExecJS
|
||||
gradio_client
|
||||
|
||||
|
||||
|
||||
23
src/qq_plugins/check.py
Normal file
23
src/qq_plugins/check.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
|
||||
from nonebot.rule import Rule, to_me
|
||||
from nonebot.adapters.qq import Message, MessageEvent, MessageSegment
|
||||
from nonebot import on_message
|
||||
from nonebot.adapters import Bot, Event
|
||||
|
||||
menu = ['/今日运势','/天气','/美图','/点歌','/摸摸','/今日老婆']
|
||||
async def check_value_in_menu(event: Event) -> bool:
|
||||
value = event.get_plaintext().strip().split(" ")
|
||||
if value[0] in menu:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
rule = Rule(check_value_in_menu)
|
||||
|
||||
check = on_message(rule=to_me() & rule ,block=True)
|
||||
@check.handle()
|
||||
async def check(bot: Bot, event: Event):
|
||||
await bot.send(message=Message("是什么呢?猫猫没有识别到,喵~"+'\n'+"(๑>ڡ<)☆ 请注意命令后要加空格哦~"),event=event)
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in a new issue