Various plugin fixes (#492)
Co-authored-by: Ven <vendicated@riseup.net>
This commit is contained in:
parent
5c1519156b
commit
60ccd8cc25
4 changed files with 40 additions and 13 deletions
|
@ -27,6 +27,17 @@ import { ChannelStore, UserStore } from "@webpack/common";
|
||||||
const DRAFT_TYPE = 0;
|
const DRAFT_TYPE = 0;
|
||||||
const promptToUpload = findByCodeLazy("UPLOAD_FILE_LIMIT_ERROR");
|
const promptToUpload = findByCodeLazy("UPLOAD_FILE_LIMIT_ERROR");
|
||||||
|
|
||||||
|
enum EmojiIntentions {
|
||||||
|
REACTION = 0,
|
||||||
|
STATUS = 1,
|
||||||
|
COMMUNITY_CONTENT = 2,
|
||||||
|
CHAT = 3,
|
||||||
|
GUILD_STICKER_RELATED_EMOJI = 4,
|
||||||
|
GUILD_ROLE_BENEFIT_EMOJI = 5,
|
||||||
|
COMMUNITY_CONTENT_ONLY = 6,
|
||||||
|
SOUNDBOARD = 7
|
||||||
|
}
|
||||||
|
|
||||||
interface BaseSticker {
|
interface BaseSticker {
|
||||||
available: boolean;
|
available: boolean;
|
||||||
description: string;
|
description: string;
|
||||||
|
@ -64,17 +75,26 @@ export default definePlugin({
|
||||||
|
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: "canUseAnimatedEmojis:function",
|
find: ".PREMIUM_LOCKED;",
|
||||||
predicate: () => Settings.plugins.FakeNitro.enableEmojiBypass === true,
|
predicate: () => Settings.plugins.FakeNitro.enableEmojiBypass === true,
|
||||||
replacement: [
|
replacement: [
|
||||||
"canUseAnimatedEmojis",
|
{
|
||||||
"canUseEmojisEverywhere"
|
match: /(?<=(?<intention>\i)=\i\.intention.+?\.(?:canUseEmojisEverywhere|canUseAnimatedEmojis)\(\i)(?=\))/g,
|
||||||
].map(func => {
|
replace: ",$<intention>"
|
||||||
return {
|
},
|
||||||
match: new RegExp(`${func}:function\\(.+?\\{`),
|
{
|
||||||
replace: "$&return true;"
|
match: /(?<=,\i=)\i\.\i\.can\(\i\.\i\.USE_EXTERNAL_EMOJIS,\i\)(?=;)/,
|
||||||
};
|
replace: "true"
|
||||||
})
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
find: "canUseAnimatedEmojis:function",
|
||||||
|
predicate: () => Settings.plugins.FakeNitro.enableEmojiBypass === true,
|
||||||
|
replacement: {
|
||||||
|
match: /(?<=(?:canUseEmojisEverywhere|canUseAnimatedEmojis):function\(\i)\){/g,
|
||||||
|
replace: `,fakeNitroIntention){return fakeNitroIntention===undefined||[${EmojiIntentions.CHAT},${EmojiIntentions.GUILD_STICKER_RELATED_EMOJI}].includes(fakeNitroIntention);`
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: "canUseAnimatedEmojis:function",
|
find: "canUseAnimatedEmojis:function",
|
||||||
|
|
|
@ -263,7 +263,7 @@ export default definePlugin({
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
// Remove the divider and the open chat button for the HiddenChannelLockScreen
|
// Remove the divider and the open chat button for the HiddenChannelLockScreen
|
||||||
match: /(?<=function \i\((?<props>\i)\).{1,1800}"more-options-popout"\)\);if\()/,
|
match: /(?<=function \i\((?<props>\i)\).{1,2000}"more-options-popout"\)\);if\()/,
|
||||||
replace: "(!$self.isHiddenChannel($<props>.channel)||$<props>.inCall)&&"
|
replace: "(!$self.isHiddenChannel($<props>.channel)||$<props>.inCall)&&"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,10 +48,10 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// channel mentions
|
// channel mentions
|
||||||
find: 'className:"channelMention",iconType:(',
|
find: ".EMOJI_IN_MESSAGE_HOVER",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /onClick:(.{1,3}),/,
|
match: /onClick:(\i)(?=,.{0,30}className:"channelMention")/,
|
||||||
replace: "onClick:(_vcEv)=>(_vcEv.detail>=2||_vcEv.target.className.includes('MentionText'))&&($1)(),",
|
replace: "onClick:(_vcEv)=>(_vcEv.detail>=2||_vcEv.target.className.includes('MentionText'))&&($1)()",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
@ -121,6 +121,13 @@ export default definePlugin({
|
||||||
const reactions = getReactionsWithQueue(message, emoji, type);
|
const reactions = getReactionsWithQueue(message, emoji, type);
|
||||||
const users = Object.values(reactions).filter(Boolean) as User[];
|
const users = Object.values(reactions).filter(Boolean) as User[];
|
||||||
|
|
||||||
|
for (const user of users) {
|
||||||
|
FluxDispatcher.dispatch({
|
||||||
|
type: "USER_UPDATE",
|
||||||
|
user
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{ marginLeft: "0.5em", transform: "scale(0.9)" }}
|
style={{ marginLeft: "0.5em", transform: "scale(0.9)" }}
|
||||||
|
|
Loading…
Reference in a new issue