-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
base: main
Are you sure you want to change the base?
EmoteCloner: Fix a hang when the sticker/original server is deleted #3087
Conversation
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
There was a problem hiding this 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
} catch (err) { | ||
return undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} catch (err) { | |
return undefined; | |
} catch { | |
// do nothing |
if (sticker === undefined) { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (sticker === undefined) { | |
return; | |
} | |
if (!sticker) return; |
} else { | ||
return fetchedSticker; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else { | |
return fetchedSticker; | |
} | |
} | |
return fetchedSticker; |
"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 |
There was a problem hiding this comment.
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
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.