When running bot sample code, I get this error(运行机器人示例代码时,我收到此错误)
问题描述
我的代码正是
这个(当然是我的令牌)
当我运行它时,我的机器人正常启动,但是当一个新人添加到服务器时,我得到了这个.
When I run it, my bot starts up as normal, but when a new person is added to the server, i get this.
------
Ignoring exception in on_member_join
Traceback (most recent call last):
File "C:UsersUSRNAMEAppDataLocalProgramsPythonPython36libsite-packagesdiscordclient.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:UsersUSRNAMEAppDataLocalProgramsPythonPython36libsite-packagesdiscordclient.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:UsersUSRNAMEAppDataLocalProgramsPythonPython36libsite-packagesdiscordhttp.py", line 198, in request
raise NotFound(r, data)
discord.errors.NotFound: NOT FOUND (status code: 404): Unknown Channel
(对不起,它不在代码块中,我是堆栈交换的新手)
(Sorry about it not being in a code block, I'm new to stack exchange)
任何帮助将不胜感激.谢谢
Any help would be appreciated. Thanks
推荐答案
这将不再起作用,因为不和谐删除了默认频道,因此将其发送到 server
将不起作用.如果您使用异步或 discord.Object(insert channel id)
,则应将 server
替换为 discord.Object('insert channel id')
如果您使用的是重写分支.注意字符串与 int 的区别.祝你好运:)
This will not work anymore because discord removed default channels so sending it to server
will not work. You should replace server
with discord.Object('insert channel id')
if you are using async or discord.Object(insert channel id)
if you are using the rewrite branch. Note the string vs int difference. Good luck :)
这篇关于运行机器人示例代码时,我收到此错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:运行机器人示例代码时,我收到此错误


基础教程推荐
- 线程时出现 msgbox 错误,GUI 块 2022-01-01
- Dask.array.套用_沿_轴:由于额外的元素([1]),使用dask.array的每一行作为另一个函数的输入失败 2022-01-01
- 用于分类数据的跳跃记号标签 2022-01-01
- 筛选NumPy数组 2022-01-01
- 何时使用 os.name、sys.platform 或 platform.system? 2022-01-01
- 在 Python 中,如果我在一个“with"中返回.块,文件还会关闭吗? 2022-01-01
- 使用PyInstaller后在Windows中打开可执行文件时出错 2022-01-01
- 如何在海运重新绘制中自定义标题和y标签 2022-01-01
- 如何让 python 脚本监听来自另一个脚本的输入 2022-01-01
- Python kivy 入口点 inflateRest2 无法定位 libpng16-16.dll 2022-01-01