首页 文章

运行bot示例代码时,我收到此错误

提问于
浏览
1

我的代码完全正确

This(当然还有我的令牌)

当我运行它时,我的机器人正常启动,但当一个新人添加到服务器时,我得到了这个 .

------
Ignoring exception in on_member_join
Traceback (most recent call last):
  File "C:\Users\USRNAME\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\client.py", line 307, in _run_event
    yield from getattr(self, event)(*args, **kwargs)
  File "test.py", line 9, in on_member_join
    await client.send_message(server, fmt.format(member, server))
  File "C:\Users\USRNAME\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\client.py", line 1152, in send_message
    data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts, embed=embed)
  File "C:\Users\USRNAME\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\http.py", line 198, in request
    raise NotFound(r, data)
discord.errors.NotFound: NOT FOUND (status code: 404): Unknown Channel

(抱歉它不在代码块中,我是堆栈交换的新手)

任何帮助,将不胜感激 . 谢谢

1 回答

  • 2

    这将不再起作用,因为discord删除了默认 Channels ,因此将其发送到 server 将不起作用 . 如果使用async,则应将 server 替换为 discord.Object('insert channel id') ;如果使用重写分支,则应将 discord.Object(insert channel id) 替换为 discord.Object(insert channel id) . 注意字符串与int的区别 . 祝好运 :)

相关问题