Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deno): faulty import paths for guild scheduled events #245

Merged
merged 1 commit into from
Nov 30, 2021
Merged

fix(deno): faulty import paths for guild scheduled events #245

merged 1 commit into from
Nov 30, 2021

Conversation

kotx
Copy link
Contributor

@kotx kotx commented Nov 29, 2021

Currently importing this library in deno (1.16.3) on version 0.25.0 will cause this error:

error: Import 'https://deno.land/x/discord_api_types@0.25.0/payloads/v9.ts' failed, not found.
    at https://deno.land/x/discord_api_types@0.25.0/rest/v9/guildScheduledEvent.ts:10:8

Here's my import_map.json:

{
    "imports": {
        "discord_api_types": "https://deno.land/x/discord_api_types@0.25.0/v9.ts"
    }
}

Reproduction: https://gitpod.io#snapshot/a6632653-7af6-4e60-bf9f-105616df115b
Run curl -fsSL https://deno.land/x/install/install.sh | sudo DENO_INSTALL=/usr/local sh to install Deno and run deno run --import-map=import_map.json main.ts

@vladfrangu
Copy link
Member

The proper fix is fixing the imports in v9 and v8 in rest 👀

diff --git a/rest/v8/guildScheduledEvent.ts b/rest/v8/guildScheduledEvent.ts
index 661079b..f22cab1 100644
--- a/rest/v8/guildScheduledEvent.ts
+++ b/rest/v8/guildScheduledEvent.ts
@@ -7,7 +7,7 @@ import type {
 	GuildScheduledEventStatus,
 	APIGuildMember,
 	APIUser,
-} from '../../payloads/v8';
+} from '../../v8';
 
 /**
  * https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild
diff --git a/rest/v9/guildScheduledEvent.ts b/rest/v9/guildScheduledEvent.ts
index a75981f..0ed1b94 100644
--- a/rest/v9/guildScheduledEvent.ts
+++ b/rest/v9/guildScheduledEvent.ts
@@ -7,7 +7,7 @@ import type {
 	GuildScheduledEventStatus,
 	APIGuildMember,
 	APIUser,
-} from '../../payloads/v9';
+} from '../../v9';
 
 /**
  * https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild

@kotx
Copy link
Contributor Author

kotx commented Nov 30, 2021

@vladfrangu I think this works

@vladfrangu
Copy link
Member

Thanks! Will push a quick .1 patch version for this

@vladfrangu vladfrangu changed the title Fix faulty import path fix(deno): faulty import paths for guild scheduled events Nov 30, 2021
@vladfrangu vladfrangu merged commit 44c0f05 into discordjs:main Nov 30, 2021
@kotx kotx deleted the patch-1 branch November 30, 2021 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants