Merge branch '201-fix-code-smells' of https://github.com/VermiumSifell/xyter-1 into 201-fix-code-smells
This commit is contained in:
commit
9928c5239f
31 changed files with 451 additions and 451 deletions
|
@ -1,12 +1,12 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { CommandInteraction } from 'discord.js';
|
import { CommandInteraction } from "discord.js";
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from '../../../handlers/logger';
|
import logger from "../../../handlers/logger";
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
import add from './modules/add';
|
import add from "./modules/add";
|
||||||
import remove from './modules/remove';
|
import remove from "./modules/remove";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
|
@ -14,13 +14,13 @@ export default async (interaction: CommandInteraction) => {
|
||||||
const { options, guild, user, commandName } = interaction;
|
const { options, guild, user, commandName } = interaction;
|
||||||
|
|
||||||
// Module - Add
|
// Module - Add
|
||||||
if (options?.getSubcommand() === 'add') {
|
if (options?.getSubcommand() === "add") {
|
||||||
// Execute Module - Add
|
// Execute Module - Add
|
||||||
return add(interaction);
|
return add(interaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module - Remove
|
// Module - Remove
|
||||||
else if (options?.getSubcommand() === 'remove') {
|
else if (options?.getSubcommand() === "remove") {
|
||||||
// Execute Module - Remove
|
// Execute Module - Remove
|
||||||
return remove(interaction);
|
return remove(interaction);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { ColorResolvable, CommandInteraction } from 'discord.js';
|
import { ColorResolvable, CommandInteraction } from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import config from '../../../../../config.json';
|
import config from "../../../../../config.json";
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from '../../../../handlers/logger';
|
import logger from "../../../../handlers/logger";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import counterSchema from '../../../../helpers/database/models/counterSchema';
|
import counterSchema from "../../../../helpers/database/models/counterSchema";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
|
@ -16,7 +16,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
const { options, guild, user } = interaction;
|
const { options, guild, user } = interaction;
|
||||||
|
|
||||||
// Get options
|
// Get options
|
||||||
const optionChannel = options?.getChannel('channel');
|
const optionChannel = options?.getChannel("channel");
|
||||||
|
|
||||||
await counterSchema
|
await counterSchema
|
||||||
?.deleteOne({
|
?.deleteOne({
|
||||||
|
@ -26,7 +26,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
?.then(async () => {
|
?.then(async () => {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':toolbox: Admin - Counters [Remove]' as string,
|
title: ":toolbox: Admin - Counters [Remove]" as string,
|
||||||
description: `${optionChannel} is no longer an counting channel.`,
|
description: `${optionChannel} is no longer an counting channel.`,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
color: config?.colors?.success as ColorResolvable,
|
color: config?.colors?.success as ColorResolvable,
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { CommandInteraction } from 'discord.js';
|
import { CommandInteraction } from "discord.js";
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
import give from './modules/give';
|
import give from "./modules/give";
|
||||||
import take from './modules/take';
|
import take from "./modules/take";
|
||||||
import set from './modules/set';
|
import set from "./modules/set";
|
||||||
import transfer from './modules/transfer';
|
import transfer from "./modules/transfer";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
|
@ -13,25 +13,25 @@ export default async (interaction: CommandInteraction) => {
|
||||||
const { options } = interaction;
|
const { options } = interaction;
|
||||||
|
|
||||||
// Module - Give
|
// Module - Give
|
||||||
if (options?.getSubcommand() === 'give') {
|
if (options?.getSubcommand() === "give") {
|
||||||
// Execute Module - Give
|
// Execute Module - Give
|
||||||
return give(interaction);
|
return give(interaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module - Take
|
// Module - Take
|
||||||
else if (options?.getSubcommand() === 'take') {
|
else if (options?.getSubcommand() === "take") {
|
||||||
// Execute Module - Take
|
// Execute Module - Take
|
||||||
return take(interaction);
|
return take(interaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module - Set
|
// Module - Set
|
||||||
else if (options?.getSubcommand() === 'set') {
|
else if (options?.getSubcommand() === "set") {
|
||||||
// Execute Module - Set
|
// Execute Module - Set
|
||||||
return set(interaction);
|
return set(interaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module - Transfer
|
// Module - Transfer
|
||||||
else if (options?.getSubcommand() === 'transfer') {
|
else if (options?.getSubcommand() === "transfer") {
|
||||||
// Execute Module - Transfer
|
// Execute Module - Transfer
|
||||||
return transfer(interaction);
|
return transfer(interaction);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { CommandInteraction, ColorResolvable } from 'discord.js';
|
import { CommandInteraction, ColorResolvable } from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import config from '../../../../../config.json';
|
import config from "../../../../../config.json";
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from '../../../../handlers/logger';
|
import logger from "../../../../handlers/logger";
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
import creditNoun from '../../../../helpers/creditNoun';
|
import creditNoun from "../../../../helpers/creditNoun";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import fetchUser from '../../../../helpers/fetchUser';
|
import fetchUser from "../../../../helpers/fetchUser";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
|
@ -19,17 +19,17 @@ export default async (interaction: CommandInteraction) => {
|
||||||
const { guild, user, options } = interaction;
|
const { guild, user, options } = interaction;
|
||||||
|
|
||||||
// User option
|
// User option
|
||||||
const optionUser = options?.getUser('user');
|
const optionUser = options?.getUser("user");
|
||||||
|
|
||||||
// Amount option
|
// Amount option
|
||||||
const optionAmount = options?.getInteger('amount');
|
const optionAmount = options?.getInteger("amount");
|
||||||
|
|
||||||
// If amount option is null
|
// If amount option is null
|
||||||
if (optionAmount === null) {
|
if (optionAmount === null) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':toolbox: Admin - Credits [Give]' as string,
|
title: ":toolbox: Admin - Credits [Give]" as string,
|
||||||
description: 'We could not read your requested amount.' as string,
|
description: "We could not read your requested amount." as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
footer: {
|
footer: {
|
||||||
|
@ -46,8 +46,8 @@ export default async (interaction: CommandInteraction) => {
|
||||||
if (optionAmount <= 0) {
|
if (optionAmount <= 0) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':toolbox: Admin - Credits [Give]' as string,
|
title: ":toolbox: Admin - Credits [Give]" as string,
|
||||||
description: 'You can not give zero credits or below.' as string,
|
description: "You can not give zero credits or below." as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
footer: {
|
footer: {
|
||||||
|
@ -70,7 +70,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
if (!toUser) {
|
if (!toUser) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':toolbox: Admin - Credits [Give]' as string,
|
title: ":toolbox: Admin - Credits [Give]" as string,
|
||||||
description: `We could not find ${optionUser} in our database.`,
|
description: `We could not find ${optionUser} in our database.`,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
@ -88,7 +88,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
if (!toUser?.credits) {
|
if (!toUser?.credits) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':toolbox: Admin - Credits [Give]' as string,
|
title: ":toolbox: Admin - Credits [Give]" as string,
|
||||||
description: `We could not find credits for ${optionUser} in our database.`,
|
description: `We could not find credits for ${optionUser} in our database.`,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
@ -109,7 +109,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
await toUser?.save()?.then(async () => {
|
await toUser?.save()?.then(async () => {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':toolbox: Admin - Credits [Give]' as string,
|
title: ":toolbox: Admin - Credits [Give]" as string,
|
||||||
description: `We have given ${optionUser}, ${creditNoun(optionAmount)}.`,
|
description: `We have given ${optionUser}, ${creditNoun(optionAmount)}.`,
|
||||||
color: config?.colors?.success as ColorResolvable,
|
color: config?.colors?.success as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { CommandInteraction, ColorResolvable } from 'discord.js';
|
import { CommandInteraction, ColorResolvable } from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import config from '../../../../../config.json';
|
import config from "../../../../../config.json";
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from '../../../../handlers/logger';
|
import logger from "../../../../handlers/logger";
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
import creditNoun from '../../../../helpers/creditNoun';
|
import creditNoun from "../../../../helpers/creditNoun";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import fetchUser from '../../../../helpers/fetchUser';
|
import fetchUser from "../../../../helpers/fetchUser";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
|
@ -19,17 +19,17 @@ export default async (interaction: CommandInteraction) => {
|
||||||
const { options, user, guild } = interaction;
|
const { options, user, guild } = interaction;
|
||||||
|
|
||||||
// User Option
|
// User Option
|
||||||
const optionUser = options.getUser('user');
|
const optionUser = options.getUser("user");
|
||||||
|
|
||||||
// Amount Option
|
// Amount Option
|
||||||
const optionAmount = options.getInteger('amount');
|
const optionAmount = options.getInteger("amount");
|
||||||
|
|
||||||
// If amount is null
|
// If amount is null
|
||||||
if (optionAmount === null) {
|
if (optionAmount === null) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':toolbox: Admin - Credits [Set]' as string,
|
title: ":toolbox: Admin - Credits [Set]" as string,
|
||||||
description: 'We could not read your requested amount.' as string,
|
description: "We could not read your requested amount." as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
footer: {
|
footer: {
|
||||||
|
@ -52,7 +52,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
if (!toUser) {
|
if (!toUser) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':toolbox: Admin - Credits [Set]' as string,
|
title: ":toolbox: Admin - Credits [Set]" as string,
|
||||||
description: `We could not find ${optionUser} in our database.`,
|
description: `We could not find ${optionUser} in our database.`,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
@ -70,7 +70,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
if (!toUser?.credits) {
|
if (!toUser?.credits) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':toolbox: Admin - Credits [Set]' as string,
|
title: ":toolbox: Admin - Credits [Set]" as string,
|
||||||
description: `We could not find credits for ${optionUser} in our database.`,
|
description: `We could not find credits for ${optionUser} in our database.`,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
@ -91,7 +91,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
await toUser?.save()?.then(async () => {
|
await toUser?.save()?.then(async () => {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':toolbox: Admin - Credits [Set]' as string,
|
title: ":toolbox: Admin - Credits [Set]" as string,
|
||||||
description: `We have set ${optionUser} to ${creditNoun(optionAmount)}`,
|
description: `We have set ${optionUser} to ${creditNoun(optionAmount)}`,
|
||||||
color: config?.colors?.success as ColorResolvable,
|
color: config?.colors?.success as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { CommandInteraction, ColorResolvable } from 'discord.js';
|
import { CommandInteraction, ColorResolvable } from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import config from '../../../../../config.json';
|
import config from "../../../../../config.json";
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from '../../../../handlers/logger';
|
import logger from "../../../../handlers/logger";
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
import creditNoun from '../../../../helpers/creditNoun';
|
import creditNoun from "../../../../helpers/creditNoun";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import fetchUser from '../../../../helpers/fetchUser';
|
import fetchUser from "../../../../helpers/fetchUser";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
|
@ -19,17 +19,17 @@ export default async (interaction: CommandInteraction) => {
|
||||||
const { guild, user, options } = interaction;
|
const { guild, user, options } = interaction;
|
||||||
|
|
||||||
// User option
|
// User option
|
||||||
const optionUser = options?.getUser('user');
|
const optionUser = options?.getUser("user");
|
||||||
|
|
||||||
// Amount option
|
// Amount option
|
||||||
const optionAmount = options?.getInteger('amount');
|
const optionAmount = options?.getInteger("amount");
|
||||||
|
|
||||||
// If amount is null
|
// If amount is null
|
||||||
if (optionAmount === null) {
|
if (optionAmount === null) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':toolbox: Admin - Credits [Take]' as string,
|
title: ":toolbox: Admin - Credits [Take]" as string,
|
||||||
description: 'We could not read your requested amount.' as string,
|
description: "We could not read your requested amount." as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
footer: {
|
footer: {
|
||||||
|
@ -46,8 +46,8 @@ export default async (interaction: CommandInteraction) => {
|
||||||
if (optionAmount <= 0) {
|
if (optionAmount <= 0) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':toolbox: Admin - Credits [Take]' as string,
|
title: ":toolbox: Admin - Credits [Take]" as string,
|
||||||
description: 'You can not take zero credits or below.' as string,
|
description: "You can not take zero credits or below." as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
footer: {
|
footer: {
|
||||||
|
@ -70,7 +70,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
if (!toUser) {
|
if (!toUser) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':toolbox: Admin - Credits [Take]' as string,
|
title: ":toolbox: Admin - Credits [Take]" as string,
|
||||||
description: `We could not find ${optionUser} in our database.`,
|
description: `We could not find ${optionUser} in our database.`,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
@ -88,7 +88,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
if (!toUser?.credits) {
|
if (!toUser?.credits) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':toolbox: Admin - Credits [Take]' as string,
|
title: ":toolbox: Admin - Credits [Take]" as string,
|
||||||
description: `We could not find credits for ${optionUser} in our database.`,
|
description: `We could not find credits for ${optionUser} in our database.`,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
@ -109,7 +109,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
await toUser?.save()?.then(async () => {
|
await toUser?.save()?.then(async () => {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':toolbox: Admin - Credits [Set]' as string,
|
title: ":toolbox: Admin - Credits [Set]" as string,
|
||||||
description: `We have taken ${creditNoun(
|
description: `We have taken ${creditNoun(
|
||||||
optionAmount
|
optionAmount
|
||||||
)} from ${optionUser}`,
|
)} from ${optionUser}`,
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { CommandInteraction, ColorResolvable } from 'discord.js';
|
import { CommandInteraction, ColorResolvable } from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import config from '../../../../../config.json';
|
import config from "../../../../../config.json";
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from '../../../../handlers/logger';
|
import logger from "../../../../handlers/logger";
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
import creditNoun from '../../../../helpers/creditNoun';
|
import creditNoun from "../../../../helpers/creditNoun";
|
||||||
import saveUser from '../../../../helpers/saveUser';
|
import saveUser from "../../../../helpers/saveUser";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import fetchUser from '../../../../helpers/fetchUser';
|
import fetchUser from "../../../../helpers/fetchUser";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
|
@ -20,16 +20,16 @@ export default async (interaction: CommandInteraction) => {
|
||||||
const { guild, options, user } = interaction;
|
const { guild, options, user } = interaction;
|
||||||
|
|
||||||
// Get options
|
// Get options
|
||||||
const optionFromUser = options?.getUser('from');
|
const optionFromUser = options?.getUser("from");
|
||||||
const optionToUser = options?.getUser('to');
|
const optionToUser = options?.getUser("to");
|
||||||
const optionAmount = options?.getInteger('amount');
|
const optionAmount = options?.getInteger("amount");
|
||||||
|
|
||||||
// If amount is null
|
// If amount is null
|
||||||
if (optionAmount === null) {
|
if (optionAmount === null) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':toolbox: Admin - Credits [Transfer]' as string,
|
title: ":toolbox: Admin - Credits [Transfer]" as string,
|
||||||
description: 'We could not read your requested amount.' as string,
|
description: "We could not read your requested amount." as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
footer: {
|
footer: {
|
||||||
|
@ -56,7 +56,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
if (!fromUser) {
|
if (!fromUser) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':toolbox: Admin - Credits [Transfer]' as string,
|
title: ":toolbox: Admin - Credits [Transfer]" as string,
|
||||||
description: `We could not find ${optionFromUser} in our database.`,
|
description: `We could not find ${optionFromUser} in our database.`,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
@ -74,7 +74,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
if (!fromUser?.credits) {
|
if (!fromUser?.credits) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':toolbox: Admin - Credits [Transfer]' as string,
|
title: ":toolbox: Admin - Credits [Transfer]" as string,
|
||||||
description: `We could not find credits for ${optionFromUser} in our database.`,
|
description: `We could not find credits for ${optionFromUser} in our database.`,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
@ -92,7 +92,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
if (!toUser) {
|
if (!toUser) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':toolbox: Admin - Credits [Transfer]' as string,
|
title: ":toolbox: Admin - Credits [Transfer]" as string,
|
||||||
description: `We could not find ${optionToUser} in our database.`,
|
description: `We could not find ${optionToUser} in our database.`,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
@ -110,7 +110,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
if (!toUser?.credits) {
|
if (!toUser?.credits) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':toolbox: Admin - Credits [Transfer]' as string,
|
title: ":toolbox: Admin - Credits [Transfer]" as string,
|
||||||
description: `We could not find credits for ${optionToUser} in our database.`,
|
description: `We could not find credits for ${optionToUser} in our database.`,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
@ -134,7 +134,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
await saveUser(fromUser, toUser)?.then(async () => {
|
await saveUser(fromUser, toUser)?.then(async () => {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':toolbox: Admin - Credits [Transfer]' as string,
|
title: ":toolbox: Admin - Credits [Transfer]" as string,
|
||||||
description: `You sent ${creditNoun(
|
description: `You sent ${creditNoun(
|
||||||
optionAmount
|
optionAmount
|
||||||
)} from ${optionFromUser} to ${optionToUser}.`,
|
)} from ${optionFromUser} to ${optionToUser}.`,
|
||||||
|
|
|
@ -1,133 +1,133 @@
|
||||||
//Dependencies
|
//Dependencies
|
||||||
import { SlashCommandBuilder } from '@discordjs/builders';
|
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||||
import { CommandInteraction, ColorResolvable, Permissions } from 'discord.js';
|
import { CommandInteraction, ColorResolvable, Permissions } from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import config from '../../../config.json';
|
import config from "../../../config.json";
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from '../../handlers/logger';
|
import logger from "../../handlers/logger";
|
||||||
|
|
||||||
// Groups
|
// Groups
|
||||||
import credits from './credits';
|
import credits from "./credits";
|
||||||
import counters from './counters';
|
import counters from "./counters";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default {
|
export default {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName('admin')
|
.setName("admin")
|
||||||
.setDescription('Admin actions.')
|
.setDescription("Admin actions.")
|
||||||
.addSubcommandGroup((group) =>
|
.addSubcommandGroup((group) =>
|
||||||
group
|
group
|
||||||
.setName('credits')
|
.setName("credits")
|
||||||
.setDescription('Manage credits.')
|
.setDescription("Manage credits.")
|
||||||
.addSubcommand((command) =>
|
.addSubcommand((command) =>
|
||||||
command
|
command
|
||||||
.setName('give')
|
.setName("give")
|
||||||
.setDescription('Give credits to a user')
|
.setDescription("Give credits to a user")
|
||||||
.addUserOption((option) =>
|
.addUserOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('user')
|
.setName("user")
|
||||||
.setDescription('The user you want to pay.')
|
.setDescription("The user you want to pay.")
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
)
|
)
|
||||||
.addIntegerOption((option) =>
|
.addIntegerOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('amount')
|
.setName("amount")
|
||||||
.setDescription('The amount you will pay.')
|
.setDescription("The amount you will pay.")
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.addSubcommand((command) =>
|
.addSubcommand((command) =>
|
||||||
command
|
command
|
||||||
.setName('set')
|
.setName("set")
|
||||||
.setDescription('Set credits to a user')
|
.setDescription("Set credits to a user")
|
||||||
.addUserOption((option) =>
|
.addUserOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('user')
|
.setName("user")
|
||||||
.setDescription('The user you want to set credits on.')
|
.setDescription("The user you want to set credits on.")
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
)
|
)
|
||||||
.addIntegerOption((option) =>
|
.addIntegerOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('amount')
|
.setName("amount")
|
||||||
.setDescription('The amount you will set.')
|
.setDescription("The amount you will set.")
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.addSubcommand((command) =>
|
.addSubcommand((command) =>
|
||||||
command
|
command
|
||||||
.setName('take')
|
.setName("take")
|
||||||
.setDescription('Take credits from a user')
|
.setDescription("Take credits from a user")
|
||||||
.addUserOption((option) =>
|
.addUserOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('user')
|
.setName("user")
|
||||||
.setDescription('The user you want to take credits from.')
|
.setDescription("The user you want to take credits from.")
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
)
|
)
|
||||||
.addIntegerOption((option) =>
|
.addIntegerOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('amount')
|
.setName("amount")
|
||||||
.setDescription('The amount you will take.')
|
.setDescription("The amount you will take.")
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.addSubcommand((command) =>
|
.addSubcommand((command) =>
|
||||||
command
|
command
|
||||||
.setName('transfer')
|
.setName("transfer")
|
||||||
.setDescription('Transfer credits from a user to another user.')
|
.setDescription("Transfer credits from a user to another user.")
|
||||||
.addUserOption((option) =>
|
.addUserOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('from')
|
.setName("from")
|
||||||
.setDescription('The user you want to take credits from.')
|
.setDescription("The user you want to take credits from.")
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
)
|
)
|
||||||
.addUserOption((option) =>
|
.addUserOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('to')
|
.setName("to")
|
||||||
.setDescription('The user you want to give credits to.')
|
.setDescription("The user you want to give credits to.")
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
)
|
)
|
||||||
.addIntegerOption((option) =>
|
.addIntegerOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('amount')
|
.setName("amount")
|
||||||
.setDescription('The amount you will transfer.')
|
.setDescription("The amount you will transfer.")
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.addSubcommandGroup((group) =>
|
.addSubcommandGroup((group) =>
|
||||||
group
|
group
|
||||||
.setName('counters')
|
.setName("counters")
|
||||||
.setDescription('Manage counters.')
|
.setDescription("Manage counters.")
|
||||||
.addSubcommand((command) =>
|
.addSubcommand((command) =>
|
||||||
command
|
command
|
||||||
.setName('add')
|
.setName("add")
|
||||||
.setDescription('Add a counter')
|
.setDescription("Add a counter")
|
||||||
.addChannelOption((option) =>
|
.addChannelOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('channel')
|
.setName("channel")
|
||||||
.setDescription('The counter channel.')
|
.setDescription("The counter channel.")
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
)
|
)
|
||||||
.addStringOption((option) =>
|
.addStringOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('word')
|
.setName("word")
|
||||||
.setDescription('The counter word.')
|
.setDescription("The counter word.")
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
)
|
)
|
||||||
.addNumberOption((option) =>
|
.addNumberOption((option) =>
|
||||||
option.setName('start').setDescription('Start at number X.')
|
option.setName("start").setDescription("Start at number X.")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.addSubcommand((command) =>
|
.addSubcommand((command) =>
|
||||||
command
|
command
|
||||||
.setName('remove')
|
.setName("remove")
|
||||||
.setDescription('Remove a counter')
|
.setDescription("Remove a counter")
|
||||||
.addChannelOption((option) =>
|
.addChannelOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('channel')
|
.setName("channel")
|
||||||
.setDescription('The counter channel.')
|
.setDescription("The counter channel.")
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -141,9 +141,9 @@ export default {
|
||||||
if (!memberPermissions?.has(Permissions?.FLAGS?.MANAGE_GUILD)) {
|
if (!memberPermissions?.has(Permissions?.FLAGS?.MANAGE_GUILD)) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':toolbox: Admin' as string,
|
title: ":toolbox: Admin" as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
description: 'You do not have permission to manage this!' as string,
|
description: "You do not have permission to manage this!" as string,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
footer: {
|
footer: {
|
||||||
iconURL: config?.footer?.icon as string,
|
iconURL: config?.footer?.icon as string,
|
||||||
|
@ -156,13 +156,13 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group - Credits
|
// Group - Credits
|
||||||
if (options?.getSubcommandGroup() === 'credits') {
|
if (options?.getSubcommandGroup() === "credits") {
|
||||||
// Execute Group - Credits
|
// Execute Group - Credits
|
||||||
return credits(interaction);
|
return credits(interaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group - Counters
|
// Group - Counters
|
||||||
else if (options?.getSubcommandGroup() === 'counters') {
|
else if (options?.getSubcommandGroup() === "counters") {
|
||||||
// Execute Group - Counters
|
// Execute Group - Counters
|
||||||
return counters(interaction);
|
return counters(interaction);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { CommandInteraction } from 'discord.js';
|
import { CommandInteraction } from "discord.js";
|
||||||
import { SlashCommandBuilder } from '@discordjs/builders';
|
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
import view from './modules/view';
|
import view from "./modules/view";
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from '../../handlers/logger';
|
import logger from "../../handlers/logger";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default {
|
export default {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName('counters')
|
.setName("counters")
|
||||||
.setDescription('Manage counters.')
|
.setDescription("Manage counters.")
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName('view')
|
.setName("view")
|
||||||
.setDescription('View a counter.')
|
.setDescription("View a counter.")
|
||||||
.addChannelOption((option) =>
|
.addChannelOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('channel')
|
.setName("channel")
|
||||||
.setDescription('The counter channel you want to view')
|
.setDescription("The counter channel you want to view")
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
@ -28,7 +28,7 @@ export default {
|
||||||
const { options, guild, user, commandName } = interaction;
|
const { options, guild, user, commandName } = interaction;
|
||||||
|
|
||||||
// Module - View
|
// Module - View
|
||||||
if (options?.getSubcommand() === 'view') {
|
if (options?.getSubcommand() === "view") {
|
||||||
// Execute Module - View
|
// Execute Module - View
|
||||||
return view(interaction);
|
return view(interaction);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { CommandInteraction, ColorResolvable } from 'discord.js';
|
import { CommandInteraction, ColorResolvable } from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import config from '../../../../config.json';
|
import config from "../../../../config.json";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import counterSchema from '../../../helpers/database/models/counterSchema';
|
import counterSchema from "../../../helpers/database/models/counterSchema";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
|
@ -13,7 +13,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
const { options, guild } = interaction;
|
const { options, guild } = interaction;
|
||||||
|
|
||||||
// Get options
|
// Get options
|
||||||
const optionChannel = options?.getChannel('channel');
|
const optionChannel = options?.getChannel("channel");
|
||||||
|
|
||||||
const counter = await counterSchema?.findOne({
|
const counter = await counterSchema?.findOne({
|
||||||
guildId: guild?.id,
|
guildId: guild?.id,
|
||||||
|
@ -23,7 +23,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
if (!counter) {
|
if (!counter) {
|
||||||
// Create embed object
|
// Create embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':1234: Counters [View]' as string,
|
title: ":1234: Counters [View]" as string,
|
||||||
description: `${optionChannel} is not a counting channel.` as string,
|
description: `${optionChannel} is not a counting channel.` as string,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
|
@ -39,7 +39,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
|
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':1234: Counters [View]' as string,
|
title: ":1234: Counters [View]" as string,
|
||||||
color: config.colors.success as ColorResolvable,
|
color: config.colors.success as ColorResolvable,
|
||||||
description: `${optionChannel} is currently at number ${counter?.counter}.`,
|
description: `${optionChannel} is currently at number ${counter?.counter}.`,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
|
|
@ -1,81 +1,81 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { SlashCommandBuilder } from '@discordjs/builders';
|
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||||
import { CommandInteraction } from 'discord.js';
|
import { CommandInteraction } from "discord.js";
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from '../../handlers/logger';
|
import logger from "../../handlers/logger";
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
import balance from './modules/balance';
|
import balance from "./modules/balance";
|
||||||
import gift from './modules/gift';
|
import gift from "./modules/gift";
|
||||||
import top from './modules/top';
|
import top from "./modules/top";
|
||||||
import work from './modules/work';
|
import work from "./modules/work";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default {
|
export default {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName('credits')
|
.setName("credits")
|
||||||
.setDescription('Manage your credits.')
|
.setDescription("Manage your credits.")
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName('balance')
|
.setName("balance")
|
||||||
.setDescription("Check a user's balance.")
|
.setDescription("Check a user's balance.")
|
||||||
.addUserOption((option) =>
|
.addUserOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('user')
|
.setName("user")
|
||||||
.setDescription('The user whose balance you want to check.')
|
.setDescription("The user whose balance you want to check.")
|
||||||
.setRequired(false)
|
.setRequired(false)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName('gift')
|
.setName("gift")
|
||||||
.setDescription('Gift someone credits from your credits.')
|
.setDescription("Gift someone credits from your credits.")
|
||||||
.addUserOption((option) =>
|
.addUserOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('user')
|
.setName("user")
|
||||||
.setDescription('The user you want to pay.')
|
.setDescription("The user you want to pay.")
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
)
|
)
|
||||||
.addIntegerOption((option) =>
|
.addIntegerOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('amount')
|
.setName("amount")
|
||||||
.setDescription('The amount you will pay.')
|
.setDescription("The amount you will pay.")
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
)
|
)
|
||||||
.addStringOption((option) =>
|
.addStringOption((option) =>
|
||||||
option.setName('reason').setDescription('Your reason.')
|
option.setName("reason").setDescription("Your reason.")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand.setName('top').setDescription('Check the top balance.')
|
subcommand.setName("top").setDescription("Check the top balance.")
|
||||||
)
|
)
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand.setName('work').setDescription('Work for credits.')
|
subcommand.setName("work").setDescription("Work for credits.")
|
||||||
),
|
),
|
||||||
async execute(interaction: CommandInteraction) {
|
async execute(interaction: CommandInteraction) {
|
||||||
const { options, user, guild, commandName } = interaction;
|
const { options, user, guild, commandName } = interaction;
|
||||||
|
|
||||||
// Module - Balance
|
// Module - Balance
|
||||||
if (options?.getSubcommand() === 'balance') {
|
if (options?.getSubcommand() === "balance") {
|
||||||
// Execute Module - Balance
|
// Execute Module - Balance
|
||||||
return balance(interaction);
|
return balance(interaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module - Gift
|
// Module - Gift
|
||||||
else if (options?.getSubcommand() === 'gift') {
|
else if (options?.getSubcommand() === "gift") {
|
||||||
// Execute Module - Gift
|
// Execute Module - Gift
|
||||||
return gift(interaction);
|
return gift(interaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module - Top
|
// Module - Top
|
||||||
else if (options?.getSubcommand() === 'top') {
|
else if (options?.getSubcommand() === "top") {
|
||||||
// Execute Module - Top
|
// Execute Module - Top
|
||||||
return top(interaction);
|
return top(interaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module - Work
|
// Module - Work
|
||||||
else if (options?.getSubcommand() === 'work') {
|
else if (options?.getSubcommand() === "work") {
|
||||||
// Execute Module - Work
|
// Execute Module - Work
|
||||||
return work(interaction);
|
return work(interaction);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { CommandInteraction, ColorResolvable } from 'discord.js';
|
import { CommandInteraction, ColorResolvable } from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import config from '../../../../config.json';
|
import config from "../../../../config.json";
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
import creditNoun from '../../../helpers/creditNoun';
|
import creditNoun from "../../../helpers/creditNoun";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import fetchUser from '../../../helpers/fetchUser';
|
import fetchUser from "../../../helpers/fetchUser";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
|
@ -16,7 +16,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
const { options, user, guild } = interaction;
|
const { options, user, guild } = interaction;
|
||||||
|
|
||||||
// User option
|
// User option
|
||||||
const optionUser = options?.getUser('user');
|
const optionUser = options?.getUser("user");
|
||||||
|
|
||||||
if (guild === null) return;
|
if (guild === null) return;
|
||||||
|
|
||||||
|
@ -27,9 +27,9 @@ export default async (interaction: CommandInteraction) => {
|
||||||
if (userDB === null) {
|
if (userDB === null) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':dollar: Credits [Balance]' as string,
|
title: ":dollar: Credits [Balance]" as string,
|
||||||
description: `We can not find ${
|
description: `We can not find ${
|
||||||
optionUser || 'you'
|
optionUser || "you"
|
||||||
} in our database.` as string,
|
} in our database.` as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
@ -47,9 +47,9 @@ export default async (interaction: CommandInteraction) => {
|
||||||
if (userDB.credits === null) {
|
if (userDB.credits === null) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':dollar: Credits [Balance]' as string,
|
title: ":dollar: Credits [Balance]" as string,
|
||||||
description: `We can not find credits for ${
|
description: `We can not find credits for ${
|
||||||
optionUser || 'you'
|
optionUser || "you"
|
||||||
} in our database.` as string,
|
} in our database.` as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
@ -64,9 +64,9 @@ export default async (interaction: CommandInteraction) => {
|
||||||
} else {
|
} else {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':dollar: Credits [Balance]' as string,
|
title: ":dollar: Credits [Balance]" as string,
|
||||||
description: `${
|
description: `${
|
||||||
optionUser ? `${optionUser} has` : 'You have'
|
optionUser ? `${optionUser} has` : "You have"
|
||||||
} ${creditNoun(userDB.credits)}.` as string,
|
} ${creditNoun(userDB.credits)}.` as string,
|
||||||
color: config?.colors?.success as ColorResolvable,
|
color: config?.colors?.success as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { CommandInteraction, ColorResolvable } from 'discord.js';
|
import { CommandInteraction, ColorResolvable } from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import config from '../../../../config.json';
|
import config from "../../../../config.json";
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from '../../../handlers/logger';
|
import logger from "../../../handlers/logger";
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
import saveUser from '../../../helpers/saveUser';
|
import saveUser from "../../../helpers/saveUser";
|
||||||
import creditNoun from '../../../helpers/creditNoun';
|
import creditNoun from "../../../helpers/creditNoun";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import fetchUser from '../../../helpers/fetchUser';
|
import fetchUser from "../../../helpers/fetchUser";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
|
@ -20,13 +20,13 @@ export default async (interaction: CommandInteraction) => {
|
||||||
const { options, user, guild, client } = interaction;
|
const { options, user, guild, client } = interaction;
|
||||||
|
|
||||||
// User option
|
// User option
|
||||||
const optionUser = options?.getUser('user');
|
const optionUser = options?.getUser("user");
|
||||||
|
|
||||||
// Amount option
|
// Amount option
|
||||||
const optionAmount = options?.getInteger('amount');
|
const optionAmount = options?.getInteger("amount");
|
||||||
|
|
||||||
// Reason option
|
// Reason option
|
||||||
const optionReason = options?.getString('reason');
|
const optionReason = options?.getString("reason");
|
||||||
|
|
||||||
if (guild === null) return;
|
if (guild === null) return;
|
||||||
if (optionUser === null) return;
|
if (optionUser === null) return;
|
||||||
|
@ -44,7 +44,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
if (optionUser?.id === user?.id) {
|
if (optionUser?.id === user?.id) {
|
||||||
// Create embed object
|
// Create embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':dollar: Credits [Gift]' as string,
|
title: ":dollar: Credits [Gift]" as string,
|
||||||
description: "You can't pay yourself." as string,
|
description: "You can't pay yourself." as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
@ -62,8 +62,8 @@ export default async (interaction: CommandInteraction) => {
|
||||||
if (optionAmount === null) {
|
if (optionAmount === null) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':dollar: Credits [Gift]' as string,
|
title: ":dollar: Credits [Gift]" as string,
|
||||||
description: 'We could not read your requested amount.' as string,
|
description: "We could not read your requested amount." as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
footer: {
|
footer: {
|
||||||
|
@ -80,7 +80,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
if (optionAmount <= 0) {
|
if (optionAmount <= 0) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':dollar: Credits [Gift]' as string,
|
title: ":dollar: Credits [Gift]" as string,
|
||||||
description: "You can't pay zero or below." as string,
|
description: "You can't pay zero or below." as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
@ -98,7 +98,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
if (fromUserDB?.credits < optionAmount) {
|
if (fromUserDB?.credits < optionAmount) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':dollar: Credits [Gift]' as string,
|
title: ":dollar: Credits [Gift]" as string,
|
||||||
description:
|
description:
|
||||||
`You have insufficient credits. Your credits is ${fromUserDB?.credits}` as string,
|
`You have insufficient credits. Your credits is ${fromUserDB?.credits}` as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
|
@ -117,7 +117,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
if (!toUserDB) {
|
if (!toUserDB) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':dollar: Credits [Gift]' as string,
|
title: ":dollar: Credits [Gift]" as string,
|
||||||
description:
|
description:
|
||||||
`That user has no credits, I can not gift credits to ${optionUser}` as string,
|
`That user has no credits, I can not gift credits to ${optionUser}` as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
|
@ -142,9 +142,9 @@ export default async (interaction: CommandInteraction) => {
|
||||||
await saveUser(fromUserDB, toUserDB)?.then(async () => {
|
await saveUser(fromUserDB, toUserDB)?.then(async () => {
|
||||||
// Interaction embed object
|
// Interaction embed object
|
||||||
const interactionEmbed = {
|
const interactionEmbed = {
|
||||||
title: ':dollar: Credits [Gift]',
|
title: ":dollar: Credits [Gift]",
|
||||||
description: `You sent ${creditNoun(optionAmount)} to ${optionUser}${
|
description: `You sent ${creditNoun(optionAmount)} to ${optionUser}${
|
||||||
optionReason ? ` with reason: ${optionReason}` : ''
|
optionReason ? ` with reason: ${optionReason}` : ""
|
||||||
}. Your new credits is ${creditNoun(fromUserDB?.credits)}.`,
|
}. Your new credits is ${creditNoun(fromUserDB?.credits)}.`,
|
||||||
color: config?.colors?.success as ColorResolvable,
|
color: config?.colors?.success as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
@ -156,9 +156,9 @@ export default async (interaction: CommandInteraction) => {
|
||||||
|
|
||||||
// DM embed object
|
// DM embed object
|
||||||
const dmEmbed = {
|
const dmEmbed = {
|
||||||
title: ':dollar: Credits [Gift]' as string,
|
title: ":dollar: Credits [Gift]" as string,
|
||||||
description: `You received ${creditNoun(optionAmount)} from ${user}${
|
description: `You received ${creditNoun(optionAmount)} from ${user}${
|
||||||
optionReason ? ` with reason: ${optionReason}` : ''
|
optionReason ? ` with reason: ${optionReason}` : ""
|
||||||
}. Your new credits is ${creditNoun(toUserDB?.credits)}.` as string,
|
}. Your new credits is ${creditNoun(toUserDB?.credits)}.` as string,
|
||||||
color: config?.colors?.success as ColorResolvable,
|
color: config?.colors?.success as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { CommandInteraction, ColorResolvable } from 'discord.js';
|
import { CommandInteraction, ColorResolvable } from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import config from '../../../../config.json';
|
import config from "../../../../config.json";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import userSchema from '../../../helpers/database/models/userSchema';
|
import userSchema from "../../../helpers/database/models/userSchema";
|
||||||
|
|
||||||
// helpers
|
// helpers
|
||||||
import creditNoun from '../../../helpers/creditNoun';
|
import creditNoun from "../../../helpers/creditNoun";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
|
@ -30,10 +30,10 @@ export default async (interaction: CommandInteraction) => {
|
||||||
|
|
||||||
// Create embed object
|
// Create embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':dollar: Credits [Top]' as string,
|
title: ":dollar: Credits [Top]" as string,
|
||||||
description: `Below are the top ten.\n${topTen
|
description: `Below are the top ten.\n${topTen
|
||||||
?.map((x, index) => entry(x, index))
|
?.map((x, index) => entry(x, index))
|
||||||
?.join('\n')}` as string,
|
?.join("\n")}` as string,
|
||||||
color: config?.colors?.success as ColorResolvable,
|
color: config?.colors?.success as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
footer: {
|
footer: {
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { CommandInteraction, ColorResolvable } from 'discord.js';
|
import { CommandInteraction, ColorResolvable } from "discord.js";
|
||||||
import Chance from 'chance';
|
import Chance from "chance";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import config from '../../../../config.json';
|
import config from "../../../../config.json";
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from '../../../handlers/logger';
|
import logger from "../../../handlers/logger";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import timeouts from '../../../helpers/database/models/timeoutSchema';
|
import timeouts from "../../../helpers/database/models/timeoutSchema";
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
import creditNoun from '../../../helpers/creditNoun';
|
import creditNoun from "../../../helpers/creditNoun";
|
||||||
import fetchUser from '../../../helpers/fetchUser';
|
import fetchUser from "../../../helpers/fetchUser";
|
||||||
import fetchGuild from '../../../helpers/fetchGuild';
|
import fetchGuild from "../../../helpers/fetchGuild";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
|
@ -28,7 +28,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
const isTimeout = await timeouts?.findOne({
|
const isTimeout = await timeouts?.findOne({
|
||||||
guildId: guild?.id,
|
guildId: guild?.id,
|
||||||
userId: user?.id,
|
userId: user?.id,
|
||||||
timeoutId: '2022-03-15-19-16',
|
timeoutId: "2022-03-15-19-16",
|
||||||
});
|
});
|
||||||
|
|
||||||
if (guild === null) return;
|
if (guild === null) return;
|
||||||
|
@ -54,7 +54,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
|
|
||||||
// Create embed object
|
// Create embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':dollar: Credits [Work]' as string,
|
title: ":dollar: Credits [Work]" as string,
|
||||||
description: `You have earned ${creditNoun(creditsEarned)}` as string,
|
description: `You have earned ${creditNoun(creditsEarned)}` as string,
|
||||||
color: config?.colors?.success as ColorResolvable,
|
color: config?.colors?.success as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
@ -72,7 +72,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
await timeouts?.create({
|
await timeouts?.create({
|
||||||
guildId: guild?.id,
|
guildId: guild?.id,
|
||||||
userId: user?.id,
|
userId: user?.id,
|
||||||
timeoutId: '2022-03-15-19-16',
|
timeoutId: "2022-03-15-19-16",
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
|
@ -87,13 +87,13 @@ export default async (interaction: CommandInteraction) => {
|
||||||
await timeouts?.deleteOne({
|
await timeouts?.deleteOne({
|
||||||
guildId: guild?.id,
|
guildId: guild?.id,
|
||||||
userId: user?.id,
|
userId: user?.id,
|
||||||
timeoutId: '2022-03-15-19-16',
|
timeoutId: "2022-03-15-19-16",
|
||||||
});
|
});
|
||||||
}, guildDB?.credits?.workTimeout);
|
}, guildDB?.credits?.workTimeout);
|
||||||
} else {
|
} else {
|
||||||
// Create embed object
|
// Create embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':dollar: Credits [Work]' as string,
|
title: ":dollar: Credits [Work]" as string,
|
||||||
description: `You have worked within the last ${
|
description: `You have worked within the last ${
|
||||||
guildDB?.credits?.workTimeout / 1000
|
guildDB?.credits?.workTimeout / 1000
|
||||||
} seconds, you can not work now!` as string,
|
} seconds, you can not work now!` as string,
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { SlashCommandBuilder } from '@discordjs/builders';
|
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||||
import { CommandInteraction } from 'discord.js';
|
import { CommandInteraction } from "discord.js";
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
import view from './modules/view';
|
import view from "./modules/view";
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from '../../handlers/logger';
|
import logger from "../../handlers/logger";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default {
|
export default {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName('profile')
|
.setName("profile")
|
||||||
.setDescription('Check a profile.')
|
.setDescription("Check a profile.")
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName('view')
|
.setName("view")
|
||||||
.setDescription('View a profile.')
|
.setDescription("View a profile.")
|
||||||
.addUserOption((option) =>
|
.addUserOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('target')
|
.setName("target")
|
||||||
.setDescription('The profile you wish to view')
|
.setDescription("The profile you wish to view")
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
async execute(interaction: CommandInteraction) {
|
async execute(interaction: CommandInteraction) {
|
||||||
|
@ -28,7 +28,7 @@ export default {
|
||||||
const { options, guild, user, commandName } = interaction;
|
const { options, guild, user, commandName } = interaction;
|
||||||
|
|
||||||
// Module - View
|
// Module - View
|
||||||
if (options?.getSubcommand() === 'view') {
|
if (options?.getSubcommand() === "view") {
|
||||||
// Execute Module - View
|
// Execute Module - View
|
||||||
return view(interaction);
|
return view(interaction);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { CommandInteraction, ColorResolvable } from 'discord.js';
|
import { CommandInteraction, ColorResolvable } from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import config from '../../../../config.json';
|
import config from "../../../../config.json";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import fetchUser from '../../../helpers/fetchUser';
|
import fetchUser from "../../../helpers/fetchUser";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
|
@ -13,7 +13,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
const { client, options, user, guild } = interaction;
|
const { client, options, user, guild } = interaction;
|
||||||
|
|
||||||
// Target information
|
// Target information
|
||||||
const target = options?.getUser('target');
|
const target = options?.getUser("target");
|
||||||
|
|
||||||
// Discord User Information
|
// Discord User Information
|
||||||
const discordUser = await client?.users?.fetch(
|
const discordUser = await client?.users?.fetch(
|
||||||
|
@ -35,27 +35,27 @@ export default async (interaction: CommandInteraction) => {
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: `:dollar: Credits` as string,
|
name: `:dollar: Credits` as string,
|
||||||
value: `${userObj?.credits || 'Not found'}` as string,
|
value: `${userObj?.credits || "Not found"}` as string,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: `:squeeze_bottle: Level` as string,
|
name: `:squeeze_bottle: Level` as string,
|
||||||
value: `${userObj?.level || 'Not found'}` as string,
|
value: `${userObj?.level || "Not found"}` as string,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: `:squeeze_bottle: Points` as string,
|
name: `:squeeze_bottle: Points` as string,
|
||||||
value: `${userObj?.points || 'Not found'}` as string,
|
value: `${userObj?.points || "Not found"}` as string,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: `:loudspeaker: Reputation` as string,
|
name: `:loudspeaker: Reputation` as string,
|
||||||
value: `${userObj?.reputation || 'Not found'}` as string,
|
value: `${userObj?.reputation || "Not found"}` as string,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: `:rainbow_flag: Language` as string,
|
name: `:rainbow_flag: Language` as string,
|
||||||
value: `${userObj?.language || 'Not found'}` as string,
|
value: `${userObj?.language || "Not found"}` as string,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { CommandInteraction, ColorResolvable } from 'discord.js';
|
import { CommandInteraction, ColorResolvable } from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import config from '../../../../config.json';
|
import config from "../../../../config.json";
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from '../../../handlers/logger';
|
import logger from "../../../handlers/logger";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import timeoutSchema from '../../../helpers/database/models/timeoutSchema';
|
import timeoutSchema from "../../../helpers/database/models/timeoutSchema";
|
||||||
import fetchUser from '../../../helpers/fetchUser';
|
import fetchUser from "../../../helpers/fetchUser";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
|
@ -17,10 +17,10 @@ export default async (interaction: CommandInteraction) => {
|
||||||
const { options, user, guild } = interaction;
|
const { options, user, guild } = interaction;
|
||||||
|
|
||||||
// Target option
|
// Target option
|
||||||
const optionTarget = options?.getUser('target');
|
const optionTarget = options?.getUser("target");
|
||||||
|
|
||||||
// Type information
|
// Type information
|
||||||
const optionType = options?.getString('type');
|
const optionType = options?.getString("type");
|
||||||
|
|
||||||
if (guild === null) return;
|
if (guild === null) return;
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
const isTimeout = await timeoutSchema?.findOne({
|
const isTimeout = await timeoutSchema?.findOne({
|
||||||
guildId: guild?.id,
|
guildId: guild?.id,
|
||||||
userId: user?.id,
|
userId: user?.id,
|
||||||
timeoutId: '2022-04-10-16-42',
|
timeoutId: "2022-04-10-16-42",
|
||||||
});
|
});
|
||||||
|
|
||||||
// If user is not on timeout
|
// If user is not on timeout
|
||||||
|
@ -42,8 +42,8 @@ export default async (interaction: CommandInteraction) => {
|
||||||
if (optionTarget?.id === user?.id) {
|
if (optionTarget?.id === user?.id) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':loudspeaker: Reputation [Give]' as string,
|
title: ":loudspeaker: Reputation [Give]" as string,
|
||||||
description: 'You can not repute yourself.' as string,
|
description: "You can not repute yourself." as string,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
footer: {
|
footer: {
|
||||||
|
@ -57,12 +57,12 @@ export default async (interaction: CommandInteraction) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If type is positive
|
// If type is positive
|
||||||
if (optionType === 'positive') {
|
if (optionType === "positive") {
|
||||||
userObj.reputation += 1;
|
userObj.reputation += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If type is negative
|
// If type is negative
|
||||||
else if (optionType === 'negative') {
|
else if (optionType === "negative") {
|
||||||
userObj.reputation -= 1;
|
userObj.reputation -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
await userObj?.save()?.then(async () => {
|
await userObj?.save()?.then(async () => {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':loudspeaker: Reputation [Give]' as string,
|
title: ":loudspeaker: Reputation [Give]" as string,
|
||||||
description:
|
description:
|
||||||
`You have given ${optionTarget} a ${optionType} reputation!` as string,
|
`You have given ${optionTarget} a ${optionType} reputation!` as string,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
@ -90,7 +90,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
await timeoutSchema?.create({
|
await timeoutSchema?.create({
|
||||||
guildId: guild?.id,
|
guildId: guild?.id,
|
||||||
userId: user?.id,
|
userId: user?.id,
|
||||||
timeoutId: '2022-04-10-16-42',
|
timeoutId: "2022-04-10-16-42",
|
||||||
});
|
});
|
||||||
// Return interaction reply
|
// Return interaction reply
|
||||||
return interaction?.editReply({ embeds: [embed] });
|
return interaction?.editReply({ embeds: [embed] });
|
||||||
|
@ -108,13 +108,13 @@ export default async (interaction: CommandInteraction) => {
|
||||||
await timeoutSchema?.deleteOne({
|
await timeoutSchema?.deleteOne({
|
||||||
guildId: guild?.id,
|
guildId: guild?.id,
|
||||||
userId: user?.id,
|
userId: user?.id,
|
||||||
timeoutId: '2022-04-10-16-42',
|
timeoutId: "2022-04-10-16-42",
|
||||||
});
|
});
|
||||||
}, config?.reputation?.timeout);
|
}, config?.reputation?.timeout);
|
||||||
} else {
|
} else {
|
||||||
// Create embed object
|
// Create embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':loudspeaker: Reputation [Give]' as string,
|
title: ":loudspeaker: Reputation [Give]" as string,
|
||||||
description: `You have given reputation within the last ${
|
description: `You have given reputation within the last ${
|
||||||
config?.reputation?.timeout / 1000
|
config?.reputation?.timeout / 1000
|
||||||
} seconds, you can not repute now!` as string,
|
} seconds, you can not repute now!` as string,
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { ColorResolvable, CommandInteraction } from 'discord.js';
|
import { ColorResolvable, CommandInteraction } from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import config from '../../../../../config.json';
|
import config from "../../../../../config.json";
|
||||||
|
|
||||||
//Handlers
|
//Handlers
|
||||||
import logger from '../../../../handlers/logger';
|
import logger from "../../../../handlers/logger";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import guildSchema from '../../../../helpers/database/models/guildSchema';
|
import guildSchema from "../../../../helpers/database/models/guildSchema";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
|
@ -16,12 +16,12 @@ export default async (interaction: CommandInteraction) => {
|
||||||
const { guild, user, options } = interaction;
|
const { guild, user, options } = interaction;
|
||||||
|
|
||||||
// Get options
|
// Get options
|
||||||
const status = options?.getBoolean('status');
|
const status = options?.getBoolean("status");
|
||||||
const rate = options?.getNumber('rate');
|
const rate = options?.getNumber("rate");
|
||||||
const timeout = options?.getNumber('timeout');
|
const timeout = options?.getNumber("timeout");
|
||||||
const minimumLength = options?.getNumber('minimum-length');
|
const minimumLength = options?.getNumber("minimum-length");
|
||||||
const workRate = options?.getNumber('work-rate');
|
const workRate = options?.getNumber("work-rate");
|
||||||
const workTimeout = options?.getNumber('work-timeout');
|
const workTimeout = options?.getNumber("work-timeout");
|
||||||
|
|
||||||
// Get guild object
|
// Get guild object
|
||||||
const guildDB = await guildSchema?.findOne({
|
const guildDB = await guildSchema?.findOne({
|
||||||
|
@ -44,37 +44,37 @@ export default async (interaction: CommandInteraction) => {
|
||||||
await guildDB?.save()?.then(async () => {
|
await guildDB?.save()?.then(async () => {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':tools: Settings - Guild [Credits]' as string,
|
title: ":tools: Settings - Guild [Credits]" as string,
|
||||||
description: 'Following settings is set!' as string,
|
description: "Following settings is set!" as string,
|
||||||
color: config?.colors?.success as ColorResolvable,
|
color: config?.colors?.success as ColorResolvable,
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: '🤖 Status' as string,
|
name: "🤖 Status" as string,
|
||||||
value: `${guildDB?.credits?.status}` as string,
|
value: `${guildDB?.credits?.status}` as string,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '📈 Rate' as string,
|
name: "📈 Rate" as string,
|
||||||
value: `${guildDB?.credits?.rate}` as string,
|
value: `${guildDB?.credits?.rate}` as string,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '📈 Work Rate' as string,
|
name: "📈 Work Rate" as string,
|
||||||
value: `${guildDB?.credits?.workRate}` as string,
|
value: `${guildDB?.credits?.workRate}` as string,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '🔨 Minimum Length' as string,
|
name: "🔨 Minimum Length" as string,
|
||||||
value: `${guildDB?.credits?.minimumLength}` as string,
|
value: `${guildDB?.credits?.minimumLength}` as string,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '⏰ Timeout' as string,
|
name: "⏰ Timeout" as string,
|
||||||
value: `${guildDB?.credits?.timeout}` as string,
|
value: `${guildDB?.credits?.timeout}` as string,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '⏰ Work Timeout' as string,
|
name: "⏰ Work Timeout" as string,
|
||||||
value: `${guildDB?.credits?.workTimeout}` as string,
|
value: `${guildDB?.credits?.workTimeout}` as string,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { ColorResolvable, CommandInteraction } from 'discord.js';
|
import { ColorResolvable, CommandInteraction } from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import config from '../../../../../config.json';
|
import config from "../../../../../config.json";
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from '../../../../handlers/logger';
|
import logger from "../../../../handlers/logger";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import guildSchema from '../../../../helpers/database/models/guildSchema';
|
import guildSchema from "../../../../helpers/database/models/guildSchema";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
|
@ -16,10 +16,10 @@ export default async (interaction: CommandInteraction) => {
|
||||||
const { options, guild, user } = interaction;
|
const { options, guild, user } = interaction;
|
||||||
|
|
||||||
// Get options
|
// Get options
|
||||||
const status = options?.getBoolean('status');
|
const status = options?.getBoolean("status");
|
||||||
const rate = options?.getNumber('rate');
|
const rate = options?.getNumber("rate");
|
||||||
const timeout = options?.getNumber('timeout');
|
const timeout = options?.getNumber("timeout");
|
||||||
const minimumLength = options?.getNumber('minimum-length');
|
const minimumLength = options?.getNumber("minimum-length");
|
||||||
|
|
||||||
// Get guild object
|
// Get guild object
|
||||||
const guildDB = await guildSchema?.findOne({
|
const guildDB = await guildSchema?.findOne({
|
||||||
|
@ -38,27 +38,27 @@ export default async (interaction: CommandInteraction) => {
|
||||||
await guildDB?.save()?.then(async () => {
|
await guildDB?.save()?.then(async () => {
|
||||||
// Create embed object
|
// Create embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':hammer: Settings - Guild [Points]' as string,
|
title: ":hammer: Settings - Guild [Points]" as string,
|
||||||
description: 'Following settings is set!' as string,
|
description: "Following settings is set!" as string,
|
||||||
color: config.colors.success as ColorResolvable,
|
color: config.colors.success as ColorResolvable,
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: '🤖 Status' as string,
|
name: "🤖 Status" as string,
|
||||||
value: `${guildDB?.points?.status}` as string,
|
value: `${guildDB?.points?.status}` as string,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '📈 Rate' as string,
|
name: "📈 Rate" as string,
|
||||||
value: `${guildDB?.points?.rate}` as string,
|
value: `${guildDB?.points?.rate}` as string,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '🔨 Minimum Length' as string,
|
name: "🔨 Minimum Length" as string,
|
||||||
value: `${guildDB?.points?.minimumLength}` as string,
|
value: `${guildDB?.points?.minimumLength}` as string,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '⏰ Timeout' as string,
|
name: "⏰ Timeout" as string,
|
||||||
value: `${guildDB?.points?.timeout}` as string,
|
value: `${guildDB?.points?.timeout}` as string,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { ColorResolvable, CommandInteraction } from 'discord.js';
|
import { ColorResolvable, CommandInteraction } from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import config from '../../../../../config.json';
|
import config from "../../../../../config.json";
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from '../../../../handlers/logger';
|
import logger from "../../../../handlers/logger";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import apiSchema from '../../../../helpers/database/models/apiSchema';
|
import apiSchema from "../../../../helpers/database/models/apiSchema";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
|
@ -16,8 +16,8 @@ export default async (interaction: CommandInteraction) => {
|
||||||
const { options, guild, user } = interaction;
|
const { options, guild, user } = interaction;
|
||||||
|
|
||||||
// Get options
|
// Get options
|
||||||
const url = options?.getString('url');
|
const url = options?.getString("url");
|
||||||
const token = options?.getString('token');
|
const token = options?.getString("token");
|
||||||
|
|
||||||
// Update API credentials
|
// Update API credentials
|
||||||
await apiSchema
|
await apiSchema
|
||||||
|
@ -29,9 +29,9 @@ export default async (interaction: CommandInteraction) => {
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':hammer: Settings - Guild [Pterodactyl]' as string,
|
title: ":hammer: Settings - Guild [Pterodactyl]" as string,
|
||||||
color: config?.colors?.success as ColorResolvable,
|
color: config?.colors?.success as ColorResolvable,
|
||||||
description: 'Pterodactyl settings is saved!' as string,
|
description: "Pterodactyl settings is saved!" as string,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
footer: {
|
footer: {
|
||||||
iconURL: config?.footer?.icon as string,
|
iconURL: config?.footer?.icon as string,
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { Permissions, ColorResolvable, CommandInteraction } from 'discord.js';
|
import { Permissions, ColorResolvable, CommandInteraction } from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import config from '../../../../config.json';
|
import config from "../../../../config.json";
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from '../../../handlers/logger';
|
import logger from "../../../handlers/logger";
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
import pterodactyl from './addons/pterodactyl';
|
import pterodactyl from "./addons/pterodactyl";
|
||||||
import credits from './addons/credits';
|
import credits from "./addons/credits";
|
||||||
import points from './addons/points';
|
import points from "./addons/points";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
|
@ -21,9 +21,9 @@ export default async (interaction: CommandInteraction) => {
|
||||||
if (!memberPermissions?.has(Permissions?.FLAGS?.MANAGE_GUILD)) {
|
if (!memberPermissions?.has(Permissions?.FLAGS?.MANAGE_GUILD)) {
|
||||||
// Create embed object
|
// Create embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':tools: Settings - Guild' as string,
|
title: ":tools: Settings - Guild" as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
description: 'You do not have permission to manage this!' as string,
|
description: "You do not have permission to manage this!" as string,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
footer: {
|
footer: {
|
||||||
iconURL: config?.footer?.icon as string,
|
iconURL: config?.footer?.icon as string,
|
||||||
|
@ -36,19 +36,19 @@ export default async (interaction: CommandInteraction) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module - Pterodactyl
|
// Module - Pterodactyl
|
||||||
if (options?.getSubcommand() === 'pterodactyl') {
|
if (options?.getSubcommand() === "pterodactyl") {
|
||||||
// Execute Module - Pterodactyl
|
// Execute Module - Pterodactyl
|
||||||
return pterodactyl(interaction);
|
return pterodactyl(interaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module - Credits
|
// Module - Credits
|
||||||
else if (options?.getSubcommand() === 'credits') {
|
else if (options?.getSubcommand() === "credits") {
|
||||||
// Execute Module - Credits
|
// Execute Module - Credits
|
||||||
return credits(interaction);
|
return credits(interaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module - Points
|
// Module - Points
|
||||||
else if (options?.getSubcommand() === 'points') {
|
else if (options?.getSubcommand() === "points") {
|
||||||
// Execute Module - Points
|
// Execute Module - Points
|
||||||
return points(interaction);
|
return points(interaction);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { CommandInteraction, ColorResolvable } from 'discord.js';
|
import { CommandInteraction, ColorResolvable } from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import config from '../../../../../config.json';
|
import config from "../../../../../config.json";
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from '../../../../handlers/logger';
|
import logger from "../../../../handlers/logger";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import fetchUser from '../../../../helpers/fetchUser';
|
import fetchUser from "../../../../helpers/fetchUser";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
|
@ -16,7 +16,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
const { options, user, guild } = interaction;
|
const { options, user, guild } = interaction;
|
||||||
|
|
||||||
// Get options
|
// Get options
|
||||||
const language = options?.getString('language');
|
const language = options?.getString("language");
|
||||||
|
|
||||||
if (guild === null) return;
|
if (guild === null) return;
|
||||||
|
|
||||||
|
@ -32,12 +32,12 @@ export default async (interaction: CommandInteraction) => {
|
||||||
await userDB?.save()?.then(async () => {
|
await userDB?.save()?.then(async () => {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':hammer: Settings - User [Appearance]' as string,
|
title: ":hammer: Settings - User [Appearance]" as string,
|
||||||
description: 'Following settings is set!' as string,
|
description: "Following settings is set!" as string,
|
||||||
color: config?.colors?.success as ColorResolvable,
|
color: config?.colors?.success as ColorResolvable,
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: '🏳️🌈 Language' as string,
|
name: "🏳️🌈 Language" as string,
|
||||||
value: `${userDB?.language}` as string,
|
value: `${userDB?.language}` as string,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,53 +1,53 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { SlashCommandBuilder } from '@discordjs/builders';
|
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||||
import { CommandInteraction } from 'discord.js';
|
import { CommandInteraction } from "discord.js";
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
import pterodactyl from './modules/pterodactyl';
|
import pterodactyl from "./modules/pterodactyl";
|
||||||
|
|
||||||
// Groups
|
// Groups
|
||||||
import roles from './roles';
|
import roles from "./roles";
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from '../../handlers/logger';
|
import logger from "../../handlers/logger";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default {
|
export default {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName('shop')
|
.setName("shop")
|
||||||
.setDescription('Open our shop.')
|
.setDescription("Open our shop.")
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName('pterodactyl')
|
.setName("pterodactyl")
|
||||||
.setDescription('Buy pterodactyl power.')
|
.setDescription("Buy pterodactyl power.")
|
||||||
.addIntegerOption((option) =>
|
.addIntegerOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('amount')
|
.setName("amount")
|
||||||
.setDescription('How much credits you want to withdraw.')
|
.setDescription("How much credits you want to withdraw.")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.addSubcommandGroup((group) =>
|
.addSubcommandGroup((group) =>
|
||||||
group
|
group
|
||||||
.setName('roles')
|
.setName("roles")
|
||||||
.setDescription('Manage custom roles.')
|
.setDescription("Manage custom roles.")
|
||||||
.addSubcommand((command) =>
|
.addSubcommand((command) =>
|
||||||
command
|
command
|
||||||
.setName('buy')
|
.setName("buy")
|
||||||
.setDescription('Buy a custom role')
|
.setDescription("Buy a custom role")
|
||||||
.addStringOption((option) =>
|
.addStringOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('name')
|
.setName("name")
|
||||||
.setDescription('Name of the role you wish to purchase.')
|
.setDescription("Name of the role you wish to purchase.")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.addSubcommand((command) =>
|
.addSubcommand((command) =>
|
||||||
command
|
command
|
||||||
.setName('cancel')
|
.setName("cancel")
|
||||||
.setDescription('Cancel a custom role')
|
.setDescription("Cancel a custom role")
|
||||||
.addRoleOption((option) =>
|
.addRoleOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('role')
|
.setName("role")
|
||||||
.setDescription('Name of the role you wish to cancel.')
|
.setDescription("Name of the role you wish to cancel.")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
@ -56,13 +56,13 @@ export default {
|
||||||
const { options, commandName, user, guild } = interaction;
|
const { options, commandName, user, guild } = interaction;
|
||||||
|
|
||||||
// Module - Pterodactyl
|
// Module - Pterodactyl
|
||||||
if (options?.getSubcommand() === 'pterodactyl') {
|
if (options?.getSubcommand() === "pterodactyl") {
|
||||||
// Execute Module - Pterodactyl
|
// Execute Module - Pterodactyl
|
||||||
return pterodactyl(interaction);
|
return pterodactyl(interaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group - Roles
|
// Group - Roles
|
||||||
else if (options?.getSubcommandGroup() === 'roles') {
|
else if (options?.getSubcommandGroup() === "roles") {
|
||||||
// Execute Group - Roles
|
// Execute Group - Roles
|
||||||
return roles(interaction);
|
return roles(interaction);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,34 +1,34 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { CommandInteraction, ColorResolvable } from 'discord.js';
|
import { CommandInteraction, ColorResolvable } from "discord.js";
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from "uuid";
|
||||||
import axios from 'axios';
|
import axios from "axios";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import config from '../../../../config.json';
|
import config from "../../../../config.json";
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from '../../../handlers/logger';
|
import logger from "../../../handlers/logger";
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
import creditNoun from '../../../helpers/creditNoun';
|
import creditNoun from "../../../helpers/creditNoun";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import apiSchema from '../../../helpers/database/models/apiSchema';
|
import apiSchema from "../../../helpers/database/models/apiSchema";
|
||||||
import fetchUser from '../../../helpers/fetchUser';
|
import fetchUser from "../../../helpers/fetchUser";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
const { options, guild, user, client } = interaction;
|
const { options, guild, user, client } = interaction;
|
||||||
|
|
||||||
// Get options
|
// Get options
|
||||||
const optionAmount = options?.getInteger('amount');
|
const optionAmount = options?.getInteger("amount");
|
||||||
|
|
||||||
// If amount is null
|
// If amount is null
|
||||||
if (optionAmount === null) {
|
if (optionAmount === null) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':dollar: Credits [Gift]' as string,
|
title: ":dollar: Credits [Gift]" as string,
|
||||||
description: 'We could not read your requested amount.' as string,
|
description: "We could not read your requested amount." as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
footer: {
|
footer: {
|
||||||
|
@ -54,13 +54,13 @@ export default async (interaction: CommandInteraction) => {
|
||||||
// Stop if amount or user credits is below 100
|
// Stop if amount or user credits is below 100
|
||||||
if ((optionAmount || userDB?.credits) < 100) {
|
if ((optionAmount || userDB?.credits) < 100) {
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':shopping_cart: Shop [Pterodactyl]' as string,
|
title: ":shopping_cart: Shop [Pterodactyl]" as string,
|
||||||
description:
|
description:
|
||||||
`You **can't** withdraw for __Pterodactyl__ below **100**.` as string,
|
`You **can't** withdraw for __Pterodactyl__ below **100**.` as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: 'Your balance' as string,
|
name: "Your balance" as string,
|
||||||
value: `${creditNoun(userDB?.credits)}` as string,
|
value: `${creditNoun(userDB?.credits)}` as string,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -76,13 +76,13 @@ export default async (interaction: CommandInteraction) => {
|
||||||
// Stop if amount or user credits is above 1.000.000
|
// Stop if amount or user credits is above 1.000.000
|
||||||
if ((optionAmount || userDB?.credits) > 1000000) {
|
if ((optionAmount || userDB?.credits) > 1000000) {
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':shopping_cart: Shop [Pterodactyl]' as string,
|
title: ":shopping_cart: Shop [Pterodactyl]" as string,
|
||||||
description:
|
description:
|
||||||
`You **can't** withdraw for __Pterodactyl__ above **1.000.000**.` as string,
|
`You **can't** withdraw for __Pterodactyl__ above **1.000.000**.` as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: 'Your balance' as string,
|
name: "Your balance" as string,
|
||||||
value: `${creditNoun(userDB?.credits)}` as string,
|
value: `${creditNoun(userDB?.credits)}` as string,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -98,12 +98,12 @@ export default async (interaction: CommandInteraction) => {
|
||||||
// Stop if user credits is below amount
|
// Stop if user credits is below amount
|
||||||
if (userDB?.credits < optionAmount) {
|
if (userDB?.credits < optionAmount) {
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':shopping_cart: Shop [Pterodactyl]' as string,
|
title: ":shopping_cart: Shop [Pterodactyl]" as string,
|
||||||
description: `You have **insufficient** credits.` as string,
|
description: `You have **insufficient** credits.` as string,
|
||||||
color: config.colors.error as ColorResolvable,
|
color: config.colors.error as ColorResolvable,
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: 'Your balance' as string,
|
name: "Your balance" as string,
|
||||||
value: `${creditNoun(userDB?.credits)}` as string,
|
value: `${creditNoun(userDB?.credits)}` as string,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -131,13 +131,13 @@ export default async (interaction: CommandInteraction) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Get shop URL
|
// Get shop URL
|
||||||
const shopUrl = apiCredentials?.url?.replace('/api', '/store');
|
const shopUrl = apiCredentials?.url?.replace("/api", "/store");
|
||||||
|
|
||||||
// Make API request
|
// Make API request
|
||||||
await api
|
await api
|
||||||
|
|
||||||
// Make a post request to the API
|
// Make a post request to the API
|
||||||
?.post('vouchers', {
|
?.post("vouchers", {
|
||||||
uses: 1,
|
uses: 1,
|
||||||
code,
|
code,
|
||||||
credits: optionAmount || userDB?.credits,
|
credits: optionAmount || userDB?.credits,
|
||||||
|
@ -148,12 +148,12 @@ export default async (interaction: CommandInteraction) => {
|
||||||
?.then(async () => {
|
?.then(async () => {
|
||||||
// Create DM embed object
|
// Create DM embed object
|
||||||
const dmEmbed = {
|
const dmEmbed = {
|
||||||
title: ':shopping_cart: Shop [Pterodactyl]' as string,
|
title: ":shopping_cart: Shop [Pterodactyl]" as string,
|
||||||
description: `Redeem this voucher [here](${shopUrl})!` as string,
|
description: `Redeem this voucher [here](${shopUrl})!` as string,
|
||||||
fields: [
|
fields: [
|
||||||
{ name: 'Code' as string, value: `${code}` as string, inline: true },
|
{ name: "Code" as string, value: `${code}` as string, inline: true },
|
||||||
{
|
{
|
||||||
name: 'Credits' as string,
|
name: "Credits" as string,
|
||||||
value: `${optionAmount || userDB?.credits}` as string,
|
value: `${optionAmount || userDB?.credits}` as string,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
|
@ -168,8 +168,8 @@ export default async (interaction: CommandInteraction) => {
|
||||||
|
|
||||||
// Create interaction embed object
|
// Create interaction embed object
|
||||||
const interactionEmbed = {
|
const interactionEmbed = {
|
||||||
title: ':shopping_cart: Shop [Pterodactyl]' as string,
|
title: ":shopping_cart: Shop [Pterodactyl]" as string,
|
||||||
description: 'I have sent you the code in DM!' as string,
|
description: "I have sent you the code in DM!" as string,
|
||||||
color: config?.colors?.success as ColorResolvable,
|
color: config?.colors?.success as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
footer: {
|
footer: {
|
||||||
|
@ -204,9 +204,9 @@ export default async (interaction: CommandInteraction) => {
|
||||||
.catch(async (e: any) => {
|
.catch(async (e: any) => {
|
||||||
logger?.error(e);
|
logger?.error(e);
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':shopping_cart: Shop [Pterodactyl]' as string,
|
title: ":shopping_cart: Shop [Pterodactyl]" as string,
|
||||||
description:
|
description:
|
||||||
'Something went wrong, please try again later.' as string,
|
"Something went wrong, please try again later." as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
footer: {
|
footer: {
|
||||||
|
@ -222,8 +222,8 @@ export default async (interaction: CommandInteraction) => {
|
||||||
.catch(async (e) => {
|
.catch(async (e) => {
|
||||||
logger?.error(e);
|
logger?.error(e);
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':shopping_cart: Shop [Pterodactyl]' as string,
|
title: ":shopping_cart: Shop [Pterodactyl]" as string,
|
||||||
description: 'Something went wrong, please try again later.' as string,
|
description: "Something went wrong, please try again later." as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
footer: {
|
footer: {
|
||||||
|
|
|
@ -3,31 +3,31 @@ import {
|
||||||
CommandInteraction,
|
CommandInteraction,
|
||||||
ColorResolvable,
|
ColorResolvable,
|
||||||
GuildMemberRoleManager,
|
GuildMemberRoleManager,
|
||||||
} from 'discord.js';
|
} from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import config from '../../../../../config.json';
|
import config from "../../../../../config.json";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import shopRolesSchema from '../../../../helpers/database/models/shopRolesSchema';
|
import shopRolesSchema from "../../../../helpers/database/models/shopRolesSchema";
|
||||||
import guildSchema from '../../../../helpers/database/models/guildSchema';
|
import guildSchema from "../../../../helpers/database/models/guildSchema";
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
import creditNoun from '../../../../helpers/creditNoun';
|
import creditNoun from "../../../../helpers/creditNoun";
|
||||||
import fetchUser from '../../../../helpers/fetchUser';
|
import fetchUser from "../../../../helpers/fetchUser";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
const { options, guild, user, member } = interaction;
|
const { options, guild, user, member } = interaction;
|
||||||
|
|
||||||
const optionName = options?.getString('name');
|
const optionName = options?.getString("name");
|
||||||
|
|
||||||
// If amount is null
|
// If amount is null
|
||||||
if (optionName === null) {
|
if (optionName === null) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':dollar: Shop - Roles [Buy]' as string,
|
title: ":dollar: Shop - Roles [Buy]" as string,
|
||||||
description: 'We could not read your requested name.' as string,
|
description: "We could not read your requested name." as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
footer: {
|
footer: {
|
||||||
|
@ -43,7 +43,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
await guild?.roles
|
await guild?.roles
|
||||||
.create({
|
.create({
|
||||||
name: optionName,
|
name: optionName,
|
||||||
color: 'RED',
|
color: "RED",
|
||||||
reason: `${user?.id} bought from shop`,
|
reason: `${user?.id} bought from shop`,
|
||||||
})
|
})
|
||||||
.then(async (role) => {
|
.then(async (role) => {
|
||||||
|
@ -74,13 +74,13 @@ export default async (interaction: CommandInteraction) => {
|
||||||
await shopRolesSchema?.find()?.then((role: any) => console.log(role));
|
await shopRolesSchema?.find()?.then((role: any) => console.log(role));
|
||||||
|
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':shopping_cart: Shop - Roles [Buy]' as string,
|
title: ":shopping_cart: Shop - Roles [Buy]" as string,
|
||||||
description:
|
description:
|
||||||
`You have bought ${role?.name} for ${guildDB?.shop?.roles?.pricePerHour} per hour.` as string,
|
`You have bought ${role?.name} for ${guildDB?.shop?.roles?.pricePerHour} per hour.` as string,
|
||||||
color: config?.colors?.success as ColorResolvable,
|
color: config?.colors?.success as ColorResolvable,
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: 'Your balance' as string,
|
name: "Your balance" as string,
|
||||||
value: `${creditNoun(userDB?.credits)}` as string,
|
value: `${creditNoun(userDB?.credits)}` as string,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -3,30 +3,30 @@ import {
|
||||||
CommandInteraction,
|
CommandInteraction,
|
||||||
ColorResolvable,
|
ColorResolvable,
|
||||||
GuildMemberRoleManager,
|
GuildMemberRoleManager,
|
||||||
} from 'discord.js';
|
} from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import config from '../../../../../config.json';
|
import config from "../../../../../config.json";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import shopRolesSchema from '../../../../helpers/database/models/shopRolesSchema';
|
import shopRolesSchema from "../../../../helpers/database/models/shopRolesSchema";
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
import creditNoun from '../../../../helpers/creditNoun';
|
import creditNoun from "../../../../helpers/creditNoun";
|
||||||
import fetchUser from '../../../../helpers/fetchUser';
|
import fetchUser from "../../../../helpers/fetchUser";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
const { options, guild, user, member } = interaction;
|
const { options, guild, user, member } = interaction;
|
||||||
|
|
||||||
const optionRole = options.getRole('role');
|
const optionRole = options.getRole("role");
|
||||||
|
|
||||||
// If amount is null
|
// If amount is null
|
||||||
if (optionRole === null) {
|
if (optionRole === null) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':dollar: Shop - Roles [Cancel]' as string,
|
title: ":dollar: Shop - Roles [Cancel]" as string,
|
||||||
description: 'We could not read your requested role.' as string,
|
description: "We could not read your requested role." as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
footer: {
|
footer: {
|
||||||
|
@ -62,12 +62,12 @@ export default async (interaction: CommandInteraction) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':shopping_cart: Shop - Roles [Cancel]' as string,
|
title: ":shopping_cart: Shop - Roles [Cancel]" as string,
|
||||||
description: `You have canceled ${optionRole.name}.` as string,
|
description: `You have canceled ${optionRole.name}.` as string,
|
||||||
color: config?.colors?.success as ColorResolvable,
|
color: config?.colors?.success as ColorResolvable,
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: 'Your balance' as string,
|
name: "Your balance" as string,
|
||||||
value: `${creditNoun(userDB?.credits)}` as string,
|
value: `${creditNoun(userDB?.credits)}` as string,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,55 +1,55 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { SlashCommandBuilder } from '@discordjs/builders';
|
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||||
import { CommandInteraction } from 'discord.js';
|
import { CommandInteraction } from "discord.js";
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
import lookup from './modules/lookup';
|
import lookup from "./modules/lookup";
|
||||||
import about from './modules/about';
|
import about from "./modules/about";
|
||||||
import stats from './modules/stats';
|
import stats from "./modules/stats";
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from '../../handlers/logger';
|
import logger from "../../handlers/logger";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default {
|
export default {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName('utilities')
|
.setName("utilities")
|
||||||
.setDescription('Common utilities.')
|
.setDescription("Common utilities.")
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName('lookup')
|
.setName("lookup")
|
||||||
.setDescription(
|
.setDescription(
|
||||||
'Lookup a domain or ip. (Request sent over HTTP, proceed with caution!)'
|
"Lookup a domain or ip. (Request sent over HTTP, proceed with caution!)"
|
||||||
)
|
)
|
||||||
.addStringOption((option) =>
|
.addStringOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('query')
|
.setName("query")
|
||||||
.setDescription('The query you want to look up.')
|
.setDescription("The query you want to look up.")
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand.setName('about').setDescription('About this bot!)')
|
subcommand.setName("about").setDescription("About this bot!)")
|
||||||
)
|
)
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand.setName('stats').setDescription('Check bot statistics!)')
|
subcommand.setName("stats").setDescription("Check bot statistics!)")
|
||||||
),
|
),
|
||||||
async execute(interaction: CommandInteraction) {
|
async execute(interaction: CommandInteraction) {
|
||||||
// Destructure
|
// Destructure
|
||||||
const { options, guild, user, commandName } = interaction;
|
const { options, guild, user, commandName } = interaction;
|
||||||
|
|
||||||
// Module - Lookup
|
// Module - Lookup
|
||||||
if (options?.getSubcommand() === 'lookup') {
|
if (options?.getSubcommand() === "lookup") {
|
||||||
// Execute Module - Lookup
|
// Execute Module - Lookup
|
||||||
return lookup(interaction);
|
return lookup(interaction);
|
||||||
}
|
}
|
||||||
// Module - About
|
// Module - About
|
||||||
else if (options?.getSubcommand() === 'about') {
|
else if (options?.getSubcommand() === "about") {
|
||||||
// Execute Module - About
|
// Execute Module - About
|
||||||
return about(interaction);
|
return about(interaction);
|
||||||
}
|
}
|
||||||
// Module - Stats
|
// Module - Stats
|
||||||
else if (options?.getSubcommand() === 'stats') {
|
else if (options?.getSubcommand() === "stats") {
|
||||||
// Execute Module - Stats
|
// Execute Module - Stats
|
||||||
return stats(interaction);
|
return stats(interaction);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { CommandInteraction, ColorResolvable } from 'discord.js';
|
import { CommandInteraction, ColorResolvable } from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import config from '../../../../config.json';
|
import config from "../../../../config.json";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
const interactionEmbed = {
|
const interactionEmbed = {
|
||||||
title: ':hammer: Utilities [About]' as string,
|
title: ":hammer: Utilities [About]" as string,
|
||||||
description: `This bot is hosted by ${
|
description: `This bot is hosted by ${
|
||||||
config?.hoster?.url
|
config?.hoster?.url
|
||||||
? `[${config?.hoster?.name}](${config?.hoster?.url})`
|
? `[${config?.hoster?.name}](${config?.hoster?.url})`
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import axios from 'axios';
|
import axios from "axios";
|
||||||
import { CommandInteraction, ColorResolvable } from 'discord.js';
|
import { CommandInteraction, ColorResolvable } from "discord.js";
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
import config from '../../../../config.json';
|
import config from "../../../../config.json";
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from '../../../handlers/logger';
|
import logger from "../../../handlers/logger";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
const { options } = interaction;
|
const { options } = interaction;
|
||||||
// Get lookup query
|
// Get lookup query
|
||||||
const query = options?.getString('query');
|
const query = options?.getString("query");
|
||||||
|
|
||||||
// Make API request
|
// Make API request
|
||||||
await axios
|
await axios
|
||||||
|
@ -22,10 +22,10 @@ export default async (interaction: CommandInteraction) => {
|
||||||
// If successful
|
// If successful
|
||||||
?.then(async (res) => {
|
?.then(async (res) => {
|
||||||
// If query failed
|
// If query failed
|
||||||
if (res?.data?.status === 'fail') {
|
if (res?.data?.status === "fail") {
|
||||||
// Create embed object
|
// Create embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':hammer: Utilities - Lookup' as string,
|
title: ":hammer: Utilities - Lookup" as string,
|
||||||
description: `${res?.data?.message}: ${res?.data?.query}` as string,
|
description: `${res?.data?.message}: ${res?.data?.query}` as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
@ -40,58 +40,58 @@ export default async (interaction: CommandInteraction) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If query is successful
|
// If query is successful
|
||||||
else if (res?.data?.status === 'success') {
|
else if (res?.data?.status === "success") {
|
||||||
// Create embed object
|
// Create embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':hammer: Utilities - Lookup' as string,
|
title: ":hammer: Utilities - Lookup" as string,
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: 'AS' as string,
|
name: "AS" as string,
|
||||||
value: `${res?.data?.as || 'Not available'}` as string,
|
value: `${res?.data?.as || "Not available"}` as string,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Country' as string,
|
name: "Country" as string,
|
||||||
value: `${res?.data?.country || 'Not available'}` as string,
|
value: `${res?.data?.country || "Not available"}` as string,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Country Code' as string,
|
name: "Country Code" as string,
|
||||||
value: `${res?.data?.countryCode || 'Not available'}` as string,
|
value: `${res?.data?.countryCode || "Not available"}` as string,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Region' as string,
|
name: "Region" as string,
|
||||||
value: `${res?.data?.region || 'Not available'}` as string,
|
value: `${res?.data?.region || "Not available"}` as string,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Region Name' as string,
|
name: "Region Name" as string,
|
||||||
value: `${res?.data?.regionName || 'Not available'}` as string,
|
value: `${res?.data?.regionName || "Not available"}` as string,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'City' as string,
|
name: "City" as string,
|
||||||
value: `${res?.data?.city || 'Not available'}` as string,
|
value: `${res?.data?.city || "Not available"}` as string,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'ZIP Code' as string,
|
name: "ZIP Code" as string,
|
||||||
value: `${res?.data?.zip || 'Not available'}` as string,
|
value: `${res?.data?.zip || "Not available"}` as string,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Latitude' as string,
|
name: "Latitude" as string,
|
||||||
value: `${res?.data?.lat || 'Not available'}` as string,
|
value: `${res?.data?.lat || "Not available"}` as string,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Longitude' as string,
|
name: "Longitude" as string,
|
||||||
value: `${res?.data?.lon || 'Not available'}` as string,
|
value: `${res?.data?.lon || "Not available"}` as string,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Timezone' as string,
|
name: "Timezone" as string,
|
||||||
value: `${res?.data?.timezone || 'Not available'}` as string,
|
value: `${res?.data?.timezone || "Not available"}` as string,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'ISP' as string,
|
name: "ISP" as string,
|
||||||
value: `${res?.data?.isp || 'Not available'}` as string,
|
value: `${res?.data?.isp || "Not available"}` as string,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Organization' as string,
|
name: "Organization" as string,
|
||||||
value: `${res?.data?.org || 'Not available'}` as string,
|
value: `${res?.data?.org || "Not available"}` as string,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
color: config?.colors?.success as ColorResolvable,
|
color: config?.colors?.success as ColorResolvable,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import config from '../../../../config.json';
|
import config from "../../../../config.json";
|
||||||
import { CommandInteraction, ColorResolvable } from 'discord.js';
|
import { CommandInteraction, ColorResolvable } from "discord.js";
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
const { client } = interaction;
|
const { client } = interaction;
|
||||||
if (client?.uptime === null) return;
|
if (client?.uptime === null) return;
|
||||||
|
@ -14,32 +14,32 @@ export default async (interaction: CommandInteraction) => {
|
||||||
const uptime = `${days} days, ${hours} hours, ${minutes} minutes and ${seconds} seconds`;
|
const uptime = `${days} days, ${hours} hours, ${minutes} minutes and ${seconds} seconds`;
|
||||||
|
|
||||||
const interactionEmbed = {
|
const interactionEmbed = {
|
||||||
title: ':hammer: Utilities - Stats' as string,
|
title: ":hammer: Utilities - Stats" as string,
|
||||||
description:
|
description:
|
||||||
'Below you can see a list of statistics about the bot.' as string,
|
"Below you can see a list of statistics about the bot." as string,
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: '⏰ Latency' as string,
|
name: "⏰ Latency" as string,
|
||||||
value: `${Date?.now() - interaction?.createdTimestamp} ms` as string,
|
value: `${Date?.now() - interaction?.createdTimestamp} ms` as string,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '⏰ API Latency' as string,
|
name: "⏰ API Latency" as string,
|
||||||
value: `${Math?.round(client?.ws?.ping)} ms` as string,
|
value: `${Math?.round(client?.ws?.ping)} ms` as string,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '⏰ Uptime' as string,
|
name: "⏰ Uptime" as string,
|
||||||
value: `${uptime}` as string,
|
value: `${uptime}` as string,
|
||||||
inline: false,
|
inline: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '📈 Guilds' as string,
|
name: "📈 Guilds" as string,
|
||||||
value: `${client?.guilds?.cache?.size}` as string,
|
value: `${client?.guilds?.cache?.size}` as string,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '📈 Users (non-unique)' as string,
|
name: "📈 Users (non-unique)" as string,
|
||||||
value: `${client?.guilds?.cache?.reduce(
|
value: `${client?.guilds?.cache?.reduce(
|
||||||
(acc, guild) => acc + guild?.memberCount,
|
(acc, guild) => acc + guild?.memberCount,
|
||||||
0
|
0
|
||||||
|
|
Loading…
Add table
Reference in a new issue