✨ per guild embed config
This commit is contained in:
parent
39099ebaea
commit
ab708538c4
51 changed files with 387 additions and 198 deletions
|
@ -1,3 +1,4 @@
|
|||
import { ColorResolvable } from "discord.js";
|
||||
import { Schema, model } from "mongoose";
|
||||
|
||||
interface IGuild {
|
||||
|
@ -10,6 +11,13 @@ interface IGuild {
|
|||
minimumLength: number;
|
||||
workTimeout: number;
|
||||
};
|
||||
embeds: {
|
||||
successColor: ColorResolvable;
|
||||
waitColor: ColorResolvable;
|
||||
errorColor: ColorResolvable;
|
||||
footerIcon: string;
|
||||
footerText: string;
|
||||
};
|
||||
shop: { roles: { status: boolean; pricePerHour: number } };
|
||||
points: {
|
||||
status: boolean;
|
||||
|
@ -61,6 +69,28 @@ const guildSchema = new Schema<IGuild>(
|
|||
default: 900000,
|
||||
},
|
||||
},
|
||||
embeds: {
|
||||
successColor: {
|
||||
type: String,
|
||||
default: "#22bb33",
|
||||
},
|
||||
waitColor: {
|
||||
type: String,
|
||||
default: "#f0ad4e",
|
||||
},
|
||||
errorColor: {
|
||||
type: String,
|
||||
default: "#bb2124",
|
||||
},
|
||||
footerText: {
|
||||
type: String,
|
||||
default: "https://github.com/ZynerOrg/xyter",
|
||||
},
|
||||
footerIcon: {
|
||||
type: String,
|
||||
default: "https://github.com/ZynerOrg.png",
|
||||
},
|
||||
},
|
||||
shop: {
|
||||
roles: {
|
||||
status: {
|
||||
|
|
|
@ -3,10 +3,14 @@ import { GuildMember, MessageEmbed, TextChannel } from "discord.js";
|
|||
|
||||
import guildSchema from "@schemas/guild";
|
||||
|
||||
import { footerText, footerIcon, successColor } from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
export default {
|
||||
execute: async (member: GuildMember) => {
|
||||
const { footerText, footerIcon, successColor } = await getEmbedConfig(
|
||||
member.guild
|
||||
);
|
||||
|
||||
const guildData = await guildSchema.findOne({ guildId: member.guild.id });
|
||||
|
||||
const { client } = member;
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
import logger from "@logger";
|
||||
import { GuildMember, MessageEmbed, TextChannel } from "discord.js";
|
||||
|
||||
import guildSchema from "@schemas/guild";
|
||||
|
||||
import { footerText, footerIcon, successColor } from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
export default {
|
||||
execute: async (member: GuildMember) => {
|
||||
logger.info(member);
|
||||
const { footerText, footerIcon, successColor } = await getEmbedConfig(
|
||||
member.guild
|
||||
);
|
||||
|
||||
const guildData = await guildSchema.findOne({ guildId: member.guild.id });
|
||||
|
||||
|
|
|
@ -3,10 +3,14 @@ import { GuildMember, MessageEmbed, TextChannel } from "discord.js";
|
|||
|
||||
import guildSchema from "@schemas/guild";
|
||||
|
||||
import { footerText, footerIcon, errorColor } from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
export default {
|
||||
execute: async (member: GuildMember) => {
|
||||
const { footerText, footerIcon, errorColor } = await getEmbedConfig(
|
||||
member.guild
|
||||
);
|
||||
|
||||
const guildData = await guildSchema.findOne({ guildId: member.guild.id });
|
||||
|
||||
const { client } = member;
|
||||
|
|
|
@ -3,11 +3,13 @@ import { GuildMember, MessageEmbed, TextChannel } from "discord.js";
|
|||
|
||||
import guildSchema from "@schemas/guild";
|
||||
|
||||
import { footerText, footerIcon, errorColor } from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
export default {
|
||||
execute: async (member: GuildMember) => {
|
||||
logger.info(member);
|
||||
const { footerText, footerIcon, errorColor } = await getEmbedConfig(
|
||||
member.guild
|
||||
);
|
||||
|
||||
const guildData = await guildSchema.findOne({ guildId: member.guild.id });
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import { Interaction, MessageEmbed, TextChannel } from "discord.js";
|
|||
|
||||
import guildSchema from "@schemas/guild";
|
||||
|
||||
import { footerText, footerIcon, successColor } from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
export default {
|
||||
execute: async (interaction: Interaction) => {
|
||||
|
@ -11,6 +11,10 @@ export default {
|
|||
|
||||
if (interaction.guild === null) return;
|
||||
|
||||
const { footerText, footerIcon, successColor } = await getEmbedConfig(
|
||||
interaction.guild
|
||||
);
|
||||
|
||||
const guildData = await guildSchema.findOne({
|
||||
guildId: interaction.guild.id,
|
||||
});
|
||||
|
|
|
@ -3,12 +3,17 @@ import { CommandInteraction, MessageEmbed } from "discord.js";
|
|||
|
||||
import logger from "@logger";
|
||||
|
||||
import { errorColor, footerText, footerIcon } from "@config/embed";
|
||||
import deferReply from "@root/helpers/deferReply";
|
||||
import getCommandMetadata from "@root/helpers/getCommandMetadata";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
import getCommandMetadata from "@helpers/getCommandMetadata";
|
||||
|
||||
export default async (interaction: CommandInteraction) => {
|
||||
if (!interaction.isCommand()) return;
|
||||
if (interaction.guild == null) return;
|
||||
|
||||
const { errorColor, footerText, footerIcon } = await getEmbedConfig(
|
||||
interaction.guild
|
||||
);
|
||||
|
||||
const { client, guild, commandName, user, memberPermissions } = interaction;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import { Message, MessageEmbed, TextChannel } from "discord.js";
|
|||
|
||||
import guildSchema from "@schemas/guild";
|
||||
|
||||
import { footerText, footerIcon, successColor } from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
export default {
|
||||
execute: async (message: Message) => {
|
||||
|
@ -11,6 +11,10 @@ export default {
|
|||
|
||||
if (message.guild === null) return;
|
||||
|
||||
const { footerText, footerIcon, successColor } = await getEmbedConfig(
|
||||
message.guild
|
||||
);
|
||||
|
||||
const guildData = await guildSchema.findOne({
|
||||
guildId: message.guild.id,
|
||||
});
|
||||
|
|
|
@ -4,7 +4,7 @@ import { Message, MessageEmbed, TextChannel } from "discord.js";
|
|||
|
||||
import guildSchema from "@schemas/guild";
|
||||
|
||||
import { footerText, footerIcon, successColor } from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
export default {
|
||||
execute: async (oldMessage: Message, newMessage: Message) => {
|
||||
|
@ -14,6 +14,10 @@ export default {
|
|||
if (oldMessage.guild === null) return;
|
||||
if (newMessage.guild === null) return;
|
||||
|
||||
const { footerText, footerIcon, successColor } = await getEmbedConfig(
|
||||
newMessage.guild
|
||||
);
|
||||
|
||||
const guildData = await guildSchema.findOne({
|
||||
guildId: oldMessage.guild.id,
|
||||
});
|
||||
|
|
|
@ -5,7 +5,7 @@ import schedule from "node-schedule";
|
|||
import logger from "@logger";
|
||||
|
||||
// Jobs
|
||||
import shopRoles from "@root/schedules/jobs/shopRoles";
|
||||
import shopRoles from "@jobs/shopRoles";
|
||||
|
||||
export default async (client: Client) => {
|
||||
const expression = "*/5 * * * *";
|
|
@ -1,11 +1,17 @@
|
|||
import { CommandInteraction, MessageEmbed } from "discord.js";
|
||||
import { waitColor, footerText, footerIcon } from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
export default async (interaction: CommandInteraction, ephemeral: boolean) => {
|
||||
if (interaction.guild == null) return;
|
||||
|
||||
await interaction.deferReply({
|
||||
ephemeral,
|
||||
});
|
||||
|
||||
const { waitColor, footerText, footerIcon } = await getEmbedConfig(
|
||||
interaction.guild
|
||||
);
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
new MessageEmbed()
|
||||
|
|
18
src/helpers/getEmbedConfig.ts
Normal file
18
src/helpers/getEmbedConfig.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import guildSchema from "@schemas/guild";
|
||||
|
||||
import { ColorResolvable, Guild } from "discord.js";
|
||||
|
||||
export default async (guild: Guild) => {
|
||||
const guildConfig = await guildSchema.findOne({ guildId: guild.id });
|
||||
|
||||
if (guildConfig == null)
|
||||
return {
|
||||
successColor: "#22bb33" as ColorResolvable,
|
||||
waitColor: "#f0ad4e" as ColorResolvable,
|
||||
errorColor: "#bb2124" as ColorResolvable,
|
||||
footerIcon: "https://github.com/ZynerOrg.png",
|
||||
footerText: "https://github.com/ZynerOrg/xyter",
|
||||
};
|
||||
|
||||
return guildConfig.embeds;
|
||||
};
|
|
@ -5,11 +5,11 @@ import { token, intents } from "@config/discord";
|
|||
import { Client } from "discord.js"; // discord.js
|
||||
|
||||
import database from "@root/events";
|
||||
import schedules from "@schedules";
|
||||
import schedules from "@handlers/schedules";
|
||||
import events from "@handlers/events";
|
||||
import commands from "@handlers/commands";
|
||||
|
||||
async function main() {
|
||||
const main = async () => {
|
||||
const client = new Client({
|
||||
intents,
|
||||
});
|
||||
|
@ -21,6 +21,6 @@ async function main() {
|
|||
await events(client);
|
||||
|
||||
await client.login(token);
|
||||
}
|
||||
};
|
||||
|
||||
main();
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
// Dependencies
|
||||
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||
import { CommandInteraction } from "discord.js";
|
||||
|
||||
// Handlers
|
||||
import logger from "@logger";
|
||||
|
||||
// Modules
|
||||
import modules from "./modules";
|
||||
|
||||
import { SlashCommandSubcommandGroupBuilder } from "@discordjs/builders";
|
||||
// Handlers
|
||||
import logger from "@logger";
|
||||
|
||||
// Function
|
||||
export default {
|
||||
modules,
|
||||
|
||||
builder: (group: SlashCommandSubcommandGroupBuilder) => {
|
||||
return group
|
||||
.setName("guild")
|
||||
.setDescription("Guild settings.")
|
||||
.addSubcommand(modules.pterodactyl.builder)
|
||||
.addSubcommand(modules.credits.builder)
|
||||
.addSubcommand(modules.points.builder)
|
||||
.addSubcommand(modules.welcome.builder)
|
||||
.addSubcommand(modules.audits.builder)
|
||||
.addSubcommand(modules.shop.builder);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
builder: new SlashCommandBuilder()
|
||||
.setName("config")
|
||||
.setDescription("Manage guild configurations.")
|
||||
|
||||
.addSubcommand(modules.pterodactyl.builder)
|
||||
.addSubcommand(modules.credits.builder)
|
||||
.addSubcommand(modules.points.builder)
|
||||
.addSubcommand(modules.welcome.builder)
|
||||
.addSubcommand(modules.audits.builder)
|
||||
.addSubcommand(modules.shop.builder)
|
||||
.addSubcommand(modules.embeds.builder),
|
||||
|
||||
async execute(interaction: CommandInteraction) {
|
||||
// Destructure member
|
||||
const { options } = interaction;
|
||||
|
||||
|
@ -53,6 +53,10 @@ export default {
|
|||
logger?.silly(`Subcommand is shop`);
|
||||
|
||||
return modules.shop.execute(interaction);
|
||||
case "embeds":
|
||||
logger?.silly(`Subcommand is shop`);
|
||||
|
||||
return modules.embeds.execute(interaction);
|
||||
default:
|
||||
logger?.silly(`Subcommand is not found`);
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
import { CommandInteraction, Permissions } from "discord.js";
|
||||
|
||||
// Configurations
|
||||
import { successColor, footerText, footerIcon } from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
// Handlers
|
||||
import logger from "@logger";
|
||||
|
@ -35,8 +35,11 @@ export default {
|
|||
);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
// Destructure member
|
||||
const { options, guild } = interaction;
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild);
|
||||
|
||||
const { guild, options } = interaction;
|
||||
|
||||
// Get options
|
||||
const status = options?.getBoolean("status");
|
|
@ -2,7 +2,7 @@
|
|||
import { CommandInteraction, Permissions } from "discord.js";
|
||||
|
||||
// Configurations
|
||||
import { successColor, footerText, footerIcon } from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
//Handlers
|
||||
import logger from "@logger";
|
||||
|
@ -51,9 +51,13 @@ export default {
|
|||
);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
// Destructure member
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild); // Destructure member
|
||||
const { guild, options } = interaction;
|
||||
|
||||
if (guild == null) return;
|
||||
|
||||
// Get options
|
||||
const status = options?.getBoolean("status");
|
||||
const rate = options?.getNumber("rate");
|
129
src/plugins/config/modules/embeds.ts
Normal file
129
src/plugins/config/modules/embeds.ts
Normal file
|
@ -0,0 +1,129 @@
|
|||
// Dependencies
|
||||
import { ColorResolvable, CommandInteraction, Permissions } from "discord.js";
|
||||
|
||||
//Handlers
|
||||
import logger from "@logger";
|
||||
|
||||
// Models
|
||||
import guildSchema from "@schemas/guild";
|
||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
// Function
|
||||
export default {
|
||||
metadata: {
|
||||
guildOnly: true,
|
||||
ephemeral: true,
|
||||
permissions: [Permissions.FLAGS.MANAGE_GUILD],
|
||||
},
|
||||
|
||||
builder: (command: SlashCommandSubcommandBuilder) => {
|
||||
return command
|
||||
.setName("embeds")
|
||||
.setDescription(`Embeds`)
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName("success-color")
|
||||
.setDescription("No provided description")
|
||||
)
|
||||
.addStringOption((option) =>
|
||||
option.setName("wait-color").setDescription("No provided description")
|
||||
)
|
||||
.addStringOption((option) =>
|
||||
option.setName("error-color").setDescription("No provided description")
|
||||
)
|
||||
.addStringOption((option) =>
|
||||
option.setName("footer-icon").setDescription("No provided description")
|
||||
)
|
||||
.addStringOption((option) =>
|
||||
option.setName("footer-text").setDescription("No provided description")
|
||||
);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
// Destructure member
|
||||
const { guild, options } = interaction;
|
||||
|
||||
if (guild == null) return;
|
||||
|
||||
const embedConfig = await getEmbedConfig(guild);
|
||||
|
||||
if (embedConfig == null) return;
|
||||
|
||||
logger.info(embedConfig);
|
||||
|
||||
// Get options
|
||||
const successColor = options?.getString("success-color") as ColorResolvable;
|
||||
const waitColor = options?.getString("wait-color") as ColorResolvable;
|
||||
const errorColor = options?.getString("error-color") as ColorResolvable;
|
||||
const footerIcon = options?.getString("footer-icon");
|
||||
const footerText = options?.getString("footer-text");
|
||||
|
||||
// Get guild object
|
||||
const guildDB = await guildSchema?.findOne({
|
||||
guildId: guild?.id,
|
||||
});
|
||||
|
||||
if (guildDB === null) {
|
||||
return logger?.silly(`Guild is null`);
|
||||
}
|
||||
|
||||
// Modify values
|
||||
guildDB.embeds.successColor =
|
||||
successColor !== null ? successColor : guildDB?.embeds?.successColor;
|
||||
guildDB.embeds.waitColor =
|
||||
waitColor !== null ? waitColor : guildDB?.embeds?.waitColor;
|
||||
guildDB.embeds.errorColor =
|
||||
errorColor !== null ? errorColor : guildDB?.embeds?.errorColor;
|
||||
guildDB.embeds.footerIcon =
|
||||
footerIcon !== null ? footerIcon : guildDB?.embeds?.footerIcon;
|
||||
guildDB.embeds.footerText =
|
||||
footerText !== null ? footerText : guildDB?.embeds?.footerText;
|
||||
|
||||
// Save guild
|
||||
await guildDB?.save()?.then(async () => {
|
||||
logger?.silly(`Guild saved`);
|
||||
|
||||
return interaction?.editReply({
|
||||
embeds: [
|
||||
{
|
||||
title: ":tools: Settings - Guild [Credits]",
|
||||
description: `Credits settings updated.`,
|
||||
color: successColor || embedConfig.successColor,
|
||||
fields: [
|
||||
{
|
||||
name: "🤖 Success Color",
|
||||
value: `${guildDB?.embeds?.successColor}`,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: "📈 Wait Color",
|
||||
value: `${guildDB?.embeds?.waitColor}`,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: "📈 Error Color",
|
||||
value: `${guildDB?.embeds?.errorColor}`,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: "🔨 Footer Icon",
|
||||
value: `${guildDB?.embeds?.footerIcon}`,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: "⏰ Footer Text",
|
||||
value: `${guildDB?.embeds?.footerText}`,
|
||||
inline: true,
|
||||
},
|
||||
],
|
||||
timestamp: new Date(),
|
||||
footer: {
|
||||
iconURL: footerIcon || embedConfig.footerIcon,
|
||||
text: footerText || embedConfig.footerText,
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
},
|
||||
};
|
9
src/plugins/config/modules/index.ts
Normal file
9
src/plugins/config/modules/index.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import audits from "@plugins/config/modules/audits";
|
||||
import credits from "@plugins/config/modules/credits";
|
||||
import points from "@plugins/config/modules/points";
|
||||
import pterodactyl from "@plugins/config/modules/pterodactyl";
|
||||
import shop from "@plugins/config/modules/shop";
|
||||
import welcome from "@plugins/config/modules/welcome";
|
||||
import embeds from "@plugins/config/modules/embeds";
|
||||
|
||||
export default { audits, credits, points, pterodactyl, shop, welcome, embeds };
|
|
@ -2,7 +2,7 @@
|
|||
import { CommandInteraction, Permissions } from "discord.js";
|
||||
|
||||
// Configurations
|
||||
import { successColor, footerText, footerIcon } from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
// Handlers
|
||||
import logger from "@logger";
|
||||
|
@ -41,6 +41,10 @@ export default {
|
|||
);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild);
|
||||
|
||||
// Destructure member
|
||||
const { options, guild } = interaction;
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
import { CommandInteraction, Permissions } from "discord.js";
|
||||
|
||||
// Configurations
|
||||
import { successColor, footerText, footerIcon } from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
// Handlers
|
||||
import logger from "@logger";
|
||||
|
@ -38,7 +38,9 @@ export default {
|
|||
);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
// Destructure member
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild); // Destructure member
|
||||
const { options, guild } = interaction;
|
||||
|
||||
// Get options
|
|
@ -2,7 +2,7 @@
|
|||
import { CommandInteraction, Permissions } from "discord.js";
|
||||
|
||||
// Configurations
|
||||
import { successColor, footerText, footerIcon } from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
// Handlers
|
||||
import logger from "@logger";
|
||||
|
@ -35,7 +35,9 @@ export default {
|
|||
);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
// Destructure member
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild); // Destructure member
|
||||
const { options, guild } = interaction;
|
||||
|
||||
// Get options
|
|
@ -2,7 +2,7 @@
|
|||
import { CommandInteraction, Permissions } from "discord.js";
|
||||
|
||||
// Configurations
|
||||
import { successColor, footerText, footerIcon } from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
// Handlers
|
||||
import logger from "@logger";
|
||||
|
@ -53,7 +53,9 @@ export default {
|
|||
);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
// Destructure member
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild); // Destructure member
|
||||
const { options, guild } = interaction;
|
||||
|
||||
// Get options
|
|
@ -1,9 +1,4 @@
|
|||
import {
|
||||
errorColor,
|
||||
successColor,
|
||||
footerText,
|
||||
footerIcon,
|
||||
} from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
import { CommandInteraction, MessageEmbed } from "discord.js";
|
||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||
|
@ -30,6 +25,9 @@ export default {
|
|||
},
|
||||
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild);
|
||||
const { options, guild } = interaction;
|
||||
|
||||
const discordChannel = options?.getChannel("channel");
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
import {
|
||||
errorColor,
|
||||
successColor,
|
||||
footerText,
|
||||
footerIcon,
|
||||
} from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
import { CommandInteraction, MessageEmbed } from "discord.js";
|
||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||
|
@ -24,6 +19,9 @@ export default {
|
|||
);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild);
|
||||
const { options, user, guild } = interaction;
|
||||
|
||||
const discordUser = options.getUser("user");
|
||||
|
|
|
@ -2,12 +2,7 @@
|
|||
import { CommandInteraction, MessageEmbed } from "discord.js";
|
||||
|
||||
// Configurations
|
||||
import {
|
||||
errorColor,
|
||||
successColor,
|
||||
footerText,
|
||||
footerIcon,
|
||||
} from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
// Handlers
|
||||
import logger from "@logger";
|
||||
|
@ -44,6 +39,9 @@ export default {
|
|||
);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild);
|
||||
const { options, user, guild, client, locale } = interaction;
|
||||
|
||||
const optionUser = options.getUser("user");
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
import {
|
||||
successColor,
|
||||
errorColor,
|
||||
footerText,
|
||||
footerIcon,
|
||||
} from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
import { CommandInteraction, MessageEmbed } from "discord.js";
|
||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||
|
@ -18,6 +13,9 @@ export default {
|
|||
return command.setName("top").setDescription(`View the top users`);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild);
|
||||
const { guild } = interaction;
|
||||
|
||||
const embed = new MessageEmbed()
|
||||
|
|
|
@ -4,12 +4,7 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
|||
import Chance from "chance";
|
||||
|
||||
// Configurations
|
||||
import {
|
||||
successColor,
|
||||
errorColor,
|
||||
footerText,
|
||||
footerIcon,
|
||||
} from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
// Handlers
|
||||
import logger from "@logger";
|
||||
|
@ -28,7 +23,9 @@ export default {
|
|||
return command.setName("work").setDescription(`Work to earn credits`);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
// Destructure member
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild); // Destructure member
|
||||
const { guild, user } = interaction;
|
||||
|
||||
const embed = new MessageEmbed()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { successColor, footerText, footerIcon } from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
import axios from "axios";
|
||||
import { CommandInteraction, MessageEmbed } from "discord.js";
|
||||
|
@ -12,6 +12,9 @@ export default {
|
|||
return command.setName("meme").setDescription("Get a meme from r/memes)");
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild);
|
||||
await axios
|
||||
.get("https://www.reddit.com/r/memes/random/.json")
|
||||
.then(async (res) => {
|
||||
|
|
|
@ -3,6 +3,7 @@ import { SlashCommandSubcommandGroupBuilder } from "@discordjs/builders";
|
|||
import { CommandInteraction } from "discord.js";
|
||||
|
||||
import logger from "@logger";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
// Modules
|
||||
import modules from "./modules";
|
||||
|
@ -20,6 +21,9 @@ export default {
|
|||
},
|
||||
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild);
|
||||
const { options } = interaction;
|
||||
|
||||
if (options?.getSubcommand() === "add") {
|
||||
|
|
|
@ -4,14 +4,8 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
|||
import { ChannelType } from "discord-api-types/v10";
|
||||
|
||||
// Configurations
|
||||
import {
|
||||
successColor,
|
||||
errorColor,
|
||||
footerText,
|
||||
footerIcon,
|
||||
} from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
// Handlers
|
||||
import logger from "@logger";
|
||||
|
||||
// Models
|
||||
|
@ -49,6 +43,9 @@ export default {
|
|||
);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild);
|
||||
const { options, guild, locale } = interaction;
|
||||
|
||||
const discordChannel = options?.getChannel("channel");
|
||||
|
|
|
@ -2,12 +2,7 @@
|
|||
import { CommandInteraction, MessageEmbed, Permissions } from "discord.js";
|
||||
|
||||
// Configurations
|
||||
import {
|
||||
successColor,
|
||||
errorColor,
|
||||
footerText,
|
||||
footerIcon,
|
||||
} from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
// Handlers
|
||||
import logger from "@logger";
|
||||
|
@ -38,6 +33,9 @@ export default {
|
|||
);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild);
|
||||
const { options, guild, locale } = interaction;
|
||||
|
||||
const discordChannel = options?.getChannel("channel");
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { CommandInteraction } from "discord.js";
|
||||
import { SlashCommandSubcommandGroupBuilder } from "@discordjs/builders";
|
||||
import logger from "@logger";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
import modules from "./modules";
|
||||
|
||||
|
@ -17,6 +18,9 @@ export default {
|
|||
.addSubcommand(modules.transfer.builder);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild);
|
||||
const { options } = interaction;
|
||||
|
||||
switch (options.getSubcommand()) {
|
||||
|
|
|
@ -3,12 +3,7 @@ import { CommandInteraction, MessageEmbed, Permissions } from "discord.js";
|
|||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||
|
||||
// Configurations
|
||||
import {
|
||||
successColor,
|
||||
errorColor,
|
||||
footerText,
|
||||
footerIcon,
|
||||
} from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
// Handlers
|
||||
import logger from "@logger";
|
||||
|
@ -45,7 +40,9 @@ export default {
|
|||
);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
// Destructure
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild); // Destructure
|
||||
const { guild, options } = interaction;
|
||||
|
||||
const discordReceiver = options?.getUser("user");
|
||||
|
|
|
@ -2,12 +2,7 @@
|
|||
import { CommandInteraction, MessageEmbed, Permissions } from "discord.js";
|
||||
|
||||
// Configurations
|
||||
import {
|
||||
successColor,
|
||||
errorColor,
|
||||
footerText,
|
||||
footerIcon,
|
||||
} from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
// Handlers
|
||||
import logger from "@logger";
|
||||
|
@ -44,6 +39,9 @@ export default {
|
|||
);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild);
|
||||
const { options, guild } = interaction;
|
||||
|
||||
const discordUser = options.getUser("user");
|
||||
|
|
|
@ -2,12 +2,7 @@
|
|||
import { CommandInteraction, MessageEmbed, Permissions } from "discord.js";
|
||||
|
||||
// Configurations
|
||||
import {
|
||||
successColor,
|
||||
errorColor,
|
||||
footerText,
|
||||
footerIcon,
|
||||
} from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
// Handlers
|
||||
import logger from "@logger";
|
||||
|
@ -45,7 +40,9 @@ export default {
|
|||
);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
// Destructure
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild); // Destructure
|
||||
const { guild, options } = interaction;
|
||||
|
||||
// User option
|
||||
|
|
|
@ -2,12 +2,7 @@
|
|||
import { CommandInteraction, MessageEmbed, Permissions } from "discord.js";
|
||||
|
||||
// Configurations
|
||||
import {
|
||||
successColor,
|
||||
errorColor,
|
||||
footerText,
|
||||
footerIcon,
|
||||
} from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
// Handlers
|
||||
import logger from "@logger";
|
||||
|
@ -51,7 +46,9 @@ export default {
|
|||
);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
// Destructure member
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild); // Destructure member
|
||||
const { guild, options } = interaction;
|
||||
|
||||
// Get options
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import { CommandInteraction } from "discord.js";
|
||||
|
||||
// Configurations
|
||||
import { successColor, footerText, footerIcon } from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
// Models
|
||||
import fetchUser from "@helpers/fetchUser";
|
||||
|
@ -24,7 +24,9 @@ export default {
|
|||
},
|
||||
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
// Destructure
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild); // Destructure
|
||||
const { client, options, user, guild } = interaction;
|
||||
|
||||
// Target information
|
||||
|
|
|
@ -2,12 +2,7 @@
|
|||
import { CommandInteraction } from "discord.js";
|
||||
|
||||
// Configurations
|
||||
import {
|
||||
successColor,
|
||||
errorColor,
|
||||
footerText,
|
||||
footerIcon,
|
||||
} from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
import { timeout } from "@config/reputation";
|
||||
|
||||
|
@ -48,7 +43,9 @@ export default {
|
|||
);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
// Destructure
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild); // Destructure
|
||||
const { options, user, guild } = interaction;
|
||||
|
||||
// Target option
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
// Dependencies
|
||||
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||
import { CommandInteraction } from "discord.js";
|
||||
|
||||
// Modules
|
||||
import modules from "./modules";
|
||||
|
||||
// Handlers
|
||||
import logger from "@logger";
|
||||
|
||||
// Function
|
||||
export default {
|
||||
modules,
|
||||
|
||||
builder: new SlashCommandBuilder()
|
||||
.setName("settings")
|
||||
.setDescription("Manage settings.")
|
||||
|
||||
.addSubcommandGroup(modules.guild.builder),
|
||||
|
||||
async execute(interaction: CommandInteraction) {
|
||||
const { options } = interaction;
|
||||
|
||||
if (options.getSubcommandGroup() === "guild") {
|
||||
logger.silly(`Executing guild subcommand`);
|
||||
|
||||
return modules.guild.execute(interaction);
|
||||
}
|
||||
|
||||
logger.silly(`No subcommand group found`);
|
||||
},
|
||||
};
|
|
@ -1,8 +0,0 @@
|
|||
import audits from "@plugins/settings/modules/guild/modules/audits";
|
||||
import credits from "@plugins/settings/modules/guild/modules/credits";
|
||||
import points from "@plugins/settings/modules/guild/modules/points";
|
||||
import pterodactyl from "@plugins/settings/modules/guild/modules/pterodactyl";
|
||||
import shop from "@plugins/settings/modules/guild/modules/shop";
|
||||
import welcome from "@plugins/settings/modules/guild/modules/welcome";
|
||||
|
||||
export default { audits, credits, points, pterodactyl, shop, welcome };
|
|
@ -1,3 +0,0 @@
|
|||
import guild from "@plugins/settings/modules/guild";
|
||||
|
||||
export default { guild };
|
|
@ -2,12 +2,7 @@ import { CommandInteraction } from "discord.js";
|
|||
import { v4 as uuidv4 } from "uuid";
|
||||
import axios from "axios";
|
||||
|
||||
import {
|
||||
successColor,
|
||||
errorColor,
|
||||
footerText,
|
||||
footerIcon,
|
||||
} from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
import logger from "@logger";
|
||||
import encryption from "@handlers/encryption";
|
||||
|
@ -32,6 +27,9 @@ export default {
|
|||
);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild);
|
||||
const { options, guild, user, client } = interaction;
|
||||
|
||||
const optionAmount = options?.getInteger("amount");
|
||||
|
|
|
@ -5,7 +5,7 @@ import { CommandInteraction } from "discord.js";
|
|||
// Handlers
|
||||
import logger from "@logger";
|
||||
|
||||
import { errorColor, footerText, footerIcon } from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
// Modules
|
||||
import modules from "./modules";
|
||||
|
@ -24,6 +24,9 @@ export default {
|
|||
.addSubcommand(modules.cancel.builder);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild);
|
||||
const { options, guild } = interaction;
|
||||
|
||||
const guildDB = await guildSchema?.findOne({
|
||||
|
|
|
@ -6,12 +6,8 @@ import {
|
|||
} from "discord.js";
|
||||
|
||||
// Configurations
|
||||
import {
|
||||
successColor,
|
||||
errorColor,
|
||||
footerText,
|
||||
footerIcon,
|
||||
} from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
// Models
|
||||
import shopRolesSchema from "@schemas/shopRole";
|
||||
import guildSchema from "@schemas/guild";
|
||||
|
@ -45,6 +41,9 @@ export default {
|
|||
);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild);
|
||||
const { options, guild, user, member } = interaction;
|
||||
|
||||
const optionName = options?.getString("name");
|
||||
|
|
|
@ -2,12 +2,8 @@
|
|||
import { CommandInteraction, GuildMemberRoleManager } from "discord.js";
|
||||
|
||||
// Configurations
|
||||
import {
|
||||
successColor,
|
||||
errorColor,
|
||||
footerText,
|
||||
footerIcon,
|
||||
} from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
// Models
|
||||
import shopRolesSchema from "@schemas/shopRole";
|
||||
|
||||
|
@ -34,6 +30,9 @@ export default {
|
|||
);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild);
|
||||
const { options, guild, user, member } = interaction;
|
||||
|
||||
const optionRole = options.getRole("role");
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import { CommandInteraction } from "discord.js";
|
||||
|
||||
// Configurations
|
||||
import { successColor, footerText, footerIcon } from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
import { hosterName, hosterUrl } from "@config/other";
|
||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||
|
@ -15,6 +15,9 @@ export default {
|
|||
return command.setName("about").setDescription("About this bot!)");
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild);
|
||||
const interactionEmbed = {
|
||||
title: ":hammer: Utilities [About]",
|
||||
description: `This bot is hosted by ${
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { successColor, footerText, footerIcon } from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
import { CommandInteraction, MessageEmbed } from "discord.js";
|
||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||
|
@ -17,6 +17,9 @@ export default {
|
|||
);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild);
|
||||
const userOption = interaction.options.getUser("user");
|
||||
|
||||
const targetUser = userOption || interaction.user;
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
import axios from "axios";
|
||||
import { CommandInteraction, MessageEmbed } from "discord.js";
|
||||
|
||||
import {
|
||||
successColor,
|
||||
errorColor,
|
||||
footerText,
|
||||
footerIcon,
|
||||
} from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
|
||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||
|
||||
|
@ -30,6 +26,9 @@ export default {
|
|||
);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild);
|
||||
const embedTitle = "[:hammer:] Utility (Lookup)";
|
||||
|
||||
embedBuilder.setTitle(embedTitle);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { successColor, footerText, footerIcon } from "@config/embed";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
|
||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||
import { CommandInteraction } from "discord.js";
|
||||
export default {
|
||||
|
@ -8,6 +9,9 @@ export default {
|
|||
return command.setName("stats").setDescription("Check bot statistics!)");
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, successColor, footerText, footerIcon } =
|
||||
await getEmbedConfig(interaction.guild);
|
||||
const { client } = interaction;
|
||||
if (client?.uptime === null) return;
|
||||
let totalSeconds = client?.uptime / 1000;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
"@events/*": ["events/*"],
|
||||
"@logger": ["logger"],
|
||||
"@database": ["database"],
|
||||
"@schedules": ["schedules"],
|
||||
"@jobs/*": ["jobs/*"],
|
||||
"@handlers/*": ["handlers/*"],
|
||||
"@helpers/*": ["helpers/*"],
|
||||
"@locale": ["locale"],
|
||||
|
|
Loading…
Add table
Reference in a new issue