⚰️ remove unused imports
This commit is contained in:
parent
741c33f41d
commit
6a7f6f33a6
50 changed files with 268 additions and 403 deletions
|
@ -1,5 +1,5 @@
|
||||||
import "dotenv/config";
|
|
||||||
import { Client, Collection, GatewayIntentBits } from "discord.js"; // discord.js
|
import { Client, Collection, GatewayIntentBits } from "discord.js"; // discord.js
|
||||||
|
import "dotenv/config";
|
||||||
|
|
||||||
import * as managers from "./managers";
|
import * as managers from "./managers";
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,9 @@ import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
||||||
|
|
||||||
import logger from "../../../../../middlewares/logger";
|
import logger from "../../../../../middlewares/logger";
|
||||||
|
|
||||||
import guildSchema from "../../../../../models/guild";
|
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
import { ChannelType } from "discord-api-types/v10";
|
import { ChannelType } from "discord-api-types/v10";
|
||||||
|
import guildSchema from "../../../../../models/guild";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
metadata: {
|
metadata: {
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import {
|
import {
|
||||||
ChatInputCommandInteraction,
|
ChatInputCommandInteraction,
|
||||||
CommandInteraction,
|
|
||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
Permissions,
|
|
||||||
PermissionsBitField,
|
PermissionsBitField,
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
|
|
||||||
|
@ -10,9 +8,9 @@ import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
||||||
|
|
||||||
import logger from "../../../../../middlewares/logger";
|
import logger from "../../../../../middlewares/logger";
|
||||||
|
|
||||||
import apiSchema from "../../../../../models/api";
|
|
||||||
import encryption from "../../../../../handlers/encryption";
|
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
|
import encryption from "../../../../../handlers/encryption";
|
||||||
|
import apiSchema from "../../../../../models/api";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
metadata: {
|
metadata: {
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import {
|
import {
|
||||||
ChatInputCommandInteraction,
|
ChatInputCommandInteraction,
|
||||||
CommandInteraction,
|
|
||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
Permissions,
|
|
||||||
PermissionsBitField,
|
PermissionsBitField,
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
|
|
||||||
|
@ -10,8 +8,8 @@ import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
||||||
|
|
||||||
import logger from "../../../../../middlewares/logger";
|
import logger from "../../../../../middlewares/logger";
|
||||||
|
|
||||||
import guildSchema from "../../../../../models/guild";
|
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
|
import guildSchema from "../../../../../models/guild";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
metadata: {
|
metadata: {
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
import {
|
import { ChatInputCommandInteraction, ColorResolvable } from "discord.js";
|
||||||
ChatInputCommandInteraction,
|
|
||||||
ColorResolvable,
|
|
||||||
CommandInteraction,
|
|
||||||
} from "discord.js";
|
|
||||||
import guildSchema from "../../../../../../../models/guild";
|
|
||||||
import getEmbedConfig from "../../../../../../../helpers/getEmbedConfig";
|
import getEmbedConfig from "../../../../../../../helpers/getEmbedConfig";
|
||||||
|
import guildSchema from "../../../../../../../models/guild";
|
||||||
|
|
||||||
export default async (interaction: ChatInputCommandInteraction) => {
|
export default async (interaction: ChatInputCommandInteraction) => {
|
||||||
const { options, guild } = interaction;
|
const { options, guild } = interaction;
|
||||||
|
|
|
@ -1,16 +1,11 @@
|
||||||
import {
|
import {
|
||||||
ColorResolvable,
|
|
||||||
ChatInputCommandInteraction,
|
ChatInputCommandInteraction,
|
||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
Permissions,
|
|
||||||
PermissionsBitField,
|
PermissionsBitField,
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
|
|
||||||
import logger from "../../../../../middlewares/logger";
|
|
||||||
|
|
||||||
import guildSchema from "../../../../../models/guild";
|
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
import guildSchema from "../../../../../models/guild";
|
||||||
import getValues from "./components/getValues";
|
import getValues from "./components/getValues";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import audits from "./audits";
|
import audits from "./audits";
|
||||||
import credits from "./credits";
|
|
||||||
import points from "./points";
|
|
||||||
import cpgg from "./cpgg";
|
import cpgg from "./cpgg";
|
||||||
|
import credits from "./credits";
|
||||||
|
import embeds from "./embeds";
|
||||||
|
import points from "./points";
|
||||||
import shop from "./shop";
|
import shop from "./shop";
|
||||||
import welcome from "./welcome";
|
import welcome from "./welcome";
|
||||||
import embeds from "./embeds";
|
|
||||||
|
|
||||||
export default { audits, credits, points, cpgg, shop, welcome, embeds };
|
export default { audits, credits, points, cpgg, shop, welcome, embeds };
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import {
|
import {
|
||||||
ChatInputCommandInteraction,
|
ChatInputCommandInteraction,
|
||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
Permissions,
|
|
||||||
PermissionsBitField,
|
PermissionsBitField,
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
|
|
||||||
|
@ -9,8 +8,8 @@ import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
||||||
|
|
||||||
import logger from "../../../../../middlewares/logger";
|
import logger from "../../../../../middlewares/logger";
|
||||||
|
|
||||||
import guildSchema from "../../../../../models/guild";
|
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
|
import guildSchema from "../../../../../models/guild";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
metadata: {
|
metadata: {
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import {
|
import {
|
||||||
ChatInputCommandInteraction,
|
ChatInputCommandInteraction,
|
||||||
CommandInteraction,
|
|
||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
Permissions,
|
|
||||||
PermissionsBitField,
|
PermissionsBitField,
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
|
|
||||||
|
@ -10,8 +8,8 @@ import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
||||||
|
|
||||||
import logger from "../../../../../middlewares/logger";
|
import logger from "../../../../../middlewares/logger";
|
||||||
|
|
||||||
import guildSchema from "../../../../../models/guild";
|
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
|
import guildSchema from "../../../../../models/guild";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
metadata: {
|
metadata: {
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import {
|
import {
|
||||||
ChatInputCommandInteraction,
|
ChatInputCommandInteraction,
|
||||||
CommandInteraction,
|
|
||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
Permissions,
|
|
||||||
PermissionsBitField,
|
PermissionsBitField,
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
|
|
||||||
|
@ -10,9 +8,9 @@ import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
||||||
|
|
||||||
import logger from "../../../../../middlewares/logger";
|
import logger from "../../../../../middlewares/logger";
|
||||||
|
|
||||||
import guildSchema from "../../../../../models/guild";
|
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
import { ChannelType } from "discord-api-types/v10";
|
import { ChannelType } from "discord-api-types/v10";
|
||||||
|
import guildSchema from "../../../../../models/guild";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
metadata: {
|
metadata: {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { CommandInteraction } from "discord.js";
|
|
||||||
import { SlashCommandBuilder } from "@discordjs/builders";
|
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||||
|
import { ChatInputCommandInteraction } from "discord.js";
|
||||||
|
|
||||||
import modules from "../../commands/counters/modules";
|
import modules from "../../commands/counters/modules";
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ export const builder = new SlashCommandBuilder()
|
||||||
|
|
||||||
export const moduleData = modules;
|
export const moduleData = modules;
|
||||||
|
|
||||||
export const execute = async (interaction: CommandInteraction) => {
|
export const execute = async (interaction: ChatInputCommandInteraction) => {
|
||||||
if (interaction.options.getSubcommand() === "view") {
|
if (interaction.options.getSubcommand() === "view") {
|
||||||
await modules.view.execute(interaction);
|
await modules.view.execute(interaction);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
||||||
|
|
||||||
import { ChatInputCommandInteraction, EmbedBuilder } from "discord.js";
|
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
import { ChannelType } from "discord-api-types/v10";
|
import { ChannelType } from "discord-api-types/v10";
|
||||||
|
import { ChatInputCommandInteraction, EmbedBuilder } from "discord.js";
|
||||||
|
|
||||||
import counterSchema from "../../../../../models/counter";
|
import counterSchema from "../../../../../models/counter";
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { SlashCommandBuilder } from "@discordjs/builders";
|
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||||
import { CommandInteraction } from "discord.js";
|
import { ChatInputCommandInteraction } from "discord.js";
|
||||||
import logger from "../../../middlewares/logger";
|
import logger from "../../../middlewares/logger";
|
||||||
|
|
||||||
import modules from "./modules";
|
import modules from "./modules";
|
||||||
|
@ -15,7 +15,7 @@ export const builder = new SlashCommandBuilder()
|
||||||
|
|
||||||
export const moduleData = modules;
|
export const moduleData = modules;
|
||||||
|
|
||||||
export const execute = async (interaction: CommandInteraction) => {
|
export const execute = async (interaction: ChatInputCommandInteraction) => {
|
||||||
const { options } = interaction;
|
const { options } = interaction;
|
||||||
|
|
||||||
switch (options.getSubcommand()) {
|
switch (options.getSubcommand()) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
||||||
|
|
||||||
import { CommandInteraction, EmbedBuilder } from "discord.js";
|
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
|
import { CommandInteraction, EmbedBuilder } from "discord.js";
|
||||||
import logger from "../../../../../middlewares/logger";
|
import logger from "../../../../../middlewares/logger";
|
||||||
|
|
||||||
import fetchUser from "../../../../../helpers/fetchUser";
|
import fetchUser from "../../../../../helpers/fetchUser";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { CommandInteraction, EmbedBuilder } from "discord.js";
|
import { ChatInputCommandInteraction, EmbedBuilder } from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
||||||
|
@ -10,8 +10,8 @@ import logger from "../../../../../middlewares/logger";
|
||||||
import mongoose from "mongoose";
|
import mongoose from "mongoose";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import fetchUser from "../../../../../helpers/fetchUser";
|
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
|
import fetchUser from "../../../../../helpers/fetchUser";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default {
|
export default {
|
||||||
|
@ -37,7 +37,7 @@ export default {
|
||||||
option.setName("reason").setDescription("Your reason.")
|
option.setName("reason").setDescription("Your reason.")
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
execute: async (interaction: CommandInteraction) => {
|
execute: async (interaction: ChatInputCommandInteraction) => {
|
||||||
const { errorColor, successColor, footerText, footerIcon } =
|
const { errorColor, successColor, footerText, footerIcon } =
|
||||||
await getEmbedConfig(interaction.guild);
|
await getEmbedConfig(interaction.guild);
|
||||||
const { options, user, guild, client } = interaction;
|
const { options, user, guild, client } = interaction;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
||||||
|
|
||||||
import { CommandInteraction, EmbedBuilder } from "discord.js";
|
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
|
import { CommandInteraction, EmbedBuilder } from "discord.js";
|
||||||
import logger from "../../../../../middlewares/logger";
|
import logger from "../../../../../middlewares/logger";
|
||||||
|
|
||||||
import userSchema, { IUser } from "../../../../../models/user";
|
import userSchema, { IUser } from "../../../../../models/user";
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { CommandInteraction, EmbedBuilder } from "discord.js";
|
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
import Chance from "chance";
|
import Chance from "chance";
|
||||||
|
import { CommandInteraction, EmbedBuilder } from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
||||||
|
@ -13,8 +13,8 @@ import logger from "../../../../../middlewares/logger";
|
||||||
import * as cooldown from "../../../../../helpers/cooldown";
|
import * as cooldown from "../../../../../helpers/cooldown";
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
import fetchUser from "../../../../../helpers/fetchUser";
|
|
||||||
import fetchGuild from "../../../../../helpers/fetchGuild";
|
import fetchGuild from "../../../../../helpers/fetchGuild";
|
||||||
|
import fetchUser from "../../../../../helpers/fetchUser";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
metadata: { guildOnly: true, ephemeral: true },
|
metadata: { guildOnly: true, ephemeral: true },
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { SlashCommandBuilder } from "@discordjs/builders";
|
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||||
import { CommandInteraction } from "discord.js";
|
import { ChatInputCommandInteraction } from "discord.js";
|
||||||
|
|
||||||
import modules from "./modules";
|
import modules from "./modules";
|
||||||
export const moduleData = modules;
|
export const moduleData = modules;
|
||||||
|
@ -10,7 +10,7 @@ export const builder = new SlashCommandBuilder()
|
||||||
|
|
||||||
.addSubcommand(modules.lookup.builder);
|
.addSubcommand(modules.lookup.builder);
|
||||||
|
|
||||||
export const execute = async (interaction: CommandInteraction) => {
|
export const execute = async (interaction: ChatInputCommandInteraction) => {
|
||||||
switch (interaction.options.getSubcommand()) {
|
switch (interaction.options.getSubcommand()) {
|
||||||
case "lookup":
|
case "lookup":
|
||||||
return modules.lookup.execute(interaction);
|
return modules.lookup.execute(interaction);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { CommandInteraction, EmbedBuilder } from "discord.js";
|
import { ChatInputCommandInteraction, EmbedBuilder } from "discord.js";
|
||||||
|
|
||||||
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ export default {
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
execute: async (interaction: CommandInteraction) => {
|
execute: async (interaction: ChatInputCommandInteraction) => {
|
||||||
const { errorColor, successColor, footerText, footerIcon } =
|
const { errorColor, successColor, footerText, footerIcon } =
|
||||||
await getEmbedConfig(interaction.guild);
|
await getEmbedConfig(interaction.guild);
|
||||||
const embedTitle = "[:hammer:] Utility (Lookup)";
|
const embedTitle = "[:hammer:] Utility (Lookup)";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { SlashCommandBuilder } from "@discordjs/builders";
|
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||||
import { CommandInteraction } from "discord.js";
|
import { ChatInputCommandInteraction } from "discord.js";
|
||||||
import logger from "../../../middlewares/logger";
|
import logger from "../../../middlewares/logger";
|
||||||
|
|
||||||
import modules from "../../commands/fun/modules";
|
import modules from "../../commands/fun/modules";
|
||||||
|
@ -12,7 +12,7 @@ export const builder = new SlashCommandBuilder()
|
||||||
|
|
||||||
export const moduleData = modules;
|
export const moduleData = modules;
|
||||||
|
|
||||||
export const execute = async (interaction: CommandInteraction) => {
|
export const execute = async (interaction: ChatInputCommandInteraction) => {
|
||||||
const { options } = interaction;
|
const { options } = interaction;
|
||||||
|
|
||||||
if (options.getSubcommand() === "meme") {
|
if (options.getSubcommand() === "meme") {
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
|
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { CommandInteraction, EmbedBuilder } from "discord.js";
|
import { CommandInteraction, EmbedBuilder } from "discord.js";
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
metadata: { guildOnly: false, ephemeral: false, cooldown: 15 },
|
metadata: { guildOnly: false, ephemeral: false, cooldown: 15 },
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//Dependencies
|
//Dependencies
|
||||||
import { SlashCommandBuilder } from "@discordjs/builders";
|
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||||
import { CommandInteraction } from "discord.js";
|
import { ChatInputCommandInteraction } from "discord.js";
|
||||||
|
|
||||||
// Groups
|
// Groups
|
||||||
import modules from "../../commands/manage/modules";
|
import modules from "../../commands/manage/modules";
|
||||||
|
@ -14,7 +14,7 @@ export const builder = new SlashCommandBuilder()
|
||||||
.addSubcommandGroup(modules.counters.builder)
|
.addSubcommandGroup(modules.counters.builder)
|
||||||
.addSubcommandGroup(modules.credits.builder);
|
.addSubcommandGroup(modules.credits.builder);
|
||||||
|
|
||||||
export const execute = async (interaction: CommandInteraction) => {
|
export const execute = async (interaction: ChatInputCommandInteraction) => {
|
||||||
// Destructure
|
// Destructure
|
||||||
const { options } = interaction;
|
const { options } = interaction;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { SlashCommandSubcommandGroupBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandGroupBuilder } from "@discordjs/builders";
|
||||||
import { ChatInputCommandInteraction, CommandInteraction } from "discord.js";
|
import { ChatInputCommandInteraction } from "discord.js";
|
||||||
|
|
||||||
import logger from "../../../../../middlewares/logger";
|
import logger from "../../../../../middlewares/logger";
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import {
|
|
||||||
EmbedBuilder,
|
|
||||||
ChatInputCommandInteraction,
|
|
||||||
PermissionsBitField,
|
|
||||||
} from "discord.js";
|
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
import { ChannelType } from "discord-api-types/v10";
|
import { ChannelType } from "discord-api-types/v10";
|
||||||
|
import {
|
||||||
|
ChatInputCommandInteraction,
|
||||||
|
EmbedBuilder,
|
||||||
|
PermissionsBitField,
|
||||||
|
} from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import getEmbedConfig from "../../../../../../../helpers/getEmbedConfig";
|
import getEmbedConfig from "../../../../../../../helpers/getEmbedConfig";
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import {
|
import {
|
||||||
ChatInputCommandInteraction,
|
ChatInputCommandInteraction,
|
||||||
CommandInteraction,
|
|
||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
Permissions,
|
|
||||||
PermissionsBitField,
|
PermissionsBitField,
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
|
|
||||||
|
@ -14,9 +12,9 @@ import getEmbedConfig from "../../../../../../../helpers/getEmbedConfig";
|
||||||
import logger from "../../../../../../../middlewares/logger";
|
import logger from "../../../../../../../middlewares/logger";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import counterSchema from "../../../../../../../models/counter";
|
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
import { ChannelType } from "discord-api-types/v10";
|
import { ChannelType } from "discord-api-types/v10";
|
||||||
|
import counterSchema from "../../../../../../../models/counter";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default {
|
export default {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { CommandInteraction } from "discord.js";
|
|
||||||
import { SlashCommandSubcommandGroupBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandGroupBuilder } from "@discordjs/builders";
|
||||||
|
import { ChatInputCommandInteraction } from "discord.js";
|
||||||
|
|
||||||
import modules from "./modules";
|
import modules from "./modules";
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ export const builder = (group: SlashCommandSubcommandGroupBuilder) => {
|
||||||
.addSubcommand(modules.giveaway.builder);
|
.addSubcommand(modules.giveaway.builder);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const execute = async (interaction: CommandInteraction) => {
|
export const execute = async (interaction: ChatInputCommandInteraction) => {
|
||||||
switch (interaction.options.getSubcommand()) {
|
switch (interaction.options.getSubcommand()) {
|
||||||
case "give":
|
case "give":
|
||||||
return modules.give.execute(interaction);
|
return modules.give.execute(interaction);
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
import {
|
import {
|
||||||
ChatInputCommandInteraction,
|
ChatInputCommandInteraction,
|
||||||
CommandInteraction,
|
|
||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
Permissions,
|
|
||||||
PermissionsBitField,
|
PermissionsBitField,
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import getEmbedConfig from "../../../../../../../helpers/getEmbedConfig";
|
import getEmbedConfig from "../../../../../../../helpers/getEmbedConfig";
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
|
import axios from "axios";
|
||||||
import {
|
import {
|
||||||
CommandInteraction,
|
|
||||||
ActionRowBuilder,
|
ActionRowBuilder,
|
||||||
ButtonBuilder,
|
ButtonBuilder,
|
||||||
EmbedBuilder,
|
|
||||||
Permissions,
|
|
||||||
PermissionsBitField,
|
|
||||||
ChatInputCommandInteraction,
|
ChatInputCommandInteraction,
|
||||||
|
EmbedBuilder,
|
||||||
|
PermissionsBitField,
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
|
||||||
import { v4 as uuidv4 } from "uuid";
|
import { v4 as uuidv4 } from "uuid";
|
||||||
import axios from "axios";
|
|
||||||
import apiSchema from "../../../../../../../models/api";
|
|
||||||
import encryption from "../../../../../../../handlers/encryption";
|
import encryption from "../../../../../../../handlers/encryption";
|
||||||
|
import apiSchema from "../../../../../../../models/api";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import getEmbedConfig from "../../../../../../../helpers/getEmbedConfig";
|
import getEmbedConfig from "../../../../../../../helpers/getEmbedConfig";
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import give from "./give";
|
import give from "./give";
|
||||||
|
import giveaway from "./giveaway";
|
||||||
import set from "./set";
|
import set from "./set";
|
||||||
import take from "./take";
|
import take from "./take";
|
||||||
import transfer from "./transfer";
|
import transfer from "./transfer";
|
||||||
import giveaway from "./giveaway";
|
|
||||||
|
|
||||||
export default { give, set, take, transfer, giveaway };
|
export default { give, set, take, transfer, giveaway };
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import {
|
import {
|
||||||
CommandInteraction,
|
ChatInputCommandInteraction,
|
||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
Permissions,
|
|
||||||
PermissionsBitField,
|
PermissionsBitField,
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
|
|
||||||
|
@ -15,8 +14,8 @@ import logger from "../../../../../../../middlewares/logger";
|
||||||
// Helpers
|
// Helpers
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import fetchUser from "../../../../../../../helpers/fetchUser";
|
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
|
import fetchUser from "../../../../../../../helpers/fetchUser";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default {
|
export default {
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import {
|
import {
|
||||||
ChatInputCommandInteraction,
|
ChatInputCommandInteraction,
|
||||||
CommandInteraction,
|
|
||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
Permissions,
|
|
||||||
PermissionsBitField,
|
PermissionsBitField,
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
|
|
||||||
|
@ -17,8 +15,8 @@ import logger from "../../../../../../../middlewares/logger";
|
||||||
import pluralize from "../../../../../../../helpers/pluralize";
|
import pluralize from "../../../../../../../helpers/pluralize";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import fetchUser from "../../../../../../../helpers/fetchUser";
|
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
|
import fetchUser from "../../../../../../../helpers/fetchUser";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default {
|
export default {
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import {
|
import {
|
||||||
ChatInputCommandInteraction,
|
ChatInputCommandInteraction,
|
||||||
CommandInteraction,
|
|
||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
Permissions,
|
|
||||||
PermissionsBitField,
|
PermissionsBitField,
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
|
|
||||||
|
@ -16,8 +14,8 @@ import getEmbedConfig from "../../../../../../../helpers/getEmbedConfig";
|
||||||
import logger from "../../../../../../../middlewares/logger";
|
import logger from "../../../../../../../middlewares/logger";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import fetchUser from "../../../../../../../helpers/fetchUser";
|
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
|
import fetchUser from "../../../../../../../helpers/fetchUser";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default {
|
export default {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { SlashCommandBuilder } from "@discordjs/builders";
|
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||||
import { CommandInteraction } from "discord.js";
|
import { ChatInputCommandInteraction } from "discord.js";
|
||||||
|
|
||||||
import modules from "./modules";
|
import modules from "./modules";
|
||||||
export const moduleData = modules;
|
export const moduleData = modules;
|
||||||
|
@ -10,7 +10,7 @@ export const builder = new SlashCommandBuilder()
|
||||||
|
|
||||||
.addSubcommand(modules.prune.builder);
|
.addSubcommand(modules.prune.builder);
|
||||||
|
|
||||||
export const execute = async (interaction: CommandInteraction) => {
|
export const execute = async (interaction: ChatInputCommandInteraction) => {
|
||||||
switch (interaction.options.getSubcommand()) {
|
switch (interaction.options.getSubcommand()) {
|
||||||
case "prune":
|
case "prune":
|
||||||
return modules.prune.execute(interaction);
|
return modules.prune.execute(interaction);
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
import {
|
import {
|
||||||
ChannelType,
|
ChannelType,
|
||||||
ChatInputCommandInteraction,
|
ChatInputCommandInteraction,
|
||||||
CommandInteraction,
|
|
||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
Permissions,
|
|
||||||
PermissionsBitField,
|
PermissionsBitField,
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
|
|
||||||
|
@ -36,8 +34,9 @@ export default {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
execute: async (interaction: ChatInputCommandInteraction) => {
|
execute: async (interaction: ChatInputCommandInteraction) => {
|
||||||
const { errorColor, successColor, footerText, footerIcon } =
|
const { errorColor, footerText, footerIcon } = await getEmbedConfig(
|
||||||
await getEmbedConfig(interaction.guild);
|
interaction.guild
|
||||||
|
);
|
||||||
|
|
||||||
const count = interaction.options.getInteger("count");
|
const count = interaction.options.getInteger("count");
|
||||||
if (count == null) return;
|
if (count == null) return;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { SlashCommandBuilder } from "@discordjs/builders";
|
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||||
import { CommandInteraction } from "discord.js";
|
import { ChatInputCommandInteraction } from "discord.js";
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
import modules from "../../commands/profile/modules";
|
import modules from "../../commands/profile/modules";
|
||||||
|
@ -16,7 +16,7 @@ export const builder = new SlashCommandBuilder()
|
||||||
.setDescription("Check a profile.")
|
.setDescription("Check a profile.")
|
||||||
.addSubcommand(modules.view.builder);
|
.addSubcommand(modules.view.builder);
|
||||||
|
|
||||||
export const execute = async (interaction: CommandInteraction) => {
|
export const execute = async (interaction: ChatInputCommandInteraction) => {
|
||||||
const { options } = interaction;
|
const { options } = interaction;
|
||||||
|
|
||||||
if (options?.getSubcommand() === "view") {
|
if (options?.getSubcommand() === "view") {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { CommandInteraction } from "discord.js";
|
import { CommandInteraction, EmbedBuilder } from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
||||||
|
@ -7,8 +7,8 @@ import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
||||||
// Models
|
// Models
|
||||||
import fetchUser from "../../../../../helpers/fetchUser";
|
import fetchUser from "../../../../../helpers/fetchUser";
|
||||||
|
|
||||||
import logger from "../../../../../middlewares/logger";
|
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
|
import logger from "../../../../../middlewares/logger";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default {
|
export default {
|
||||||
|
@ -24,7 +24,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
execute: async (interaction: CommandInteraction) => {
|
execute: async (interaction: CommandInteraction) => {
|
||||||
const { successColor, footerText, footerIcon } = await getEmbedConfig(
|
const { errorColor, footerText, footerIcon } = await getEmbedConfig(
|
||||||
interaction.guild
|
interaction.guild
|
||||||
); // Destructure
|
); // Destructure
|
||||||
const { client, options, user, guild } = interaction;
|
const { client, options, user, guild } = interaction;
|
||||||
|
@ -44,14 +44,12 @@ export default {
|
||||||
// User Information
|
// User Information
|
||||||
const userObj = await fetchUser(discordUser, guild);
|
const userObj = await fetchUser(discordUser, guild);
|
||||||
|
|
||||||
// Embed object
|
const embed = new EmbedBuilder()
|
||||||
const embed = {
|
.setAuthor({
|
||||||
author: {
|
|
||||||
name: `${discordUser?.username}#${discordUser?.discriminator}`,
|
name: `${discordUser?.username}#${discordUser?.discriminator}`,
|
||||||
icon_url: discordUser?.displayAvatarURL(),
|
iconURL: discordUser?.displayAvatarURL(),
|
||||||
},
|
})
|
||||||
color: successColor,
|
.addFields(
|
||||||
fields: [
|
|
||||||
{
|
{
|
||||||
name: `:dollar: Credits`,
|
name: `:dollar: Credits`,
|
||||||
value: `${userObj?.credits || "Not found"}`,
|
value: `${userObj?.credits || "Not found"}`,
|
||||||
|
@ -76,14 +74,11 @@ export default {
|
||||||
name: `:rainbow_flag: Language`,
|
name: `:rainbow_flag: Language`,
|
||||||
value: `${userObj?.language || "Not found"}`,
|
value: `${userObj?.language || "Not found"}`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
}
|
||||||
],
|
)
|
||||||
timestamp: new Date(),
|
.setTimestamp()
|
||||||
footer: {
|
.setColor(errorColor)
|
||||||
iconURL: footerIcon,
|
.setFooter({ text: footerText, iconURL: footerIcon });
|
||||||
text: footerText,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
// Return interaction reply
|
// Return interaction reply
|
||||||
return interaction?.editReply({ embeds: [embed] });
|
return interaction?.editReply({ embeds: [embed] });
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { SlashCommandBuilder } from "@discordjs/builders";
|
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||||
import { CommandInteraction } from "discord.js";
|
import { ChatInputCommandInteraction } from "discord.js";
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
import modules from "./modules";
|
import modules from "./modules";
|
||||||
|
@ -15,7 +15,7 @@ export const builder = new SlashCommandBuilder()
|
||||||
.setDescription("Manage reputation.")
|
.setDescription("Manage reputation.")
|
||||||
.addSubcommand(modules.give.builder);
|
.addSubcommand(modules.give.builder);
|
||||||
|
|
||||||
export const execute = async (interaction: CommandInteraction) => {
|
export const execute = async (interaction: ChatInputCommandInteraction) => {
|
||||||
if (interaction.options.getSubcommand() === "give") {
|
if (interaction.options.getSubcommand() === "give") {
|
||||||
await modules.give.execute(interaction);
|
await modules.give.execute(interaction);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { User } from "discord.js";
|
import { User } from "discord.js";
|
||||||
|
|
||||||
export default async (to: User | null, from: User | null) => {
|
export default async (to: User | null, from: User | null) => {
|
||||||
if (from?.id === to?.id) {
|
if (from?.id === to?.id) {
|
||||||
throw new Error("You cannot give reputation to yourself.");
|
throw new Error("You cannot give reputation to yourself.");
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { CommandInteraction } from "discord.js";
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
|
import { ChatInputCommandInteraction, EmbedBuilder } from "discord.js";
|
||||||
|
import * as cooldown from "../../../../../helpers/cooldown";
|
||||||
|
import fetchUser from "../../../../../helpers/fetchUser";
|
||||||
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
||||||
import logger from "../../../../../middlewares/logger";
|
import logger from "../../../../../middlewares/logger";
|
||||||
import fetchUser from "../../../../../helpers/fetchUser";
|
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
|
||||||
import * as cooldown from "../../../../../helpers/cooldown";
|
|
||||||
import noSelfReputation from "./components/noSelfReputation";
|
import noSelfReputation from "./components/noSelfReputation";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -33,7 +33,7 @@ export default {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
execute: async (interaction: CommandInteraction) => {
|
execute: async (interaction: ChatInputCommandInteraction) => {
|
||||||
const { options, user, guild } = interaction;
|
const { options, user, guild } = interaction;
|
||||||
|
|
||||||
const { successColor, footerText, footerIcon } = await getEmbedConfig(
|
const { successColor, footerText, footerIcon } = await getEmbedConfig(
|
||||||
|
@ -68,19 +68,17 @@ export default {
|
||||||
await userObj.save().then(async () => {
|
await userObj.save().then(async () => {
|
||||||
logger.silly(`User reputation has been updated`);
|
logger.silly(`User reputation has been updated`);
|
||||||
|
|
||||||
|
const interactionEmbed = new EmbedBuilder()
|
||||||
|
.setTitle("[:loudspeaker:] Give")
|
||||||
|
.setDescription(
|
||||||
|
`You have given a ${optionType} repute to ${optionTarget}`
|
||||||
|
)
|
||||||
|
.setTimestamp()
|
||||||
|
.setColor(successColor)
|
||||||
|
.setFooter({ text: footerText, iconURL: footerIcon });
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [
|
embeds: [interactionEmbed],
|
||||||
{
|
|
||||||
title: "[:loudspeaker:] Give",
|
|
||||||
description: `You have given a ${optionType} repute to ${optionTarget}`,
|
|
||||||
timestamp: new Date(),
|
|
||||||
color: successColor,
|
|
||||||
footer: {
|
|
||||||
iconURL: footerIcon,
|
|
||||||
text: footerText,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { SlashCommandBuilder } from "@discordjs/builders";
|
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||||
import { CommandInteraction } from "discord.js";
|
import { ChatInputCommandInteraction } from "discord.js";
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
import modules from "./modules";
|
import modules from "./modules";
|
||||||
|
@ -17,7 +17,7 @@ export const builder = new SlashCommandBuilder()
|
||||||
.addSubcommand(modules.cpgg.builder)
|
.addSubcommand(modules.cpgg.builder)
|
||||||
.addSubcommandGroup(modules.roles.builder);
|
.addSubcommandGroup(modules.roles.builder);
|
||||||
|
|
||||||
export const execute = async (interaction: CommandInteraction) => {
|
export const execute = async (interaction: ChatInputCommandInteraction) => {
|
||||||
const { options } = interaction;
|
const { options } = interaction;
|
||||||
|
|
||||||
if (options?.getSubcommand() === "cpgg") {
|
if (options?.getSubcommand() === "cpgg") {
|
||||||
|
|
|
@ -1,21 +1,22 @@
|
||||||
|
import axios from "axios";
|
||||||
import {
|
import {
|
||||||
CommandInteraction,
|
|
||||||
ActionRowBuilder,
|
ActionRowBuilder,
|
||||||
ButtonBuilder,
|
ButtonBuilder,
|
||||||
|
ButtonStyle,
|
||||||
|
ChatInputCommandInteraction,
|
||||||
|
EmbedBuilder,
|
||||||
|
Message,
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
import { v4 as uuidv4 } from "uuid";
|
import { v4 as uuidv4 } from "uuid";
|
||||||
import axios from "axios";
|
|
||||||
|
|
||||||
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
|
||||||
|
|
||||||
import logger from "../../../../../middlewares/logger";
|
|
||||||
import encryption from "../../../../../handlers/encryption";
|
import encryption from "../../../../../handlers/encryption";
|
||||||
|
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
||||||
|
import logger from "../../../../../middlewares/logger";
|
||||||
|
|
||||||
import pluralize from "../../../../../helpers/pluralize";
|
|
||||||
|
|
||||||
import apiSchema from "../../../../../models/api";
|
|
||||||
import fetchUser from "../../../../../helpers/fetchUser";
|
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
|
import fetchUser from "../../../../../helpers/fetchUser";
|
||||||
|
import pluralize from "../../../../../helpers/pluralize";
|
||||||
|
import apiSchema from "../../../../../models/api";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
metadata: { guildOnly: true, ephemeral: true },
|
metadata: { guildOnly: true, ephemeral: true },
|
||||||
|
@ -31,7 +32,7 @@ export default {
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
execute: async (interaction: CommandInteraction) => {
|
execute: async (interaction: ChatInputCommandInteraction) => {
|
||||||
const { errorColor, successColor, footerText, footerIcon } =
|
const { errorColor, successColor, footerText, footerIcon } =
|
||||||
await getEmbedConfig(interaction.guild);
|
await getEmbedConfig(interaction.guild);
|
||||||
const { options, guild, user, client } = interaction;
|
const { options, guild, user, client } = interaction;
|
||||||
|
@ -41,19 +42,15 @@ export default {
|
||||||
if (optionAmount === null) {
|
if (optionAmount === null) {
|
||||||
logger?.silly(`Amount is null.`);
|
logger?.silly(`Amount is null.`);
|
||||||
|
|
||||||
|
const interactionEmbed = new EmbedBuilder()
|
||||||
|
.setTitle("[:dollar:] Gift")
|
||||||
|
.setDescription("We could not read your requested amount.")
|
||||||
|
.setTimestamp()
|
||||||
|
.setColor(errorColor)
|
||||||
|
.setFooter({ text: footerText, iconURL: footerIcon });
|
||||||
|
|
||||||
return interaction?.editReply({
|
return interaction?.editReply({
|
||||||
embeds: [
|
embeds: [interactionEmbed],
|
||||||
{
|
|
||||||
title: ":dollar: Credits [Gift]",
|
|
||||||
description: "We could not read your requested amount.",
|
|
||||||
color: errorColor,
|
|
||||||
timestamp: new Date(),
|
|
||||||
footer: {
|
|
||||||
iconURL: footerIcon,
|
|
||||||
text: footerText,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,76 +69,59 @@ export default {
|
||||||
if ((optionAmount || userDB?.credits) < 100) {
|
if ((optionAmount || userDB?.credits) < 100) {
|
||||||
logger?.silly(`Amount or user credits is below 100.`);
|
logger?.silly(`Amount or user credits is below 100.`);
|
||||||
|
|
||||||
|
const interactionEmbed = new EmbedBuilder()
|
||||||
|
.setTitle("[:shopping_cart:] CPGG")
|
||||||
|
.setDescription("You **can't** withdraw for __CPGG__ below **100**.")
|
||||||
|
.setTimestamp()
|
||||||
|
.addFields({
|
||||||
|
name: "Your balance",
|
||||||
|
value: `${pluralize(userDB?.credits, "credit")}`,
|
||||||
|
})
|
||||||
|
.setColor(errorColor)
|
||||||
|
.setFooter({ text: footerText, iconURL: footerIcon });
|
||||||
|
|
||||||
return interaction?.editReply({
|
return interaction?.editReply({
|
||||||
embeds: [
|
embeds: [interactionEmbed],
|
||||||
{
|
|
||||||
title: "[:shopping_cart:] CPGG",
|
|
||||||
description: `You **can't** withdraw for __CPGG__ below **100**.`,
|
|
||||||
color: errorColor,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: "Your balance",
|
|
||||||
value: `${pluralize(userDB?.credits, "credit")}`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
timestamp: new Date(),
|
|
||||||
footer: {
|
|
||||||
iconURL: footerIcon,
|
|
||||||
text: footerText,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((optionAmount || userDB?.credits) > 1000000) {
|
if ((optionAmount || userDB?.credits) > 1000000) {
|
||||||
logger?.silly(`Amount or user credits is above 1.000.000.`);
|
logger?.silly(`Amount or user credits is above 1.000.000.`);
|
||||||
|
|
||||||
|
const interactionEmbed = new EmbedBuilder()
|
||||||
|
.setTitle("[:shopping_cart:] CPGG")
|
||||||
|
.setDescription(
|
||||||
|
"You **can't** withdraw for __CPGG__ above **1.000.000**."
|
||||||
|
)
|
||||||
|
.setTimestamp()
|
||||||
|
.addFields({
|
||||||
|
name: "Your balance",
|
||||||
|
value: `${pluralize(userDB?.credits, "credit")}`,
|
||||||
|
})
|
||||||
|
.setColor(errorColor)
|
||||||
|
.setFooter({ text: footerText, iconURL: footerIcon });
|
||||||
|
|
||||||
return interaction?.editReply({
|
return interaction?.editReply({
|
||||||
embeds: [
|
embeds: [interactionEmbed],
|
||||||
{
|
|
||||||
title: "[:shopping_cart:] CPGG",
|
|
||||||
description:
|
|
||||||
"You **can't** withdraw for __CPGG__ above **1.000.000**.",
|
|
||||||
color: errorColor,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: "Your balance",
|
|
||||||
value: `${pluralize(userDB?.credits, "credit")}`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
timestamp: new Date(),
|
|
||||||
footer: {
|
|
||||||
iconURL: footerIcon,
|
|
||||||
text: footerText,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userDB?.credits < optionAmount) {
|
if (userDB?.credits < optionAmount) {
|
||||||
logger?.silly(`User credits is below amount.`);
|
logger?.silly(`User credits is below amount.`);
|
||||||
|
|
||||||
|
const interactionEmbed = new EmbedBuilder()
|
||||||
|
.setTitle("[:shopping_cart:] CPGG")
|
||||||
|
.setDescription("You have **insufficient** credits.")
|
||||||
|
.setTimestamp()
|
||||||
|
.addFields({
|
||||||
|
name: "Your balance",
|
||||||
|
value: `${pluralize(userDB?.credits, "credit")}`,
|
||||||
|
})
|
||||||
|
.setColor(errorColor)
|
||||||
|
.setFooter({ text: footerText, iconURL: footerIcon });
|
||||||
|
|
||||||
return interaction?.editReply({
|
return interaction?.editReply({
|
||||||
embeds: [
|
embeds: [interactionEmbed],
|
||||||
{
|
|
||||||
title: "[:shopping_cart:] CPGG",
|
|
||||||
description: `You have **insufficient** credits.`,
|
|
||||||
color: errorColor,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: "Your balance",
|
|
||||||
value: `${pluralize(userDB?.credits, "credit")}`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
timestamp: new Date(),
|
|
||||||
footer: {
|
|
||||||
iconURL: footerIcon,
|
|
||||||
text: footerText,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,10 +143,10 @@ export default {
|
||||||
|
|
||||||
const shopUrl = `${url}/store`;
|
const shopUrl = `${url}/store`;
|
||||||
|
|
||||||
const buttons = new ActionRowBuilder().addComponents(
|
const buttons = new ActionRowBuilder<ButtonBuilder>().addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setLabel("Redeem it here")
|
.setLabel("Redeem it here")
|
||||||
.setStyle("LINK")
|
.setStyle(ButtonStyle.Link)
|
||||||
.setEmoji("🏦")
|
.setEmoji("🏦")
|
||||||
.setURL(`${shopUrl}?voucher=${code}`)
|
.setURL(`${shopUrl}?voucher=${code}`)
|
||||||
);
|
);
|
||||||
|
@ -193,43 +173,37 @@ export default {
|
||||||
|
|
||||||
if (!interaction.guild) throw new Error("Guild is undefined");
|
if (!interaction.guild) throw new Error("Guild is undefined");
|
||||||
|
|
||||||
|
const dmEmbed = new EmbedBuilder()
|
||||||
|
.setTitle("[:shopping_cart:] CPGG")
|
||||||
|
.setDescription(
|
||||||
|
`This voucher comes from **${interaction.guild.name}**.`
|
||||||
|
)
|
||||||
|
.setTimestamp()
|
||||||
|
.addFields({
|
||||||
|
name: "💶 Credits",
|
||||||
|
value: `${optionAmount || userDB?.credits}`,
|
||||||
|
inline: true,
|
||||||
|
})
|
||||||
|
.setColor(successColor)
|
||||||
|
.setFooter({ text: footerText, iconURL: footerIcon });
|
||||||
|
|
||||||
await dmUser
|
await dmUser
|
||||||
?.send({
|
?.send({
|
||||||
embeds: [
|
embeds: [dmEmbed],
|
||||||
{
|
|
||||||
title: "[:shopping_cart:] CPGG",
|
|
||||||
description: `This voucher comes from **${interaction.guild.name}**.`,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: "💶 Credits",
|
|
||||||
value: `${optionAmount || userDB?.credits}`,
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
color: successColor,
|
|
||||||
timestamp: new Date(),
|
|
||||||
footer: {
|
|
||||||
iconURL: footerIcon,
|
|
||||||
text: footerText,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
components: [buttons],
|
components: [buttons],
|
||||||
})
|
})
|
||||||
.then(async (msg) => {
|
.then(async (msg: Message) => {
|
||||||
|
const interactionEmbed = new EmbedBuilder()
|
||||||
|
.setTitle("[:shopping_cart:] CPGG")
|
||||||
|
.setDescription(
|
||||||
|
`I have sent you the code in [DM](${msg.url})!`
|
||||||
|
)
|
||||||
|
.setTimestamp()
|
||||||
|
.setColor(successColor)
|
||||||
|
.setFooter({ text: footerText, iconURL: footerIcon });
|
||||||
|
|
||||||
return interaction?.editReply({
|
return interaction?.editReply({
|
||||||
embeds: [
|
embeds: [interactionEmbed],
|
||||||
{
|
|
||||||
title: "[:shopping_cart:] CPGG",
|
|
||||||
description: `I have sent you the code in [DM](${msg.url})!`,
|
|
||||||
color: successColor,
|
|
||||||
timestamp: new Date(),
|
|
||||||
footer: {
|
|
||||||
iconURL: footerIcon,
|
|
||||||
text: footerText,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
@ -237,19 +211,15 @@ export default {
|
||||||
.catch(async (error) => {
|
.catch(async (error) => {
|
||||||
logger?.silly(`Error saving new credits. - ${error}`);
|
logger?.silly(`Error saving new credits. - ${error}`);
|
||||||
|
|
||||||
|
const interactionEmbed = new EmbedBuilder()
|
||||||
|
.setTitle("[:shopping_cart:] CPGG")
|
||||||
|
.setDescription(`Something went wrong.`)
|
||||||
|
.setTimestamp()
|
||||||
|
.setColor(errorColor)
|
||||||
|
.setFooter({ text: footerText, iconURL: footerIcon });
|
||||||
|
|
||||||
return interaction?.editReply({
|
return interaction?.editReply({
|
||||||
embeds: [
|
embeds: [interactionEmbed],
|
||||||
{
|
|
||||||
title: "[:shopping_cart:] CPGG",
|
|
||||||
description: "Something went wrong.",
|
|
||||||
color: errorColor,
|
|
||||||
timestamp: new Date(),
|
|
||||||
footer: {
|
|
||||||
iconURL: footerIcon,
|
|
||||||
text: footerText,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
@ -257,19 +227,15 @@ export default {
|
||||||
.catch(async (error) => {
|
.catch(async (error) => {
|
||||||
logger?.silly(`Error creating voucher. - ${error}`);
|
logger?.silly(`Error creating voucher. - ${error}`);
|
||||||
|
|
||||||
|
const interactionEmbed = new EmbedBuilder()
|
||||||
|
.setTitle("[:shopping_cart:] CPGG")
|
||||||
|
.setDescription(`Something went wrong.`)
|
||||||
|
.setTimestamp()
|
||||||
|
.setColor(errorColor)
|
||||||
|
.setFooter({ text: footerText, iconURL: footerIcon });
|
||||||
|
|
||||||
return interaction?.editReply({
|
return interaction?.editReply({
|
||||||
embeds: [
|
embeds: [interactionEmbed],
|
||||||
{
|
|
||||||
title: "[:shopping_cart:] CPGG",
|
|
||||||
description: "Something went wrong.",
|
|
||||||
color: errorColor,
|
|
||||||
timestamp: new Date(),
|
|
||||||
footer: {
|
|
||||||
iconURL: footerIcon,
|
|
||||||
text: footerText,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { SlashCommandSubcommandGroupBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandGroupBuilder } from "@discordjs/builders";
|
||||||
import { CommandInteraction } from "discord.js";
|
import { ChatInputCommandInteraction } from "discord.js";
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from "../../../../../middlewares/logger";
|
|
||||||
|
|
||||||
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
import modules from "./modules";
|
import modules from "./modules";
|
||||||
|
@ -23,11 +20,8 @@ export const builder = (group: SlashCommandSubcommandGroupBuilder) => {
|
||||||
.addSubcommand(modules.cancel.builder);
|
.addSubcommand(modules.cancel.builder);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const execute = async (interaction: CommandInteraction) => {
|
export const execute = async (interaction: ChatInputCommandInteraction) => {
|
||||||
if (interaction.guild == null) return;
|
if (interaction.guild == null) return;
|
||||||
const { errorColor, footerText, footerIcon } = await getEmbedConfig(
|
|
||||||
interaction.guild
|
|
||||||
);
|
|
||||||
const { options, guild } = interaction;
|
const { options, guild } = interaction;
|
||||||
|
|
||||||
const guildDB = await guildSchema?.findOne({
|
const guildDB = await guildSchema?.findOne({
|
||||||
|
@ -36,24 +30,8 @@ export const execute = async (interaction: CommandInteraction) => {
|
||||||
|
|
||||||
if (guildDB === null) return;
|
if (guildDB === null) return;
|
||||||
|
|
||||||
if (!guildDB.shop.roles.status) {
|
if (!guildDB.shop.roles.status)
|
||||||
logger.silly(`Shop roles disabled.`);
|
throw new Error("This server has disabled shop roles.");
|
||||||
|
|
||||||
return interaction?.editReply({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
title: ":dollar: Shop - Roles",
|
|
||||||
description: "This server has disabled shop roles.",
|
|
||||||
color: errorColor,
|
|
||||||
timestamp: new Date(),
|
|
||||||
footer: {
|
|
||||||
iconURL: footerIcon,
|
|
||||||
text: footerText,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options?.getSubcommand() === "buy") {
|
if (options?.getSubcommand() === "buy") {
|
||||||
await modules.buy.execute(interaction);
|
await modules.buy.execute(interaction);
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import {
|
import {
|
||||||
CommandInteraction,
|
ChatInputCommandInteraction,
|
||||||
ColorResolvable,
|
ColorResolvable,
|
||||||
|
EmbedBuilder,
|
||||||
GuildMemberRoleManager,
|
GuildMemberRoleManager,
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
|
|
||||||
|
@ -9,15 +10,15 @@ import {
|
||||||
import getEmbedConfig from "../../../../../../../helpers/getEmbedConfig";
|
import getEmbedConfig from "../../../../../../../helpers/getEmbedConfig";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import shopRolesSchema from "../../../../../../../models/shopRole";
|
|
||||||
import guildSchema from "../../../../../../../models/guild";
|
import guildSchema from "../../../../../../../models/guild";
|
||||||
|
import shopRolesSchema from "../../../../../../../models/shopRole";
|
||||||
|
|
||||||
import logger from "../../../../../../../middlewares/logger";
|
import logger from "../../../../../../../middlewares/logger";
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
import pluralize from "../../../../../../../helpers/pluralize";
|
|
||||||
import fetchUser from "../../../../../../../helpers/fetchUser";
|
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
|
import fetchUser from "../../../../../../../helpers/fetchUser";
|
||||||
|
import pluralize from "../../../../../../../helpers/pluralize";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default {
|
export default {
|
||||||
|
@ -40,33 +41,18 @@ export default {
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
execute: async (interaction: CommandInteraction) => {
|
execute: async (interaction: ChatInputCommandInteraction) => {
|
||||||
const { errorColor, successColor, footerText, footerIcon } =
|
const { successColor, footerText, footerIcon } = await getEmbedConfig(
|
||||||
await getEmbedConfig(interaction.guild);
|
interaction.guild
|
||||||
|
);
|
||||||
const { options, guild, user, member } = interaction;
|
const { options, guild, user, member } = interaction;
|
||||||
|
|
||||||
const optionName = options?.getString("name");
|
const optionName = options?.getString("name");
|
||||||
const optionColor = options?.getString("color");
|
const optionColor = options?.getString("color");
|
||||||
|
|
||||||
// If amount is null
|
// If amount is null
|
||||||
if (optionName === null) {
|
if (optionName === null)
|
||||||
logger?.silly(`Name is null.`);
|
throw new Error("We could not read your requested name");
|
||||||
|
|
||||||
return interaction?.editReply({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
title: ":dollar: Shop - Roles [Buy]",
|
|
||||||
description: "We could not read your requested name.",
|
|
||||||
color: errorColor,
|
|
||||||
timestamp: new Date(),
|
|
||||||
footer: {
|
|
||||||
iconURL: footerIcon,
|
|
||||||
text: footerText,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
await guild?.roles
|
await guild?.roles
|
||||||
.create({
|
.create({
|
||||||
|
@ -112,28 +98,20 @@ export default {
|
||||||
|
|
||||||
logger?.silly(`Role ${role?.name} was bought by ${user?.tag}`);
|
logger?.silly(`Role ${role?.name} was bought by ${user?.tag}`);
|
||||||
|
|
||||||
|
const interactionEmbed = new EmbedBuilder()
|
||||||
|
.setTitle("[:shopping_cart:] Buy")
|
||||||
|
.setDescription(
|
||||||
|
`You bought **${optionName}** for **${pluralize(
|
||||||
|
pricePerHour,
|
||||||
|
"credit"
|
||||||
|
)}**.`
|
||||||
|
)
|
||||||
|
.setTimestamp()
|
||||||
|
.setColor(successColor)
|
||||||
|
.setFooter({ text: footerText, iconURL: footerIcon });
|
||||||
|
|
||||||
return interaction?.editReply({
|
return interaction?.editReply({
|
||||||
embeds: [
|
embeds: [interactionEmbed],
|
||||||
{
|
|
||||||
title: ":shopping_cart: Shop - Roles [Buy]",
|
|
||||||
description: `You bought **${optionName}** for **${pluralize(
|
|
||||||
pricePerHour,
|
|
||||||
"credit"
|
|
||||||
)}**.`,
|
|
||||||
color: successColor,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: "Your balance",
|
|
||||||
value: `${pluralize(userDB?.credits, "credit")}`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
timestamp: new Date(),
|
|
||||||
footer: {
|
|
||||||
iconURL: footerIcon,
|
|
||||||
text: footerText,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(async (error) => {
|
.catch(async (error) => {
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { CommandInteraction, GuildMemberRoleManager } from "discord.js";
|
import {
|
||||||
|
ChatInputCommandInteraction,
|
||||||
|
EmbedBuilder,
|
||||||
|
GuildMemberRoleManager,
|
||||||
|
} from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import getEmbedConfig from "../../../../../../../helpers/getEmbedConfig";
|
import getEmbedConfig from "../../../../../../../helpers/getEmbedConfig";
|
||||||
|
@ -10,9 +14,9 @@ import shopRolesSchema from "../../../../../../../models/shopRole";
|
||||||
import logger from "../../../../../../../middlewares/logger";
|
import logger from "../../../../../../../middlewares/logger";
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
import pluralize from "../../../../../../../helpers/pluralize";
|
|
||||||
import fetchUser from "../../../../../../../helpers/fetchUser";
|
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
|
import fetchUser from "../../../../../../../helpers/fetchUser";
|
||||||
|
import pluralize from "../../../../../../../helpers/pluralize";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default {
|
export default {
|
||||||
|
@ -29,31 +33,16 @@ export default {
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
execute: async (interaction: CommandInteraction) => {
|
execute: async (interaction: ChatInputCommandInteraction) => {
|
||||||
const { errorColor, successColor, footerText, footerIcon } =
|
const { successColor, footerText, footerIcon } = await getEmbedConfig(
|
||||||
await getEmbedConfig(interaction.guild);
|
interaction.guild
|
||||||
|
);
|
||||||
const { options, guild, user, member } = interaction;
|
const { options, guild, user, member } = interaction;
|
||||||
|
|
||||||
const optionRole = options.getRole("role");
|
const optionRole = options.getRole("role");
|
||||||
|
|
||||||
if (optionRole === null) {
|
if (optionRole === null)
|
||||||
logger?.silly(`Role is null.`);
|
throw new Error("We could not read your requested role.");
|
||||||
|
|
||||||
return interaction?.editReply({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
title: ":dollar: Shop - Roles [Cancel]",
|
|
||||||
description: "We could not read your requested role.",
|
|
||||||
color: errorColor,
|
|
||||||
timestamp: new Date(),
|
|
||||||
footer: {
|
|
||||||
iconURL: footerIcon,
|
|
||||||
text: footerText,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const roleExist = await shopRolesSchema?.findOne({
|
const roleExist = await shopRolesSchema?.findOne({
|
||||||
guildId: guild?.id,
|
guildId: guild?.id,
|
||||||
|
@ -80,28 +69,22 @@ export default {
|
||||||
guildId: guild?.id,
|
guildId: guild?.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const interactionEmbed = new EmbedBuilder()
|
||||||
|
.setTitle("[:shopping_cart:] Cancel")
|
||||||
|
.setDescription(`You have canceled ${optionRole.name}.`)
|
||||||
|
.setTimestamp()
|
||||||
|
.setColor(successColor)
|
||||||
|
.addFields({
|
||||||
|
name: "Your balance",
|
||||||
|
value: `${pluralize(userDB?.credits, "credit")}`,
|
||||||
|
})
|
||||||
|
.setFooter({ text: footerText, iconURL: footerIcon });
|
||||||
|
|
||||||
return interaction?.editReply({
|
return interaction?.editReply({
|
||||||
embeds: [
|
embeds: [interactionEmbed],
|
||||||
{
|
|
||||||
title: ":shopping_cart: Shop - Roles [Cancel]",
|
|
||||||
description: `You have canceled ${optionRole.name}.`,
|
|
||||||
color: successColor,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: "Your balance",
|
|
||||||
value: `${pluralize(userDB?.credits, "credit")}`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
timestamp: new Date(),
|
|
||||||
footer: {
|
|
||||||
iconURL: footerIcon,
|
|
||||||
text: footerText,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(async (error) => {
|
.catch(async (error: Error) => {
|
||||||
return logger?.silly(`Role could not be deleted. ${error}`);
|
return logger?.silly(`Role could not be deleted. ${error}`);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { SlashCommandBuilder } from "@discordjs/builders";
|
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||||
import { CommandInteraction } from "discord.js";
|
import { ChatInputCommandInteraction } from "discord.js";
|
||||||
|
|
||||||
import modules from "./modules";
|
import modules from "./modules";
|
||||||
export const moduleData = modules;
|
export const moduleData = modules;
|
||||||
|
@ -13,7 +13,7 @@ export const builder = new SlashCommandBuilder()
|
||||||
.addSubcommand(modules.avatar.builder)
|
.addSubcommand(modules.avatar.builder)
|
||||||
.addSubcommand(modules.ping.builder);
|
.addSubcommand(modules.ping.builder);
|
||||||
|
|
||||||
export const execute = async (interaction: CommandInteraction) => {
|
export const execute = async (interaction: ChatInputCommandInteraction) => {
|
||||||
switch (interaction.options.getSubcommand()) {
|
switch (interaction.options.getSubcommand()) {
|
||||||
case "about":
|
case "about":
|
||||||
return modules.about.execute(interaction);
|
return modules.about.execute(interaction);
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import {
|
import {
|
||||||
CommandInteraction,
|
|
||||||
ActionRowBuilder,
|
ActionRowBuilder,
|
||||||
ButtonBuilder,
|
ButtonBuilder,
|
||||||
ButtonStyle,
|
ButtonStyle,
|
||||||
|
CommandInteraction,
|
||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
||||||
|
|
||||||
import { CommandInteraction, EmbedBuilder } from "discord.js";
|
|
||||||
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
|
||||||
|
import { CommandInteraction, EmbedBuilder } from "discord.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
metadata: { guildOnly: false, ephemeral: false },
|
metadata: { guildOnly: false, ephemeral: false },
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import avatar from "./avatar";
|
|
||||||
import about from "./about";
|
import about from "./about";
|
||||||
import stats from "./stats";
|
import avatar from "./avatar";
|
||||||
import ping from "./ping";
|
import ping from "./ping";
|
||||||
|
import stats from "./stats";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
avatar,
|
avatar,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { CommandInteraction } from "discord.js";
|
import { CommandInteraction, EmbedBuilder } from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
import getEmbedConfig from "../../../../../helpers/getEmbedConfig";
|
||||||
|
@ -18,9 +18,9 @@ export default {
|
||||||
interaction.guild
|
interaction.guild
|
||||||
);
|
);
|
||||||
|
|
||||||
const interactionEmbed = {
|
const interactionEmbed = new EmbedBuilder()
|
||||||
title: "[:tools:] Ping",
|
.setTitle("[:tools:] Ping")
|
||||||
fields: [
|
.addFields(
|
||||||
{
|
{
|
||||||
name: "📦 Deliver Latency",
|
name: "📦 Deliver Latency",
|
||||||
value: `${Math.abs(Date.now() - interaction.createdTimestamp)} ms`,
|
value: `${Math.abs(Date.now() - interaction.createdTimestamp)} ms`,
|
||||||
|
@ -30,15 +30,12 @@ export default {
|
||||||
name: "🤖 API Latency",
|
name: "🤖 API Latency",
|
||||||
value: `${Math.round(interaction.client.ws.ping)} ms`,
|
value: `${Math.round(interaction.client.ws.ping)} ms`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
}
|
||||||
],
|
)
|
||||||
color: successColor,
|
.setTimestamp()
|
||||||
timestamp: new Date(),
|
.setColor(successColor)
|
||||||
footer: {
|
.setFooter({ text: footerText, iconURL: footerIcon });
|
||||||
iconURL: footerIcon,
|
|
||||||
text: footerText,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [interactionEmbed],
|
embeds: [interactionEmbed],
|
||||||
});
|
});
|
||||||
|
|
2
src/types/common/environment.d.ts
vendored
2
src/types/common/environment.d.ts
vendored
|
@ -1,4 +1,4 @@
|
||||||
import { Snowflake, ColorResolvable } from "discord.js";
|
import { ColorResolvable, Snowflake } from "discord.js";
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
namespace NodeJS {
|
namespace NodeJS {
|
||||||
|
|
Loading…
Add table
Reference in a new issue