Python 文本检测Discord.py PRAW

Python 文本检测Discord.py PRAW,python,discord.py,praw,Python,Discord.py,Praw,这是我的代码,当检测到它时,它会发布文本帖子。但事实并非如此。它不是给我一个错误,而是一个图像,而不是一个文本。第一个(if len(submission.text==0)如果检测到,应该发布一篇文本文章,另一个(else)如果没有任何文本,应该发布一篇普通的图像文章。但是文本不起作用。没有一个错误,我需要你们的帮助!if len(submission.selftext)==0:不应该用于图像帖子,因为它们没有selftext。如果不提交,请尝试。is_self:。尽管我很困惑,因为你说图像帖子

这是我的代码,当检测到它时,它会发布文本帖子。但事实并非如此。它不是给我一个错误,而是一个图像,而不是一个文本。第一个(
if len(submission.text==0
)如果检测到,应该发布一篇文本文章,另一个(
else
)如果没有任何文本,应该发布一篇普通的图像文章。但是文本不起作用。没有一个错误,我需要你们的帮助!

if len(submission.selftext)==0:
不应该用于图像帖子,因为它们没有
selftext
。如果不提交,请尝试
。is_self:
。尽管我很困惑,因为你说图像帖子有效,而自我帖子无效。这很有效。谢谢!
如果len(submission.selftext)==0:
不应该对图片帖子起作用,因为它们没有
selftext
。如果没有提交,请尝试
。self:
。尽管我很困惑,因为你说图片帖子起作用,而self帖子不起作用。这起作用了。谢谢!
@client.command(aliases=["h"])  # this is what the command will be in discord
async def letterh(ctx):
    async with ctx.channel.typing():
        memes_submissions = reddit.subreddit("theletterh").hot()
        post_to_pick = random.randint(1, 10)
        for i in range(0, post_to_pick):
            submission = memes_submissions.__next__()
        if len(submission.selftext) == 0:
            embed = discord.Embed(
                title=submission.title,
                color=discord.Colour.purple()
            )
            embed.set_image(url=submission.url)
            embed.add_field(name="Author", value="u/" + submission.author.name, )
            embed.add_field(name="View Online", value=f"[Link]({submission.url})", )
            embed.add_field(name="Subreddit", value="r/TheLetterH", )
        else:
            embed = discord.Embed(
                title=submission.title,
                description=submission.selftext,
                color=discord.Colour.purple()
            )
            embed.add_field(name="Author", value="u/" + submission.author.name, )
            embed.add_field(name="View Online", value=f"[Link]({submission.url})", )
            embed.add_field(name="Subreddit", value="r/TheLetterH", )
    await ctx.send(embed=embed)