fix: permissions and magicImport (#285)

* fix: magicImport

* fix: dapi-types

* fix: socram
This commit is contained in:
MARCROCK22 2024-11-01 21:13:10 -04:00 committed by GitHub
parent 4052cb2a53
commit e7b8806973
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 11 additions and 10 deletions

View File

@ -279,11 +279,12 @@ export const ReplaceRegex = {
}; };
export async function magicImport(path: string) { export async function magicImport(path: string) {
try { //@ts-expect-error
return require(path); if (typeof require === 'undefined' || globalThis.Deno)
} catch { return new Function('return ((path) => import(`file:///${path}?update=${Date.now()}`))')()(
return eval('((path) => import(`file:///${path}?update=${Date.now()}`))')(path.split('\\').join('\\\\')); path.split('\\').join('\\\\'),
} );
return require(path);
} }
export type OnFailCallback = (error: unknown) => any; export type OnFailCallback = (error: unknown) => any;

View File

@ -1,5 +1,5 @@
import type { ApplicationIntegrationType, InteractionContextType } from '..'; import type { ApplicationIntegrationType, InteractionContextType } from '..';
import type { ChannelType, Snowflake } from '../..'; import type { ChannelType, Permissions, Snowflake } from '../..';
import type { LocaleString } from '../../rest'; import type { LocaleString } from '../../rest';
import type { import type {

View File

@ -3,7 +3,7 @@
*/ */
import type { LocalizationMap } from '.'; import type { LocalizationMap } from '.';
import type { Snowflake } from '..'; import type { Permissions, Snowflake } from '..';
import type { APIPartialGuild } from './guild'; import type { APIPartialGuild } from './guild';
import type { ApplicationIntegrationType } from './interactions'; import type { ApplicationIntegrationType } from './interactions';
import type { OAuth2Scopes } from './oauth2'; import type { OAuth2Scopes } from './oauth2';

View File

@ -1,4 +1,4 @@
import type { Snowflake } from '..'; import type { Permissions, Snowflake } from '..';
import type { import type {
APIBan, APIBan,
APIChannel, APIChannel,

View File

@ -1,4 +1,4 @@
import type { Snowflake } from '..'; import type { Permissions, Snowflake } from '..';
import type { APIApplication, APIGuild, APIUser, APIWebhook, OAuth2Scopes } from '../payloads'; import type { APIApplication, APIGuild, APIUser, APIWebhook, OAuth2Scopes } from '../payloads';
/** /**

View File

@ -1,4 +1,4 @@
import type { Snowflake } from '..'; import type { Permissions, Snowflake } from '..';
import type { import type {
APIApplicationRoleConnection, APIApplicationRoleConnection,
APIChannel, APIChannel,