137 role command cannot read properties of undefined #141
2 changed files with 7 additions and 7 deletions
|
@ -1,8 +1,8 @@
|
||||||
USAGE: config <add|remove> <Role Name>
|
USAGE: config <add|remove> <Role ID>
|
||||||
|
|
||||||
===[ EXAMPLE ]===
|
===[ EXAMPLE ]===
|
||||||
To add a role:
|
To add a role:
|
||||||
- config add role-name
|
- config add 000000000000000000
|
||||||
|
|
||||||
To remove a role:
|
To remove a role:
|
||||||
- config remove role-name
|
- config remove 000000000000000000
|
|
@ -62,7 +62,7 @@ export default class Role extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async ToggleRole(context: ICommandContext, roles: String[]): Promise<ICommandReturnContext> {
|
public async ToggleRole(context: ICommandContext, roles: String[]): Promise<ICommandReturnContext> {
|
||||||
const requestedRole = context.args[0];
|
const requestedRole = context.args.join(" ");
|
||||||
|
|
||||||
if (!roles.includes(requestedRole)) {
|
if (!roles.includes(requestedRole)) {
|
||||||
const errorEmbed = new ErrorEmbed(context, "This role isn't marked as assignable, to see a list of assignable roles, run this command without any parameters");
|
const errorEmbed = new ErrorEmbed(context, "This role isn't marked as assignable, to see a list of assignable roles, run this command without any parameters");
|
||||||
|
@ -158,7 +158,7 @@ export default class Role extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async AddRoleConfig(context: ICommandContext) {
|
private async AddRoleConfig(context: ICommandContext) {
|
||||||
const role = context.message.guild!.roles.cache.find(x => x.name == context.args[2]);
|
const role = context.message.guild!.roles.cache.find(x => x.id == context.args[2]);
|
||||||
|
|
||||||
if (!role) {
|
if (!role) {
|
||||||
this.SendConfigHelp(context);
|
this.SendConfigHelp(context);
|
||||||
|
@ -180,7 +180,7 @@ export default class Role extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async RemoveRoleConfig(context: ICommandContext) {
|
private async RemoveRoleConfig(context: ICommandContext) {
|
||||||
const role = context.message.guild!.roles.cache.find(x => x.name == context.args[2]);
|
const role = context.message.guild!.roles.cache.find(x => x.id == context.args[2]);
|
||||||
|
|
||||||
if (!role) {
|
if (!role) {
|
||||||
this.SendConfigHelp(context);
|
this.SendConfigHelp(context);
|
||||||
|
@ -193,7 +193,7 @@ export default class Role extends Command {
|
||||||
|
|
||||||
const settingArray = setting.split(",");
|
const settingArray = setting.split(",");
|
||||||
|
|
||||||
const index = settingArray.findIndex(x => x == context.args[2]);
|
const index = settingArray.findIndex(x => x == role.name);
|
||||||
|
|
||||||
if (index == -1) return;
|
if (index == -1) return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue