Merge pull request #194 from ZynerOrg/main-cf-autofix
Apply fixes from CodeFactor
This commit is contained in:
commit
a1edb794de
6 changed files with 108 additions and 108 deletions
|
@ -1,30 +1,30 @@
|
|||
// Dependencies
|
||||
import { SlashCommandBuilder } from '@discordjs/builders';
|
||||
import { CommandInteraction } from 'discord.js';
|
||||
|
||||
// Modules
|
||||
import view from './modules/view';
|
||||
|
||||
// Function
|
||||
export default {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('profile')
|
||||
.setDescription('Check a profile.')
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand
|
||||
.setName('view')
|
||||
.setDescription('View a profile.')
|
||||
.addUserOption((option) =>
|
||||
option
|
||||
.setName('target')
|
||||
.setDescription('The profile you wish to view')
|
||||
)
|
||||
),
|
||||
async execute(interaction: CommandInteraction) {
|
||||
// Module - View
|
||||
if (interaction.options.getSubcommand() === 'view') {
|
||||
// Execute Module - View
|
||||
await view(interaction);
|
||||
}
|
||||
},
|
||||
};
|
||||
// Dependencies
|
||||
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||
import { CommandInteraction } from "discord.js";
|
||||
|
||||
// Modules
|
||||
import view from "./modules/view";
|
||||
|
||||
// Function
|
||||
export default {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("profile")
|
||||
.setDescription("Check a profile.")
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand
|
||||
.setName("view")
|
||||
.setDescription("View a profile.")
|
||||
.addUserOption((option) =>
|
||||
option
|
||||
.setName("target")
|
||||
.setDescription("The profile you wish to view")
|
||||
)
|
||||
),
|
||||
async execute(interaction: CommandInteraction) {
|
||||
// Module - View
|
||||
if (interaction.options.getSubcommand() === "view") {
|
||||
// Execute Module - View
|
||||
await view(interaction);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import i18next from 'i18next';
|
||||
import config from '../../../../config.json';
|
||||
import logger from '../../../handlers/logger';
|
||||
import users from '../../../helpers/database/models/userSchema';
|
||||
import { CommandInteraction } from 'discord.js';
|
||||
import i18next from "i18next";
|
||||
import config from "../../../../config.json";
|
||||
import logger from "../../../handlers/logger";
|
||||
import users from "../../../helpers/database/models/userSchema";
|
||||
import { CommandInteraction } from "discord.js";
|
||||
export default async (interaction: CommandInteraction) => {
|
||||
// Destructure
|
||||
const { client, options, user, guild } = interaction;
|
||||
|
||||
// Target information
|
||||
const target = options?.getUser('target');
|
||||
const target = options?.getUser("target");
|
||||
|
||||
// Discord User Information
|
||||
const discordUser = await client.users.fetch(
|
||||
|
@ -31,27 +31,27 @@ export default async (interaction: CommandInteraction) => {
|
|||
fields: [
|
||||
{
|
||||
name: `:dollar: Credits`,
|
||||
value: `${userObj.credits || 'Not found'}`,
|
||||
value: `${userObj.credits || "Not found"}`,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: `:squeeze_bottle: Level`,
|
||||
value: `${userObj.level || 'Not found'}`,
|
||||
value: `${userObj.level || "Not found"}`,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: `:squeeze_bottle: Points`,
|
||||
value: `${userObj.points || 'Not found'}`,
|
||||
value: `${userObj.points || "Not found"}`,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: `:loudspeaker: Reputation`,
|
||||
value: `${userObj.reputation || 'Not found'}`,
|
||||
value: `${userObj.reputation || "Not found"}`,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: `:rainbow_flag: Language`,
|
||||
value: `${userObj.language || 'Not found'}`,
|
||||
value: `${userObj.language || "Not found"}`,
|
||||
inline: true,
|
||||
},
|
||||
],
|
||||
|
|
|
@ -1,42 +1,42 @@
|
|||
// Dependencies
|
||||
import { SlashCommandBuilder } from '@discordjs/builders';
|
||||
import { CommandInteraction } from 'discord.js';
|
||||
|
||||
// Modules
|
||||
import give from './modules/give';
|
||||
|
||||
// Function
|
||||
export default {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('reputation')
|
||||
.setDescription('Give reputation.')
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand
|
||||
.setName('give')
|
||||
.setDescription('Give reputation to a user')
|
||||
.addUserOption((option) =>
|
||||
option
|
||||
.setName('target')
|
||||
.setDescription('The user you want to repute.')
|
||||
.setRequired(true)
|
||||
)
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('type')
|
||||
.setDescription('What type of reputation you want to repute')
|
||||
.setRequired(true)
|
||||
.addChoice('Positive', 'positive')
|
||||
.addChoice('Negative', 'negative')
|
||||
)
|
||||
),
|
||||
async execute(interaction: CommandInteraction) {
|
||||
// Destructure
|
||||
const { options } = interaction;
|
||||
|
||||
// Module - Give
|
||||
if (options.getSubcommand() === 'give') {
|
||||
// Execute Module - Give
|
||||
await give(interaction);
|
||||
}
|
||||
},
|
||||
};
|
||||
// Dependencies
|
||||
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||
import { CommandInteraction } from "discord.js";
|
||||
|
||||
// Modules
|
||||
import give from "./modules/give";
|
||||
|
||||
// Function
|
||||
export default {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("reputation")
|
||||
.setDescription("Give reputation.")
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand
|
||||
.setName("give")
|
||||
.setDescription("Give reputation to a user")
|
||||
.addUserOption((option) =>
|
||||
option
|
||||
.setName("target")
|
||||
.setDescription("The user you want to repute.")
|
||||
.setRequired(true)
|
||||
)
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName("type")
|
||||
.setDescription("What type of reputation you want to repute")
|
||||
.setRequired(true)
|
||||
.addChoice("Positive", "positive")
|
||||
.addChoice("Negative", "negative")
|
||||
)
|
||||
),
|
||||
async execute(interaction: CommandInteraction) {
|
||||
// Destructure
|
||||
const { options } = interaction;
|
||||
|
||||
// Module - Give
|
||||
if (options.getSubcommand() === "give") {
|
||||
// Execute Module - Give
|
||||
await give(interaction);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
import i18next from 'i18next';
|
||||
import { CommandInteraction } from 'discord.js';
|
||||
import config from '../../../../config.json';
|
||||
import logger from '../../../handlers/logger';
|
||||
import users from '../../../helpers/database/models/userSchema';
|
||||
import timeouts from '../../../helpers/database/models/timeoutSchema';
|
||||
import i18next from "i18next";
|
||||
import { CommandInteraction } from "discord.js";
|
||||
import config from "../../../../config.json";
|
||||
import logger from "../../../handlers/logger";
|
||||
import users from "../../../helpers/database/models/userSchema";
|
||||
import timeouts from "../../../helpers/database/models/timeoutSchema";
|
||||
|
||||
export default async (interaction: CommandInteraction) => {
|
||||
// Destructure
|
||||
const { options, user, guild } = interaction;
|
||||
|
||||
// Target information
|
||||
const target = options.getUser('target');
|
||||
const target = options.getUser("target");
|
||||
|
||||
// Type information
|
||||
const type = options.getString('type');
|
||||
const type = options.getString("type");
|
||||
|
||||
// User information
|
||||
const userObj = await users.findOne({
|
||||
|
@ -34,8 +34,8 @@ export default async (interaction: CommandInteraction) => {
|
|||
if (target?.id === user?.id) {
|
||||
// Embed object
|
||||
const embed = {
|
||||
title: ':loudspeaker: Reputation - Give',
|
||||
description: 'You can not repute yourself.',
|
||||
title: ":loudspeaker: Reputation - Give",
|
||||
description: "You can not repute yourself.",
|
||||
timestamp: new Date(),
|
||||
color: config.colors.error as any,
|
||||
footer: { iconURL: config.footer.icon, text: config.footer.text },
|
||||
|
@ -46,12 +46,12 @@ export default async (interaction: CommandInteraction) => {
|
|||
}
|
||||
|
||||
// If type is positive
|
||||
if (type === 'positive') {
|
||||
if (type === "positive") {
|
||||
userObj.reputation += 1;
|
||||
}
|
||||
|
||||
// If type is negative
|
||||
if (type === 'negative') {
|
||||
if (type === "negative") {
|
||||
userObj.reputation -= 1;
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ export default async (interaction: CommandInteraction) => {
|
|||
await userObj.save().then(async () => {
|
||||
// Embed object
|
||||
const embed = {
|
||||
title: ':loudspeaker: Reputation - Give',
|
||||
title: ":loudspeaker: Reputation - Give",
|
||||
description: `You have given ${target} a ${type} reputation!`,
|
||||
timestamp: new Date(),
|
||||
color: config.colors.success as any,
|
||||
|
@ -100,7 +100,7 @@ export default async (interaction: CommandInteraction) => {
|
|||
} else {
|
||||
// Create embed object
|
||||
const embed = {
|
||||
title: ':loudspeaker: Reputation - Give',
|
||||
title: ":loudspeaker: Reputation - Give",
|
||||
description: `You have given reputation within the last ${
|
||||
config.reputation.timeout / 1000
|
||||
} seconds, you can not repute now!`,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import database from './database';
|
||||
import deployCommands from './deployCommands';
|
||||
import dbGuildFix from './dbGuildFix';
|
||||
import dbMemberFix from './dbMemberFix';
|
||||
import database from "./database";
|
||||
import deployCommands from "./deployCommands";
|
||||
import dbGuildFix from "./dbGuildFix";
|
||||
import dbMemberFix from "./dbMemberFix";
|
||||
|
||||
export default { database, deployCommands, dbGuildFix, dbMemberFix };
|
||||
|
|
14
src/index.ts
14
src/index.ts
|
@ -1,13 +1,13 @@
|
|||
// Dependencies
|
||||
import { Client, Intents } from 'discord.js'; // discord.js
|
||||
import { Client, Intents } from "discord.js"; // discord.js
|
||||
|
||||
import database from './helpers/database';
|
||||
import events from './handlers/events';
|
||||
import commands from './handlers/commands';
|
||||
import locale from './handlers/locale';
|
||||
import schedules from './handlers/schedules';
|
||||
import database from "./helpers/database";
|
||||
import events from "./handlers/events";
|
||||
import commands from "./handlers/commands";
|
||||
import locale from "./handlers/locale";
|
||||
import schedules from "./handlers/schedules";
|
||||
|
||||
import config from '../config.json'; // config.json
|
||||
import config from "../config.json"; // config.json
|
||||
|
||||
(async () => {
|
||||
// Initialize discord.js client
|
||||
|
|
Loading…
Add table
Reference in a new issue