Compare commits

..

No commits in common. "cdbe79f2a24fb37f10668e221127262a74a293be" and "4b6a413f853da3179fd696ae412032d8f182a919" have entirely different histories.

4 changed files with 4 additions and 45 deletions

View file

@ -21,7 +21,6 @@ import { commands } from "../commands";
import { BOT_ID, BOT_TOKEN } from "./config";
import { DeployCommandsProps } from "./types";
import Logger from "../utils/Logger";
import { BotClient } from "./client";
const logger = new Logger("Deployer");
@ -33,15 +32,13 @@ const rest = new REST({ version: "9" }).setToken(BOT_TOKEN);
export async function deployCommands({ guildId }: DeployCommandsProps) {
try {
const guildName = BotClient.guilds.cache.get(guildId)?.name;
logger.log(`Started refreshing (/) commands for ${guildName}`);
logger.log("Started refreshing (/) commands.");
await rest.put(Routes.applicationGuildCommands(BOT_ID, guildId), {
body: commandsData
});
logger.log(`Successfully reloaded (/) commands for ${guildName}`);
logger.log("Successfully reloaded (/) commands.");
} catch (err) {
logger.error(err);
}

View file

@ -54,7 +54,6 @@ export async function execute(interaction: ChatInputCommandInteraction) {
// 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
try {
// If the user is banned in this guild, don't let them post
if (dt.isBanned(interaction.guild?.id!, interaction.user.id)) {
return interaction.reply({
content: "You are banned from confessions in this server!",
@ -62,7 +61,6 @@ export async function execute(interaction: ChatInputCommandInteraction) {
});
}
// If no guild info is present for this guild, don't let the user post
if (!dt.getGuildInfo(interaction.guild?.id!)) {
return interaction.reply({
content:
@ -84,15 +82,6 @@ export async function execute(interaction: ChatInputCommandInteraction) {
const color = getRandomColor();
const messageId = StoreMan.genId();
// Looks like:
//
// |
// | Anonymous Confession a1b2
// |
// | "example confession content"
// |
//
const userConfessionEmbed = new EmbedBuilder()
.setColor(color)
.setTitle(`Anonymous Confession \`${messageId}\``)
@ -100,20 +89,6 @@ export async function execute(interaction: ChatInputCommandInteraction) {
isAttachment(attachment) && userConfessionEmbed.setImage(attachment);
// Looks like:
//
// |
// | Anonymous Confession a1b2
// |
// | "example confession content"
// |
// | Author
// | @user1
// |
// | Author ID
// | 1234567890
// |
//
const adminConfessionEmbed = new EmbedBuilder()
.setColor(color)
.setTitle(`Anonymous Confession \`${messageId}\``)
@ -173,7 +148,6 @@ export async function execute(interaction: ChatInputCommandInteraction) {
const confessionsLength = dt.getGuildInfo(interaction.guild?.id!)
?.confessions.length!;
// If there are 2 or more confessions, remove the previous confession's button components
if (confessionsLength >= 2) {
await (
BotClient.channels.cache.get(confessChannel!) as TextChannel

View file

@ -35,15 +35,6 @@ export async function execute(interaction: CommandInteraction) {
? "Banned Members:\n"
: "There are no banned members.";
// For each member, add them to the message content.
// It will end up looking something like this:
//
// Banned Members:
//
// @user1 | a1b2
// @user2 | c3d4
// @user3 | e5f6
//
for (const member of bannedMembers) {
content += `\n<@${member.user}> | \`${member.confessionId}\``;
}

View file

@ -18,6 +18,7 @@
import {
ChatInputCommandInteraction,
CommandInteraction,
EmbedBuilder,
SlashCommandBuilder,
TextChannel
@ -37,8 +38,6 @@ export const data = new SlashCommandBuilder()
);
export async function execute(interaction: ChatInputCommandInteraction) {
// If there is no guild info, don't let the user delete anything
if (!dt.getGuildInfo(interaction.guild?.id!)) {
return interaction.reply({
content:
@ -50,8 +49,6 @@ export async function execute(interaction: ChatInputCommandInteraction) {
const idVal = interaction.options.getString("id")!;
const result = dt.getConfession(interaction.guild?.id!, idVal);
// If a confession is found with the given ID, check if the user is the one that posted it, and delete it if they are.
// Otherwise, don't let the user delete anything.
if (result) {
try {
const confession = dt.getConfession(
@ -63,9 +60,9 @@ export async function execute(interaction: ChatInputCommandInteraction) {
const emptyEmbed = new EmbedBuilder()
.setColor(getRandomColor())
.setTitle("Confession Deleted")
// @ts-ignore
.setDescription("[Confession Deleted]");
// Replace the given confession with an empty embed
await (BotClient.channels.cache.get(channelId) as TextChannel).messages
.fetch(confession!)
.then(e => {