我想让我的机器人发布这个服务器上所有6个通道的管脚,但是,我的机器人只从调用命令的当前通道获取管脚。我想知道有没有办法解决这个问题。Discord版本1.0.0A
我现在的代码是:
if "seepins()" == message.content.lower():
# retrieve and post all pins again
allPins = await message.channel.pins()
for i in allPins:
# Check if pin is text or a link
mat = i.attachments
if len(mat)==0:
await message.channel.send(i.content)
else:
await message.channel.send(mat[0].url)
以下代码从存在此bot的所有服务器检索用户详细信息。我想知道是否应该在第一个代码片段中使用guild而不是channel?结果这给了我一个错误。在
^{pr2}$
多亏了谢伊的评论,我才弄明白这一点。 你要做的是使用
返回所有文本频道的列表。 然后迭代每个通道,并使用
^{pr2}$它可能不是最有效的代码,但它确实起到了作用:) 最后再次迭代以重新发布该通道中的每个管脚。在
final的代码如下:
相关问题 更多 >
编程相关推荐