Different prefix per server
Signed-off-by: Ethan Lane <ethan@vylpes.com>
This commit is contained in:
parent
a0cf29d586
commit
5d629c3b8f
3 changed files with 14 additions and 1 deletions
|
@ -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.")
|
||||||
|
|
||||||
|
|
|
@ -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(" ");
|
||||||
|
|
|
@ -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." });
|
||||||
|
|
Loading…
Reference in a new issue