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

Add !archive message command #458

Open
wants to merge 1 commit into
base: live
Choose a base branch
from
Open

Conversation

JJRcop
Copy link
Contributor

@JJRcop JJRcop commented Jan 20, 2025

This command takes up to two messages and archives any messages between them

If provided with one message it archives that one

kuva

Uses PartialMessage instead of Message for argument conversion, so you can archive deleted messages if you still have the link. This also means that without a full message link including Channel ID the command may archive incorrect messages from the current channel.

Notices have been set up to inform about this.

What does this PR add/fix/improve/...
You can now archive specific messages or a range of messages.

Migration
No migration required however some translations need to be created for a couple of new tokens

Dependencies
None

This command takes up to two messages and archives any messages between
them

If provided with one message it archives that one

Uses PartialMessage instead of Message for argument conversion, so you
can archive deleted messages if you still have the link. This also means
that without a full message link including Channel ID the command may
archive incorrect messages from the current channel.

Notices have been set up to inform about this.
@JJRcop
Copy link
Contributor Author

JJRcop commented Jan 20, 2025

Feedback welcome on using PartialMessages. I did it for speed so the bot doesn't need to fetch the messages before getting on with the archiving, however this does mean since they are partials they are not verified to be in the right channel if a channel ID is not included.

This is safe, the worst case is some messages posted around the same time from the current channel are archived instead, as that's what the PartialMessage converter does.

A side-effect is you can use links to deleted messages and archive those.

I could make a custom converter extending PartialMessageConverter to reject arguments without channel IDs.

@JJRcop
Copy link
Contributor Author

JJRcop commented Jan 20, 2025

I could make a custom converter extending PartialMessageConverter to reject arguments without channel IDs.

I've done this here: 3162fc4

But I don't want to add it to the PR just yet because I am happy the way it is now, just made that to expand the available options.

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.

1 participant