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

feat(Widget): support fetching widget image #8589

Closed
wants to merge 14 commits into from

Conversation

dager-mohamed
Copy link
Contributor

Please describe the changes this PR makes and why it should be merged:

Status and versioning classification:

@vercel
Copy link

vercel bot commented Sep 3, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Updated
discord-js ⬜️ Ignored (Inspect) Oct 10, 2022 at 6:30PM (UTC)
discord-js-guide ⬜️ Ignored (Inspect) Oct 10, 2022 at 6:30PM (UTC)

packages/discord.js/src/structures/Widget.js Outdated Show resolved Hide resolved
packages/discord.js/src/structures/Widget.js Outdated Show resolved Hide resolved
packages/discord.js/typings/index.d.ts Outdated Show resolved Hide resolved
fetchImage(style) {
const styles = ['banner1', 'banner2', 'banner3', 'banner4', 'shield'];
if (!styles.includes(style)) style = 'shield';
const data = `https://discord.com/api/v${APIVersion}${Routes.guildWidgetImage(this.id)}?style=${style}`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be returned directly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not resolved

Copy link
Member

@almeidx almeidx Oct 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still not resolved (original comment: #8589 (comment)) - Also, is there no function for this link in discord-api-types somewhere?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides the previous review, this could use RouteBases.api + Routes.guildWidgetImage(this.id) from discord-api-types (need to handle the query string separately)

dager-mohamed and others added 3 commits September 4, 2022 09:07
Co-authored-by: Suneet Tipirneni <77477100+suneettipirneni@users.noreply.github.com>
@almeidx
Copy link
Member

almeidx commented Oct 9, 2022

Are you still maintaining this @dager-mohamed? Seems like there are merge conflicts and unresolved conversations

@dager-mohamed
Copy link
Contributor Author

Are you still maintaining this @dager-mohamed? Seems like there are merge conflicts and unresolved conversations

idk why there are merge conflicts, but there are no resolved conversations

packages/discord.js/src/structures/Widget.js Outdated Show resolved Hide resolved
packages/discord.js/src/structures/Widget.js Outdated Show resolved Hide resolved
packages/discord.js/src/structures/Widget.js Show resolved Hide resolved
fetchImage(style) {
const styles = ['banner1', 'banner2', 'banner3', 'banner4', 'shield'];
if (!styles.includes(style)) style = 'shield';
const data = `https://discord.com/api/v${APIVersion}${Routes.guildWidgetImage(this.id)}?style=${style}`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not resolved

packages/discord.js/src/structures/Widget.js Outdated Show resolved Hide resolved
@almeidx
Copy link
Member

almeidx commented Oct 10, 2022

GuildWidgetStyle needs to be added to the APITypes file

Co-authored-by: Almeida <almeidx@pm.me>
@vercel
Copy link

vercel bot commented Oct 10, 2022

@dager-mohamed is attempting to deploy a commit to the discordjs Team on Vercel.

A member of the Team first needs to authorize it.

Co-authored-by: Almeida <almeidx@pm.me>
Co-authored-by: Almeida <almeidx@pm.me>
Co-authored-by: Almeida <almeidx@pm.me>
@dager-mohamed
Copy link
Contributor Author

GuildWidgetStyle needs to be added to the APITypes file

all things are done

packages/discord.js/src/structures/Widget.js Outdated Show resolved Hide resolved
@@ -83,6 +83,16 @@ class Widget extends Base {
this._patch(data);
return this;
}

/**
* Get Guild Widget Image
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a great description

packages/discord.js/src/structures/Widget.js Outdated Show resolved Hide resolved
fetchImage(style) {
const styles = ['banner1', 'banner2', 'banner3', 'banner4', 'shield'];
if (!styles.includes(style)) style = 'shield';
const data = `https://discord.com/api/v${APIVersion}${Routes.guildWidgetImage(this.id)}?style=${style}`;
Copy link
Member

@almeidx almeidx Oct 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still not resolved (original comment: #8589 (comment)) - Also, is there no function for this link in discord-api-types somewhere?

packages/discord.js/typings/index.d.ts Outdated Show resolved Hide resolved
dager-mohamed and others added 3 commits October 10, 2022 20:08
Co-authored-by: Almeida <almeidx@pm.me>
Co-authored-by: Almeida <almeidx@pm.me>
Co-authored-by: Almeida <almeidx@pm.me>
@dager-mohamed
Copy link
Contributor Author

now done

Copy link
Member

@Jiralite Jiralite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are still conversations that are marked as resolved but are not resolved.

* @param {GuildWidgetStyle} [style=GuildWidgetStyle.Shield] The style for the widget image
* @returns {string}
*/
imageURL(style = GuildWidgetStyle.Shield) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we defaulting to this? I don't think we should have a default value for this.

@dager-mohamed
Copy link
Contributor Author

There are still conversations that are marked as resolved but are not resolved.

done

@Jiralite
Copy link
Member

No, not done. Re-review the conversations.

@dager-mohamed
Copy link
Contributor Author

No, not done. Re-review the conversations.

bro where?

@Jiralite
Copy link
Member

https://github.com/discordjs/discord.js/pull/8589/files#r991311523

You were told it is not a great description (which it is not). You resolved it without making any changes, leaving it to be still a lacklustre description.

https://github.com/discordjs/discord.js/pull/8589/files#r991539399

This ideally shouldn't have a default. I don't see a reason why discord.js should default it.

https://github.com/discordjs/discord.js/pull/8589/files#r962216556

You've been told this one hasn't been resolved multiple times, despite marking it as resolved. No changes have been made here.

Co-authored-by: Almeida <almeidx@pm.me>
fetchImage(style) {
const styles = ['banner1', 'banner2', 'banner3', 'banner4', 'shield'];
if (!styles.includes(style)) style = 'shield';
const data = `https://discord.com/api/v${APIVersion}${Routes.guildWidgetImage(this.id)}?style=${style}`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides the previous review, this could use RouteBases.api + Routes.guildWidgetImage(this.id) from discord-api-types (need to handle the query string separately)

@Jiralite Jiralite removed this from the discord.js v14.7 milestone Nov 3, 2022
@Jiralite Jiralite added api support and removed REST labels Aug 18, 2023
@Jiralite
Copy link
Member

Superseded by #9782.

@Jiralite Jiralite closed this Aug 18, 2023
@almeidx almeidx removed the blocked label Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants