diff options
author | Cynthia Foxwell <gamers@riseup.net> | 2022-10-04 20:45:35 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-05 04:45:35 +0200 |
commit | 98cfa090d4fcdf5ed934cf7435df9423fbe58932 (patch) | |
tree | 61a5c57ca7db0e1cda307b7a9bf5f55afa000769 /src/plugins | |
parent | 77aa0c78a02d4c3937a93173836b67087beea2b5 (diff) | |
download | Vencord-98cfa090d4fcdf5ed934cf7435df9423fbe58932.tar.gz Vencord-98cfa090d4fcdf5ed934cf7435df9423fbe58932.tar.bz2 Vencord-98cfa090d4fcdf5ed934cf7435df9423fbe58932.zip |
feat(plugin): add webhookTags (#46)
* feat(plugin): add webhookTags
* fix(plugin): merge same find patches in webhookTags
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/webhookTags.ts | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/plugins/webhookTags.ts b/src/plugins/webhookTags.ts new file mode 100644 index 0000000..70a1010 --- /dev/null +++ b/src/plugins/webhookTags.ts @@ -0,0 +1,33 @@ +import definePlugin from "../utils/types"; +import { Devs } from "../utils/constants"; + +export default definePlugin({ + name: "Webhook Tags", + description: "Changes the bot tag to say webhook for webhooks", + authors: [Devs.Cyn], + patches: [ + { + find: '.BOT=0]="BOT"', + replacement: [ + { + match: /(.)\[.\.BOT=0\]="BOT";/, + replace: (orig, types) => + `${types}[${types}.WEBHOOK=99]="WEBHOOK";${orig}`, + }, + { + match: /case (.)\.BOT:default:(.)=/, + replace: (orig, types, text) => + `case ${types}.WEBHOOK:${text}="WEBHOOK";break;${orig}`, + }, + ], + }, + { + find: ".Types.ORIGINAL_POSTER", + replacement: { + match: /return null==(.)\?null:.\.createElement\((.)\.Z/, + replace: (orig, type, BotTag) => + `if(${type}==${BotTag}.Z.Types.BOT&&arguments[0].user.isNonUserBot()){${type}=${BotTag}.Z.Types.WEBHOOK}${orig}`, + }, + }, + ], +}); |