aboutsummaryrefslogtreecommitdiff
path: root/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.d.ts
blob: ece4a60bc2f9b890743708e3502443e518d45e82 (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
53
54
55
56
57
58
59
60
61
import { APIApplicationCommandPermission } from 'discord-api-types';
import {
	ApplicationCommand,
	ApplicationCommandManager,
	ApplicationCommandPermissionData,
	ApplicationCommandPermissions,
	BaseManager,
	Collection,
	GuildApplicationCommandManager,
	GuildApplicationCommandPermissionData,
	Snowflake
} from 'discord.js';
import { ApplicationCommandPermissionTypes } from 'discord.js/typings/enums';
import { BushClient, BushRoleResolvable, BushUserResolvable } from '../discord-akairo/BushClient';

export class BushApplicationCommandPermissionsManager<
	BaseOptions,
	FetchSingleOptions,
	FullPermissionsOptions,
	GuildType,
	CommandIdType
> extends BaseManager {
	public constructor(manager: ApplicationCommandManager | GuildApplicationCommandManager | ApplicationCommand);
	private manager: ApplicationCommandManager | GuildApplicationCommandManager | ApplicationCommand;

	public client: BushClient;
	public commandId: CommandIdType;
	public guild: GuildType;
	public guildId: Snowflake | null;
	public add(
		options: FetchSingleOptions & { permissions: ApplicationCommandPermissionData[] }
	): Promise<ApplicationCommandPermissions[]>;
	public has(options: FetchSingleOptions & { permissionId: BushUserResolvable | BushRoleResolvable }): Promise<boolean>;
	public fetch(options: FetchSingleOptions): Promise<ApplicationCommandPermissions[]>;
	public fetch(options: BaseOptions): Promise<Collection<Snowflake, ApplicationCommandPermissions[]>>;
	public remove(
		options:
			| (FetchSingleOptions & {
					users: BushUserResolvable | BushUserResolvable[];
					roles?: BushRoleResolvable | BushRoleResolvable[];
			  })
			| (FetchSingleOptions & {
					users?: BushUserResolvable | BushUserResolvable[];
					roles: BushRoleResolvable | BushRoleResolvable[];
			  })
	): Promise<ApplicationCommandPermissions[]>;
	public set(
		options: FetchSingleOptions & { permissions: ApplicationCommandPermissionData[] }
	): Promise<ApplicationCommandPermissions[]>;
	public set(
		options: FullPermissionsOptions & {
			fullPermissions: GuildApplicationCommandPermissionData[];
		}
	): Promise<Collection<Snowflake, ApplicationCommandPermissions[]>>;
	private permissionsPath(guildId: Snowflake, commandId?: Snowflake): unknown;
	private static transformPermissions(
		permissions: ApplicationCommandPermissionData,
		received: true
	): Omit<APIApplicationCommandPermission, 'type'> & { type: keyof ApplicationCommandPermissionTypes };
	private static transformPermissions(permissions: ApplicationCommandPermissionData): APIApplicationCommandPermission;
}