Python 3.x 在discord.py中获取附加图像的高度

Python 3.x 在discord.py中获取附加图像的高度,python-3.x,discord,discord.py,Python 3.x,Discord,Discord.py,我想在discord.py中获取附加到邮件的图像的高度。这是我的密码: if message.content(discord.Attachment.height > 0): await message.channel.send('Your media file is restricted!') 运行时,它会显示以下错误: error: TypeError: '>' not supported between instances of 'member_descriptor' an

我想在discord.py中获取附加到邮件的图像的高度。这是我的密码:

if message.content(discord.Attachment.height > 0):
  await message.channel.send('Your media file is restricted!')
运行时,它会显示以下错误:

error: TypeError: '>' not supported between instances of 'member_descriptor' and 'int'

discord.Attachment.height
是对象
discord.Attachment
成员的
height
描述符。这不涉及任何特定对象,因此需要获取特定消息上特定附件的
height
属性

要获取邮件附件的高度,请执行以下操作:

  • 使用获取邮件上的附件列表。这将是类型为的对象列表。请注意,如果没有附件,此列表将为空

  • 获取特定附件的高度。例如,如果邮件有一个附件,您可以使用:

  • 请注意,“高度”属性仅适用于图像和视频。您可能需要使用
    discord.Attachment的
    filename
    成员检查文件类型是否正确

    message.attachments[0].height