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