Updated imports and formating

Signed-off-by: Taken <taken@mairimashita.org>
This commit is contained in:
2024-01-16 17:05:15 +01:00
parent ee0250ed5e
commit 5661bc66bb
49 changed files with 819 additions and 491 deletions

View File

@@ -1,44 +1,61 @@
import { ChatInputCommandInteraction, TextChannel, channelMention } from "discord.js"
import {
ChatInputCommandInteraction,
TextChannel,
channelMention,
} from "discord.js"
import settingsSchema from "schemas/settingsSchema"
import { color, devMessage } from "config/options.json"
import mongoose from "mongoose"
export default async function setup(interaction: ChatInputCommandInteraction): Promise<void> {
export default async function setup(
interaction: ChatInputCommandInteraction,
): Promise<void> {
await interaction.deferReply()
const channel = interaction.options.getChannel("channel") as TextChannel
const embedColor = Number(color.replace("#", "0x"))
if (await settingsSchema.findOne({ name: "counting" })) {
await settingsSchema.findOneAndUpdate({ name: "counting" }, { name: "counting", channel: channel.id })
await settingsSchema.findOneAndUpdate(
{ name: "counting" },
{ name: "counting", channel: channel.id },
)
await interaction.editReply({
embeds: [{
description: "Counting channel has been updated to " + channelMention(channel.id),
color: embedColor,
footer: {
icon_url: interaction.guild!.iconURL() || undefined,
text: interaction.guild!.name + " | " + devMessage
}
}]
embeds: [
{
description:
"Counting channel has been updated to " +
channelMention(channel.id),
color: embedColor,
footer: {
icon_url: interaction.guild!.iconURL() || undefined,
text: interaction.guild!.name + " | " + devMessage,
},
},
],
})
} else {
const counting = new settingsSchema({
_id: new mongoose.Types.ObjectId(),
name: "counting",
value: channel.id
value: channel.id,
})
await counting.save()
await interaction.editReply({
embeds: [{
description: "Counting channel has been set to " + channelMention(channel.id),
color: embedColor,
footer: {
icon_url: interaction.guild!.iconURL() || undefined,
text: interaction.guild!.name + " | " + devMessage
}
}]
embeds: [
{
description:
"Counting channel has been set to " +
channelMention(channel.id),
color: embedColor,
footer: {
icon_url: interaction.guild!.iconURL() || undefined,
text: interaction.guild!.name + " | " + devMessage,
},
},
],
})
}
}
}