-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
get around invite link automod limitations
- Loading branch information
alyssa
committed
Jan 1, 2025
1 parent
645544e
commit b825982
Showing
5 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 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,31 @@ | ||
import { Context } from '..'; | ||
import config from '../config'; | ||
|
||
let sorryMessage = (id: string) => `<@${id}> | ||
sorry, discord's automoderation feature doesn't let us allow specific invite links. | ||
below is a copy of your message that included an allowed invite link (you can delete with ❌reaction). | ||
sorry, this isn't able to repost images yet | ||
`; | ||
|
||
export default async (evt: any, ctx: Context) => { | ||
if (evt.action.type != 3) return; | ||
let split = evt.matched_content.split("/"); | ||
let invite = split[split.length - 1]; | ||
if (config.allowedInvites.includes(invite)) { | ||
await ctx.rest.request({ | ||
body: { communication_disabled_until: null }, | ||
headers: { 'x-audit-log-reason': 'this invite link is allowed' }, | ||
route: { | ||
method: 'PATCH', | ||
path: '/guilds/:guildId/members/:userId', | ||
params: { guildId: evt.guild_id, userId: evt.user_id, }, | ||
} | ||
}); | ||
let sentMessage = await ctx.rest.createMessage(evt.channel_id, { | ||
content: sorryMessage(evt.user_id), | ||
embeds: [{ description: evt.content }], | ||
}); | ||
await ctx.db.level.put(`replymsg:${sentMessage.id}`, evt.user_id); | ||
await ctx.rest.createMessage("847022163982548992", "^ the above message contained an allowed invite link and was reposted"); | ||
} | ||
} |
This file contains 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 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 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