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

Channel Archiver #304

Merged
merged 8 commits into from
Jul 3, 2024
Merged

Channel Archiver #304

merged 8 commits into from
Jul 3, 2024

Conversation

zuuring
Copy link
Member

@zuuring zuuring commented Apr 10, 2024

Notes

This adds two new commands: /archive-channel and /unarchive-channel to be used for starting only in defense channels. This will move the channel into a new category "archived channels" and lock it into ViewMessages: true mode for the groups that have access to it already. The channel can be unarchived by running /unarchive-channel and that will then move the channel back to the defense category

Saving a transcript

In addition to moving/locking the channel to archived-channels, we also save a transcript of all the messages in the channel, outputted as a temp .txt file. File is deleted after being added to discord file-attachments.
Screenshot 2024-05-15 at 11 38 50

Future ideas

  • For getting this working across an entire discord server, we would have to setup some wiring to account for moving the channel back to the right category, this could be based on project-channelname style routing. Something to discuss

### Notes
This WIP PR focuses on building a channel archiver function into Valkyrie. So that you can easily dump channel logs from a specific channel at point of archive.

Due to Discord APIs message rate limit of 100 messages, we run a loop depending on the total number of messages in the channel, then combine into a file which is sent back to the channel.

### WIP
This is just the initial test setup of this, some things we need to add still are:

- Better storage for the archival message file (dotenv is temp)
- Message headers specifying date of archive, channel name, etc
- Permission flags, access to archive
- Introduction of a command, valkyrie interface, etc
Adds the feature so that when the archival command is run (!archive placeholder for now), move and lock the channel into a `archived-channels` category. Still WIP.

Note: Needs extended permission flags for bot to be enabled `Administrator, Manage Channels, Manage Guild`
@zuuring
Copy link
Member Author

zuuring commented Apr 19, 2024

@Shadowfiend This has got now the ability to move channel into an archive-channels category. Now we have to decide how we want to handle the usability of this to unarchive, since in-order to do that we need to store channel category history. Or alternatively, run via command /unarchive <category-name> specify where the unarchived channel should live in.

Just for viewing the audit logs and what's going on for channelUpdate events in the discord audit logs.
This commit removes the file transcript on the archiver script and also setups up the proper /unarchive /archive commands.
@zuuring zuuring marked this pull request as ready for review April 29, 2024 10:17
@zuuring
Copy link
Member Author

zuuring commented May 15, 2024

@Shadowfiend Resurfacing this one since it seems like there is a need atm for saving a transcript easily of channels to be archived. We could alternatively also branch this transcript out into it's own command, something like /save-transcript.

Copy link
Contributor

@Shadowfiend Shadowfiend left a comment

Choose a reason for hiding this comment

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

Two small blockers.

This resolves the issue with running archiver on specific channel category. Now it can only be run within the channels defined in `defenseArchiveCategoryName` and `defenseCategoryName`
@zuuring zuuring requested a review from Shadowfiend July 3, 2024 10:50
@zuuring
Copy link
Member Author

zuuring commented Jul 3, 2024

@Shadowfiend We should be good now! I added two new definitions for defense channel categories defenseCategoryName and defenseArchiveCategoryName we can change when needed. Now those commands are restricted to only run in those specific categories.

Copy link
Contributor

@Shadowfiend Shadowfiend 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 to me, let's see how it does in practice!

@Shadowfiend Shadowfiend merged commit 4f4e62d into main Jul 3, 2024
7 checks passed
@Shadowfiend Shadowfiend deleted the channel-archiver branch July 3, 2024 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants