8000 Listening party tracking by Philonous · Pull Request #3 · etwyniel/humble-ledger · GitHub
[go: up one dir, main page]

Skip to content

Listening party tracking - #3

Merged
etwyniel merged 13 commits into
etwyniel:masterfrom
Philonous:lp
Feb 18, 2024
Merged

etwyniel merged 13 commits into
etwyniel:masterfrom
Philonous:lp

Conversation

@Philonous
@Philonous Philonous commented Jan 21, 2024 •
Copy link
Copy Markdown
Contributor

I've opened a PR to track the development of this

This draft is not done, please do not merge.
This should now be mergeable

@etwyniel etwyniel left a comment
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Initial review

Comment thread src/lp.rs Resolved
Comment thread src/lp.rs Resolved
Comment thread src/lp.rs Resolved
Comment thread src/lp.rs Outdated
Comment on lines +333 to +336
const LP_ROLES: &'static [u64] = &[
1198354637137391709, // `@Listening Party`` in test guild
// TODO: Make this configurable? Fetch via name?
];
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The Lp module in serenity-command-handler defines a role_id guild field, could use that for consistency (it can be defined here too without risk of conflicts)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was thinking about this - the roles should ideally work both in test instances and on the deployed instance, perhaps they should be fetched by name when we connect to the guild, if that's possible?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The way I've come up with now is to keep taking the role ID from the message (essentially free since they are provided by serenity anyway) and dynamically resolve them to their name via to_role_cached. This should be "cheap enough" since the request is cached and it only happens on role mentions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmm, maybe it should get the role from this: https://github.com/etwyniel/discord_framework/blob/f26138393edb495b7d951129f13cd04350a86c5a/serenity-command-handler/src/modules/lp.rs#L349-L376

However, this only seems to be a single role for listening parties that the LP module uses to ping.

Comment thread src/lp.rs Resolved
Comment thread src/lp.rs Resolved
Comment thread src/lp.rs Resolved
Comment thread src/lp.rs Resolved
Comment thread src/main.rs Outdated

let conn = Connection::open("humble_ledger.sqlite")?;
let polls = ModPoll::new("✅", "❎", "▶️", None, "<a:crabrave:996854529742094417>");
let polls = ModPoll::new("✅", "❎", "▶️", None, "<a:crabrave:996854529742094417>", lp.clone() );
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I wonder if we could implement some kind of event system in Handler, instead of explicitly connecting modules.

@Philonous Philonous Jan 24, 2024 •
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is the big ugly. I just hacked together the dumbest thing I could think of to make it work.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've implemented this now, and it relies on etwyniel/discord_framework#2

Comment thread src/lp_info.rs Resolved
Comment thread src/lp_info.rs Resolved
@Philonous
Copy link
Copy Markdown
Contributor Author

I've rebased this PR so it doesn't pull in the changes from #2

@Philonous
Philonous marked this pull request as ready for review February 17, 2024 21:47
@etwyniel
etwyniel merged commit 317bb6b into etwyniel:master Feb 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0