可以关闭门票频道
我正在使用discord.ext.slash为我的票务机器人创建一个密切的斜杠命令,这不会关闭我认为应该应该的频道。谢谢!
@client.slash_cmd()
async def close(ctx: slash.Context):
"""Closes the ticket"""
await ctx.delete()
编辑: 运行此命令时,我会得到
File "/home/runner/Ticket-Bot/venv/lib/python3.8/site-packages/discord/ext/slash/__init__.py", line 1371, in on_interaction_create
raise commands.CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NotFound: 404 Not Found (error code: 10015): Unknown Webhook
,然后尝试使用ctx.channel.delete()而不是ctx.delete()时,我得到了
Traceback (most recent call last):
File "/home/runner/Ticket-Bot/venv/lib/python3.8/site-packages/discord/ext/slash/__init__.py", line 1371, in on_interaction_create
raise commands.CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Object' object has no attribute 'delete'
I'm using discord.ext.slash to create a close slash command for my ticket bot and this won't close the channel which I think it should. Thanks!
@client.slash_cmd()
async def close(ctx: slash.Context):
"""Closes the ticket"""
await ctx.delete()
Edit:
When running this command, I get
File "/home/runner/Ticket-Bot/venv/lib/python3.8/site-packages/discord/ext/slash/__init__.py", line 1371, in on_interaction_create
raise commands.CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NotFound: 404 Not Found (error code: 10015): Unknown Webhook
And then when I try to use ctx.channel.delete() instead of ctx.delete(), I get
Traceback (most recent call last):
File "/home/runner/Ticket-Bot/venv/lib/python3.8/site-packages/discord/ext/slash/__init__.py", line 1371, in on_interaction_create
raise commands.CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Object' object has no attribute 'delete'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决。我刚刚使该机器人在频道中发送消息,然后使用
on_message
来关注该消息,然后关闭频道。我知道这不是这样做的专业方式,但它是有效的。Resolved. I Just made the bot send a message in the channel and then used
on_message
to watch for that message and then close the channel. I know it's not a professional way to do this but it works so.