Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check Permissions for Approval #2

Open
zsarge opened this issue Oct 1, 2024 · 0 comments
Open

Check Permissions for Approval #2

zsarge opened this issue Oct 1, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@zsarge
Copy link
Member

zsarge commented Oct 1, 2024

I thought I was checking the permissions before approving a piece of media; I guess not

@commands.Cog.listener()
async def on_raw_reaction_add(self, reaction: RawReactionActionEvent):
"""Approve or deny submissions by reacting to their associated bot message"""
if reaction.user_id == self.bot.user.id:
return # ignore the bot
submission = (
self.session.query(Submission)
.filter_by(discord_approval_message_id=reaction.message_id)
.one_or_none()
)
if not submission:
self.log.info(
f"Could not find submission reacting to {reaction.message_id}"
)
return
thread = self.bot.get_channel(submission.discord_thread_id)
reviewer = self.bot.get_user(reaction.user_id)
assert reviewer is not None
emoji = reaction.emoji.name
if emoji == NIoTBot.APPROVAL_EMOJI:
await thread.send(f"Approved by {reviewer.mention}.")
approval = True

@zsarge zsarge added the bug Something isn't working label Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant