forked from SokoraDesu/Sokora
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added moderation user notes + some fixes
- Loading branch information
Showing
4 changed files
with
92 additions
and
19 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,44 @@ | ||
import { SlashCommandSubcommandBuilder, type ChatInputCommandInteraction } from "discord.js"; | ||
import { errorCheck, modEmbed } from "../../utils/embeds/modEmbed"; | ||
|
||
export default class Note { | ||
data: SlashCommandSubcommandBuilder; | ||
constructor() { | ||
this.data = new SlashCommandSubcommandBuilder() | ||
.setName("note") | ||
.setDescription("Add a note on a user.") | ||
.addUserOption(user => | ||
user.setName("user").setDescription("The user that you want to add a note on.").setRequired(true) | ||
) | ||
.addStringOption(string => | ||
string.setName("note").setDescription("The content of the user note.").setRequired(true) | ||
) | ||
.addIntegerOption(bool => | ||
bool | ||
.setName("previous_note_id") | ||
.setDescription( | ||
"If provided, will modify the user note with the given case id instead of adding a new one." | ||
) | ||
); | ||
} | ||
|
||
async run(interaction: ChatInputCommandInteraction) { | ||
const user = interaction.options.getUser("user")!; | ||
const note = interaction.options.getString("note"); | ||
const previousID = interaction.options.getInteger("previous_note_id") ?? 0; | ||
if ( | ||
await errorCheck( | ||
"ModerateMembers", | ||
{ interaction, user, action: "Annotate" }, | ||
{ allErrors: true, botError: false, ownerError: true, outsideError: true }, | ||
"Moderate Members" | ||
) | ||
) | ||
return; | ||
|
||
await modEmbed( | ||
{ interaction, user, action: "Annotated", dm: false, dbAction: "NOTE", previousID: previousID }, | ||
note | ||
); | ||
} | ||
} |
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