Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/commands/delete-and-warn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
PermissionFlagsBits,
ApplicationCommandType,
TextInputStyle,
MessageFlags,
} from "discord.js";
const { ManageMessages, ModerateMembers } = PermissionFlagsBits;
import { modalInput } from "../components.ts";
Expand All @@ -17,18 +18,18 @@ const DeleteAndWarn: MessageCommand = {
const { channel, targetMessage } = interaction;
if (!channel)
return interaction.reply({
flags: "Ephemeral",
flags: MessageFlags.Ephemeral,
content: "Error: could not fetch the channel",
});
if (channel.isDMBased())
return interaction.reply({
flags: "Ephemeral",
flags: MessageFlags.Ephemeral,
content: "Cannot use this command in DMs",
});

if (!targetMessage.deletable) {
return interaction.reply({
flags: "Ephemeral",
flags: MessageFlags.Ephemeral,
content:
"I do not have the permission to delete messages in this channel.",
});
Expand Down
3 changes: 2 additions & 1 deletion src/commands/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
type APIEmbed,
ApplicationCommandType,
channelMention,
MessageFlags,
} from "discord.js";
import type { Command } from "djs-fsrouter";

Expand All @@ -14,7 +15,7 @@ const Info: Command = {
if (!interaction.guild) {
interaction.reply({
content: "Run this command in a server to get server info",
flags: "Ephemeral",
flags: MessageFlags.Ephemeral,
});
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/commands/purge.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ApplicationCommandOptionType, PermissionFlagsBits } from "discord.js";
import { ApplicationCommandOptionType, PermissionFlagsBits, MessageFlags } from "discord.js";
const { ManageMessages } = PermissionFlagsBits;
import type { Command } from "djs-fsrouter";

Expand Down Expand Up @@ -28,7 +28,7 @@ const Purge: Command = {
const { channel } = interaction;

function reply(content: string) {
return interaction.reply({ flags: "Ephemeral", content });
return interaction.reply({ flags: MessageFlags.Ephemeral, content });
}

if (!channel) {
Expand Down
5 changes: 3 additions & 2 deletions src/listeners/delete-and-warn.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Listener } from "../types/listener.ts";
import { customId } from "../commands/delete-and-warn.ts";
import { MessageFlags } from "discord.js";

export default [
{
Expand Down Expand Up @@ -29,15 +30,15 @@ export default [
.then(() => {
interaction
.reply({
flags: "Ephemeral",
flags: MessageFlags.Ephemeral,
content: "Reason sent.",
})
.catch(console.error);
})
.catch(() => {
interaction
.reply({
flags: "Ephemeral",
flags: MessageFlags.Ephemeral,
content: `The reason could not be sent to ${target}; they proabably blocked me or disabled DMs from server members.\n\`\`\`${reason}\`\`\``,
})
.catch(console.error);
Expand Down
11 changes: 6 additions & 5 deletions src/listeners/suggestion-interaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
ModalBuilder,
TextInputStyle,
inlineCode,
MessageFlags,
} from "discord.js";
import type { Listener } from "../types/listener.ts";
import {
Expand Down Expand Up @@ -56,7 +57,7 @@ export default [
content: `You're missing the manager role and ${inlineCode(
"ManageGuild",
)} permission`,
flags: "Ephemeral",
flags: MessageFlags.Ephemeral,
});
}

Expand All @@ -66,7 +67,7 @@ export default [
) {
return interaction.reply({
content: `You're missing the ${inlineCode("ManageGuild")} permission`,
flags: "Ephemeral",
flags: MessageFlags.Ephemeral,
});
}

Expand Down Expand Up @@ -124,7 +125,7 @@ export default [
"this suggestion",
interaction.message.url,
)} to ${inlineCode(statusString.toLowerCase())}`,
flags: "Ephemeral",
flags: MessageFlags.Ephemeral,
});
},
},
Expand Down Expand Up @@ -154,7 +155,7 @@ export default [
"this",
interaction.message.url,
)} suggestion`,
flags: "Ephemeral",
flags: MessageFlags.Ephemeral,
});
} else {
await suggestion.downvote(interaction.user.id, config);
Expand All @@ -163,7 +164,7 @@ export default [
"this",
interaction.message.url,
)} suggestion`,
flags: "Ephemeral",
flags: MessageFlags.Ephemeral,
});
}
},
Expand Down