首页 > 解决方案 > 如何解决python中的客户端连接器错误?

问题描述

我有下面的代码

我正在为不和谐写一个机器人

但我得到错误

" Exception has occurred: ClientConnectorError Cannot connect to host discord.com:443 ssl:default [The specified network name is no longer available]"

在最后一行

代码:

import discord
import os

client = discord.Client()

@client.event

async def ready1():
  print('we have logged in')

  
@client.event

async def hello(message):
  if message.author==client.user:
    return
  if message.content.contains('hello'):
    await message.channel.send('hello')

client.run(token)

标签: pythondiscorddiscord.pybotspython-module

解决方案


我只是重新生成令牌并且它有效


推荐阅读