[CodeFactor] Apply fixes to commit 0b6ccc9
This commit is contained in:
parent
0b6ccc9cb7
commit
21fc633a65
4 changed files with 56 additions and 56 deletions
|
@ -1,17 +1,17 @@
|
|||
// Dependencies
|
||||
import { CommandInteraction, ColorResolvable } from 'discord.js';
|
||||
import { CommandInteraction, ColorResolvable } from "discord.js";
|
||||
|
||||
// Configurations
|
||||
import config from '../../../../../config.json';
|
||||
import config from "../../../../../config.json";
|
||||
|
||||
// Handlers
|
||||
import logger from '../../../../handlers/logger';
|
||||
import logger from "../../../../handlers/logger";
|
||||
|
||||
// Helpers
|
||||
import creditNoun from '../../../../helpers/creditNoun';
|
||||
import creditNoun from "../../../../helpers/creditNoun";
|
||||
|
||||
// Models
|
||||
import fetchUser from '../../../../helpers/fetchUser';
|
||||
import fetchUser from "../../../../helpers/fetchUser";
|
||||
|
||||
// Function
|
||||
export default async (interaction: CommandInteraction) => {
|
||||
|
@ -19,17 +19,17 @@ export default async (interaction: CommandInteraction) => {
|
|||
const { guild, user, options } = interaction;
|
||||
|
||||
// User option
|
||||
const optionUser = options?.getUser('user');
|
||||
const optionUser = options?.getUser("user");
|
||||
|
||||
// Amount option
|
||||
const optionAmount = options?.getInteger('amount');
|
||||
const optionAmount = options?.getInteger("amount");
|
||||
|
||||
// If amount option is null
|
||||
if (optionAmount === null) {
|
||||
// Embed object
|
||||
const embed = {
|
||||
title: ':toolbox: Admin - Credits [Give]' as string,
|
||||
description: 'We could not read your requested amount.' as string,
|
||||
title: ":toolbox: Admin - Credits [Give]" as string,
|
||||
description: "We could not read your requested amount." as string,
|
||||
color: config?.colors?.error as ColorResolvable,
|
||||
timestamp: new Date(),
|
||||
footer: {
|
||||
|
@ -46,8 +46,8 @@ export default async (interaction: CommandInteraction) => {
|
|||
if (optionAmount <= 0) {
|
||||
// Embed object
|
||||
const embed = {
|
||||
title: ':toolbox: Admin - Credits [Give]' as string,
|
||||
description: 'You can not give zero credits or below.' as string,
|
||||
title: ":toolbox: Admin - Credits [Give]" as string,
|
||||
description: "You can not give zero credits or below." as string,
|
||||
color: config?.colors?.error as ColorResolvable,
|
||||
timestamp: new Date(),
|
||||
footer: {
|
||||
|
@ -70,7 +70,7 @@ export default async (interaction: CommandInteraction) => {
|
|||
if (!toUser) {
|
||||
// Embed object
|
||||
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.`,
|
||||
color: config?.colors?.error as ColorResolvable,
|
||||
timestamp: new Date(),
|
||||
|
@ -88,7 +88,7 @@ export default async (interaction: CommandInteraction) => {
|
|||
if (toUser?.credits === null) {
|
||||
// Embed object
|
||||
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.`,
|
||||
color: config?.colors?.error as ColorResolvable,
|
||||
timestamp: new Date(),
|
||||
|
@ -109,7 +109,7 @@ export default async (interaction: CommandInteraction) => {
|
|||
await toUser?.save()?.then(async () => {
|
||||
// Embed object
|
||||
const embed = {
|
||||
title: ':toolbox: Admin - Credits [Give]' as string,
|
||||
title: ":toolbox: Admin - Credits [Give]" as string,
|
||||
description: `We have given ${optionUser}, ${creditNoun(optionAmount)}.`,
|
||||
color: config?.colors?.success as ColorResolvable,
|
||||
timestamp: new Date(),
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
// Dependencies
|
||||
import { CommandInteraction, ColorResolvable } from 'discord.js';
|
||||
import { CommandInteraction, ColorResolvable } from "discord.js";
|
||||
|
||||
// Configurations
|
||||
import config from '../../../../../config.json';
|
||||
import config from "../../../../../config.json";
|
||||
|
||||
// Handlers
|
||||
import logger from '../../../../handlers/logger';
|
||||
import logger from "../../../../handlers/logger";
|
||||
|
||||
// Helpers
|
||||
import creditNoun from '../../../../helpers/creditNoun';
|
||||
import creditNoun from "../../../../helpers/creditNoun";
|
||||
|
||||
// Models
|
||||
import fetchUser from '../../../../helpers/fetchUser';
|
||||
import fetchUser from "../../../../helpers/fetchUser";
|
||||
|
||||
// Function
|
||||
export default async (interaction: CommandInteraction) => {
|
||||
|
@ -19,17 +19,17 @@ export default async (interaction: CommandInteraction) => {
|
|||
const { options, user, guild } = interaction;
|
||||
|
||||
// User Option
|
||||
const optionUser = options.getUser('user');
|
||||
const optionUser = options.getUser("user");
|
||||
|
||||
// Amount Option
|
||||
const optionAmount = options.getInteger('amount');
|
||||
const optionAmount = options.getInteger("amount");
|
||||
|
||||
// If amount is null
|
||||
if (optionAmount === null) {
|
||||
// Embed object
|
||||
const embed = {
|
||||
title: ':toolbox: Admin - Credits [Set]' as string,
|
||||
description: 'We could not read your requested amount.' as string,
|
||||
title: ":toolbox: Admin - Credits [Set]" as string,
|
||||
description: "We could not read your requested amount." as string,
|
||||
color: config?.colors?.error as ColorResolvable,
|
||||
timestamp: new Date(),
|
||||
footer: {
|
||||
|
@ -52,7 +52,7 @@ export default async (interaction: CommandInteraction) => {
|
|||
if (!toUser) {
|
||||
// Embed object
|
||||
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.`,
|
||||
color: config?.colors?.error as ColorResolvable,
|
||||
timestamp: new Date(),
|
||||
|
@ -70,7 +70,7 @@ export default async (interaction: CommandInteraction) => {
|
|||
if (toUser?.credits === null) {
|
||||
// Embed object
|
||||
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.`,
|
||||
color: config?.colors?.error as ColorResolvable,
|
||||
timestamp: new Date(),
|
||||
|
@ -91,7 +91,7 @@ export default async (interaction: CommandInteraction) => {
|
|||
await toUser?.save()?.then(async () => {
|
||||
// Embed object
|
||||
const embed = {
|
||||
title: ':toolbox: Admin - Credits [Set]' as string,
|
||||
title: ":toolbox: Admin - Credits [Set]" as string,
|
||||
description: `We have set ${optionUser} to ${creditNoun(optionAmount)}`,
|
||||
color: config?.colors?.success as ColorResolvable,
|
||||
timestamp: new Date(),
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
// Dependencies
|
||||
import { CommandInteraction, ColorResolvable } from 'discord.js';
|
||||
import { CommandInteraction, ColorResolvable } from "discord.js";
|
||||
|
||||
// Configurations
|
||||
import config from '../../../../../config.json';
|
||||
import config from "../../../../../config.json";
|
||||
|
||||
// Handlers
|
||||
import logger from '../../../../handlers/logger';
|
||||
import logger from "../../../../handlers/logger";
|
||||
|
||||
// Helpers
|
||||
import creditNoun from '../../../../helpers/creditNoun';
|
||||
import creditNoun from "../../../../helpers/creditNoun";
|
||||
|
||||
// Models
|
||||
import fetchUser from '../../../../helpers/fetchUser';
|
||||
import fetchUser from "../../../../helpers/fetchUser";
|
||||
|
||||
// Function
|
||||
export default async (interaction: CommandInteraction) => {
|
||||
|
@ -19,17 +19,17 @@ export default async (interaction: CommandInteraction) => {
|
|||
const { guild, user, options } = interaction;
|
||||
|
||||
// User option
|
||||
const optionUser = options?.getUser('user');
|
||||
const optionUser = options?.getUser("user");
|
||||
|
||||
// Amount option
|
||||
const optionAmount = options?.getInteger('amount');
|
||||
const optionAmount = options?.getInteger("amount");
|
||||
|
||||
// If amount is null
|
||||
if (optionAmount === null) {
|
||||
// Embed object
|
||||
const embed = {
|
||||
title: ':toolbox: Admin - Credits [Take]' as string,
|
||||
description: 'We could not read your requested amount.' as string,
|
||||
title: ":toolbox: Admin - Credits [Take]" as string,
|
||||
description: "We could not read your requested amount." as string,
|
||||
color: config?.colors?.error as ColorResolvable,
|
||||
timestamp: new Date(),
|
||||
footer: {
|
||||
|
@ -46,8 +46,8 @@ export default async (interaction: CommandInteraction) => {
|
|||
if (optionAmount <= 0) {
|
||||
// Embed object
|
||||
const embed = {
|
||||
title: ':toolbox: Admin - Credits [Take]' as string,
|
||||
description: 'You can not take zero credits or below.' as string,
|
||||
title: ":toolbox: Admin - Credits [Take]" as string,
|
||||
description: "You can not take zero credits or below." as string,
|
||||
color: config?.colors?.error as ColorResolvable,
|
||||
timestamp: new Date(),
|
||||
footer: {
|
||||
|
@ -70,7 +70,7 @@ export default async (interaction: CommandInteraction) => {
|
|||
if (!toUser) {
|
||||
// Embed object
|
||||
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.`,
|
||||
color: config?.colors?.error as ColorResolvable,
|
||||
timestamp: new Date(),
|
||||
|
@ -88,7 +88,7 @@ export default async (interaction: CommandInteraction) => {
|
|||
if (toUser?.credits === null) {
|
||||
// Embed object
|
||||
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.`,
|
||||
color: config?.colors?.error as ColorResolvable,
|
||||
timestamp: new Date(),
|
||||
|
@ -109,7 +109,7 @@ export default async (interaction: CommandInteraction) => {
|
|||
await toUser?.save()?.then(async () => {
|
||||
// Embed object
|
||||
const embed = {
|
||||
title: ':toolbox: Admin - Credits [Set]' as string,
|
||||
title: ":toolbox: Admin - Credits [Set]" as string,
|
||||
description: `We have taken ${creditNoun(
|
||||
optionAmount
|
||||
)} from ${optionUser}`,
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
// Dependencies
|
||||
import { CommandInteraction, ColorResolvable } from 'discord.js';
|
||||
import { CommandInteraction, ColorResolvable } from "discord.js";
|
||||
|
||||
// Configurations
|
||||
import config from '../../../../../config.json';
|
||||
import config from "../../../../../config.json";
|
||||
|
||||
// Handlers
|
||||
import logger from '../../../../handlers/logger';
|
||||
import logger from "../../../../handlers/logger";
|
||||
|
||||
// Helpers
|
||||
import creditNoun from '../../../../helpers/creditNoun';
|
||||
import saveUser from '../../../../helpers/saveUser';
|
||||
import creditNoun from "../../../../helpers/creditNoun";
|
||||
import saveUser from "../../../../helpers/saveUser";
|
||||
|
||||
// Models
|
||||
import fetchUser from '../../../../helpers/fetchUser';
|
||||
import fetchUser from "../../../../helpers/fetchUser";
|
||||
|
||||
// Function
|
||||
export default async (interaction: CommandInteraction) => {
|
||||
|
@ -20,16 +20,16 @@ export default async (interaction: CommandInteraction) => {
|
|||
const { guild, options, user } = interaction;
|
||||
|
||||
// Get options
|
||||
const optionFromUser = options?.getUser('from');
|
||||
const optionToUser = options?.getUser('to');
|
||||
const optionAmount = options?.getInteger('amount');
|
||||
const optionFromUser = options?.getUser("from");
|
||||
const optionToUser = options?.getUser("to");
|
||||
const optionAmount = options?.getInteger("amount");
|
||||
|
||||
// If amount is null
|
||||
if (optionAmount === null) {
|
||||
// Embed object
|
||||
const embed = {
|
||||
title: ':toolbox: Admin - Credits [Transfer]' as string,
|
||||
description: 'We could not read your requested amount.' as string,
|
||||
title: ":toolbox: Admin - Credits [Transfer]" as string,
|
||||
description: "We could not read your requested amount." as string,
|
||||
color: config?.colors?.error as ColorResolvable,
|
||||
timestamp: new Date(),
|
||||
footer: {
|
||||
|
@ -56,7 +56,7 @@ export default async (interaction: CommandInteraction) => {
|
|||
if (!fromUser) {
|
||||
// Embed object
|
||||
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.`,
|
||||
color: config?.colors?.error as ColorResolvable,
|
||||
timestamp: new Date(),
|
||||
|
@ -74,7 +74,7 @@ export default async (interaction: CommandInteraction) => {
|
|||
if (!fromUser?.credits) {
|
||||
// Embed object
|
||||
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.`,
|
||||
color: config?.colors?.error as ColorResolvable,
|
||||
timestamp: new Date(),
|
||||
|
@ -92,7 +92,7 @@ export default async (interaction: CommandInteraction) => {
|
|||
if (!toUser) {
|
||||
// Embed object
|
||||
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.`,
|
||||
color: config?.colors?.error as ColorResolvable,
|
||||
timestamp: new Date(),
|
||||
|
@ -110,7 +110,7 @@ export default async (interaction: CommandInteraction) => {
|
|||
if (toUser?.credits === null) {
|
||||
// Embed object
|
||||
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.`,
|
||||
color: config?.colors?.error as ColorResolvable,
|
||||
timestamp: new Date(),
|
||||
|
@ -134,7 +134,7 @@ export default async (interaction: CommandInteraction) => {
|
|||
await saveUser(fromUser, toUser)?.then(async () => {
|
||||
// Embed object
|
||||
const embed = {
|
||||
title: ':toolbox: Admin - Credits [Transfer]' as string,
|
||||
title: ":toolbox: Admin - Credits [Transfer]" as string,
|
||||
description: `You sent ${creditNoun(
|
||||
optionAmount
|
||||
)} from ${optionFromUser} to ${optionToUser}.`,
|
||||
|
|
Loading…
Add table
Reference in a new issue