discord.py 如何设置代理?有没有详细的教程或步骤分享?

20 Replies, 1775 Views

嘿,我也遇到过这个问题!discord.py 如何设置代理其实不难,主要是要用 `aiohttp` 的 `ClientSession` 来设置代理。你可以试试这样:

```python
import discord
import aiohttp

proxy = 'http://your_proxy_address:port'

intents = discord.Intents.default()
client = discord.Client(intents=intents, proxy=proxy)

@client.event
async def on_ready():
print(f'Logged in as {client.user}')

client.run('YOUR_BOT_TOKEN')
```

如果还报错,可能是代理地址有问题,建议换个代理试试。我用过 ProxyScrape,感觉还不错,免费代理也挺多的。

Messages In This Thread



Users browsing this thread: 1 Guest(s)