fix prefix.ts

This commit is contained in:
Lio Young 2021-07-02 14:18:06 +02:00
parent d8dbb6eba2
commit aca185d62a
No known key found for this signature in database
GPG Key ID: 789795A11879E169
1 changed files with 4 additions and 2 deletions

View File

@ -1,9 +1,9 @@
import Command from '../../handler/structures/Command'; import Command from '../../handler/structures/Command';
import { Context, Server } from '../../utils/types'; import { Context, Server } from '../../utils/types';
import database from "../../utils/database"
import lingua from '../../utils/lingua'; import lingua from '../../utils/lingua';
import replace from '../../utils/replace'; import replace from '../../utils/replace';
import { MessageEmbed } from 'discord.js'; import { MessageEmbed } from 'discord.js';
import database from "../../utils/database"
export = class Prefix extends Command { export = class Prefix extends Command {
constructor() { constructor() {
super({ super({
@ -27,7 +27,8 @@ export = class Prefix extends Command {
case "+": case "+":
case "a": case "a":
case "add": { case "add": {
if (ctx.args === [] || ctx.args.join(' ').trim() === '') return ctx.channel.send('No Prefix was given'); // @ts-ignore
if (ctx.args === [] || ctx.args.join(' ').trim() === '') return ctx.channel.send(lingua[ctx.settings.locale].MISSING.VALUE.PREFIX);
// @ts-ignore // @ts-ignore
let { data, error } = await database.from<Server>("servers").update({ prefix: [...ctx.settings.prefix, `${ctx.args.join(" ").trim()}`] }).match({ server_id: ctx.guild?.id }) let { data, error } = await database.from<Server>("servers").update({ prefix: [...ctx.settings.prefix, `${ctx.args.join(" ").trim()}`] }).match({ server_id: ctx.guild?.id })
// @ts-ignore // @ts-ignore
@ -54,6 +55,7 @@ export = class Prefix extends Command {
const embed = new MessageEmbed() const embed = new MessageEmbed()
.setColor(ctx.config.variables.color) .setColor(ctx.config.variables.color)
.setFooter(`${ctx.config.variables.name}`, ctx.config.variables.avatar) .setFooter(`${ctx.config.variables.name}`, ctx.config.variables.avatar)
// TODO move this to translation file
.setTitle(`Updated Prefixes for ${ctx.guild?.name}`) .setTitle(`Updated Prefixes for ${ctx.guild?.name}`)
.setDescription(`Successfully removed \`${ctx.args.join(" ").trim()}\` from the list of prefixes for this Server.`) .setDescription(`Successfully removed \`${ctx.args.join(" ").trim()}\` from the list of prefixes for this Server.`)