[CodeFactor] Apply fixes to commit eb1aa6c
This commit is contained in:
parent
eb1aa6c5ff
commit
407603540e
6 changed files with 108 additions and 108 deletions
|
@ -1,28 +1,28 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { SlashCommandBuilder } from '@discordjs/builders';
|
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||||
import { CommandInteraction } from 'discord.js';
|
import { CommandInteraction } from "discord.js";
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
import view from './modules/view';
|
import view from "./modules/view";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default {
|
export default {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName('profile')
|
.setName("profile")
|
||||||
.setDescription('Check a profile.')
|
.setDescription("Check a profile.")
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName('view')
|
.setName("view")
|
||||||
.setDescription('View a profile.')
|
.setDescription("View a profile.")
|
||||||
.addUserOption((option) =>
|
.addUserOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('target')
|
.setName("target")
|
||||||
.setDescription('The profile you wish to view')
|
.setDescription("The profile you wish to view")
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
async execute(interaction: CommandInteraction) {
|
async execute(interaction: CommandInteraction) {
|
||||||
// Module - View
|
// Module - View
|
||||||
if (interaction.options.getSubcommand() === 'view') {
|
if (interaction.options.getSubcommand() === "view") {
|
||||||
// Execute Module - View
|
// Execute Module - View
|
||||||
await view(interaction);
|
await view(interaction);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import i18next from 'i18next';
|
import i18next from "i18next";
|
||||||
import config from '../../../../config.json';
|
import config from "../../../../config.json";
|
||||||
import logger from '../../../handlers/logger';
|
import logger from "../../../handlers/logger";
|
||||||
import users from '../../../helpers/database/models/userSchema';
|
import users from "../../../helpers/database/models/userSchema";
|
||||||
import { CommandInteraction } from 'discord.js';
|
import { CommandInteraction } from "discord.js";
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
// Destructure
|
// Destructure
|
||||||
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(
|
||||||
|
@ -31,27 +31,27 @@ export default async (interaction: CommandInteraction) => {
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: `:dollar: Credits`,
|
name: `:dollar: Credits`,
|
||||||
value: `${userObj.credits || 'Not found'}`,
|
value: `${userObj.credits || "Not found"}`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: `:squeeze_bottle: Level`,
|
name: `:squeeze_bottle: Level`,
|
||||||
value: `${userObj.level || 'Not found'}`,
|
value: `${userObj.level || "Not found"}`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: `:squeeze_bottle: Points`,
|
name: `:squeeze_bottle: Points`,
|
||||||
value: `${userObj.points || 'Not found'}`,
|
value: `${userObj.points || "Not found"}`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: `:loudspeaker: Reputation`,
|
name: `:loudspeaker: Reputation`,
|
||||||
value: `${userObj.reputation || 'Not found'}`,
|
value: `${userObj.reputation || "Not found"}`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: `:rainbow_flag: Language`,
|
name: `:rainbow_flag: Language`,
|
||||||
value: `${userObj.language || 'Not found'}`,
|
value: `${userObj.language || "Not found"}`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,32 +1,32 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { SlashCommandBuilder } from '@discordjs/builders';
|
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||||
import { CommandInteraction } from 'discord.js';
|
import { CommandInteraction } from "discord.js";
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
import give from './modules/give';
|
import give from "./modules/give";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default {
|
export default {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName('reputation')
|
.setName("reputation")
|
||||||
.setDescription('Give reputation.')
|
.setDescription("Give reputation.")
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName('give')
|
.setName("give")
|
||||||
.setDescription('Give reputation to a user')
|
.setDescription("Give reputation to a user")
|
||||||
.addUserOption((option) =>
|
.addUserOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('target')
|
.setName("target")
|
||||||
.setDescription('The user you want to repute.')
|
.setDescription("The user you want to repute.")
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
)
|
)
|
||||||
.addStringOption((option) =>
|
.addStringOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('type')
|
.setName("type")
|
||||||
.setDescription('What type of reputation you want to repute')
|
.setDescription("What type of reputation you want to repute")
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
.addChoice('Positive', 'positive')
|
.addChoice("Positive", "positive")
|
||||||
.addChoice('Negative', 'negative')
|
.addChoice("Negative", "negative")
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
async execute(interaction: CommandInteraction) {
|
async execute(interaction: CommandInteraction) {
|
||||||
|
@ -34,7 +34,7 @@ export default {
|
||||||
const { options } = interaction;
|
const { options } = interaction;
|
||||||
|
|
||||||
// Module - Give
|
// Module - Give
|
||||||
if (options.getSubcommand() === 'give') {
|
if (options.getSubcommand() === "give") {
|
||||||
// Execute Module - Give
|
// Execute Module - Give
|
||||||
await give(interaction);
|
await give(interaction);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
import i18next from 'i18next';
|
import i18next from "i18next";
|
||||||
import { CommandInteraction } from 'discord.js';
|
import { CommandInteraction } from "discord.js";
|
||||||
import config from '../../../../config.json';
|
import config from "../../../../config.json";
|
||||||
import logger from '../../../handlers/logger';
|
import logger from "../../../handlers/logger";
|
||||||
import users from '../../../helpers/database/models/userSchema';
|
import users from "../../../helpers/database/models/userSchema";
|
||||||
import timeouts from '../../../helpers/database/models/timeoutSchema';
|
import timeouts from "../../../helpers/database/models/timeoutSchema";
|
||||||
|
|
||||||
export default async (interaction: CommandInteraction) => {
|
export default async (interaction: CommandInteraction) => {
|
||||||
// Destructure
|
// Destructure
|
||||||
const { options, user, guild } = interaction;
|
const { options, user, guild } = interaction;
|
||||||
|
|
||||||
// Target information
|
// Target information
|
||||||
const target = options.getUser('target');
|
const target = options.getUser("target");
|
||||||
|
|
||||||
// Type information
|
// Type information
|
||||||
const type = options.getString('type');
|
const type = options.getString("type");
|
||||||
|
|
||||||
// User information
|
// User information
|
||||||
const userObj = await users.findOne({
|
const userObj = await users.findOne({
|
||||||
|
@ -34,8 +34,8 @@ export default async (interaction: CommandInteraction) => {
|
||||||
if (target?.id === user?.id) {
|
if (target?.id === user?.id) {
|
||||||
// Embed object
|
// Embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':loudspeaker: Reputation - Give',
|
title: ":loudspeaker: Reputation - Give",
|
||||||
description: 'You can not repute yourself.',
|
description: "You can not repute yourself.",
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
color: config.colors.error as any,
|
color: config.colors.error as any,
|
||||||
footer: { iconURL: config.footer.icon, text: config.footer.text },
|
footer: { iconURL: config.footer.icon, text: config.footer.text },
|
||||||
|
@ -46,12 +46,12 @@ export default async (interaction: CommandInteraction) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If type is positive
|
// If type is positive
|
||||||
if (type === 'positive') {
|
if (type === "positive") {
|
||||||
userObj.reputation += 1;
|
userObj.reputation += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If type is negative
|
// If type is negative
|
||||||
if (type === 'negative') {
|
if (type === "negative") {
|
||||||
userObj.reputation -= 1;
|
userObj.reputation -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,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',
|
title: ":loudspeaker: Reputation - Give",
|
||||||
description: `You have given ${target} a ${type} reputation!`,
|
description: `You have given ${target} a ${type} reputation!`,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
color: config.colors.success as any,
|
color: config.colors.success as any,
|
||||||
|
@ -100,7 +100,7 @@ export default async (interaction: CommandInteraction) => {
|
||||||
} else {
|
} else {
|
||||||
// Create embed object
|
// Create embed object
|
||||||
const embed = {
|
const embed = {
|
||||||
title: ':loudspeaker: Reputation - Give',
|
title: ":loudspeaker: Reputation - Give",
|
||||||
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!`,
|
} seconds, you can not repute now!`,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import database from './database';
|
import database from "./database";
|
||||||
import deployCommands from './deployCommands';
|
import deployCommands from "./deployCommands";
|
||||||
import dbGuildFix from './dbGuildFix';
|
import dbGuildFix from "./dbGuildFix";
|
||||||
import dbMemberFix from './dbMemberFix';
|
import dbMemberFix from "./dbMemberFix";
|
||||||
|
|
||||||
export default { database, deployCommands, dbGuildFix, dbMemberFix };
|
export default { database, deployCommands, dbGuildFix, dbMemberFix };
|
||||||
|
|
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