Added mutation key to features.
All checks were successful
Main / build-and-push-docker-image (20.x) (push) Successful in 3m32s

This commit is contained in:
2025-12-10 19:39:15 -05:00
parent 465fbf96c9
commit 2050e61706
9 changed files with 84 additions and 27 deletions

View File

@@ -11,6 +11,8 @@ const composer = new Composer<Context>();
const feature = composer.chatType(["group", "supergroup"]);
const mutationKey = process.env.GRAPHQL_MUTATION_KEY || "";
/**
* What triggers this feature and adds to the log when it has been triggered.
* The trigger uses the global Twitter regex to detect Twitter and X links within messages.
@@ -19,7 +21,7 @@ feature.hears(
metaRegex,
logHandle("blacklist-detection-meta"),
async (ctx: Context) => {
await urql.mutation(increment, { trigger: true });
await urql.mutation(increment, { trigger: true, mutationKey });
if (ctx.chat && ctx.msg) {
const username = ctx.msg.from?.username;
@@ -27,7 +29,7 @@ feature.hears(
ctx.msg.delete();
return await urql
.mutation(increment, { link: true })
.mutation(increment, { link: true, mutationKey })
.toPromise()
.then(async () => {
if (ctx.msg) {
@@ -42,10 +44,19 @@ feature.hears(
const groupUsername = ctx.chat?.username;
return await urql
.mutation(addGroup, { groupID, groupName, groupUsername })
.mutation(addGroup, {
groupID,
groupName,
groupUsername,
mutationKey
})
.toPromise()
.then(() =>
urql.mutation(incrementGroup, { groupID, linksDeleted: 1 })
urql.mutation(incrementGroup, {
groupID,
linksDeleted: 1,
mutationKey
})
);
}
});