fix : 暂时添加dev变量

This commit is contained in:
Wbucket
2026-09-30 13:28:33 +08:00
parent f7ad06c085
commit cac4856f2f
+11 -8
View File
@@ -11,8 +11,8 @@ from botpy.types.session import Session
from dotenv import load_dotenv from dotenv import load_dotenv
import os import os
import types import types
# from bobby import bobbySession from bobby import bobbySession
# from mcwatcher import watcher from mcwatcher import watcher
from threading import Thread from threading import Thread
import asyncio import asyncio
#环境配置 #环境配置
@@ -98,7 +98,7 @@ class djtuWebsocket (Client) :
# 触发概率不大所以可以直接提取关键字 # 触发概率不大所以可以直接提取关键字
async def parseCommand(self,msg :Message): async def parseCommand(self,msg :Message):
commands:dict[str,types.MethodType|types.FunctionType] = { commands:dict[str,types.MethodType|types.FunctionType] = {
# r'/邀请码' : bobby.getInviteCode, r'/邀请码' : bobby.getInviteCode,
r'吃什么' : lambda :"是啊吃什么" r'吃什么' : lambda :"是啊吃什么"
} }
required = msg.content required = msg.content
@@ -142,17 +142,19 @@ bbyPasswd = os.getenv("BOBBY_PASSWORD")
appid = os.getenv("APP_ID") appid = os.getenv("APP_ID")
secret_bot = os.getenv("SECRET") secret_bot = os.getenv("SECRET")
group_open_id = os.getenv("GROUP_OPEN_ID") group_open_id = os.getenv("GROUP_OPEN_ID")
dev = os.getenv("DEV")
if appid is None or secret_bot is None : if appid is None or secret_bot is None :
raise SystemExit("未找到bot配置!") raise SystemExit("未找到bot配置!")
logger.info("登录账号:"+appid) logger.info("登录账号:"+appid)
# bobby Session # bobby Session
if not dev is None:
if bbyAccount is None or bbyPasswd is None : if bbyAccount is None or bbyPasswd is None :
raise SystemError("未找到账密配置") raise SystemError("未找到账密配置")
if appid is None or secret_bot is None : if appid is None or secret_bot is None :
raise SystemError("未找到bot配置") raise SystemError("未找到bot配置")
# bobby = bobbySession(bbyAccount,bbyPasswd) bobby = bobbySession(bbyAccount,bbyPasswd)
async def main(ws:djtuWebsocket, *args: Any, **kwargs: Any) -> None: async def main(ws:djtuWebsocket, *args: Any, **kwargs: Any) -> None:
async with ws as ws: async with ws as ws:
@@ -175,10 +177,11 @@ ws = djtuWebsocket(Intents_ex(public_messages=True,member_event=True))
# 启动mcwatcher线程 # 启动mcwatcher线程
def pushQuene(cont:str): def pushQuene(cont:str):
ws.q.put(cont) ws.q.put(cont)
# Thread(target=watcher.MCWatcher,name="watcher",kwargs={ if not dev is None :
# "hookfunction":pushQuene, Thread(target=watcher.MCWatcher,name="watcher",kwargs={
# "logging":logger "hookfunction":pushQuene,
# }).start() "logging":logger
}).start()
# bot线程运行 # bot线程运行
asyncio.run(main(ws,appid=appid,secret=secret_bot)) asyncio.run(main(ws,appid=appid,secret=secret_bot))