Added graphql calls every time a feature is triggered, the bot responds to a command, and deletes a link
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { Composer } from "grammy";
|
||||
import type { Context } from "#root/bot/context.js";
|
||||
import { logHandle } from "#root/bot/helpers/logging.js";
|
||||
import urql from "#root/lib/urql.js";
|
||||
import increment from "#root/lib/graphql/mutations/incrimentMutation.js";
|
||||
|
||||
const composer = new Composer<Context>();
|
||||
|
||||
@@ -9,12 +11,21 @@ const feature = composer.chatType("private");
|
||||
* What triggers this feature and adds to the log when it has been triggered.
|
||||
* The trigger is the command "/start" or "start"
|
||||
*/
|
||||
feature.command("start", logHandle("command-start"), ctx => {
|
||||
// Responds with information about the bot.
|
||||
return ctx.reply(
|
||||
`Welcome\\! I am a bot created by Lucid for [Werewolf Kid Creations](https://werewolfkid.monster/) I am designed to delete any Twitter/X and Meta links along with corresponding reformatting services within groups\\. I also check embedded links and forwarded messages\\! I am currently in a public beta mode\\! Simply add me to a group and make me an admin with the permission to delete messages\\. From there I will start deleting any Twitter\\/X and Meta links I detect\\.`,
|
||||
{ parse_mode: "MarkdownV2" }
|
||||
);
|
||||
feature.command("start", logHandle("command-start"), async ctx => {
|
||||
await urql.mutation(increment, { trigger: true });
|
||||
|
||||
await urql
|
||||
.mutation(increment, { command: true })
|
||||
.toPromise()
|
||||
.then(async () => {
|
||||
if (ctx.msg) {
|
||||
// Responds with information about the bot.
|
||||
return ctx.reply(
|
||||
`Welcome\\! I am a bot created by Lucid for [Werewolf Kid Creations](https://werewolfkid.monster/) I am designed to delete any Twitter/X and Meta links along with corresponding reformatting services within groups\\. I also check embedded links and forwarded messages\\! I am currently in a public beta mode\\! Simply add me to a group and make me an admin with the permission to delete messages\\. From there I will start deleting any Twitter\\/X and Meta links I detect\\.`,
|
||||
{ parse_mode: "MarkdownV2" }
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
export { composer as welcomeFeature };
|
||||
|
||||
Reference in New Issue
Block a user