Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问如何配置nb2的.env文件 以适配clash代理,谢谢 #46

Open
VincentZyu233 opened this issue Dec 1, 2024 · 0 comments
Open

Comments

@VincentZyu233
Copy link

请问如何配置nb2的.env文件 以适配clash代理,谢谢

这里是我的clash代理的输出:

root@ser4500530465:/mnt/data/SSoftwareFiles/clash# ./clash-linux-amd64-v3-v1.18.0 -d .
INFO[0000] Start initial compatible provider 🔰国外流量      
INFO[0000] Start initial compatible provider 🎬哔哩哔哩      
INFO[0000] Start initial compatible provider 🎬Youtube   
INFO[0000] Start initial compatible provider 🎬国外媒体      
INFO[0000] Start initial compatible provider ⚓️其他流量     
INFO[0000] Start initial compatible provider ♻️ 自动选择    
INFO[0000] Start initial compatible provider 🚀直接连接      
INFO[0000] Start initial compatible provider 🍎苹果服务      
INFO[0000] Start initial compatible provider 🎬ChatGPT   
INFO[0000] Start initial compatible provider ✈️Telegram 
INFO[0000] Start initial compatible provider 🎬Netflix   
INFO[0000] RESTful API listening at: [::]:9090          
INFO[0000] inbound http://:7890 create success.         
INFO[0000] inbound socks://:7891 create success.        
INFO[0000] inbound redir://:7892 create success.        


我的部分的.env配置:

# DRIVER=~fastapi
DRIVER=~fastapi+~websockets+~httpx
PORT=8080

.....

HTTP_PROXY=http://127.0.0.1:7890
HTTPS_PROXY=http://127.0.0.1:7890
DISCORD_PROXY='http://127.0.0.1:7890'
ALL_PROXY=socks5://127.0.0.1:7891

.....


DISCORD_BOTS='
[
  {
    "token": "MTMxMDU0ODQ4Nzc3OTI1NDMxMw.GLhgxn.jwfIiKgJ3vQVJApVZJyWZX5IIbpS0wm4NdeD7Y",
    "intent": {
      "guild_messages": true,
      "direct_messages": true
    },
    "application_commands": {"*": ["*"]}
  }
]'

机器人启动以后的输出

(qwq-bot-3) root@ser4500530465:/mnt/data/SSoftwareFiles/nonebot2/qwq-bot-3/qwq-bot-3# nb run
Using python: /mnt/data/SSoftwareFiles/nonebot2/qwq-bot-3/qwq-bot-3/.venv/bin/python
12-02 00:40:06 [SUCCESS] nonebot | NoneBot is initializing...
12-02 00:40:06 [INFO] nonebot | Current Env: prod
12-02 00:40:07 [SUCCESS] nonebot | Succeeded to load plugin "maobing" from "src.plugins.maobing"
12-02 00:40:07 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_alconna:uniseg" from "nonebot_plugin_alconna.uniseg"
12-02 00:40:07 [SUCCESS] nonebot | Succeeded to load plugin "quote" from "src.plugins.quote"
12-02 00:40:07 [SUCCESS] nonebot | Succeeded to load plugin "beijing_time" from "src.plugins.beijing_time"
12-02 00:40:08 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_easymarkdown"
12-02 00:40:08 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_charpic"
12-02 00:40:08 [SUCCESS] nonebot | Succeeded to load plugin "nihao" from "src.plugins.nihao"
12-02 00:40:08 [SUCCESS] nonebot | Succeeded to load plugin "qwq" from "src.plugins.qwq"
12-02 00:40:08 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_saa"
12-02 00:40:08 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_analysis_bilibili"
12-02 00:40:08 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_htmlrender"
/mnt/data/SSoftwareFiles/nonebot2/qwq-bot-3/qwq-bot-3/.venv/lib/python3.10/site-packages/nonebot_plugin_alconna/matcher.py:208: UserWarning: Shortcut Key should not start with '^', otherwise it will ignore the prefix automatically.
  cls.command().shortcut(key, args, **kwargs)  # type: ignore
12-02 00:40:08 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_heweather"
12-02 00:40:09 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_picmcstat"
12-02 00:40:09 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_alconna"
12-02 00:40:09 [SUCCESS] nonebot | Succeeded to load plugin "ciallo" from "src.plugins.ciallo"
12-02 00:40:09 [SUCCESS] nonebot | Succeeded to load plugin "free" from "src.plugins.free"
12-02 00:40:09 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_apscheduler"
12-02 00:40:09 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_nowtime"
12-02 00:40:09 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_userinfo"
12-02 00:40:09 [WARNING] nonebot_plugin_picstatus | Custom background path does not exist, fallback to default
12-02 00:40:09 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_picstatus"
12-02 00:40:09 [SUCCESS] nonebot | Running NoneBot...
12-02 00:40:09 [INFO] uvicorn | Started server process [304638]
12-02 00:40:09 [INFO] uvicorn | Waiting for application startup.
12-02 00:40:09 [WARNING] nonebot_plugin_htmlrender | 浏览器参数错误,无 {} 浏览器核心可用,使用 Chromium 启动
12-02 00:40:09 [INFO] nonebot_plugin_htmlrender | 使用 Chromium 启动
12-02 00:40:10 [INFO] nonebot_plugin_htmlrender | Browser Started.
12-02 00:40:10 [INFO] nonebot_plugin_apscheduler | Scheduler Started
12-02 00:40:11 [INFO] nonebot | Discord | Discord Adapter is starting up...
12-02 00:40:11 [ERROR] nonebot | Discord | Failed to get gateway info.
Traceback (most recent call last):
  File "<string>", line 19, in <module>
  File "/mnt/data/SSoftwareFiles/nonebot2/qwq-bot-3/qwq-bot-3/.venv/lib/python3.10/site-packages/nonebot/__init__.py", line 337, in run
    get_driver().run(*args, **kwargs)
  File "/mnt/data/SSoftwareFiles/nonebot2/qwq-bot-3/qwq-bot-3/.venv/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 188, in run
    uvicorn.run(
  File "/mnt/data/SSoftwareFiles/nonebot2/qwq-bot-3/qwq-bot-3/.venv/lib/python3.10/site-packages/uvicorn/main.py", line 579, in run
    server.run()
  File "/mnt/data/SSoftwareFiles/nonebot2/qwq-bot-3/qwq-bot-3/.venv/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
> File "/mnt/data/SSoftwareFiles/nonebot2/qwq-bot-3/qwq-bot-3/.venv/lib/python3.10/site-packages/nonebot/adapters/discord/adapter.py", line 81, in run_bot
    gateway_info = await self._get_gateway_bot(bot_info)
  File "/mnt/data/SSoftwareFiles/nonebot2/qwq-bot-3/qwq-bot-3/.venv/lib/python3.10/site-packages/nonebot/adapters/discord/adapter.py", line 131, in _get_gateway_bot
    resp = await self.request(request)
  File "/mnt/data/SSoftwareFiles/nonebot2/qwq-bot-3/qwq-bot-3/.venv/lib/python3.10/site-packages/nonebot/internal/adapter/adapter.py", line 92, in request
    return await self.driver.request(setup)
  File "/mnt/data/SSoftwareFiles/nonebot2/qwq-bot-3/qwq-bot-3/.venv/lib/python3.10/site-packages/nonebot/drivers/httpx.py", line 129, in request
    async with self.get_session(
  File "/mnt/data/SSoftwareFiles/nonebot2/qwq-bot-3/qwq-bot-3/.venv/lib/python3.10/site-packages/nonebot/internal/driver/abstract.py", line 269, in __aenter__
    await self.setup()
  File "/mnt/data/SSoftwareFiles/nonebot2/qwq-bot-3/qwq-bot-3/.venv/lib/python3.10/site-packages/nonebot/drivers/httpx.py", line 100, in setup
    self._client = httpx.AsyncClient(
TypeError: AsyncClient.__init__() got an unexpected keyword argument 'proxies'
12-02 00:40:11 [INFO] uvicorn | Application startup complete.
12-02 00:40:11 [INFO] uvicorn | Uvicorn running on http://127.0.0.1:8080 (Press CTRL+C to quit)
12-02 00:40:16 [INFO] uvicorn | ('127.0.0.1', 51304) - "WebSocket /onebot/v11/ws" [accepted]
12-02 00:40:16 [INFO] nonebot | OneBot V11 | Bot 3056516992 connected
12-02 00:40:16 [INFO] websockets | connection open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant