mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 08:33:30 +01:00
types: better fullPermissions typings (#6028)
This commit is contained in:
11
typings/index.d.ts
vendored
11
typings/index.d.ts
vendored
@@ -310,6 +310,7 @@ declare module 'discord.js' {
|
||||
public name: string;
|
||||
public options: ApplicationCommandOption[];
|
||||
public permissions: ApplicationCommandPermissionsManager<
|
||||
PermissionsFetchType,
|
||||
PermissionsFetchType,
|
||||
PermissionsFetchType,
|
||||
Guild | null,
|
||||
@@ -2375,6 +2376,7 @@ declare module 'discord.js' {
|
||||
public permissions: ApplicationCommandPermissionsManager<
|
||||
{ command?: ApplicationCommandResolvable } & PermissionsOptionsExtras,
|
||||
{ command: ApplicationCommandResolvable } & PermissionsOptionsExtras,
|
||||
PermissionsOptionsExtras,
|
||||
PermissionsGuildType,
|
||||
null
|
||||
>;
|
||||
@@ -2415,6 +2417,7 @@ declare module 'discord.js' {
|
||||
export class ApplicationCommandPermissionsManager<
|
||||
BaseOptions,
|
||||
FetchSingleOptions,
|
||||
FullPermissionsOptions,
|
||||
GuildType,
|
||||
CommandIDType,
|
||||
> extends BaseManager {
|
||||
@@ -2445,7 +2448,7 @@ declare module 'discord.js' {
|
||||
options: FetchSingleOptions & { permissions: ApplicationCommandPermissionData[] },
|
||||
): Promise<ApplicationCommandPermissions[]>;
|
||||
public set(
|
||||
options: BaseOptions & {
|
||||
options: FullPermissionsOptions & {
|
||||
fullPermissions: GuildApplicationCommandPermissionData[];
|
||||
},
|
||||
): Promise<Collection<Snowflake, ApplicationCommandPermissions[]>>;
|
||||
@@ -2668,7 +2671,11 @@ declare module 'discord.js' {
|
||||
public delete(channel: StageChannel | Snowflake): Promise<void>;
|
||||
}
|
||||
|
||||
export class ThreadManager<AllowedThreadType> extends CachedManager<Snowflake, ThreadChannel, ThreadChannelResolvable> {
|
||||
export class ThreadManager<AllowedThreadType> extends CachedManager<
|
||||
Snowflake,
|
||||
ThreadChannel,
|
||||
ThreadChannelResolvable
|
||||
> {
|
||||
constructor(channel: TextChannel | NewsChannel, iterable?: Iterable<any>);
|
||||
public channel: TextChannel | NewsChannel;
|
||||
public create(options: ThreadCreateOptions<AllowedThreadType>): Promise<ThreadChannel>;
|
||||
|
||||
@@ -97,6 +97,12 @@ client.on('ready', async () => {
|
||||
await globalPermissionsManager?.set({
|
||||
fullPermissions: [{ id: globalCommandID, permissions: [{ type: 'ROLE', id: testGuildID, permission: true }] }],
|
||||
});
|
||||
// @ts-expect-error
|
||||
await globalPermissionsManager?.set({
|
||||
command: globalCommandID,
|
||||
guild: testGuildID,
|
||||
fullPermissions: [{ id: globalCommandID, permissions: [{ type: 'ROLE', id: testGuildID, permission: true }] }],
|
||||
});
|
||||
|
||||
// @ts-expect-error
|
||||
await globalPermissionsManager?.add({
|
||||
@@ -159,9 +165,9 @@ client.on('ready', async () => {
|
||||
roles: [testGuildID],
|
||||
users: [testUserID],
|
||||
});
|
||||
// @ts-expect-error
|
||||
await guildPermissionsManager?.set({
|
||||
command: globalCommandID,
|
||||
// @ts-expect-error
|
||||
guild: testGuildID,
|
||||
permissions: [{ type: 'ROLE', id: testGuildID, permission: true }],
|
||||
});
|
||||
@@ -183,6 +189,11 @@ client.on('ready', async () => {
|
||||
await guildPermissionsManager?.remove({ roles: [testGuildID], users: [testUserID] });
|
||||
// @ts-expect-error
|
||||
await guildPermissionsManager?.set({ permissions: [{ type: 'ROLE', id: testGuildID, permission: true }] });
|
||||
// @ts-expect-error
|
||||
await guildPermissionsManager?.set({
|
||||
command: globalCommandID,
|
||||
fullPermissions: [{ id: globalCommandID, permissions: [{ type: 'ROLE', id: testGuildID, permission: true }] }],
|
||||
});
|
||||
|
||||
// Permissions from cached global ApplicationCommand
|
||||
await globalCommand?.permissions.add({
|
||||
|
||||
Reference in New Issue
Block a user