mirror of
https://github.com/Vendicated/Vencord.git
synced 2024-09-20 06:30:35 +00:00
fix regex remove fake nitro name part
This commit is contained in:
parent
850b940306
commit
9c819e83b3
1 changed files with 2 additions and 2 deletions
|
@ -324,7 +324,7 @@ const messageContextMenuPatch: NavContextMenuPatchCallback = (children, props) =
|
||||||
const match = props.message.content.match(RegExp(`<a?:(\\w+)(?:~\\d+)?:${favoriteableId}>|https://cdn\\.discordapp\\.com/emojis/${favoriteableId}\\.`));
|
const match = props.message.content.match(RegExp(`<a?:(\\w+)(?:~\\d+)?:${favoriteableId}>|https://cdn\\.discordapp\\.com/emojis/${favoriteableId}\\.`));
|
||||||
const reaction = props.message.reactions.find(reaction => reaction.emoji.id === favoriteableId);
|
const reaction = props.message.reactions.find(reaction => reaction.emoji.id === favoriteableId);
|
||||||
if (!match && !reaction) return;
|
if (!match && !reaction) return;
|
||||||
const name = (match && match[1]) ?? reaction?.emoji.name ?? props?.message?.content.match(/(?<=name=)\w[a-zA-Z_0-9]*/gm) ?? "FakeNitroEmoji";
|
const name = (match && match[1]) ?? reaction?.emoji.name ?? "FakeNitroEmoji";
|
||||||
|
|
||||||
return buildMenuItem("Emoji", () => ({
|
return buildMenuItem("Emoji", () => ({
|
||||||
id: favoriteableId,
|
id: favoriteableId,
|
||||||
|
@ -366,7 +366,7 @@ function imageContextPatch(c, p: {
|
||||||
if ("src" in p
|
if ("src" in p
|
||||||
&& /https:\/\/cdn\.discordapp\.com\/emojis\/(\d+)\.[a-zA-Z]{3,4}.*/gm.test(p.src)
|
&& /https:\/\/cdn\.discordapp\.com\/emojis\/(\d+)\.[a-zA-Z]{3,4}.*/gm.test(p.src)
|
||||||
){
|
){
|
||||||
const matches = [...p.src.matchAll(/https:\/\/cdn\.discordapp\.com\/emojis\/(\d+)\.(gif|png).*/gm)];
|
const matches = [...p.src.matchAll(/https:\/\/cdn\.discordapp\.com\/emojis\/(\d+)\.[a-zA-Z]{3,4}.*/gm)];
|
||||||
if (!matches) return;
|
if (!matches) return;
|
||||||
c.push(buildMenuItem("Emoji", () => ({
|
c.push(buildMenuItem("Emoji", () => ({
|
||||||
id: matches[0][1],
|
id: matches[0][1],
|
||||||
|
|
Loading…
Reference in a new issue