Closed github-actions[bot] closed 4 years ago
Attempt to find a function Discord has to normalize embed key's
https://github.com/AAGaming00/rich-quotes/blob/8c8f15b17ce4d7985f96a1b3b8a990e692b5ebb3/components/Quote.jsx#L70
} async linkRes() { const MessageC = await getModule(m => m.prototype && m.prototype.getReaction && m.prototype.isSystemDM); const parser = await getModule(["parse", "parseTopic"]); if (this.props.link[0] !== '000000000000000000') { const getWithQueue = (() => { let pending = Promise.resolve() const run = async ([guildId, channelId, messageId]) => { try { await pending } finally { return getMsg(guildId, channelId, messageId); } } return (link) => (pending = run(link)); })(), originalMessage = await getWithQueue(this.props.link); if (originalMessage.error) { errorParams = originalMessage; errorParams.link = this.props.link; } else { const { getChannel } = await getModule(['getChannel']); const { renderSimpleAccessories } = await getModule(m => m?.default?.displayName == 'renderAccessories'); let messageData = { ...originalMessage }; let hasEmbedSpoilers = false; if (this.props.settings.displayEmbeds) embedHandler(messageData, this.props.settings, hasEmbedSpoilers); else { messageData.embeds = []; messageData.attachments = []; } if (!this.props.settings.displayReactions) messageData.reactions = []; this.props.content = await parser.parse( messageData.content.trim(), true, { channelId: this.props.thisChannel } ); this.props.author = messageData.author; this.props.message = await new MessageC({ ...messageData }); this.props.channel = await getChannel(messageData.channel_id); if (this.props.settings.displayEmbeds && (this.props.message.embeds?.length !== 0 || this.props.message.attachments?.length !== 0)) { if (this.props.message.embeds?.length !== 0) { // @todo Attempt to find a function Discord has to normalize embed key's const fixers = [['description','rawDescription'],['title','rawTitle']]; this.props.message.embeds.forEach((e, i) => fixers.forEach((f) => { if (e[f[0]]) { this.props.message.embeds[i][f[1]] = e[f[0]]; delete this.props.message.embeds[i][f[0]]; } })) } this.props.accessories = renderSimpleAccessories({ message: this.props.message, channel: this.props.channel}, hasEmbedSpoilers); } else this.props.accessories = false; } } else { // funni preview handler const getCurrentUser = await getModule([ 'getCurrentUser' ]); this.props.content = await parser.parse( 'Check out this preview', true, { channelId: '000000000000000000' } ); this.props.author = await getCurrentUser.getCurrentUser(); this.props.message = await new MessageC({ ...'' }); this.props.channel = { id: 'owo', name: 'test-channel'}; this.props.link = ['000000000000000000','000000000000000000','000000000000000000']; } this.setState(this.state); } async searchRes() { const { transitionTo } = await getModule([ 'transitionTo' ]); const setStatus = (s, link) => this.setState({ searchStatus: s, link });
2d563036d325044be7de73582e611bc71e87f9e6
Attempt to find a function Discord has to normalize embed key's
https://github.com/AAGaming00/rich-quotes/blob/8c8f15b17ce4d7985f96a1b3b8a990e692b5ebb3/components/Quote.jsx#L70
2d563036d325044be7de73582e611bc71e87f9e6