Feature/48 database #114

Merged
Vylpes merged 12 commits from feature/48-database into develop 2022-03-29 18:19:54 +01:00
3 changed files with 14 additions and 1 deletions
Showing only changes of commit 5d629c3b8f - Show all commits

View file

@ -1,6 +1,8 @@
USAGE: <key> <set|reset> [value] USAGE: <key> <set|reset> [value]
===[ KEYS ]=== ===[ KEYS ]===
bot.prefix: The bot prefix for the server (Default: "v!")
commands.disabled: Disabled commands (Default: "") commands.disabled: Disabled commands (Default: "")
commands.disabled.message: The message to show when a disabled command is ran (Default: "This command is disabled.") commands.disabled.message: The message to show when a disabled command is ran (Default: "This command is disabled.")

View file

@ -1,6 +1,7 @@
import { Message } from "discord.js"; import { Message } from "discord.js";
import { IBaseResponse } from "../contracts/IBaseResponse"; import { IBaseResponse } from "../contracts/IBaseResponse";
import ICommandItem from "../contracts/ICommandItem"; import ICommandItem from "../contracts/ICommandItem";
import SettingsHelper from "../helpers/SettingsHelper";
import { Util } from "./util"; import { Util } from "./util";
export interface IEventResponse extends IBaseResponse { export interface IEventResponse extends IBaseResponse {
@ -32,7 +33,14 @@ export class Events {
message: "Message was sent by a bot, ignoring.", message: "Message was sent by a bot, ignoring.",
}; };
const prefix = process.env.BOT_PREFIX as string; const prefix = await SettingsHelper.GetSetting("bot.prefix", message.guild.id);
if (!prefix) {
return {
valid: false,
message: "Prefix not found",
};
}
if (message.content.substring(0, prefix.length).toLowerCase() == prefix.toLowerCase()) { if (message.content.substring(0, prefix.length).toLowerCase() == prefix.toLowerCase()) {
const args = message.content.substring(prefix.length).split(" "); const args = message.content.substring(prefix.length).split(" ");

View file

@ -15,6 +15,9 @@ export default class DefaultValues {
private static SetValues() { private static SetValues() {
if (this.values.length == 0) { if (this.values.length == 0) {
// Bot
this.values.push({ Key: "bot.prefix", Value: "v!" });
// Commands // Commands
this.values.push({ Key: "commands.disabled", Value: "" }); this.values.push({ Key: "commands.disabled", Value: "" });
this.values.push({ Key: "commands.disabled.message", Value: "This command is disabled." }); this.values.push({ Key: "commands.disabled.message", Value: "This command is disabled." });