[CodeFactor] Apply fixes
This commit is contained in:
parent
eacf9fd557
commit
82ac841993
30 changed files with 395 additions and 395 deletions
|
@ -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() as Date,
|
timestamp: new Date() as 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() as Date,
|
timestamp: new Date() as 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.` as string,
|
description: `We could not find ${optionUser} in our database.` as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date() as Date,
|
timestamp: new Date() as 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:
|
description:
|
||||||
`We could not find credits for ${optionUser} in our database.` as string,
|
`We could not find credits for ${optionUser} in our database.` as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
|
@ -110,7 +110,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(
|
description: `We have given ${optionUser}, ${creditNoun(
|
||||||
optionAmount
|
optionAmount
|
||||||
)}.` as string,
|
)}.` as string,
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { Permissions, CommandInteraction, ColorResolvable } from 'discord.js';
|
import { Permissions, 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() as Date,
|
timestamp: new Date() as 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.` as string,
|
description: `We could not find ${optionUser} in our database.` as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date() as Date,
|
timestamp: new Date() as 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:
|
description:
|
||||||
`We could not find credits for ${optionUser} in our database.` as string,
|
`We could not find credits for ${optionUser} in our database.` as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
|
@ -92,7 +92,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(
|
description: `We have set ${optionUser} to ${creditNoun(
|
||||||
optionAmount
|
optionAmount
|
||||||
)}` as string,
|
)}` as string,
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { Permissions, CommandInteraction, ColorResolvable } from 'discord.js';
|
import { Permissions, 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() as Date,
|
timestamp: new Date() as 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() as Date,
|
timestamp: new Date() as 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.` as string,
|
description: `We could not find ${optionUser} in our database.` as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
timestamp: new Date() as Date,
|
timestamp: new Date() as 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:
|
description:
|
||||||
`We could not find credits for ${optionUser} in our database.` as string,
|
`We could not find credits for ${optionUser} in our database.` as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
|
@ -110,7 +110,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}` as string,
|
)} from ${optionUser}` as string,
|
||||||
|
|
|
@ -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() as Date,
|
timestamp: new Date() as 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:
|
description:
|
||||||
`We could not find ${optionFromUser} in our database.` as string,
|
`We could not find ${optionFromUser} in our database.` as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
|
@ -75,7 +75,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:
|
description:
|
||||||
`We could not find credits for ${optionFromUser} in our database.` as string,
|
`We could not find credits for ${optionFromUser} in our database.` as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
|
@ -94,7 +94,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:
|
description:
|
||||||
`We could not find ${optionToUser} in our database.` as string,
|
`We could not find ${optionToUser} in our database.` as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
|
@ -113,7 +113,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:
|
description:
|
||||||
`We could not find credits for ${optionToUser} in our database.` as string,
|
`We could not find credits for ${optionToUser} in our database.` as string,
|
||||||
color: config?.colors?.error as ColorResolvable,
|
color: config?.colors?.error as ColorResolvable,
|
||||||
|
@ -138,7 +138,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}.` as string,
|
)} from ${optionFromUser} to ${optionToUser}.` as string,
|
||||||
|
|
|
@ -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() as Date,
|
timestamp: new Date() as 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() as Date,
|
timestamp: new Date() as 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() as Date,
|
timestamp: new Date() as 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() as Date,
|
timestamp: new Date() as 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() as Date,
|
timestamp: new Date() as 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() as Date,
|
timestamp: new Date() as 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() as Date,
|
timestamp: new Date() as 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() as Date,
|
timestamp: new Date() as Date,
|
||||||
|
|
|
@ -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() as Date,
|
timestamp: new Date() as 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,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() as Date,
|
timestamp: new Date() as 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() as Date,
|
timestamp: new Date() as 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 await interaction?.editReply({ embeds: [embed] });
|
return await 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 { 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,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() as Date,
|
timestamp: new Date() as 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() as Date,
|
timestamp: new Date() as 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() as Date,
|
timestamp: new Date() as 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() as Date,
|
timestamp: new Date() as 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() as Date,
|
timestamp: new Date() as 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() as Date,
|
timestamp: new Date() as 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,13 +1,13 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { Guild } from 'discord.js';
|
import { Guild } from "discord.js";
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
import updatePresence from '../../helpers/updatePresence';
|
import updatePresence from "../../helpers/updatePresence";
|
||||||
import fetchGuild from '../../helpers/fetchGuild';
|
import fetchGuild from "../../helpers/fetchGuild";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default {
|
export default {
|
||||||
name: 'guildCreate',
|
name: "guildCreate",
|
||||||
async execute(guild: Guild) {
|
async execute(guild: Guild) {
|
||||||
// Destructure
|
// Destructure
|
||||||
const { client } = guild;
|
const { client } = guild;
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { Guild } from 'discord.js';
|
import { Guild } from "discord.js";
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
import updatePresence from '../../helpers/updatePresence';
|
import updatePresence from "../../helpers/updatePresence";
|
||||||
import dropGuild from '../../helpers/dropGuild';
|
import dropGuild from "../../helpers/dropGuild";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default {
|
export default {
|
||||||
name: 'guildDelete',
|
name: "guildDelete",
|
||||||
async execute(guild: Guild) {
|
async execute(guild: Guild) {
|
||||||
// Destructure client
|
// Destructure client
|
||||||
const { client } = guild;
|
const { client } = guild;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import users from '../../helpers/database/models/userSchema';
|
import users from "../../helpers/database/models/userSchema";
|
||||||
import logger from '../../handlers/logger';
|
import logger from "../../handlers/logger";
|
||||||
|
|
||||||
import { GuildMember } from 'discord.js';
|
import { GuildMember } from "discord.js";
|
||||||
import updatePresence from '../../helpers/updatePresence';
|
import updatePresence from "../../helpers/updatePresence";
|
||||||
import fetchUser from '../../helpers/fetchUser';
|
import fetchUser from "../../helpers/fetchUser";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'guildMemberAdd',
|
name: "guildMemberAdd",
|
||||||
async execute(member: GuildMember) {
|
async execute(member: GuildMember) {
|
||||||
const { client, user, guild } = member;
|
const { client, user, guild } = member;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import users from '../../helpers/database/models/userSchema';
|
import users from "../../helpers/database/models/userSchema";
|
||||||
import logger from '../../handlers/logger';
|
import logger from "../../handlers/logger";
|
||||||
|
|
||||||
import { GuildMember } from 'discord.js';
|
import { GuildMember } from "discord.js";
|
||||||
import updatePresence from '../../helpers/updatePresence';
|
import updatePresence from "../../helpers/updatePresence";
|
||||||
import dropUser from '../../helpers/dropUser';
|
import dropUser from "../../helpers/dropUser";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'guildMemberRemove',
|
name: "guildMemberRemove",
|
||||||
async execute(member: GuildMember) {
|
async execute(member: GuildMember) {
|
||||||
const { client, user, guild } = member;
|
const { client, user, guild } = member;
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import config from '../../../config.json';
|
import config from "../../../config.json";
|
||||||
import logger from '../../handlers/logger';
|
import logger from "../../handlers/logger";
|
||||||
import guilds from '../../helpers/database/models/guildSchema';
|
import guilds from "../../helpers/database/models/guildSchema";
|
||||||
|
|
||||||
import { Interaction, ColorResolvable } from 'discord.js';
|
import { Interaction, ColorResolvable } from "discord.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'interactionCreate',
|
name: "interactionCreate",
|
||||||
async execute(interaction: Interaction) {
|
async execute(interaction: Interaction) {
|
||||||
// Destructure member, client
|
// Destructure member, client
|
||||||
const { client, guild } = interaction;
|
const { client, guild } = interaction;
|
||||||
|
@ -41,10 +41,10 @@ export default {
|
||||||
author: {
|
author: {
|
||||||
name: client?.user?.username,
|
name: client?.user?.username,
|
||||||
icon_url: client?.user?.displayAvatarURL(),
|
icon_url: client?.user?.displayAvatarURL(),
|
||||||
url: 'https://bot.zyner.org/',
|
url: "https://bot.zyner.org/",
|
||||||
},
|
},
|
||||||
title: 'Error',
|
title: "Error",
|
||||||
description: 'There was an error while executing this command!',
|
description: "There was an error while executing this command!",
|
||||||
color: config.colors.error as ColorResolvable,
|
color: config.colors.error as ColorResolvable,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { Message } from 'discord.js';
|
import { Message } from "discord.js";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import userSchema from '../../helpers/database/models/userSchema';
|
import userSchema from "../../helpers/database/models/userSchema";
|
||||||
import guildSchema from '../../helpers/database/models/guildSchema';
|
import guildSchema from "../../helpers/database/models/guildSchema";
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
import points from './modules/points';
|
import points from "./modules/points";
|
||||||
import credits from './modules/credits';
|
import credits from "./modules/credits";
|
||||||
import counters from './modules/counters';
|
import counters from "./modules/counters";
|
||||||
import fetchUser from '../../helpers/fetchUser';
|
import fetchUser from "../../helpers/fetchUser";
|
||||||
import fetchGuild from '../../helpers/fetchGuild';
|
import fetchGuild from "../../helpers/fetchGuild";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default {
|
export default {
|
||||||
name: 'messageCreate',
|
name: "messageCreate",
|
||||||
async execute(message: Message) {
|
async execute(message: Message) {
|
||||||
const { author, guild } = message;
|
const { author, guild } = message;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import logger from '../../../handlers/logger';
|
import logger from "../../../handlers/logger";
|
||||||
import counters from '../../../helpers/database/models/counterSchema';
|
import counters from "../../../helpers/database/models/counterSchema";
|
||||||
|
|
||||||
import { Message } from 'discord.js';
|
import { Message } from "discord.js";
|
||||||
|
|
||||||
export default async (guildDB: any, userDB: any, message: Message) => {
|
export default async (guildDB: any, userDB: any, message: Message) => {
|
||||||
const { guild, channel, content } = message;
|
const { guild, channel, content } = message;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import counters from '../../helpers/database/models/counterSchema';
|
import counters from "../../helpers/database/models/counterSchema";
|
||||||
import { Message } from 'discord.js';
|
import { Message } from "discord.js";
|
||||||
export default {
|
export default {
|
||||||
name: 'messageUpdate',
|
name: "messageUpdate",
|
||||||
async execute(oldMessage: Message, newMessage: Message) {
|
async execute(oldMessage: Message, newMessage: Message) {
|
||||||
// If message author is bot
|
// If message author is bot
|
||||||
if (newMessage.author.bot) return;
|
if (newMessage.author.bot) return;
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
import logger from '../../handlers/logger';
|
import logger from "../../handlers/logger";
|
||||||
import config from '../../../config.json';
|
import config from "../../../config.json";
|
||||||
import deployCommands from '../../helpers/deployCommands';
|
import deployCommands from "../../helpers/deployCommands";
|
||||||
import dbGuildFix from '../../helpers/dbGuildFix';
|
import dbGuildFix from "../../helpers/dbGuildFix";
|
||||||
import dbMemberFix from '../../helpers/dbMemberFix';
|
import dbMemberFix from "../../helpers/dbMemberFix";
|
||||||
|
|
||||||
import userSchema from '../../helpers/database/models/userSchema';
|
import userSchema from "../../helpers/database/models/userSchema";
|
||||||
|
|
||||||
import { Client } from 'discord.js';
|
import { Client } from "discord.js";
|
||||||
import updatePresence from '../../helpers/updatePresence';
|
import updatePresence from "../../helpers/updatePresence";
|
||||||
export default {
|
export default {
|
||||||
name: 'ready',
|
name: "ready",
|
||||||
once: true,
|
once: true,
|
||||||
async execute(client: Client) {
|
async execute(client: Client) {
|
||||||
// Send info message
|
// Send info message
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import schedule from 'node-schedule';
|
import schedule from "node-schedule";
|
||||||
import users from '../helpers/database/models/userSchema';
|
import users from "../helpers/database/models/userSchema";
|
||||||
import shopRoles from '../helpers/database/models/shopRolesSchema';
|
import shopRoles from "../helpers/database/models/shopRolesSchema";
|
||||||
import guilds from '../helpers/database/models/guildSchema';
|
import guilds from "../helpers/database/models/guildSchema";
|
||||||
import logger from './logger';
|
import logger from "./logger";
|
||||||
import { Client } from 'discord.js';
|
import { Client } from "discord.js";
|
||||||
|
|
||||||
export default async (client: Client) => {
|
export default async (client: Client) => {
|
||||||
schedule.scheduleJob('*/5 * * * *', async () => {
|
schedule.scheduleJob("*/5 * * * *", async () => {
|
||||||
shopRoles.find().then(async (shopRoles: any) => {
|
shopRoles.find().then(async (shopRoles: any) => {
|
||||||
shopRoles.map(async (shopRole: any) => {
|
shopRoles.map(async (shopRole: any) => {
|
||||||
const payed = new Date(shopRole.lastPayed);
|
const payed = new Date(shopRole.lastPayed);
|
||||||
|
@ -39,8 +39,8 @@ export default async (client: Client) => {
|
||||||
|
|
||||||
await rMember?.roles
|
await rMember?.roles
|
||||||
.remove(`${shopRole.roleId}`)
|
.remove(`${shopRole.roleId}`)
|
||||||
.then(async (test) => console.log('4', test))
|
.then(async (test) => console.log("4", test))
|
||||||
.catch(async (test) => console.log('5', test)); // Removes all roles
|
.catch(async (test) => console.log("5", test)); // Removes all roles
|
||||||
}
|
}
|
||||||
|
|
||||||
shopRole.lastPayed = new Date();
|
shopRole.lastPayed = new Date();
|
||||||
|
@ -54,6 +54,6 @@ export default async (client: Client) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
await logger.debug('Checking schedules! (Every 5 minutes)');
|
await logger.debug("Checking schedules! (Every 5 minutes)");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Snowflake } from 'discord.js';
|
import { Snowflake } from "discord.js";
|
||||||
import { Schema, model } from 'mongoose';
|
import { Schema, model } from "mongoose";
|
||||||
|
|
||||||
export interface IUser {
|
export interface IUser {
|
||||||
guildId: Snowflake;
|
guildId: Snowflake;
|
||||||
|
@ -29,7 +29,7 @@ const userSchema = new Schema(
|
||||||
},
|
},
|
||||||
language: {
|
language: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'en',
|
default: "en",
|
||||||
},
|
},
|
||||||
reputation: { type: Number, default: 0 },
|
reputation: { type: Number, default: 0 },
|
||||||
credits: { type: Number, default: 0 },
|
credits: { type: Number, default: 0 },
|
||||||
|
@ -39,4 +39,4 @@ const userSchema = new Schema(
|
||||||
{ timestamps: true }
|
{ timestamps: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
export default model<IUser>('user', userSchema);
|
export default model<IUser>("user", userSchema);
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import guilds from '../helpers/database/models/guildSchema';
|
import guilds from "../helpers/database/models/guildSchema";
|
||||||
import users from '../helpers/database/models/userSchema';
|
import users from "../helpers/database/models/userSchema";
|
||||||
import apis from '../helpers/database/models/apiSchema';
|
import apis from "../helpers/database/models/apiSchema";
|
||||||
import counters from '../helpers/database/models/counterSchema';
|
import counters from "../helpers/database/models/counterSchema";
|
||||||
import shopRoles from '../helpers/database/models/shopRolesSchema';
|
import shopRoles from "../helpers/database/models/shopRolesSchema";
|
||||||
import timeouts from '../helpers/database/models/timeoutSchema';
|
import timeouts from "../helpers/database/models/timeoutSchema";
|
||||||
|
|
||||||
import logger from '../handlers/logger';
|
import logger from "../handlers/logger";
|
||||||
|
|
||||||
import { Guild } from 'discord.js';
|
import { Guild } from "discord.js";
|
||||||
import updatePresence from '../helpers/updatePresence';
|
import updatePresence from "../helpers/updatePresence";
|
||||||
|
|
||||||
export default async (guild: Guild) => {
|
export default async (guild: Guild) => {
|
||||||
guilds
|
guilds
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import users from '../helpers/database/models/userSchema';
|
import users from "../helpers/database/models/userSchema";
|
||||||
|
|
||||||
import logger from '../handlers/logger';
|
import logger from "../handlers/logger";
|
||||||
|
|
||||||
import { Guild, User } from 'discord.js';
|
import { Guild, User } from "discord.js";
|
||||||
|
|
||||||
export default async (user: User, guild: Guild) => {
|
export default async (user: User, guild: Guild) => {
|
||||||
await users
|
await users
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { Guild } from 'discord.js';
|
import { Guild } from "discord.js";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import guildSchema from './database/models/guildSchema';
|
import guildSchema from "./database/models/guildSchema";
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from '../handlers/logger';
|
import logger from "../handlers/logger";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (guild: Guild) => {
|
export default async (guild: Guild) => {
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { Guild, User } from 'discord.js';
|
import { Guild, User } from "discord.js";
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import userSchema from './database/models/userSchema';
|
import userSchema from "./database/models/userSchema";
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from '../handlers/logger';
|
import logger from "../handlers/logger";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (user: User, guild: Guild) => {
|
export default async (user: User, guild: Guild) => {
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { Client } from 'discord.js';
|
import { Client } from "discord.js";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default async (client: Client) => {
|
export default async (client: Client) => {
|
||||||
// Set client status
|
// Set client status
|
||||||
client?.user?.setPresence({
|
client?.user?.setPresence({
|
||||||
activities: [
|
activities: [
|
||||||
{ type: 'WATCHING', name: `${client?.guilds?.cache?.size} guilds` },
|
{ type: "WATCHING", name: `${client?.guilds?.cache?.size} guilds` },
|
||||||
],
|
],
|
||||||
status: 'online',
|
status: "online",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
14
src/index.ts
14
src/index.ts
|
@ -1,13 +1,13 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { Client, Intents } from 'discord.js'; // discord.js
|
import { Client, Intents } from "discord.js"; // discord.js
|
||||||
|
|
||||||
import database from './helpers/database';
|
import database from "./helpers/database";
|
||||||
import events from './handlers/events';
|
import events from "./handlers/events";
|
||||||
import commands from './handlers/commands';
|
import commands from "./handlers/commands";
|
||||||
import locale from './handlers/locale';
|
import locale from "./handlers/locale";
|
||||||
import schedules from './handlers/schedules';
|
import schedules from "./handlers/schedules";
|
||||||
|
|
||||||
import config from '../config.json'; // config.json
|
import config from "../config.json"; // config.json
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
// Initialize discord.js client
|
// Initialize discord.js client
|
||||||
|
|
Loading…
Add table
Reference in a new issue