我正在尝试在discord.py bot中发出命令,将附加的图像或视频发送到reddit中的帖子。 但是,当一篇文章带有图片时,一切都很好。。。当文章包含视频时,结果如下:
现在我有这个:
@client.command()
async def meme(ctx):
subreddits = ['memesITA','yesyesyesyesno','nonononoyes','technicallythetruth','WatchPeopleDieInside','Wellthatsucks','hmmm']
probs = [1,2,3,4,5,6,7,8,9,10]
choice = random.choice(subreddits)
choice_num = random.choice(probs)
count = 0
new_messages = choice.new(limit=10)
for post in new_messages:
if count == choice_num:
img_url = post.url
title = post.title
em = discord.Embed(title=title)
em.set_image(url=img_url)
await ctx.send(embed=em)
break
count = count + 1
没有回溯,因为我没有收到任何错误
Discord的API不允许在嵌入中使用自定义视频,如this other question所示。只要看看函数名,它是
set_image
。如果你想把视频放在那里,也许把它转换成gif就行了相关问题 更多 >
编程相关推荐