Add permissions checks for FakeNitro actions (#2160)

Co-authored-by: Vendicated <vendicated@riseup.net>
This commit is contained in:
Nuckyz 2024-02-27 09:19:05 -03:00 committed by GitHub
parent 27696ed62a
commit ed5e1be7a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 105 additions and 36 deletions

View file

@ -25,10 +25,13 @@ export default definePlugin({
authors: [Devs.Arjix, Devs.hunt, Devs.Ven],
patches: [
{
find: '"MessageActionCreators"',
find: ".Messages.EDIT_TEXTAREA_HELP",
replacement: {
match: /async editMessage\(.+?\)\{/,
replace: "$&await Vencord.Api.MessageEvents._handlePreEdit(...arguments);"
match: /(?<=,channel:\i\}\)\.then\().+?(?=return \i\.content!==this\.props\.message\.content&&\i\((.+?)\))/,
replace: (match, args) => "" +
`async ${match}` +
`if(await Vencord.Api.MessageEvents._handlePreEdit(${args}))` +
"return Promise.resolve({shoudClear:true,shouldRefocus:true});"
}
},
{