Cast some nets

This commit is contained in:
powermaker450 2024-10-12 18:50:34 -04:00
parent 256956df73
commit 9da9926fac
5 changed files with 189 additions and 155 deletions

View file

@ -26,6 +26,9 @@ import { BotClient } from "../bot";
import { dt } from "../main"; import { dt } from "../main";
import { StoreMan } from "../storeman"; import { StoreMan } from "../storeman";
import getRandomColor from "../utils/getRandomColor"; import getRandomColor from "../utils/getRandomColor";
import Logger from "../utils/Logger";
const logger = new Logger("(/) confess");
export const data = new SlashCommandBuilder() export const data = new SlashCommandBuilder()
.setName("confess") .setName("confess")
@ -38,6 +41,7 @@ export const data = new SlashCommandBuilder()
); );
export async function execute(interaction: CommandInteraction) { export async function execute(interaction: CommandInteraction) {
try {
if (dt.isBanned(interaction.guild?.id!, interaction.user.id)) { if (dt.isBanned(interaction.guild?.id!, interaction.user.id)) {
return interaction.reply({ return interaction.reply({
content: "You are banned from confessions in this server!", content: "You are banned from confessions in this server!",
@ -102,4 +106,7 @@ export async function execute(interaction: CommandInteraction) {
content: "Confession sent!", content: "Confession sent!",
ephemeral: true, ephemeral: true,
}); });
} catch (err) {
logger.error("An error occured:", err);
}
} }

View file

@ -18,6 +18,9 @@
import { CommandInteraction, PermissionFlagsBits, SlashCommandBuilder } from "discord.js"; import { CommandInteraction, PermissionFlagsBits, SlashCommandBuilder } from "discord.js";
import { dt } from "../main"; import { dt } from "../main";
import Logger from "../utils/Logger";
const logger = new Logger("(/) confessban");
export const data = new SlashCommandBuilder() export const data = new SlashCommandBuilder()
.setName("confessban") .setName("confessban")
@ -37,6 +40,7 @@ export async function execute(interaction: CommandInteraction) {
interaction.options.getString("id") interaction.options.getString("id")
); );
try {
return result return result
? interaction.reply({ ? interaction.reply({
content: "User was banned.", content: "User was banned.",
@ -46,4 +50,7 @@ export async function execute(interaction: CommandInteraction) {
content: "No confession with that ID was found.", content: "No confession with that ID was found.",
ephemeral: true ephemeral: true
}); });
} catch (err) {
logger.error("An error occured:", err);
}
} }

View file

@ -20,6 +20,9 @@ import { CommandInteraction, EmbedBuilder, SlashCommandBuilder, TextChannel } fr
import { dt } from "../main"; import { dt } from "../main";
import { BotClient } from "../bot"; import { BotClient } from "../bot";
import getRandomColor from "../utils/getRandomColor"; import getRandomColor from "../utils/getRandomColor";
import Logger from "../utils/Logger";
const logger = new Logger("(/) confessdel");
export const data = new SlashCommandBuilder() export const data = new SlashCommandBuilder()
.setName("confessdel") .setName("confessdel")
@ -45,6 +48,7 @@ export async function execute(interaction: CommandInteraction) {
const result = dt.getConfession(interaction.guild?.id!, idVal); const result = dt.getConfession(interaction.guild?.id!, idVal);
if (result) { if (result) {
try {
const confession = dt.getConfession(interaction.guild?.id!, idVal)?.messageId; const confession = dt.getConfession(interaction.guild?.id!, idVal)?.messageId;
const channelId = dt.getGuildInfo(interaction.guild?.id!)?.settings.confessChannel!; const channelId = dt.getGuildInfo(interaction.guild?.id!)?.settings.confessChannel!;
const emptyEmbed = new EmbedBuilder() const emptyEmbed = new EmbedBuilder()
@ -64,7 +68,10 @@ export async function execute(interaction: CommandInteraction) {
return interaction.reply({ return interaction.reply({
content: "Confession removed.", content: "Confession removed.",
ephemeral: true ephemeral: true
}) });
} catch (err) {
logger.error("An error occured:", err);
}
} else { } else {
return interaction.reply({ return interaction.reply({
content: "Either the confession wasn't found or you may not be allowed to remove it.", content: "Either the confession wasn't found or you may not be allowed to remove it.",

View file

@ -18,6 +18,9 @@
import { CommandInteraction, PermissionFlagsBits, SlashCommandBuilder } from "discord.js"; import { CommandInteraction, PermissionFlagsBits, SlashCommandBuilder } from "discord.js";
import { dt } from "../main"; import { dt } from "../main";
import Logger from "../utils/Logger";
const logger = new Logger("(/) confesspardon");
export const data = new SlashCommandBuilder() export const data = new SlashCommandBuilder()
.setName("confesspardon") .setName("confesspardon")
@ -37,6 +40,7 @@ export function execute(interaction: CommandInteraction) {
interaction.options.getString("id") interaction.options.getString("id")
); );
try {
return result return result
? interaction.reply({ ? interaction.reply({
content: "User was unbanned.", content: "User was unbanned.",
@ -46,4 +50,7 @@ export function execute(interaction: CommandInteraction) {
content: "No confession with that ID was found.", content: "No confession with that ID was found.",
ephemeral: true ephemeral: true
}); });
} catch (err) {
logger.error("An error occured:", err);
}
} }

View file

@ -28,6 +28,8 @@ import {
import { dt } from "../main"; import { dt } from "../main";
import Logger from "../utils/Logger"; import Logger from "../utils/Logger";
const logger = new Logger("(/) setup");
export const data = new SlashCommandBuilder() export const data = new SlashCommandBuilder()
.setName("setup") .setName("setup")
.setDescription("Setup the bot.") .setDescription("Setup the bot.")
@ -52,6 +54,7 @@ export async function execute(interaction: CommandInteraction) {
const channelRow = const channelRow =
new ActionRowBuilder<ChannelSelectMenuBuilder>().addComponents(channelList); new ActionRowBuilder<ChannelSelectMenuBuilder>().addComponents(channelList);
try {
const response = await interaction.reply({ const response = await interaction.reply({
content: `# Let's get started, ${interaction.user.displayName}!\nFirst, let's choose a channel for your confessions.`, content: `# Let's get started, ${interaction.user.displayName}!\nFirst, let's choose a channel for your confessions.`,
ephemeral: true, ephemeral: true,
@ -131,4 +134,7 @@ export async function execute(interaction: CommandInteraction) {
components: [] components: []
}); });
}); });
} catch (err) {
logger.error("An error occured:", err);
}
} }