Repository navigation
feat: repel now keeps messages deleted by logging them into a moderator channel + refactor to repel #168
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
Merged
Merged
feat: repel now keeps messages deleted by logging them into a moderator channel + refactor to repel #168
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
b2d57b3
feat: add mass message deletion logs to repels
michal-skraburski 202df74
fix: move deletion embeds into spam-detection channel for clean log s…
michal-skraburski d6ddd82
fix: move features/moderation -> /repel and refactor
michal-skraburski 31c9a5c
fix: double isUserInServer check
michal-skraburski 4ea147a
feat:rework the tri-embed into two embeds one channel
michal-skraburski 095dcf3
fix: broken lookback echoing messages
michal-skraburski adda905
fix: revert back to tri-embed display
michal-skraburski 125d78a
feat: disable the buttons when a moderator interacts with them
michal-skraburski a07ac8d
Update src/features/ban-buttons/ban-command-buttons.ts
michal-skraburski 6c5b83d
feat: update colours on embeds
michal-skraburski 109a154
Update src/features/repel/embeds.ts
michal-skraburski 3edd0cf
Update src/features/repel/embeds.ts
michal-skraburski 3b00948
Update src/features/repel/repel.ts
michal-skraburski 6d2e0a7
Update src/features/repel/repel.ts
michal-skraburski 339c8c1
fix: broken auth and logic
michal-skraburski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| import { | ||
| channelMention, | ||
| Colors, | ||
| EmbedBuilder, | ||
| type GuildMember, | ||
| type User, | ||
| userMention, | ||
| } from 'discord.js'; | ||
| import { timeToString } from '@/constants/time.js'; | ||
| import { | ||
| buildDeletedMessagesDescription, | ||
| type DeletedMessageSnapshot, | ||
| } from './util.js'; | ||
|
|
||
| export const buildCommandEmbed = ({ | ||
| member, | ||
| channelInfo, | ||
| commandString, | ||
| }: { | ||
| member: GuildMember; | ||
| channelInfo: string; | ||
| commandString: string; | ||
| }): EmbedBuilder => | ||
| new EmbedBuilder() | ||
| .setAuthor({ | ||
| name: member.user.tag, | ||
| iconURL: member.user.displayAvatarURL(), | ||
| }) | ||
| .setDescription( | ||
| `Used \`repel\` command in ${channelInfo}.\n${commandString}` | ||
| ) | ||
| .setColor(Colors.Green); | ||
|
|
||
| export const buildFailedChannelsEmbed = ( | ||
| failedChannels: string[] | ||
| ): EmbedBuilder => | ||
| new EmbedBuilder() | ||
| .setTitle('Failed to delete messages in the following channels:') | ||
| .setDescription(failedChannels.map((id) => channelMention(id)).join('\n')) | ||
| .setColor(Colors.Red) | ||
| .setTimestamp(); | ||
|
|
||
| export const buildResultEmbed = (context: { | ||
| target: User | GuildMember; | ||
| member: GuildMember; | ||
| reason: string; | ||
| duration?: number; | ||
| shouldSendDm: boolean; | ||
| dmSent: boolean; | ||
| }): EmbedBuilder => { | ||
| const footerParts = [ | ||
| context.duration | ||
| ? `Timeout: ${timeToString(context.duration)}` | ||
| : 'No timeout', | ||
| ]; | ||
| if (context.shouldSendDm) { | ||
| footerParts.push(context.dmSent ? 'DM sent' : 'DM sent error'); | ||
| } | ||
|
|
||
| return new EmbedBuilder() | ||
| .setTitle('Repel') | ||
| .addFields( | ||
| { | ||
| name: 'Repelled User', | ||
| value: userMention(context.target.id), | ||
| inline: true, | ||
| }, | ||
| { | ||
| name: 'Repelled By', | ||
| value: userMention(context.member.id), | ||
| inline: true, | ||
| }, | ||
| { | ||
| name: 'Reason', | ||
| value: context.reason, | ||
| inline: true, | ||
| } | ||
| ) | ||
| .setColor(Colors.Orange) | ||
| .setFooter({ text: footerParts.join(' • ') }); | ||
| }; | ||
|
|
||
| export const buildDeletedMessagesEmbed = ( | ||
| deletedMessages: DeletedMessageSnapshot[] | ||
| ): EmbedBuilder => | ||
| new EmbedBuilder() | ||
| .setTitle('Deleted Messages') | ||
| .setDescription(buildDeletedMessagesDescription(deletedMessages)) | ||
| .setColor(Colors.Red) | ||
| .setTimestamp(); | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.