Fixed more formatting
This commit is contained in:
@@ -1,48 +1,34 @@
|
||||
import {
|
||||
ChatInputCommandInteraction,
|
||||
GuildMember,
|
||||
userMention,
|
||||
} from "discord.js"
|
||||
import { ChatInputCommandInteraction, GuildMember, userMention } from "discord.js"
|
||||
import { countingBanned } from "config/roles.json"
|
||||
import { color, devMessage } from "config/options.json"
|
||||
|
||||
export default async function ban(
|
||||
interaction: ChatInputCommandInteraction,
|
||||
): Promise<void> {
|
||||
export default async function ban(interaction: ChatInputCommandInteraction): Promise<void> {
|
||||
const member = interaction.options.getMember("user")! as GuildMember
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
if (member.roles.cache.has(countingBanned)) {
|
||||
await interaction.reply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
userMention(member.user.id) +
|
||||
" is currently banned from counting",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: userMention(member.user.id) + " is currently banned from counting",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage
|
||||
}
|
||||
}]
|
||||
})
|
||||
} else {
|
||||
await member.roles.add(countingBanned)
|
||||
|
||||
await interaction.reply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
userMention(member.user.id) +
|
||||
" has been banned from counting",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: userMention(member.user.id) + " has been banned from counting",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
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
|
||||
@@ -18,44 +12,36 @@ export default async function setup(
|
||||
if (await settingsSchema.findOne({ name: "counting" })) {
|
||||
await settingsSchema.findOneAndUpdate(
|
||||
{ name: "counting" },
|
||||
{ name: "counting", channel: channel.id },
|
||||
{ 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
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,48 +1,34 @@
|
||||
import {
|
||||
ChatInputCommandInteraction,
|
||||
GuildMember,
|
||||
userMention,
|
||||
} from "discord.js"
|
||||
import { ChatInputCommandInteraction, GuildMember, userMention } from "discord.js"
|
||||
import { countingBanned } from "config/roles.json"
|
||||
import { color, devMessage } from "config/options.json"
|
||||
|
||||
export default async function ban(
|
||||
interaction: ChatInputCommandInteraction,
|
||||
): Promise<void> {
|
||||
export default async function ban(interaction: ChatInputCommandInteraction): Promise<void> {
|
||||
const member = interaction.options.getMember("user")! as GuildMember
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
if (!member.roles.cache.has(countingBanned)) {
|
||||
await interaction.reply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
userMention(member.user.id) +
|
||||
" is currently not banned from counting",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: userMention(member.user.id) + " is currently not banned from counting",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage
|
||||
}
|
||||
}]
|
||||
})
|
||||
} else {
|
||||
await member.roles.remove(countingBanned)
|
||||
|
||||
await interaction.reply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
userMention(member.user.id) +
|
||||
" has been unbanned from counting",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: userMention(member.user.id) + " has been unbanned from counting",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user