change coolq into cqhttp

This commit is contained in:
yanyongyu 2020-08-06 17:19:06 +08:00
parent 10f1ab70b4
commit 41713f0645
3 changed files with 7 additions and 5 deletions

View File

@ -70,6 +70,8 @@ html_theme = 'alabaster'
# so a file named "default.css" will overwrite the builtin "default.css". # so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static'] html_static_path = ['_static']
# html_baseurl = '/api/'
# -- Extension configuration ------------------------------------------------- # -- Extension configuration -------------------------------------------------
# -- Options for todo extension ---------------------------------------------- # -- Options for todo extension ----------------------------------------------

View File

@ -14,7 +14,7 @@ from fastapi import Body, FastAPI, WebSocket as FastAPIWebSocket
from nonebot.log import logger from nonebot.log import logger
from nonebot.config import Config from nonebot.config import Config
from nonebot.drivers import BaseDriver, BaseWebSocket from nonebot.drivers import BaseDriver, BaseWebSocket
from nonebot.adapters.coolq import Bot as CoolQBot from nonebot.adapters.cqhttp import Bot as CQBot
class Driver(BaseDriver): class Driver(BaseDriver):
@ -94,8 +94,8 @@ class Driver(BaseDriver):
"/", auto_error=False)): "/", auto_error=False)):
# TODO: Check authorization # TODO: Check authorization
logger.debug(f"Received message: {data}") logger.debug(f"Received message: {data}")
if adapter == "coolq": if adapter == "cqhttp":
bot = CoolQBot("http", self.config) bot = CQBot("http", self.config)
await bot.handle_message(data) await bot.handle_message(data)
return {"status": 200, "message": "success"} return {"status": 200, "message": "success"}
@ -116,8 +116,8 @@ class Driver(BaseDriver):
continue continue
logger.debug(f"Received message: {data}") logger.debug(f"Received message: {data}")
if adapter == "coolq": if adapter == "cqhttp":
bot = CoolQBot("websocket", self.config, websocket=websocket) bot = CQBot("websocket", self.config, websocket=websocket)
await bot.handle_message(data) await bot.handle_message(data)