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

EmoteCloner: Fix a hang when the sticker/original server is deleted #3087

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

nakoyasha
Copy link
Contributor

This fixes the modal hanging and infinitely loading in cases where the sticker can't be fetched (e.g when it or the server it's from was deleted, general Discord weirdness, etc). Also allows for the sticker to still be cloned.

The modal will hang and load infinitely if the server or the sticker was deleted as the API returns "Unknown Sticker" instead of the sticker object for cases like this
Copy link
Contributor

@splatterxl splatterxl left a comment

Choose a reason for hiding this comment

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

cleaner code suggestions but lgtm otherwise

Comment on lines +77 to +78
} catch (err) {
return undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
} catch (err) {
return undefined;
} catch {
// do nothing

Comment on lines +345 to +347
if (sticker === undefined) {
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (sticker === undefined) {
return;
}
if (!sticker) return;

Comment on lines +366 to +368
} else {
return fetchedSticker;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
} else {
return fetchedSticker;
}
}
return fetchedSticker;

Comment on lines +356 to +364
"id": sticker?.id,
"name": sticker?.name,
"format_type": sticker?.format_type,
// Discord has a character limit of at least 1 for tags (aka related emoji)
"tags": " ",
"description": "",
"type": "2",
"available": true,
"guild_id": 0
Copy link
Contributor

Choose a reason for hiding this comment

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

format to have normal key names not in quotes

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.

2 participants