BotPermissions
Contains methods to test whether a user has permissions in a guild
Static Method Summary
Static Public Methods | ||
public static |
Tests to see if a user is an administrator in a guild with a specified client. |
|
public static |
isMod(client: Client, modRoles: ModRoleStorage, settings: SettingStorage, config: BotConfig, guild: Guild | string, user: User | string): boolean Tests to see if a user is a moderator in a guild using a specified client and config. |
|
public static |
Tests to see if a user is the owner of the bot |
|
public static |
Resolves a guild and user to Discord.js instances with a specified client |
Constructor Summary
Public Constructor | ||
public |
constructor(client: Client, modRoles: ModRoleStorage, settings: SettingStorage, config: BotConfig) |
Member Summary
Public Members | ||
public |
|
|
public |
|
|
public |
|
|
public |
|
Method Summary
Public Methods | ||
public |
Tests to see if a user is an administrator in a guild. |
|
public |
Tests to see if a user is a moderator in a guild. |
|
public |
Tests to see if a user is the owner of the bot |
|
public |
Resolves a guild and user to Discord.js instances |
Static Public Methods
public static isAdmin(client: Client, config: BotConfig, guild: Guild | string, user: User | string): boolean source
Tests to see if a user is an administrator in a guild with a specified client. If the user is the bot owner or has any roles assigned with the "Administrate" permission, they are considered an administrator.
public static isMod(client: Client, modRoles: ModRoleStorage, settings: SettingStorage, config: BotConfig, guild: Guild | string, user: User | string): boolean source
Tests to see if a user is a moderator in a guild using a specified client and config. If the guild has not set any moderator roles, then they will be a moderator if any of their assigned roles contain the "Manage messages" permission. If the guild has set moderator roles, then they will instead be a moderator if they have any of the moderator roles assigned. The bot owner and users with the "Administrate" permission are always moderators.
Params:
Name | Type | Attribute | Description |
client | Client | The Client to use |
|
modRoles | ModRoleStorage | The mod role storage to use |
|
settings | SettingStorage | The setting storage to use |
|
config | BotConfig | The bot config to use |
|
guild | Guild | string | The Guild or the guild ID |
|
user | User | string | The User or the user ID |
public static isOwner(config: BotConfig, user: User | string): boolean source
Tests to see if a user is the owner of the bot
Public Constructors
public constructor(client: Client, modRoles: ModRoleStorage, settings: SettingStorage, config: BotConfig) source
Params:
Name | Type | Attribute | Description |
client | Client | The Client to use |
|
modRoles | ModRoleStorage | The mod role storage to use |
|
settings | SettingStorage | The setting storage to use |
|
config | BotConfig | The bot config to use |
Public Methods
public isAdmin(guild: Guild | string, user: User | string): boolean source
Tests to see if a user is an administrator in a guild. If the user is the bot owner or has any roles assigned with the "Administrate" permission, they are considered an administrator.
public isMod(guild: Guild | string, user: User | string): boolean source
Tests to see if a user is a moderator in a guild. If the guild has not set any moderator roles, then they will be a moderator if any of their assigned roles contain the "Manage messages" permission. If the guild has set moderator roles, then they will instead be a moderator if they have any of the moderator roles assigned. The bot owner and users with the "Administrate" permission are always moderators.