标题说明了一切...我想在公会中获取指定名称的频道 id,但我在文档中找不到任何可以让我这样做的内容。看看像Mee6这样更发达的机器人,它们可以选择连接到您的服务器并为您的任何文本频道设置欢迎页面。我尝试过类似的事情:
channels = discord.utils.get(client.get_all_channels(), guild__name='Test Server'
Run Code Online (Sandbox Code Playgroud)
但这只返回“文本通道”而没有其他内容。
我有一个错误在我的不和谐机器人目前,当有人在命令使用引号,我得到以下错误:discord.ext.commands.errors.ExpectedClosingQuoteError: Expected closing ".看起来这是一个开放的bugdiscord.py根据这个bug报告,以及该代码中discord.py。这是问题有点烦人,我想知道目前是否有任何解决方案。到目前为止,这是我的代码:
@bot.command()
async def f(ctx, *args):
hearts = (':heart:', ':orange_heart:', ':yellow_heart:', ':green_heart:', ':blue_heart:', ':purple_heart:')
if not args:
response = '**{0}** has paid their respects {1}'.format(ctx.author.name,
hearts[random.randint(0, len(hearts) - 1)])
else:
response = '**{0}** has paid their respects {1} {2}'.format(ctx.author.name, ' '.join(args),
hearts[random.randint(0, len(hearts) - 1)])
Run Code Online (Sandbox Code Playgroud)
当用户通过输入!f "The thingDiscord调用此函数时,我会得到上面提到的命令。无论如何我有可能解决这个问题吗?我认为这是不可能的,因为从参数传递到函数的那一刻起,就会抛出错误。我想我可以编辑discord.py来解决这个问题,但它可能会破坏我机器人的其他区域。当 iOS 用户使用键盘上的引号并键入类似!f Josh's face. 有没有办法让所有的引号都通过这个函数成功传递?
谢谢!