I'm currently making a reaction role configuration for my Discord.py bot, and I came across an issue trying to blacklist users from picking up roles. Here is my code:
cursor.execute(f"SELECT blacklists FROM reactionroles WHERE message_id = {payload.message_id} AND emojis = '{reaction}'") blacklist_result = cursor.fetchone() member = payload.member rolesUserHas = member.roles rolesIDuserHas = [] for role in rolesUserHas: rolesIDuserHas.append(role.id) print(rolesIDuserHas) if any(item in blacklist_result for item in rolesIDuserHas): await member.send(f'{x_mark} You are blacklisted from picking up roles from that message.') return else: pass However when I give myself a blacklisted role, it doesn't cancel or dm me, it just continues the process, as if it thinks I don't have the role. No errors are given, and I don't know why this is happening.
https://stackoverflow.com/questions/65526503/discord-py-check-if-user-has-role-id-from-list-not-working January 01, 2021 at 08:23AM
没有评论:
发表评论