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

Better reaction-based quick actions #91

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Zahariel
Copy link
Contributor

@Zahariel Zahariel commented Jan 16, 2024

High-five now works almost anywhere a puzzle channel is mentioned

Add "leaves" reaction to puzzle solved messages to leave the puzzle (fixes #66)

Messages in puzzle-announcements now include the round name (fixes #87)

Copy link
Owner

@gwillen gwillen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good (see minor comments) -- is it tested and otherwise ready-to-merge?

@rhendric, are you cool with rebasing #81 on top of this?

target_channel = message.channel_mentions[0]
await self.add_user_to_puzzle(payload.member, target_channel.name)
# we're ok with this working anywhere for any reason if anyone ever mentions a puzzle channel
if len(message.raw_channel_mentions) > 0:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does raw_channel_mentions in fact work for what we need here, for both regular and DM messages? (I saw in ryan's PR that regular channel_mentions did not.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it does. All channel_mentions does is map message.guild.get_channel over raw_channel_mentions, but if message is a DM, that doesn't work because it doesn't have a guild. So I'm doing it myself.

def post_local_and_global(local_channel, local_message, global_message):
logging.warning("tasks: post_local_and_global(%s, %s, %s)", local_channel, local_message, global_message)
def post_local_and_global(local_channel, local_message, global_message, local_reaction=None, global_reaction=None):
logging.warning("tasks: post_local_and_global(%s, %s, %s, %s)", local_channel, local_message, global_message, local_reaction, global_reaction)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You missed a %s there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blast, I originally only included one reaction and added the 2nd one later when I realized that I was sometimes going to want it in global but not local. Will fix.

@Zahariel
Copy link
Contributor Author

Yes, it's fully tested and ready to go (now, I fixed a bug).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants