我需要我的Discorde机器人来判断斜杠命令是否在线程中执行.在discord.py文档https://discordpy.readthedocs.io/en/stable/api.html中找不到任何相关内容,在Stackoverflow或其他任何地方也没有相关信息:(
我基本上需要类似于is_thread()
个函数的东西.如果有可能的话.谢谢你的帮助.
我需要我的Discorde机器人来判断斜杠命令是否在线程中执行.在discord.py文档https://discordpy.readthedocs.io/en/stable/api.html中找不到任何相关内容,在Stackoverflow或其他任何地方也没有相关信息:(
我基本上需要类似于is_thread()
个函数的东西.如果有可能的话.谢谢你的帮助.
您正在寻找的最有可能是ctx.channel.type
,它将告诉您执行命令的通道类型.您的问题的可能解决方案如下所示:
async def creativeName(ctx):
if ctx.channel.type == "public_thread" or "private_thread":
# Code to execute if it is in a thread goes here
else:
# Code, if any, to execute if it is not in a thread