Some cleanup again
This commit is contained in:
parent
e89e674aa2
commit
0600f13511
|
@ -54,7 +54,7 @@ export async function execute(interaction: ChatInputCommandInteraction) {
|
||||||
// TODO: This all works as intended, but I'd like for it so be a reusable function
|
// TODO: This all works as intended, but I'd like for it so be a reusable function
|
||||||
// instead because all of this is used in src/main.ts
|
// instead because all of this is used in src/main.ts
|
||||||
const { id: guildId } = interaction.guild!;
|
const { id: guildId } = interaction.guild!;
|
||||||
const { id: userId } = interaction.user;
|
const { id: userId, displayName: userName } = interaction.user;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// If the user is banned in this guild, don't let them post
|
// If the user is banned in this guild, don't let them post
|
||||||
|
@ -74,7 +74,7 @@ export async function execute(interaction: ChatInputCommandInteraction) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const confessChannel = dt.getGuildInfo(guildId)?.settings.confessChannel;
|
const confessChannel = dt.getGuildInfo(guildId)!.settings.confessChannel;
|
||||||
const adminChannel = dt.getGuildInfo(guildId)?.settings.modChannel;
|
const adminChannel = dt.getGuildInfo(guildId)?.settings.modChannel;
|
||||||
|
|
||||||
const messageContent = `"${interaction.options.getString("message")}"`;
|
const messageContent = `"${interaction.options.getString("message")}"`;
|
||||||
|
@ -163,8 +163,8 @@ export async function execute(interaction: ChatInputCommandInteraction) {
|
||||||
dt.addConfession(
|
dt.addConfession(
|
||||||
message,
|
message,
|
||||||
messageId,
|
messageId,
|
||||||
interaction.user.displayName,
|
userName,
|
||||||
interaction.user.id,
|
userId,
|
||||||
messageContent,
|
messageContent,
|
||||||
attachment
|
attachment
|
||||||
);
|
);
|
||||||
|
@ -173,14 +173,18 @@ export async function execute(interaction: ChatInputCommandInteraction) {
|
||||||
|
|
||||||
// If there are 2 or more confessions, remove the previous confession's button components
|
// If there are 2 or more confessions, remove the previous confession's button components
|
||||||
if (confessionsLength >= 2) {
|
if (confessionsLength >= 2) {
|
||||||
await (
|
(BotClient.channels.cache.get(confessChannel) as TextChannel).messages
|
||||||
BotClient.channels.cache.get(confessChannel!) as TextChannel
|
|
||||||
).messages
|
|
||||||
.fetch(
|
.fetch(
|
||||||
dt.getGuildInfo(guildId)!.confessions[confessionsLength - 2].messageId
|
dt.getGuildInfo(guildId)!.confessions[confessionsLength - 2].messageId
|
||||||
)
|
)
|
||||||
.then(message => {
|
.then(message => {
|
||||||
message.edit({ components: [] });
|
message.edit({ components: [] });
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
logger.error(
|
||||||
|
"An error occured removing embeds from the previous message:",
|
||||||
|
err
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,10 @@ export async function execute(interaction: ChatInputCommandInteraction) {
|
||||||
}
|
}
|
||||||
// /confessmod pardon <id>
|
// /confessmod pardon <id>
|
||||||
} else if (interaction.options.getSubcommand() === "pardon") {
|
} else if (interaction.options.getSubcommand() === "pardon") {
|
||||||
const result = dt.removeBanById(guildId, interaction.options.getString("id")!);
|
const result = dt.removeBanById(
|
||||||
|
guildId,
|
||||||
|
interaction.options.getString("id")!
|
||||||
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return result
|
return result
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
export const messageOpts = {
|
export const messageOpts = {
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
}
|
};
|
||||||
|
|
Loading…
Reference in a new issue