aboutsummaryrefslogtreecommitdiff
path: root/src/lib/extensions/discord.js/BushGuildEmojiRoleManager.d.ts
blob: 9253cadaa1af4a9d2c0a08c8f1fa21207f100be0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import type { BushClient, BushGuild, BushGuildEmoji, BushRole, BushRoleResolvable } from '#lib';
import { DataManager, type Collection, type Snowflake } from 'discord.js';

/**
 * Manages API methods for roles belonging to emojis and stores their cache.
 */
export class BushGuildEmojiRoleManager extends DataManager<Snowflake, BushRole, BushRoleResolvable> {
	public constructor(emoji: BushGuildEmoji);
	public declare readonly client: BushClient;

	/**
	 * The emoji belonging to this manager
	 */
	public emoji: BushGuildEmoji;

	/**
	 * The guild belonging to this manager
	 */
	public guild: BushGuild;

	/**
	 * Adds a role (or multiple roles) to the list of roles that can use this emoji.
	 * @param roleOrRoles The role or roles to add
	 */
	public add(
		roleOrRoles: BushRoleResolvable | readonly BushRoleResolvable[] | Collection<Snowflake, BushRole>
	): Promise<BushGuildEmoji>;

	/**
	 * Sets the role(s) that can use this emoji.
	 * @param roles The roles or role ids to apply
	 * @example
	 * // Set the emoji's roles to a single role
	 * guildEmoji.roles.set(['391156570408615936'])
	 *   .then(console.log)
	 *   .catch(console.error);
	 * @example
	 * // Remove all roles from an emoji
	 * guildEmoji.roles.set([])
	 *    .then(console.log)
	 *    .catch(console.error);
	 */
	public set(roles: readonly BushRoleResolvable[] | Collection<Snowflake, BushRole>): Promise<BushGuildEmoji>;

	/**
	 * Removes a role (or multiple roles) from the list of roles that can use this emoji.
	 * @param roleOrRoles The role or roles to remove
	 */
	public remove(
		roleOrRoles: BushRoleResolvable | readonly BushRoleResolvable[] | Collection<Snowflake, BushRole>
	): Promise<BushGuildEmoji>;
}