feat(plugin): add webhookTags (#46)
* feat(plugin): add webhookTags * fix(plugin): merge same find patches in webhookTags
This commit is contained in:
parent
77aa0c78a0
commit
98cfa090d4
1 changed files with 33 additions and 0 deletions
33
src/plugins/webhookTags.ts
Normal file
33
src/plugins/webhookTags.ts
Normal file
|
@ -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}`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
Loading…
Reference in a new issue