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

1
.prettierignore Normal file
View File

@@ -0,0 +1 @@
src/config/

View File

@@ -1,4 +1,9 @@
import { ApplicationCommandType, ContextMenuCommandBuilder, PermissionFlagsBits, userMention } from "discord.js" import {
ApplicationCommandType,
ContextMenuCommandBuilder,
PermissionFlagsBits,
userMention,
} from "discord.js"
import { color, devMessage, hypixelGuildID } from "config/options.json" import { color, devMessage, hypixelGuildID } from "config/options.json"
import { ContextMenu } from "interfaces" import { ContextMenu } from "interfaces"
import verifySchema from "schemas/verifySchema" import verifySchema from "schemas/verifySchema"
@@ -74,13 +79,18 @@ export = {
if (responseGuildID !== hypixelGuildID) { if (responseGuildID !== hypixelGuildID) {
const roles = roleManage("default") const roles = roleManage("default")
await user.roles.remove(roles.rolesToRemove, "User was force updated.") await user.roles.remove(
roles.rolesToRemove,
"User was force updated.",
)
await user.roles.add(roles.rolesToAdd, "User was force updated.") await user.roles.add(roles.rolesToAdd, "User was force updated.")
await interaction.editReply({ await interaction.editReply({
embeds: [ embeds: [
{ {
description: usermentioned + " was given the the Default Member role.", description:
usermentioned +
" was given the the Default Member role.",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: head!, url: head!,
@@ -97,50 +107,91 @@ export = {
if (responseGuildID === hypixelGuildID) { if (responseGuildID === hypixelGuildID) {
const GuildMembers = guild!.members const GuildMembers = guild!.members
const guildRank = GuildMembers.find( member => member.uuid === verifyData.uuid)!.rank const guildRank = GuildMembers.find(
member => member.uuid === verifyData.uuid,
)!.rank
let replyRank: string | null = null let replyRank: string | null = null
await user.roles.add(roleManage("default").rolesToAdd, "User was force updated.") await user.roles.add(
roleManage("default").rolesToAdd,
"User was force updated.",
)
if (guildRank === "Guild Master") { if (guildRank === "Guild Master") {
const roles = roleManage("gm") const roles = roleManage("gm")
await user.roles.remove(roles.rolesToRemove, "User was force updated.") await user.roles.remove(
await user.roles.add(roles.rolesToAdd, "User was force updated.") roles.rolesToRemove,
"User was force updated.",
)
await user.roles.add(
roles.rolesToAdd,
"User was force updated.",
)
replyRank = "Guild Master" replyRank = "Guild Master"
} }
if (guildRank === "Manager") { if (guildRank === "Manager") {
const roles = roleManage("manager") const roles = roleManage("manager")
await user.roles.remove(roles.rolesToRemove, "User was force updated.") await user.roles.remove(
await user.roles.add(roles.rolesToAdd, "User was force updated.") roles.rolesToRemove,
"User was force updated.",
)
await user.roles.add(
roles.rolesToAdd,
"User was force updated.",
)
replyRank = "Manager" replyRank = "Manager"
} }
if (guildRank === "Moderator") { if (guildRank === "Moderator") {
const roles = roleManage("moderator") const roles = roleManage("moderator")
await user.roles.remove(roles.rolesToRemove, "User was force updated.") await user.roles.remove(
await user.roles.add(roles.rolesToAdd, "User was force updated.") roles.rolesToRemove,
"User was force updated.",
)
await user.roles.add(
roles.rolesToAdd,
"User was force updated.",
)
replyRank = "Moderator" replyRank = "Moderator"
} }
if (guildRank === "Beast") { if (guildRank === "Beast") {
const roles = roleManage("beast") const roles = roleManage("beast")
await user.roles.remove(roles.rolesToRemove, "User was force updated.") await user.roles.remove(
await user.roles.add(roles.rolesToAdd, "User was force updated.") roles.rolesToRemove,
"User was force updated.",
)
await user.roles.add(
roles.rolesToAdd,
"User was force updated.",
)
replyRank = "Beast" replyRank = "Beast"
} }
if (guildRank === "Elite") { if (guildRank === "Elite") {
const roles = roleManage("elite") const roles = roleManage("elite")
await user.roles.remove(roles.rolesToRemove, "User was force updated.") await user.roles.remove(
await user.roles.add(roles.rolesToAdd, "User was force updated.") roles.rolesToRemove,
"User was force updated.",
)
await user.roles.add(
roles.rolesToAdd,
"User was force updated.",
)
replyRank = "Elite" replyRank = "Elite"
} }
if (guildRank === "Member") { if (guildRank === "Member") {
const roles = roleManage("member") const roles = roleManage("member")
await user.roles.remove(roles.rolesToRemove, "User was force updated.") await user.roles.remove(
await user.roles.add(roles.rolesToAdd, "User was force updated.") roles.rolesToRemove,
"User was force updated.",
)
await user.roles.add(
roles.rolesToAdd,
"User was force updated.",
)
replyRank = "Member" replyRank = "Member"
} }
@@ -148,7 +199,10 @@ export = {
embeds: [ embeds: [
{ {
description: description:
usermentioned + " was given the " + replyRank + " role.", usermentioned +
" was given the " +
replyRank +
" role.",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: head!, url: head!,
@@ -161,5 +215,5 @@ export = {
], ],
}) })
} }
} },
} as ContextMenu } as ContextMenu

View File

@@ -112,30 +112,30 @@ export = {
}) })
await logToChannel("mod", { await logToChannel("mod", {
embeds: [{ embeds: [
author: { {
name: mod.user.username, author: {
icon_url: mod.user.avatarURL() || undefined, name: mod.user.username,
}, icon_url: mod.user.avatarURL() || undefined,
title: "Member Banned", },
description: ` title: "Member Banned",
description: `
**User:** ${userMention(member.user.id)} **User:** ${userMention(member.user.id)}
**Mod:** ${userMention(mod.user.id)} **Mod:** ${userMention(mod.user.id)}
**Reason:** ${reason} **Reason:** ${reason}
**Messages Deleted:** ${messageDeletionDays} days **Messages Deleted:** ${messageDeletionDays} days
`, `,
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: mod.user.avatarURL() || "", url: mod.user.avatarURL() || "",
},
footer: {
text: "ID: " + member.user.id,
icon_url: member.user.avatarURL() || undefined,
},
timestamp: new Date().toISOString(),
}, },
footer: { ],
text: "ID: " + member.user.id,
icon_url:
member.user.avatarURL() ||
undefined,
},
timestamp: new Date().toISOString(),
}]
}) })
await interaction.editReply({ await interaction.editReply({
@@ -143,9 +143,15 @@ export = {
{ {
title: "Member Banned", title: "Member Banned",
description: description:
"**User:** " + userMention(member.user.id) + "\n" + "**User:** " +
"**Reason:** " + reason + "\n" + userMention(member.user.id) +
"**Messages Deleted:** " + messageDeletionDays + " days", "\n" +
"**Reason:** " +
reason +
"\n" +
"**Messages Deleted:** " +
messageDeletionDays +
" days",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: member.user.avatarURL() || "", url: member.user.avatarURL() || "",

View File

@@ -60,27 +60,29 @@ export = {
await channel.bulkDelete(messagesToDelete, true) await channel.bulkDelete(messagesToDelete, true)
await logToChannel("mod", { await logToChannel("mod", {
embeds: [{ embeds: [
author: { {
name: interaction.user.username, author: {
icon_url: interaction.user.avatarURL() || undefined, name: interaction.user.username,
}, icon_url: interaction.user.avatarURL() || undefined,
title: "Messages Cleared", },
description: ` title: "Messages Cleared",
description: `
**Channel:** ${channelMention(channel.id)} **Channel:** ${channelMention(channel.id)}
**Amount:** \`${messages.size}\` messages **Amount:** \`${messages.size}\` messages
**Mod:** ${userMention(interaction.user.id)} **Mod:** ${userMention(interaction.user.id)}
`, `,
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: interaction.user.avatarURL() || "", url: interaction.user.avatarURL() || "",
},
footer: {
text: "ID: " + channel.id,
icon_url: interaction.guild!.iconURL() || undefined,
},
timestamp: new Date().toISOString(),
}, },
footer: { ],
text: "ID: " + channel.id,
icon_url: interaction.guild!.iconURL() || undefined,
},
timestamp: new Date().toISOString()
}]
}) })
await interaction.editReply({ await interaction.editReply({

View File

@@ -1,4 +1,8 @@
import { ChannelType, PermissionFlagsBits, SlashCommandBuilder } from "discord.js" import {
ChannelType,
PermissionFlagsBits,
SlashCommandBuilder,
} from "discord.js"
import { color, devMessage } from "config/options.json" import { color, devMessage } from "config/options.json"
import { Command } from "interfaces" import { Command } from "interfaces"
import setup from "./counting/setup" import setup from "./counting/setup"
@@ -25,7 +29,10 @@ export = {
.setName("channel") .setName("channel")
.setDescription("The channel to setup counting in") .setDescription("The channel to setup counting in")
.setRequired(true) .setRequired(true)
.addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) .addChannelTypes(
ChannelType.GuildText,
ChannelType.GuildAnnouncement,
),
), ),
) )
.addSubcommand(subcommand => .addSubcommand(subcommand =>
@@ -36,8 +43,8 @@ export = {
option option
.setName("user") .setName("user")
.setDescription("The user to ban") .setDescription("The user to ban")
.setRequired(true) .setRequired(true),
) ),
) )
.addSubcommand(subcommand => .addSubcommand(subcommand =>
subcommand subcommand
@@ -47,8 +54,8 @@ export = {
option option
.setName("user") .setName("user")
.setDescription("The user to ban") .setDescription("The user to ban")
.setRequired(true) .setRequired(true),
) ),
) )
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false), .setDMPermission(false),
@@ -79,8 +86,7 @@ export = {
color: embedColor, color: embedColor,
footer: { footer: {
text: interaction.guild!.name + " | " + devMessage, text: interaction.guild!.name + " | " + devMessage,
icon_url: icon_url: interaction.guild!.iconURL() || undefined,
interaction.guild!.iconURL() || undefined,
}, },
}, },
], ],

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 settingsSchema from "schemas/settingsSchema"
import { color, devMessage } from "config/options.json" import { color, devMessage } from "config/options.json"
import mongoose from "mongoose" 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() await interaction.deferReply()
const channel = interaction.options.getChannel("channel") as TextChannel const channel = interaction.options.getChannel("channel") as TextChannel
const embedColor = Number(color.replace("#", "0x")) const embedColor = Number(color.replace("#", "0x"))
if (await settingsSchema.findOne({ name: "counting" })) { 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({ await interaction.editReply({
embeds: [{ embeds: [
description: "Counting channel has been updated to " + channelMention(channel.id), {
color: embedColor, description:
footer: { "Counting channel has been updated to " +
icon_url: interaction.guild!.iconURL() || undefined, channelMention(channel.id),
text: interaction.guild!.name + " | " + devMessage color: embedColor,
} footer: {
}] icon_url: interaction.guild!.iconURL() || undefined,
text: interaction.guild!.name + " | " + devMessage,
},
},
],
}) })
} else { } else {
const counting = new settingsSchema({ const counting = new settingsSchema({
_id: new mongoose.Types.ObjectId(), _id: new mongoose.Types.ObjectId(),
name: "counting", name: "counting",
value: channel.id value: channel.id,
}) })
await counting.save() await counting.save()
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [
description: "Counting channel has been set to " + channelMention(channel.id), {
color: embedColor, description:
footer: { "Counting channel has been set to " +
icon_url: interaction.guild!.iconURL() || undefined, channelMention(channel.id),
text: interaction.guild!.name + " | " + devMessage color: embedColor,
} footer: {
}] icon_url: interaction.guild!.iconURL() || undefined,
text: interaction.guild!.name + " | " + devMessage,
},
},
],
}) })
} }
} }

View File

@@ -33,4 +33,4 @@ export = {
await interaction.reply({ content: "Test command.", ephemeral: true }) await interaction.reply({ content: "Test command.", ephemeral: true })
}, },
} as Command } as Command

View File

@@ -50,32 +50,36 @@ export = {
const uuid = verifiedUser.uuid const uuid = verifiedUser.uuid
const ign = await getIGN(uuid) const ign = await getIGN(uuid)
await verify.findOneAndDelete({ userID: member.user.id }) await verify.findOneAndDelete({ userID: member.user.id })
await member.roles.remove(roleManage("all").rolesToRemove, "User force unverified by " + interaction.user.username) await member.roles.remove(
roleManage("all").rolesToRemove,
"User force unverified by " + interaction.user.username,
)
await logToChannel("mod", { await logToChannel("mod", {
embeds: [{ embeds: [
title: "Force Unverified", {
author: { title: "Force Unverified",
name: mod.username, author: {
icon_url: mod.avatarURL() || undefined, name: mod.username,
}, icon_url: mod.avatarURL() || undefined,
description: ` },
description: `
**User:** ${userMention(member.user.id)} **User:** ${userMention(member.user.id)}
**Mod:** ${userMention(mod.id)} **Mod:** ${userMention(mod.id)}
**IGN:** \`${ign}\` **IGN:** \`${ign}\`
**UUID:** \`${uuid}\` **UUID:** \`${uuid}\`
`, `,
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: mod.avatarURL() || "", url: mod.avatarURL() || "",
},
footer: {
icon_url: member.user.avatarURL() || undefined,
text: "ID: " + member.user.id,
},
timestamp: new Date().toISOString(),
}, },
footer: { ],
icon_url: member.user.avatarURL() || undefined,
text: "ID: " + member.user.id,
},
timestamp: new Date().toISOString(),
}]
}) })
await interaction.reply({ await interaction.reply({

View File

@@ -85,7 +85,10 @@ export = {
if (responseGuildID !== hypixelGuildID) { if (responseGuildID !== hypixelGuildID) {
const roles = roleManage("default") const roles = roleManage("default")
await user.roles.remove(roles.rolesToRemove, "User was force updated.") await user.roles.remove(
roles.rolesToRemove,
"User was force updated.",
)
await user.roles.add(roles.rolesToAdd, "User was force updated.") await user.roles.add(roles.rolesToAdd, "User was force updated.")
await interaction.editReply({ await interaction.editReply({
@@ -110,50 +113,91 @@ export = {
if (responseGuildID === hypixelGuildID) { if (responseGuildID === hypixelGuildID) {
const GuildMembers = guild!.members const GuildMembers = guild!.members
const guildRank = GuildMembers.find( member => member.uuid === verifyData.uuid)!.rank const guildRank = GuildMembers.find(
member => member.uuid === verifyData.uuid,
)!.rank
let replyRank: string | null = null let replyRank: string | null = null
await user.roles.add(roleManage("default").rolesToAdd, "User was force updated.") await user.roles.add(
roleManage("default").rolesToAdd,
"User was force updated.",
)
if (guildRank === "Guild Master") { if (guildRank === "Guild Master") {
const roles = roleManage("gm") const roles = roleManage("gm")
await user.roles.remove(roles.rolesToRemove, "User was force updated.") await user.roles.remove(
await user.roles.add(roles.rolesToAdd, "User was force updated.") roles.rolesToRemove,
"User was force updated.",
)
await user.roles.add(
roles.rolesToAdd,
"User was force updated.",
)
replyRank = "Guild Master" replyRank = "Guild Master"
} }
if (guildRank === "Manager") { if (guildRank === "Manager") {
const roles = roleManage("manager") const roles = roleManage("manager")
await user.roles.remove(roles.rolesToRemove, "User was force updated.") await user.roles.remove(
await user.roles.add(roles.rolesToAdd, "User was force updated.") roles.rolesToRemove,
"User was force updated.",
)
await user.roles.add(
roles.rolesToAdd,
"User was force updated.",
)
replyRank = "Manager" replyRank = "Manager"
} }
if (guildRank === "Moderator") { if (guildRank === "Moderator") {
const roles = roleManage("moderator") const roles = roleManage("moderator")
await user.roles.remove(roles.rolesToRemove, "User was force updated.") await user.roles.remove(
await user.roles.add(roles.rolesToAdd, "User was force updated.") roles.rolesToRemove,
"User was force updated.",
)
await user.roles.add(
roles.rolesToAdd,
"User was force updated.",
)
replyRank = "Moderator" replyRank = "Moderator"
} }
if (guildRank === "Beast") { if (guildRank === "Beast") {
const roles = roleManage("beast") const roles = roleManage("beast")
await user.roles.remove(roles.rolesToRemove, "User was force updated.") await user.roles.remove(
await user.roles.add(roles.rolesToAdd, "User was force updated.") roles.rolesToRemove,
"User was force updated.",
)
await user.roles.add(
roles.rolesToAdd,
"User was force updated.",
)
replyRank = "Beast" replyRank = "Beast"
} }
if (guildRank === "Elite") { if (guildRank === "Elite") {
const roles = roleManage("elite") const roles = roleManage("elite")
await user.roles.remove(roles.rolesToRemove, "User was force updated.") await user.roles.remove(
await user.roles.add(roles.rolesToAdd, "User was force updated.") roles.rolesToRemove,
"User was force updated.",
)
await user.roles.add(
roles.rolesToAdd,
"User was force updated.",
)
replyRank = "Elite" replyRank = "Elite"
} }
if (guildRank === "Member") { if (guildRank === "Member") {
const roles = roleManage("member") const roles = roleManage("member")
await user.roles.remove(roles.rolesToRemove, "User was force updated.") await user.roles.remove(
await user.roles.add(roles.rolesToAdd, "User was force updated.") roles.rolesToRemove,
"User was force updated.",
)
await user.roles.add(
roles.rolesToAdd,
"User was force updated.",
)
replyRank = "Member" replyRank = "Member"
} }
@@ -161,7 +205,10 @@ export = {
embeds: [ embeds: [
{ {
description: description:
usermentioned + " was given the the " + replyRank + " role.", usermentioned +
" was given the the " +
replyRank +
" role.",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: head!, url: head!,

View File

@@ -143,36 +143,57 @@ export = {
if (guildRank === "Guild Master") { if (guildRank === "Guild Master") {
const roles = roleManage("gm") const roles = roleManage("gm")
await user.roles.add(roles.rolesToAdd, "User was force verified by " + modName) await user.roles.add(
roles.rolesToAdd,
"User was force verified by " + modName,
)
} }
if (guildRank === "Manager") { if (guildRank === "Manager") {
const roles = roleManage("manager") const roles = roleManage("manager")
await user.roles.add(roles.rolesToAdd, "User was force verified by " + modName) await user.roles.add(
roles.rolesToAdd,
"User was force verified by " + modName,
)
} }
if (guildRank === "Moderator") { if (guildRank === "Moderator") {
const roles = roleManage("moderator") const roles = roleManage("moderator")
await user.roles.add(roles.rolesToAdd, "User was force verified by " + modName) await user.roles.add(
roles.rolesToAdd,
"User was force verified by " + modName,
)
} }
if (guildRank === "Beast") { if (guildRank === "Beast") {
const roles = roleManage("beast") const roles = roleManage("beast")
await user.roles.add(roles.rolesToAdd, "User was force verified by " + modName) await user.roles.add(
roles.rolesToAdd,
"User was force verified by " + modName,
)
} }
if (guildRank === "Elite") { if (guildRank === "Elite") {
const roles = roleManage("elite") const roles = roleManage("elite")
await user.roles.add(roles.rolesToAdd, "User was force verified by " + modName) await user.roles.add(
roles.rolesToAdd,
"User was force verified by " + modName,
)
} }
if (guildRank === "Member") { if (guildRank === "Member") {
const roles = roleManage("member") const roles = roleManage("member")
await user.roles.add(roles.rolesToAdd, "User was force verified by " + modName) await user.roles.add(
roles.rolesToAdd,
"User was force verified by " + modName,
)
} }
} }
await user.roles.add(roleManage("default").rolesToAdd, "User was force verified by " + modName) await user.roles.add(
roleManage("default").rolesToAdd,
"User was force verified by " + modName,
)
const newVerify = new verify({ const newVerify = new verify({
_id: new mongoose.Types.ObjectId(), _id: new mongoose.Types.ObjectId(),
@@ -183,28 +204,30 @@ export = {
await newVerify.save() await newVerify.save()
await logToChannel("mod", { await logToChannel("mod", {
embeds: [{ embeds: [
author: { {
name: modName, author: {
icon_url: mod.avatarURL() || undefined, name: modName,
}, icon_url: mod.avatarURL() || undefined,
title: "Force Verified", },
description: ` title: "Force Verified",
description: `
**User:** ${userMention(user.id)} **User:** ${userMention(user.id)}
**Mod:** ${userMention(mod.id)} **Mod:** ${userMention(mod.id)}
**IGN:** \`${player.displayname}\` **IGN:** \`${player.displayname}\`
**UUID:** \`${uuid}\` **UUID:** \`${uuid}\`
`, `,
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: mod.avatarURL() || "", url: mod.avatarURL() || "",
},
footer: {
icon_url: user.user.avatarURL() || undefined,
text: "ID: " + user.user.id,
},
timestamp: new Date().toISOString(),
}, },
footer: { ],
icon_url: user.user.avatarURL() || undefined,
text: "ID: " + user.user.id
},
timestamp: new Date().toISOString(),
}]
}) })
await interaction.editReply({ await interaction.editReply({

View File

@@ -108,8 +108,7 @@ export = {
color: embedColor, color: embedColor,
footer: { footer: {
text: interaction.guild!.name + " | " + devMessage, text: interaction.guild!.name + " | " + devMessage,
icon_url: icon_url: interaction.guild!.iconURL() || undefined,
interaction.guild!.iconURL() || undefined,
}, },
}, },
], ],

View File

@@ -1,10 +1,4 @@
import { import { getUUID, getIGN, getPlayer, getGuild, guildLevel } from "utils/Hypixel"
getUUID,
getIGN,
getPlayer,
getGuild,
guildLevel,
} from "utils/Hypixel"
import { color, devMessage } from "config/options.json" import { color, devMessage } from "config/options.json"
import { ChatInputCommandInteraction } from "discord.js" import { ChatInputCommandInteraction } from "discord.js"
import { GuildData } from "interfaces" import { GuildData } from "interfaces"
@@ -234,11 +228,9 @@ export default async function guildInfo(
color: embedColor, color: embedColor,
footer: { footer: {
text: interaction.guild!.name + " | " + devMessage, text: interaction.guild!.name + " | " + devMessage,
icon_url: icon_url: interaction.guild!.iconURL() || undefined,
interaction.guild!.iconURL() ||
undefined,
}, },
}, },
], ],
}) })
} }

View File

@@ -205,4 +205,4 @@ export default async function guildMember(
}, },
], ],
}) })
} }

View File

@@ -177,8 +177,8 @@ export default async function guildTop(
amount = 1 amount = 1
} }
type GuildTopData = { ign: string, uuid: string }[] type GuildTopData = { ign: string; uuid: string }[]
type NewList = { name: string, value: string; inline: boolean }[] type NewList = { name: string; value: string; inline: boolean }[]
let cacheStatus: boolean let cacheStatus: boolean
let guildData: GuildTopData = [] let guildData: GuildTopData = []
@@ -243,7 +243,9 @@ export default async function guildTop(
for (let i = 0; i < amount; i++) { for (let i = 0; i < amount; i++) {
const gexp = new Intl.NumberFormat("en-US").format(topMembers[i].gexp) const gexp = new Intl.NumberFormat("en-US").format(topMembers[i].gexp)
const ign = guildData.find(member => member.uuid === topMembers[i].uuid)?.ign const ign = guildData.find(
member => member.uuid === topMembers[i].uuid,
)?.ign
const position = i + 1 const position = i + 1
@@ -291,4 +293,4 @@ export default async function guildTop(
}, },
], ],
}) })
} }

View File

@@ -36,8 +36,9 @@ export = {
async execute(interaction) { async execute(interaction) {
await interaction.deferReply() await interaction.deferReply()
const member = interaction.options.getMember( "member",) as GuildMember const member = interaction.options.getMember("member") as GuildMember
const reason = interaction.options.getString("reason") ?? "No reason provided." const reason =
interaction.options.getString("reason") ?? "No reason provided."
const embedColor = Number(color.replace("#", "0x")) const embedColor = Number(color.replace("#", "0x"))
const mod = await interaction.guild!.members.fetch(interaction.user.id) const mod = await interaction.guild!.members.fetch(interaction.user.id)
@@ -79,36 +80,44 @@ export = {
await member.kick(reason + ` - ${mod.user.username}`) await member.kick(reason + ` - ${mod.user.username}`)
await logToChannel("mod", { await logToChannel("mod", {
embeds: [{ embeds: [
author: { {
name: mod.user.username, author: {
icon_url: mod.user.avatarURL() || undefined, name: mod.user.username,
}, icon_url: mod.user.avatarURL() || undefined,
title: "Member Kicked", },
description: ` title: "Member Kicked",
description: `
**User:** ${userMention(member.user.id)} **User:** ${userMention(member.user.id)}
**Mod:** ${userMention(mod.user.id)} **Mod:** ${userMention(mod.user.id)}
**Reason:** ${reason} **Reason:** ${reason}
`, `,
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: mod.user.avatarURL() || "", url: mod.user.avatarURL() || "",
},
footer: {
text: "ID: " + member.user.id,
icon_url: member.user.avatarURL() || undefined,
},
timestamp: new Date().toISOString(),
}, },
footer: { ],
text: "ID: " + member.user.id,
icon_url: member.user.avatarURL() || undefined,
},
timestamp: new Date().toISOString(),
}]
}) })
await interaction.editReply({ await interaction.editReply({
embeds: [ embeds: [
{ {
title: "Member Kicked", title: "Member Kicked",
description: "**User:** " + userMention(member.user.id) + "\n" + description:
"**Reason:** " + reason + "\n" + "**User:** " +
"**Moderator:** " + mod.user.username, userMention(member.user.id) +
"\n" +
"**Reason:** " +
reason +
"\n" +
"**Moderator:** " +
mod.user.username,
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: member.user.avatarURL() || "", url: member.user.avatarURL() || "",
@@ -116,7 +125,7 @@ export = {
footer: { footer: {
icon_url: interaction.guild!.iconURL() || undefined, icon_url: interaction.guild!.iconURL() || undefined,
text: interaction.guild!.name + " | " + devMessage, text: interaction.guild!.name + " | " + devMessage,
} },
}, },
], ],
}) })

View File

@@ -26,8 +26,7 @@ export = {
color: embedColor, color: embedColor,
footer: { footer: {
text: interaction.guild!.name + " | " + devMessage, text: interaction.guild!.name + " | " + devMessage,
icon_url: icon_url: interaction.guild?.iconURL() || undefined,
interaction.guild?.iconURL() || undefined,
}, },
timestamp: new Date().toISOString(), timestamp: new Date().toISOString(),
}, },

View File

@@ -61,27 +61,29 @@ export = {
await waitinglistSchema.findOneAndDelete({ userID: user.id }) await waitinglistSchema.findOneAndDelete({ userID: user.id })
await logToChannel("mod", { await logToChannel("mod", {
embeds: [{ embeds: [
author: { {
name: mod.username, author: {
icon_url: mod.avatarURL() || undefined, name: mod.username,
}, icon_url: mod.avatarURL() || undefined,
title: "Waiting List - Remove User", },
description: ` title: "Waiting List - Remove User",
description: `
**User:** ${userMention(user.id)} **User:** ${userMention(user.id)}
**Reason:** ${reason} **Reason:** ${reason}
**Mod:** ${userMention(mod.id)} **Mod:** ${userMention(mod.id)}
`, `,
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: mod.avatarURL() || "", url: mod.avatarURL() || "",
},
footer: {
icon_url: user.avatarURL() || undefined,
text: "ID: " + user.id,
},
timestamp: new Date().toISOString(),
}, },
footer: { ],
icon_url: user.avatarURL() || undefined,
text: "ID: " + user.id,
},
timestamp: new Date().toISOString()
}]
}) })
await interaction.editReply({ await interaction.editReply({
@@ -89,13 +91,17 @@ export = {
{ {
title: "Waiting List - Remove User", title: "Waiting List - Remove User",
description: description:
"**User:** " + userMention(user.id) + "\n" + "**User:** " +
"**Reason:** `" + reason + "`", userMention(user.id) +
"\n" +
"**Reason:** `" +
reason +
"`",
color: embedColor, color: embedColor,
footer: { footer: {
text: interaction.guild!.name + " | " + devMessage, text: interaction.guild!.name + " | " + devMessage,
icon_url: interaction.guild!.iconURL() || undefined, icon_url: interaction.guild!.iconURL() || undefined,
} },
}, },
], ],
}) })

View File

@@ -34,8 +34,7 @@ export = {
"**You must make 100k-150k weekly GEXP.\nAs well as onne of the game stats below**", "**You must make 100k-150k weekly GEXP.\nAs well as onne of the game stats below**",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: url: interaction.guild!.iconURL() || "",
interaction.guild!.iconURL() || "",
}, },
fields: [ fields: [
{ {

View File

@@ -27,7 +27,10 @@ export = {
option option
.setName("channel") .setName("channel")
.setDescription("The channel to send the message to.") .setDescription("The channel to send the message to.")
.addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) .addChannelTypes(
ChannelType.GuildText,
ChannelType.GuildAnnouncement,
),
) )
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false), .setDMPermission(false),
@@ -36,7 +39,8 @@ export = {
await interaction.deferReply({ ephemeral: true }) await interaction.deferReply({ ephemeral: true })
const message = interaction.options.getString("message")! const message = interaction.options.getString("message")!
const channel = (interaction.options.getChannel("channel") || interaction.channel) as TextChannel const channel = (interaction.options.getChannel("channel") ||
interaction.channel) as TextChannel
const embedColor = Number(color.replace("#", "0x")) const embedColor = Number(color.replace("#", "0x"))
channel.send({ channel.send({

View File

@@ -49,38 +49,42 @@ export = {
await member.setNickname(nickname, `Set by ${interaction.user.tag}`) await member.setNickname(nickname, `Set by ${interaction.user.tag}`)
await logToChannel("mod", { await logToChannel("mod", {
embeds: [{ embeds: [
author: { {
name: interaction.user.username, author: {
icon_url: interaction.user.avatarURL() || undefined, name: interaction.user.username,
}, icon_url: interaction.user.avatarURL() || undefined,
title: "Nickname", },
description: ` title: "Nickname",
description: `
**User:** ${userMention(member.id)} **User:** ${userMention(member.id)}
**Nickname:** ${nickname} **Nickname:** ${nickname}
**Moderator:** ${userMention(interaction.user.id)} **Moderator:** ${userMention(interaction.user.id)}
`, `,
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: interaction.user.avatarURL() || "", url: interaction.user.avatarURL() || "",
},
footer: {
text: "ID: " + member.user.id,
icon_url: member.user.avatarURL() || undefined,
},
timestamp: new Date().toISOString(),
}, },
footer: { ],
text: "ID: " + member.user.id,
icon_url: member.user.avatarURL() || undefined,
},
timestamp: new Date().toISOString()
}]
}) })
await interaction.reply({ await interaction.reply({
embeds: [{ embeds: [
description: `Successfully set the nickname of ${userMention(member.id)} to ${nickname}`, {
color: embedColor, description: `Successfully set the nickname of ${userMention(member.id)} to ${nickname}`,
footer: { color: embedColor,
text: interaction.guild!.name + " | " + devMessage, footer: {
icon_url: interaction.guild!.iconURL() || undefined, text: interaction.guild!.name + " | " + devMessage,
} icon_url: interaction.guild!.iconURL() || undefined,
}], },
},
],
ephemeral: true, ephemeral: true,
}) })
}, },

View File

@@ -31,7 +31,10 @@ export = {
.setDescription( .setDescription(
"The channel to send the application to.", "The channel to send the application to.",
) )
.addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) .addChannelTypes(
ChannelType.GuildText,
ChannelType.GuildAnnouncement,
)
.setRequired(true), .setRequired(true),
), ),
) )
@@ -45,7 +48,10 @@ export = {
.setDescription( .setDescription(
"The channel to send the application to.", "The channel to send the application to.",
) )
.addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) .addChannelTypes(
ChannelType.GuildText,
ChannelType.GuildAnnouncement,
)
.setRequired(true), .setRequired(true),
), ),
) )
@@ -59,7 +65,10 @@ export = {
.setDescription( .setDescription(
"The channel to send the verfiy message to.", "The channel to send the verfiy message to.",
) )
.addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) .addChannelTypes(
ChannelType.GuildText,
ChannelType.GuildAnnouncement,
)
.setRequired(true), .setRequired(true),
), ),
) )
@@ -73,7 +82,10 @@ export = {
.setDescription( .setDescription(
"The channel to send the waiting list message to.", "The channel to send the waiting list message to.",
) )
.addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) .addChannelTypes(
ChannelType.GuildText,
ChannelType.GuildAnnouncement,
)
.setRequired(true), .setRequired(true),
), ),
) )
@@ -87,7 +99,10 @@ export = {
.setDescription( .setDescription(
"The channel to send the application to.", "The channel to send the application to.",
) )
.addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) .addChannelTypes(
ChannelType.GuildText,
ChannelType.GuildAnnouncement,
)
.setRequired(true), .setRequired(true),
), ),
) )
@@ -106,7 +121,8 @@ export = {
if (subcommand === "sendguildapplication") { if (subcommand === "sendguildapplication") {
title = "Guild Application" title = "Guild Application"
description = "You can apply for the guild by clicking the button below." description =
"You can apply for the guild by clicking the button below."
customId = "guildapply" customId = "guildapply"
label = "Apply" label = "Apply"
emoji = "✅" emoji = "✅"
@@ -114,7 +130,8 @@ export = {
if (subcommand === "sendstaffapplication") { if (subcommand === "sendstaffapplication") {
title = "Staff Application" title = "Staff Application"
description = "You can apply for the staff team by clicking the button below." description =
"You can apply for the staff team by clicking the button below."
customId = "staffapply" customId = "staffapply"
label = "Apply" label = "Apply"
emoji = "✅" emoji = "✅"
@@ -122,7 +139,8 @@ export = {
if (subcommand === "sendinactivityapplication") { if (subcommand === "sendinactivityapplication") {
title = "Inactivity Log" title = "Inactivity Log"
description = "You can send an inactivity log by clicking the button below." description =
"You can send an inactivity log by clicking the button below."
customId = "guildinactivitylog" customId = "guildinactivitylog"
label = "Submit" label = "Submit"
emoji = "✅" emoji = "✅"
@@ -138,34 +156,38 @@ export = {
if (subcommand === "sendwaitinglistmessage") { if (subcommand === "sendwaitinglistmessage") {
title = "Waiting List" title = "Waiting List"
description = "The people below were accepted into the guild\n" + "Try to invite them in order.", ;(description =
customId = "waitinglistupdate" "The people below were accepted into the guild\n" +
"Try to invite them in order."),
(customId = "waitinglistupdate")
label = "Update" label = "Update"
emoji = "🔄" emoji = "🔄"
} }
await channel.send({ await channel.send({
embeds: [{ embeds: [
title: title, {
description: description, title: title,
color: embedColor, description: description,
thumbnail: { color: embedColor,
url: interaction.guild!.iconURL() || "", thumbnail: {
url: interaction.guild!.iconURL() || "",
},
footer: {
text: interaction.guild!.name + " | " + devMessage,
icon_url: interaction.guild!.iconURL() || undefined,
},
}, },
footer: { ],
text: interaction.guild!.name + " | " + devMessage,
icon_url: interaction.guild!.iconURL() || undefined,
}
}],
components: [ components: [
new ActionRowBuilder<ButtonBuilder>().addComponents( new ActionRowBuilder<ButtonBuilder>().addComponents(
new ButtonBuilder() new ButtonBuilder()
.setCustomId(customId) .setCustomId(customId)
.setLabel(label) .setLabel(label)
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary)
.setEmoji({ name: emoji }) .setEmoji({ name: emoji }),
) ),
] ],
}) })
await interaction.reply({ await interaction.reply({

View File

@@ -31,7 +31,10 @@ export = {
option option
.setName("channel") .setName("channel")
.setDescription("The channel to set the slowmode of.") .setDescription("The channel to set the slowmode of.")
.addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement), .addChannelTypes(
ChannelType.GuildText,
ChannelType.GuildAnnouncement,
),
) )
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false), .setDMPermission(false),
@@ -40,7 +43,8 @@ export = {
await interaction.deferReply({ ephemeral: true }) await interaction.deferReply({ ephemeral: true })
const seconds = interaction.options.getInteger("seconds") ?? 5 const seconds = interaction.options.getInteger("seconds") ?? 5
const channel = (interaction.options.getChannel("channel") || interaction.channel) as TextChannel const channel = (interaction.options.getChannel("channel") ||
interaction.channel) as TextChannel
const embedColor = Number(color.replace("#", "0x")) const embedColor = Number(color.replace("#", "0x"))
if (seconds > 21600) { if (seconds > 21600) {
@@ -52,8 +56,7 @@ export = {
color: embedColor, color: embedColor,
footer: { footer: {
text: interaction.guild!.name + " | " + devMessage, text: interaction.guild!.name + " | " + devMessage,
icon_url: icon_url: interaction.guild!.iconURL() || undefined,
interaction.guild!.iconURL() || undefined,
}, },
}, },
], ],
@@ -62,27 +65,29 @@ export = {
} }
await logToChannel("mod", { await logToChannel("mod", {
embeds: [{ embeds: [
author: { {
name: interaction.user.username, author: {
icon_url: interaction.user.avatarURL() || undefined, name: interaction.user.username,
}, icon_url: interaction.user.avatarURL() || undefined,
title: "Slowmode Update", },
description: ` title: "Slowmode Update",
description: `
**Channel:** ${channelMention(channel.id)} **Channel:** ${channelMention(channel.id)}
**Slowmode:** ${seconds} seconds **Slowmode:** ${seconds} seconds
**Mod:** ${userMention(interaction.user.id)} **Mod:** ${userMention(interaction.user.id)}
`, `,
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: interaction.user.avatarURL() || "", url: interaction.user.avatarURL() || "",
},
footer: {
icon_url: interaction.guild!.iconURL() || undefined,
text: " ID: " + channel.id,
},
timestamp: new Date().toISOString(),
}, },
footer: { ],
icon_url: interaction.guild!.iconURL() || undefined,
text: " ID: " + channel.id
},
timestamp: new Date().toISOString()
}]
}) })
await interaction.editReply({ await interaction.editReply({
@@ -92,8 +97,7 @@ export = {
color: embedColor, color: embedColor,
footer: { footer: {
text: interaction.guild!.name + " | " + devMessage, text: interaction.guild!.name + " | " + devMessage,
icon_url: icon_url: interaction.guild!.iconURL() || undefined,
interaction.guild!.iconURL() || undefined,
}, },
}, },
], ],

View File

@@ -18,7 +18,8 @@ export = {
option option
.setName("user") .setName("user")
.setDescription("The user to snipe") .setDescription("The user to snipe")
.setRequired(true)) .setRequired(true),
)
.setDMPermission(false), .setDMPermission(false),
async execute(interaction) { async execute(interaction) {
@@ -26,17 +27,19 @@ export = {
const member = interaction.options.getMember("user") as GuildMember const member = interaction.options.getMember("user") as GuildMember
const snipeCache = await snipeCacheSchema.find({ const snipeCache = await snipeCacheSchema.find({
userid: member.user.id, userid: member.user.id,
channelid: interaction.channel!.id channelid: interaction.channel!.id,
}) })
const embedColor = Number(color.replace("#", "0x")) const embedColor = Number(color.replace("#", "0x"))
const messages: string[] = [] const messages: string[] = []
if (!snipeCache.length) { if (!snipeCache.length) {
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [
description: "No messages to snipe", {
color: embedColor description: "No messages to snipe",
}] color: embedColor,
},
],
}) })
return return
} }
@@ -48,28 +51,32 @@ export = {
messages.push(`**Message #${i}:** ${data.content}\n`) messages.push(`**Message #${i}:** ${data.content}\n`)
} else { } else {
messages.push(`**Message #${i}:** ${data.content}`) messages.push(`**Message #${i}:** ${data.content}`)
messages.push(`**Attachments:** ${data.attachments.join(", ")}\n`) messages.push(
`**Attachments:** ${data.attachments.join(", ")}\n`,
)
} }
i++ i++
} }
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [
author: { {
name: member.user.username, author: {
icon_url: member.user.avatarURL() || undefined name: member.user.username,
icon_url: member.user.avatarURL() || undefined,
},
description: messages.join("\n"),
thumbnail: {
url: member.user.avatarURL() || "",
},
color: embedColor,
footer: {
text: "ID: " + member.user.id,
icon_url: interaction.guild!.iconURL() || undefined,
},
timestamp: new Date().toISOString(),
}, },
description: messages.join("\n"), ],
thumbnail: {
url: member.user.avatarURL() || ""
},
color: embedColor,
footer: {
text: "ID: " + member.user.id,
icon_url: interaction.guild!.iconURL() || undefined
},
timestamp: new Date().toISOString()
}]
}) })
} },
} as Command } as Command

View File

@@ -124,44 +124,62 @@ export = {
if (target.isCommunicationDisabled()) { if (target.isCommunicationDisabled()) {
if (time === 0) { if (time === 0) {
title = "Timeout Removed" title = "Timeout Removed"
description = "Removed timeout of " + userMention(target.id) + " for " + reason, ;(description =
timeouttime = null "Removed timeout of " +
userMention(target.id) +
" for " +
reason),
(timeouttime = null)
} else { } else {
title = "Timeout Updated" title = "Timeout Updated"
description = "Updated timeout of " + userMention(target.id) + " to " + prettyTime + " for " + reason, ;(description =
timeouttime = time "Updated timeout of " +
userMention(target.id) +
" to " +
prettyTime +
" for " +
reason),
(timeouttime = time)
} }
} else { } else {
title = "Member Timed Out" title = "Member Timed Out"
description = "Timed out " + userMention(target.id) + " for " + prettyTime + " for " + reason, ;(description =
timeouttime = time "Timed out " +
userMention(target.id) +
" for " +
prettyTime +
" for " +
reason),
(timeouttime = time)
} }
await target.timeout(timeouttime, reason) await target.timeout(timeouttime, reason)
await logToChannel("mod", { await logToChannel("mod", {
embeds: [{ embeds: [
author: { {
name: mod.user.username, author: {
icon_url: mod.user.avatarURL() || undefined, name: mod.user.username,
}, icon_url: mod.user.avatarURL() || undefined,
title: title, },
description: ` title: title,
description: `
**User:** ${userMention(target.id)} **User:** ${userMention(target.id)}
${timeouttime === null ? "**Time:** `None`" : "**Time:** `" + prettyTime + "`"} ${timeouttime === null ? "**Time:** `None`" : "**Time:** `" + prettyTime + "`"}
**Reason:** \`${reason}\` **Reason:** \`${reason}\`
**Mod:** ${userMention(mod.id)} **Mod:** ${userMention(mod.id)}
`, `,
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: mod.user.avatarURL() || "", url: mod.user.avatarURL() || "",
},
footer: {
text: "ID: " + target.id,
icon_url: target.user.avatarURL() || undefined,
},
timestamp: new Date().toISOString(),
}, },
footer: { ],
text: "ID: " + target.id,
icon_url: target.user.avatarURL() || undefined,
},
timestamp: new Date().toISOString()
}]
}) })
await interaction.editReply({ await interaction.editReply({
@@ -177,4 +195,4 @@ export = {
], ],
}) })
}, },
} as Command } as Command

View File

@@ -38,7 +38,8 @@ export = {
await interaction.deferReply() await interaction.deferReply()
const userid = interaction.options.getString("user")! const userid = interaction.options.getString("user")!
const reason = interaction.options.getString("reason") || "No reason provided" const reason =
interaction.options.getString("reason") || "No reason provided"
const mod = interaction.user const mod = interaction.user
const embedColor = Number(color.replace("#", "0x")) const embedColor = Number(color.replace("#", "0x"))
let user: User let user: User
@@ -102,9 +103,14 @@ export = {
{ {
title: "User unbanned", title: "User unbanned",
description: description:
"The user " + user!.username + " has been unbanned.\n" + "The user " +
"**Reason:** `" + reason + "`\n" + user!.username +
"**Moderator:** " + userMention(mod.id), " has been unbanned.\n" +
"**Reason:** `" +
reason +
"`\n" +
"**Moderator:** " +
userMention(mod.id),
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: user!.avatarURL() || "", url: user!.avatarURL() || "",

View File

@@ -62,8 +62,14 @@ export = {
const head = await getHeadURL(ign) const head = await getHeadURL(ign)
if (guildID !== hypixelGuildID) { if (guildID !== hypixelGuildID) {
const roles = roleManage("default") const roles = roleManage("default")
await user.roles.remove(roles.rolesToRemove, "User used the update command") await user.roles.remove(
await user.roles.add(roles.rolesToAdd, "User used the update command") roles.rolesToRemove,
"User used the update command",
)
await user.roles.add(
roles.rolesToAdd,
"User used the update command",
)
await interaction.editReply({ await interaction.editReply({
embeds: [ embeds: [
@@ -85,57 +91,99 @@ export = {
if (guildID === hypixelGuildID) { if (guildID === hypixelGuildID) {
const GuildMembers = guild!.members const GuildMembers = guild!.members
const guildRank = GuildMembers.find( member => member.uuid === verifyData.uuid)!.rank const guildRank = GuildMembers.find(
member => member.uuid === verifyData.uuid,
)!.rank
let replyRank: string | null = null let replyRank: string | null = null
await user.roles.add(roleManage("default").rolesToAdd, "User used the update command") await user.roles.add(
roleManage("default").rolesToAdd,
"User used the update command",
)
if (guildRank === "Guild Master") { if (guildRank === "Guild Master") {
const roles = roleManage("gm") const roles = roleManage("gm")
await user.roles.remove(roles.rolesToRemove, "User used the update command") await user.roles.remove(
await user.roles.add(roles.rolesToAdd, "User used the update command") roles.rolesToRemove,
"User used the update command",
)
await user.roles.add(
roles.rolesToAdd,
"User used the update command",
)
replyRank = "Guild Master" replyRank = "Guild Master"
} }
if (guildRank === "Manager") { if (guildRank === "Manager") {
const roles = roleManage("manager") const roles = roleManage("manager")
await user.roles.remove(roles.rolesToRemove, "User used the update command") await user.roles.remove(
await user.roles.add(roles.rolesToAdd, "User used the update command") roles.rolesToRemove,
"User used the update command",
)
await user.roles.add(
roles.rolesToAdd,
"User used the update command",
)
replyRank = "Manager" replyRank = "Manager"
} }
if (guildRank === "Moderator") { if (guildRank === "Moderator") {
const roles = roleManage("moderator") const roles = roleManage("moderator")
await user.roles.remove(roles.rolesToRemove, "User used the update command") await user.roles.remove(
await user.roles.add(roles.rolesToAdd, "User used the update command") roles.rolesToRemove,
"User used the update command",
)
await user.roles.add(
roles.rolesToAdd,
"User used the update command",
)
replyRank = "Moderator" replyRank = "Moderator"
} }
if (guildRank === "Beast") { if (guildRank === "Beast") {
const roles = roleManage("beast") const roles = roleManage("beast")
await user.roles.remove(roles.rolesToRemove, "User used the update command") await user.roles.remove(
await user.roles.add(roles.rolesToAdd, "User used the update command") roles.rolesToRemove,
"User used the update command",
)
await user.roles.add(
roles.rolesToAdd,
"User used the update command",
)
replyRank = "Beast" replyRank = "Beast"
} }
if (guildRank === "Elite") { if (guildRank === "Elite") {
const roles = roleManage("elite") const roles = roleManage("elite")
await user.roles.remove(roles.rolesToRemove, "User used the update command") await user.roles.remove(
await user.roles.add(roles.rolesToAdd, "User used the update command") roles.rolesToRemove,
"User used the update command",
)
await user.roles.add(
roles.rolesToAdd,
"User used the update command",
)
replyRank = "Elite" replyRank = "Elite"
} }
if (guildRank === "Member") { if (guildRank === "Member") {
const roles = roleManage("member") const roles = roleManage("member")
await user.roles.remove(roles.rolesToRemove, "User used the update command") await user.roles.remove(
await user.roles.add(roles.rolesToAdd, "User used the update command") roles.rolesToRemove,
"User used the update command",
)
await user.roles.add(
roles.rolesToAdd,
"User used the update command",
)
replyRank = "Member" replyRank = "Member"
} }
await interaction.editReply({ await interaction.editReply({
embeds: [ embeds: [
{ {
description: "Updated your roles to `" + replyRank + "`", description:
"Updated your roles to `" + replyRank + "`",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: head!, url: head!,

View File

@@ -59,8 +59,7 @@ export = {
}, },
footer: { footer: {
text: interaction.guild!.name + " | " + devMessage, text: interaction.guild!.name + " | " + devMessage,
icon_url: icon_url: interaction.guild!.iconURL() || undefined,
interaction.guild!.iconURL() || undefined,
}, },
}, },
], ],

View File

@@ -155,7 +155,9 @@ export = {
], ],
}) })
} catch (err) { } catch (err) {
console.log(colorLog("Error while trying to update waiting list.", "red")) console.log(
colorLog("Error while trying to update waiting list.", "red"),
)
} }
}, },
} as Button } as Button

View File

@@ -12,9 +12,7 @@ import { TextChannel } from "discord.js"
const client = Illegitimate.client const client = Illegitimate.client
async function guildWeekly() { async function guildWeekly() {
const channel = client.channels.cache.get( const channel = client.channels.cache.get(guildLogChannel) as TextChannel
guildLogChannel,
) as TextChannel
if (!channel) { if (!channel) {
console.log(colorLog("Guild log channel not found", "red")) console.log(colorLog("Guild log channel not found", "red"))

View File

@@ -11,32 +11,38 @@ export = {
execute(interaction: ChatInputCommandInteraction | ButtonInteraction) { execute(interaction: ChatInputCommandInteraction | ButtonInteraction) {
if (interaction.isCommand()) { if (interaction.isCommand()) {
try { try {
console.log(color( console.log(
interaction.user.username + color(
" ran " + interaction.user.username +
interaction.commandName + " ran " +
" " + interaction.commandName +
interaction.options.getSubcommand(), " " +
"pink") interaction.options.getSubcommand(),
"pink",
),
) )
} catch { } catch {
console.log(color( console.log(
interaction.user.username + color(
" ran " + interaction.user.username +
interaction.commandName, " ran " +
"pink") interaction.commandName,
"pink",
),
) )
} }
} }
if (interaction.isButton()) { if (interaction.isButton()) {
console.log(color( console.log(
interaction.user.username + color(
"#" + interaction.user.username +
interaction.user.discriminator + "#" +
" clicked " + interaction.user.discriminator +
interaction.customId, " clicked " +
"pink") interaction.customId,
"pink",
),
) )
return return
} }

View File

@@ -24,12 +24,12 @@ export = {
} }
const snipeCache = new snipeCacheSchema({ const snipeCache = new snipeCacheSchema({
_id: new mongoose.Types.ObjectId, _id: new mongoose.Types.ObjectId(),
userid: message.author.id, userid: message.author.id,
channelid: message.channel.id, channelid: message.channel.id,
data: msg, data: msg,
}) })
await snipeCache.save() await snipeCache.save()
} },
} as Event } as Event

View File

@@ -1,8 +1,4 @@
import { import { userMention, channelMention, VoiceState } from "discord.js"
userMention,
channelMention,
VoiceState,
} from "discord.js"
import { color } from "config/options.json" import { color } from "config/options.json"
import { Event } from "interfaces" import { Event } from "interfaces"
import logToChannel from "utils/functions/logtochannel" import logToChannel from "utils/functions/logtochannel"
@@ -32,7 +28,8 @@ export = {
color: embedColor, color: embedColor,
footer: { footer: {
text: "ID: " + newState.member!.id, text: "ID: " + newState.member!.id,
icon_url: newState.member!.user.avatarURL() || undefined, icon_url:
newState.member!.user.avatarURL() || undefined,
}, },
timestamp: new Date().toISOString(), timestamp: new Date().toISOString(),
}, },
@@ -50,7 +47,8 @@ export = {
color: embedColor, color: embedColor,
footer: { footer: {
text: "ID: " + oldState.member!.id, text: "ID: " + oldState.member!.id,
icon_url: oldState.member!.user.avatarURL() || undefined, icon_url:
oldState.member!.user.avatarURL() || undefined,
}, },
timestamp: new Date().toISOString(), timestamp: new Date().toISOString(),
}, },
@@ -72,7 +70,8 @@ export = {
color: embedColor, color: embedColor,
footer: { footer: {
text: "ID: " + oldState.member!.id, text: "ID: " + oldState.member!.id,
icon_url: oldState.member!.user.avatarURL() || undefined, icon_url:
oldState.member!.user.avatarURL() || undefined,
}, },
timestamp: new Date().toISOString(), timestamp: new Date().toISOString(),
}, },

View File

@@ -5,7 +5,7 @@ const snipeCacheSchema = new Schema({
userid: { type: String, required: true }, userid: { type: String, required: true },
channelid: { type: String, required: true }, channelid: { type: String, required: true },
data: { type: Object, required: true }, data: { type: Object, required: true },
date: { type: Date, default: Date.now(), expires: 600 } date: { type: Date, default: Date.now(), expires: 600 },
}) })
export default model("snipeCache", snipeCacheSchema, "snipeCache") export default model("snipeCache", snipeCacheSchema, "snipeCache")

View File

@@ -7,4 +7,4 @@ type SnipeCache = {
attachments: string[] attachments: string[]
} }
export default SnipeCache export default SnipeCache

View File

@@ -1,3 +1,3 @@
import SnipeCache from "./Types" import SnipeCache from "./Types"
export { SnipeCache } export { SnipeCache }

View File

@@ -7,7 +7,7 @@ import {
RESTPutAPIApplicationGuildCommandsJSONBody, RESTPutAPIApplicationGuildCommandsJSONBody,
Routes, Routes,
} from "discord.js" } from "discord.js"
import fs = require("fs") import fs from "fs"
type FileType = "js" | "ts" type FileType = "js" | "ts"
export default async function autoDeployCommands(fileType: FileType) { export default async function autoDeployCommands(fileType: FileType) {
@@ -17,10 +17,10 @@ export default async function autoDeployCommands(fileType: FileType) {
if (fileType === "js") { if (fileType === "js") {
commandFiles = fs commandFiles = fs
.readdirSync("./dist/src/commands/") .readdirSync("./dist/commands/")
.filter(file => file.endsWith(fileType)) .filter(file => file.endsWith(fileType))
contentMenuCommands = fs contentMenuCommands = fs
.readdirSync("./dist/src/commands-contextmenu/") .readdirSync("./dist/commands-contextmenu/")
.filter(file => file.endsWith(fileType)) .filter(file => file.endsWith(fileType))
} else if (fileType === "ts") { } else if (fileType === "ts") {
commandFiles = fs commandFiles = fs
@@ -93,9 +93,7 @@ export default async function autoDeployCommands(fileType: FileType) {
} }
try { try {
console.log( console.log(color("Commands are different, starting deploy.", "red"))
color("Commands are different, starting deploy.", "red"),
)
console.log(color(currentCmds, "red")) console.log(color(currentCmds, "red"))
console.log( console.log(
`Started refreshing ${commands.length} application (/) commands.`, `Started refreshing ${commands.length} application (/) commands.`,
@@ -114,4 +112,4 @@ export default async function autoDeployCommands(fileType: FileType) {
} catch (error) { } catch (error) {
console.error(error) console.error(error)
} }
} }

View File

@@ -34,7 +34,9 @@ export class ExtendedClient extends Client {
async start() { async start() {
let token: string let token: string
if (process.env.NODE_ENV === "dev" && process.env.TYPESCRIPT) { if (process.env.NODE_ENV === "dev" && process.env.TYPESCRIPT) {
console.log(color("Running in development mode. [ts-node]", "lavender")) console.log(
color("Running in development mode. [ts-node]", "lavender"),
)
loadAllEvents(this, "ts") loadAllEvents(this, "ts")
token = env.dev.devtoken! token = env.dev.devtoken!
autoDeployCommands("ts") autoDeployCommands("ts")

View File

@@ -3,8 +3,8 @@ import { color } from "config/options.json"
import { Autocomplete } from "interfaces" import { Autocomplete } from "interfaces"
import { Events } from "discord.js" import { Events } from "discord.js"
import colorLog from "utils/functions/colors" import colorLog from "utils/functions/colors"
import path = require("path") import path from "path"
import fs = require("fs") import fs from "fs"
import logToChannel from "utils/functions/logtochannel" import logToChannel from "utils/functions/logtochannel"
type FileType = "js" | "ts" type FileType = "js" | "ts"
const embedColor = Number(color.replace("#", "0x")) const embedColor = Number(color.replace("#", "0x"))
@@ -32,10 +32,12 @@ export default function loadAutocompleteEvents(client: Client, ft: FileType) {
) { ) {
client.autocomplete.set(autocomplete.name, autocomplete) client.autocomplete.set(autocomplete.name, autocomplete)
} else { } else {
console.log(colorLog( console.log(
`[WARNING] The autocomplete at ${filePath} is missing a required "name", "execute" or "type" property.`, colorLog(
"red" `[WARNING] The autocomplete at ${filePath} is missing a required "name", "execute" or "type" property.`,
)) "red",
),
)
} }
} }
@@ -55,7 +57,6 @@ export default function loadAutocompleteEvents(client: Client, ft: FileType) {
await autocomplete.execute(interaction) await autocomplete.execute(interaction)
} catch (error) { } catch (error) {
if (process.env.NODE_ENV !== "dev") { if (process.env.NODE_ENV !== "dev") {
await logToChannel("error", { await logToChannel("error", {
embeds: [ embeds: [
{ {
@@ -63,7 +64,8 @@ export default function loadAutocompleteEvents(client: Client, ft: FileType) {
description: String(error), description: String(error),
color: embedColor, color: embedColor,
footer: { footer: {
icon_url: interaction.guild!.iconURL() || undefined, icon_url:
interaction.guild!.iconURL() || undefined,
text: text:
interaction.user.username + interaction.user.username +
" | " + " | " +

View File

@@ -3,8 +3,8 @@ import colorLog from "utils/functions/colors"
import { color } from "config/options.json" import { color } from "config/options.json"
import { Button } from "interfaces" import { Button } from "interfaces"
import { Events } from "discord.js" import { Events } from "discord.js"
import path = require("path") import path from "path"
import fs = require("fs") import fs from "fs"
import logToChannel from "utils/functions/logtochannel" import logToChannel from "utils/functions/logtochannel"
type FileType = "js" | "ts" type FileType = "js" | "ts"
const embedColor = Number(color.replace("#", "0x")) const embedColor = Number(color.replace("#", "0x"))
@@ -20,10 +20,12 @@ export default function loadButtonEvents(client: Client, ft: FileType) {
if ("name" in btn && "execute" in btn && btn.type === "button") { if ("name" in btn && "execute" in btn && btn.type === "button") {
client.buttons.set(btn.name, btn) client.buttons.set(btn.name, btn)
} else { } else {
console.log(colorLog( console.log(
`[WARNING] The button at ${filePath} is missing a required "name", "execute" or "type" property.`, colorLog(
"red" `[WARNING] The button at ${filePath} is missing a required "name", "execute" or "type" property.`,
)) "red",
),
)
} }
} }
@@ -50,7 +52,8 @@ export default function loadButtonEvents(client: Client, ft: FileType) {
description: "```" + error + "```", description: "```" + error + "```",
color: embedColor, color: embedColor,
footer: { footer: {
icon_url: interaction.guild!.iconURL() || undefined, icon_url:
interaction.guild!.iconURL() || undefined,
text: text:
interaction.user.username + interaction.user.username +
" | " + " | " +
@@ -64,18 +67,24 @@ export default function loadButtonEvents(client: Client, ft: FileType) {
console.error(error) console.error(error)
if (!interaction.deferred) { if (!interaction.deferred) {
await interaction.reply({ await interaction.reply({
embeds: [{ embeds: [
description: "There was an error while executing this button!", {
color: embedColor, description:
}], "There was an error while executing this button!",
color: embedColor,
},
],
ephemeral: true, ephemeral: true,
}) })
} else { } else {
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [
description: "There was an error while executing this button! 2", {
color: embedColor, description:
}] "There was an error while executing this button! 2",
color: embedColor,
},
],
}) })
} }
} }

View File

@@ -3,8 +3,8 @@ import colorLog from "utils/functions/colors"
import { color } from "config/options.json" import { color } from "config/options.json"
import { Command } from "interfaces" import { Command } from "interfaces"
import { Events } from "discord.js" import { Events } from "discord.js"
import path = require("path") import path from "path"
import fs = require("fs") import fs from "fs"
import logToChannel from "utils/functions/logtochannel" import logToChannel from "utils/functions/logtochannel"
type FileType = "js" | "ts" type FileType = "js" | "ts"
const embedColor = Number(color.replace("#", "0x")) const embedColor = Number(color.replace("#", "0x"))
@@ -20,10 +20,12 @@ export default function loadSlashCommandsEvents(client: Client, ft: FileType) {
if ("data" in cmd && "execute" in cmd && cmd.type === "slash") { if ("data" in cmd && "execute" in cmd && cmd.type === "slash") {
client.commands.set(cmd.data.name, cmd) client.commands.set(cmd.data.name, cmd)
} else { } else {
console.log(colorLog( console.log(
`[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`, colorLog(
"red" `[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`,
)) "red",
),
)
} }
} }
@@ -51,7 +53,8 @@ export default function loadSlashCommandsEvents(client: Client, ft: FileType) {
description: "```" + error + "```", description: "```" + error + "```",
color: embedColor, color: embedColor,
footer: { footer: {
icon_url: interaction.guild!.iconURL() || undefined, icon_url:
interaction.guild!.iconURL() || undefined,
text: text:
interaction.user.username + interaction.user.username +
" | " + " | " +
@@ -65,18 +68,24 @@ export default function loadSlashCommandsEvents(client: Client, ft: FileType) {
console.error(error) console.error(error)
if (!interaction.deferred) { if (!interaction.deferred) {
await interaction.reply({ await interaction.reply({
embeds: [{ embeds: [
description: "There was an error while executing this command!", {
color: embedColor, description:
}], "There was an error while executing this command!",
color: embedColor,
},
],
ephemeral: true, ephemeral: true,
}) })
} else { } else {
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [
description: "There was an error while executing this command!", {
color: embedColor, description:
}] "There was an error while executing this command!",
color: embedColor,
},
],
}) })
} }
} }

View File

@@ -3,8 +3,8 @@ import colorLog from "utils/functions/colors"
import { ContextMenu } from "interfaces" import { ContextMenu } from "interfaces"
import { color } from "config/options.json" import { color } from "config/options.json"
import { Events } from "discord.js" import { Events } from "discord.js"
import path = require("path") import path from "path"
import fs = require("fs") import fs from "fs"
import logToChannel from "utils/functions/logtochannel" import logToChannel from "utils/functions/logtochannel"
type FileType = "js" | "ts" type FileType = "js" | "ts"
const embedColor = Number(color.replace("#", "0x")) const embedColor = Number(color.replace("#", "0x"))
@@ -27,10 +27,12 @@ export default function loadContextMenuEvents(client: Client, ft: FileType) {
if ("data" in cmd && "execute" in cmd && cmd.type === "contextmenu") { if ("data" in cmd && "execute" in cmd && cmd.type === "contextmenu") {
client.contextmenus.set(cmd.data.name, cmd) client.contextmenus.set(cmd.data.name, cmd)
} else { } else {
console.log(colorLog( console.log(
`[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`, colorLog(
"red" `[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`,
)) "red",
),
)
} }
} }
@@ -58,7 +60,8 @@ export default function loadContextMenuEvents(client: Client, ft: FileType) {
description: "```" + error + "```", description: "```" + error + "```",
color: embedColor, color: embedColor,
footer: { footer: {
icon_url: interaction.guild!.iconURL() || undefined, icon_url:
interaction.guild!.iconURL() || undefined,
text: text:
interaction.user.username + interaction.user.username +
" | " + " | " +
@@ -72,18 +75,24 @@ export default function loadContextMenuEvents(client: Client, ft: FileType) {
console.error(error) console.error(error)
if (!interaction.deferred) { if (!interaction.deferred) {
await interaction.reply({ await interaction.reply({
embeds: [{ embeds: [
description: "There was an error while executing this contextmenu command!", {
color: embedColor, description:
}], "There was an error while executing this contextmenu command!",
color: embedColor,
},
],
ephemeral: true, ephemeral: true,
}) })
} else { } else {
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [
description: "There was an error while executing this contextmenu command!", {
color: embedColor, description:
}] "There was an error while executing this contextmenu command!",
color: embedColor,
},
],
}) })
} }
} }

View File

@@ -1,7 +1,7 @@
import { ExtendedClient as Client } from "utils/Client" import { ExtendedClient as Client } from "utils/Client"
import { Event } from "interfaces" import { Event } from "interfaces"
import path = require("path") import path from "path"
import fs = require("fs") import fs from "fs"
export default function loadEvents(client: Client) { export default function loadEvents(client: Client) {
const serverDir = path.join(__dirname, "..", "..", "events", "server") const serverDir = path.join(__dirname, "..", "..", "events", "server")

View File

@@ -3,8 +3,8 @@ import colorLog from "utils/functions/colors"
import { color } from "config/options.json" import { color } from "config/options.json"
import { Modal } from "interfaces" import { Modal } from "interfaces"
import { Events } from "discord.js" import { Events } from "discord.js"
import path = require("path") import path from "path"
import fs = require("fs") import fs from "fs"
import logToChannel from "utils/functions/logtochannel" import logToChannel from "utils/functions/logtochannel"
type FileType = "js" | "ts" type FileType = "js" | "ts"
const embedColor = Number(color.replace("#", "0x")) const embedColor = Number(color.replace("#", "0x"))
@@ -22,10 +22,12 @@ export default function loadModalEvents(client: Client, ft: FileType) {
if ("name" in modal && "execute" in modal && modal.type === "modal") { if ("name" in modal && "execute" in modal && modal.type === "modal") {
client.modals.set(modal.name, modal) client.modals.set(modal.name, modal)
} else { } else {
console.log(colorLog( console.log(
`[WARNING] The modal at ${filePath} is missing a required "name", "execute" or "type" property.`, colorLog(
"red" `[WARNING] The modal at ${filePath} is missing a required "name", "execute" or "type" property.`,
)) "red",
),
)
} }
} }
@@ -52,7 +54,8 @@ export default function loadModalEvents(client: Client, ft: FileType) {
description: "```" + error + "```", description: "```" + error + "```",
color: embedColor, color: embedColor,
footer: { footer: {
icon_url: interaction.guild!.iconURL() || undefined, icon_url:
interaction.guild!.iconURL() || undefined,
text: text:
interaction.user.username + interaction.user.username +
" | " + " | " +
@@ -66,19 +69,25 @@ export default function loadModalEvents(client: Client, ft: FileType) {
console.error(error) console.error(error)
if (!interaction.deferred) { if (!interaction.deferred) {
await interaction.reply({ await interaction.reply({
embeds: [{ embeds: [
description: "There was an error while executing this modal!", {
color: embedColor description:
}] "There was an error while executing this modal!",
color: embedColor,
},
],
}) })
} else { } else {
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [
description: "There was an error while executing this modal!", {
color: embedColor description:
}] "There was an error while executing this modal!",
color: embedColor,
},
],
}) })
} }
} }
}) })
} }

View File

@@ -10,14 +10,14 @@ function getExpForLevel(level: number): number {
} }
switch (respectedLevel) { switch (respectedLevel) {
case 1: case 1:
return 500 return 500
case 2: case 2:
return 1000 return 1000
case 3: case 3:
return 2000 return 2000
case 4: case 4:
return 3500 return 3500
} }
return 5000 return 5000
} }

View File

@@ -12,10 +12,10 @@ function getLevel(exp: number): number {
return exp <= 1 return exp <= 1
? 1 ? 1
: Math.floor( : Math.floor(
1 + 1 +
REVERSE_PQ_PREFIX + REVERSE_PQ_PREFIX +
Math.sqrt(REVERSE_CONST + GROWTH_DIVIDES_2 * exp), Math.sqrt(REVERSE_CONST + GROWTH_DIVIDES_2 * exp),
) )
} }
function hypixelLevel(exp: number): number { function hypixelLevel(exp: number): number {

View File

@@ -3,10 +3,4 @@ export { bedwarsLevel } from "./bedwars"
export { hypixelLevel } from "./hypixel" export { hypixelLevel } from "./hypixel"
export { formatUuid } from "./uuid" export { formatUuid } from "./uuid"
export { guildLevel, scaledGEXP } from "./guild" export { guildLevel, scaledGEXP } from "./guild"
export { export { getUUID, getIGN, getPlayer, getGuild, getHeadURL } from "./account"
getUUID,
getIGN,
getPlayer,
getGuild,
getHeadURL,
} from "./account"

View File

@@ -4,7 +4,7 @@ const colors = {
red: "#f38ba8", red: "#f38ba8",
lavender: "#b4befe", lavender: "#b4befe",
green: "#a6e3a1", green: "#a6e3a1",
pink: "#f5c2e7" pink: "#f5c2e7",
} }
export default function color(text: string, type: keyof typeof colors) { export default function color(text: string, type: keyof typeof colors) {
@@ -41,4 +41,4 @@ export default function color(text: string, type: keyof typeof colors) {
export default function colorize(text: string, color: keyof typeof colors) { export default function colorize(text: string, color: keyof typeof colors) {
return colors[color] + text + colors.reset return colors[color] + text + colors.reset
} */ } */

View File

@@ -1,4 +1,12 @@
import { guildid, onlineLogChannel, botLogChannel, guildLogChannel, errorLogChannel, moderationLogChannel, devLogChannel } from "config/options.json" import {
guildid,
onlineLogChannel,
botLogChannel,
guildLogChannel,
errorLogChannel,
moderationLogChannel,
devLogChannel,
} from "config/options.json"
import { Guild, MessageCreateOptions, TextChannel } from "discord.js" import { Guild, MessageCreateOptions, TextChannel } from "discord.js"
import Illegitimate from "utils/Illegitimate" import Illegitimate from "utils/Illegitimate"
@@ -8,12 +16,15 @@ const channels = {
guild: guildLogChannel, guild: guildLogChannel,
error: errorLogChannel, error: errorLogChannel,
mod: moderationLogChannel, mod: moderationLogChannel,
dev: devLogChannel dev: devLogChannel,
} }
type Channel = keyof typeof channels type Channel = keyof typeof channels
export default async function logToChannel(channel: Channel, message: MessageCreateOptions): Promise<void|null> { export default async function logToChannel(
channel: Channel,
message: MessageCreateOptions,
): Promise<void | null> {
const guild = Illegitimate.client.guilds.cache.get(guildid) as Guild const guild = Illegitimate.client.guilds.cache.get(guildid) as Guild
let logChannel: TextChannel let logChannel: TextChannel
@@ -24,9 +35,11 @@ export default async function logToChannel(channel: Channel, message: MessageCre
} }
if (!logChannel) { if (!logChannel) {
console.log(`[ERROR] Could not find channel used for ${channel} logging.`) console.log(
`[ERROR] Could not find channel used for ${channel} logging.`,
)
return return
} }
await logChannel.send(message) await logChannel.send(message)
} }

View File

@@ -7,7 +7,7 @@ import {
member, member,
guildStaff, guildStaff,
guildRole, guildRole,
defaultMember defaultMember,
} from "config/roles.json" } from "config/roles.json"
const roles = [ const roles = [
gm, gm,