如何使用discord.py检查默认的个人资料图片? [英] How do I check for a default profile pic with discord.py?
本文介绍了如何使用discord.py检查默认的个人资料图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果发件人具有默认的个人资料图片,我目前正试图找到一种方法来阻止我的机器人上的命令,我该如何编码?
I’m currently trying to find a way to block commands on my bot if the sender has a default profile picture, how would I code this?
推荐答案
我认为这等同于检查 default_avatar_url
.我们可以很容易地将其打包为检查:
I believe that this is equivalent to checking if the avatar_url
equals default_avatar_url
for the author. We can package that in a check pretty easily:
has_avatar = commands.check(lambda ctx: ctx.avatar_url != ctx.author.default_avatar_url)
@has_avatar
@bot.command()
def some_command(ctx):
await cts.send("You have set your avatar")
这篇关于如何使用discord.py检查默认的个人资料图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文