-
Notifications
You must be signed in to change notification settings - Fork 5
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
Defense channels and rolemapping #301
Conversation
### Notes This adds an additional feature to the new audit channel flow. Once an `ext-name-audit` channel is setup, now you can make an `int-name-audit` channel, which will perform these steps: 1. Setup a new role `Defense Internal: Name` 2. Generate an invite for the `int-name-audit` channel 3. Check if a matching `ext-name-audit` channel exists, if so assign `ViewChannel` permission to `Defense Internal: name` role.
This is still a work in progress just testing out the ability of assigning a role to an invite based of the uses it has.
Rewrite some of the checks and counts in-order to correctly match the role. The previous method was breaking on different format channels such as `ext-thesis-test-audit`
Moves `listInvites` into it's own function for easier calls
Refactor the `guildMemberAdd` event to resolve lint expression errors and make sure channel name is found correctly based on ext, int patterns
Resolves the issue that would fail to assign internal roles to external channel if the channel name had the format `ext-client-name-audit` vs `ext-clientname-audit`
This fixes the bug happening on invites not counting correctly if they were being used more than 2 times on certain edge cases.
This is still WIP but adds the `defense-audit` command with the parameter `client-name` to automatically build `int-clientname-audit` and `ext-clientname-audit` channels with two roles `Defense Internal: ClientName` and `Defense External: ClientName`. Can only be run from the `defense` category
This commit makes it so the `defense-audit` command can only be run within the `defense` parent category of channels and will send a reply if it isn't working as it should. Also adds an `interaction.editReply` inorder to avoid any timeout issues happening
Removes the debug loggers from the scripts, not needed anymore!
Question here: can we kill the embeds in the intro message? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a handful of questions & comments.
This commit adds a number of changes to the audit channel flow. mainly: - Update permissions if channel already exists - Check if role already exists, if so skip - Changed logic so that if audit channels already exist, we output a different message to interaction - Remove embeds by wrapping invite URL in quotes. - Change verbiage around messages - Separates InternalChannel and externalChannel - Changed invite code permission match
@Shadowfiend Just pushed an update to this with fixes to the review comments as following:
Now one thing that came up, turns out Discord channel categories have a limit of max (50) channels per category. Should we maybe setup an "Audit" category or even (not ideal) a channel category on a per client basis? |
Lawd. I think we can hold for now, as I don't think we're going to have 20 audits going in parallel, and older audits will get archived. Making them their own category is a good idea though and we can discuss with Defense once we've got the basics working here. |
This commit switches over from discordjs `Collection` in favour of storing invites as an object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think I'm going to hold this up on the remaining remarks—it's close though!
This commit does some refactoring based off review feedback (thank you!) as well as making sure the invite uses / expiry date is listed properly.
@Shadowfiend Just pushed an update on this with the fixes based on your review! I also added a way to show expiry date using Discord's built in time rendering. That way we get a nice hover event when going over the expiry time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good, let's
Notes
This adds a new discord command
defense-audit
which has one parameterclient-name
which will then perform the following steps:int-clientname-audit
andext-clientname-audit
Defense Internal: clientname
andDefense Extenal: clientname
ViewChannel
access to both channels forDefense Internal: *
and onlyext-*-audit
channel access toDefense Extenal
Screenshot
Automatic role assignment
Also included in this PR is automatic role assignment based of the invite code used. Due to lack of IDs associated to
GuildMemberAdd
events when a new user joins discord, the only way to tie a discord user to an invite link is to count invite code uses within the guild and compare it once a new member has joined the discord. For this to work, we check the invites and match role assignment to channel.name the invite link was generated from.To-do
defense-audit
commandint-client-name-audit
channels not finding correct role forext-client-name-audit
channels