Fix server prefix not showing
This commit is contained in:
parent
62dc3a8d6e
commit
ae1b5f237c
2 changed files with 14 additions and 4 deletions
|
@ -28,14 +28,15 @@ export default class Role extends Command {
|
|||
const rolesArray = roles.split(",");
|
||||
|
||||
if (context.args.length == 0) {
|
||||
this.SendRolesList(context, rolesArray);
|
||||
await this.SendRolesList(context, rolesArray, context.message.guild.id);
|
||||
} else {
|
||||
await this.ToggleRole(context, rolesArray);
|
||||
}
|
||||
}
|
||||
|
||||
public SendRolesList(context: ICommandContext, roles: String[]): ICommandReturnContext {
|
||||
const description = `Do ${process.env.BOT_PREFIX}role <role> to get the role!\n${roles.join('\n')}`;
|
||||
public async SendRolesList(context: ICommandContext, roles: String[], serverId: string): Promise<ICommandReturnContext> {
|
||||
const botPrefix = await SettingsHelper.GetServerPrefix(serverId);
|
||||
const description = `Do ${botPrefix}role <role> to get the role!\n${roles.join('\n')}`;
|
||||
|
||||
const embed = new PublicEmbed(context, "Roles", description);
|
||||
embed.SendToCurrentChannel();
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { getConnection } from "typeorm";
|
||||
import DefaultValues from "../constants/DefaultValues";
|
||||
import Server from "../entity/Server";
|
||||
import Setting from "../entity/Setting";
|
||||
|
@ -47,4 +46,14 @@ export default class SettingsHelper {
|
|||
await server.Save(Server, server);
|
||||
}
|
||||
}
|
||||
|
||||
public static async GetServerPrefix(serverId: string): Promise<string> {
|
||||
const setting = await this.GetSetting("bot.prefix", serverId);
|
||||
|
||||
if (!setting) {
|
||||
return "v!";
|
||||
}
|
||||
|
||||
return setting;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue