aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/webhookTags.ts33
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}`,
+ },
+ },
+ ],
+});