75 lines
3.3 KiB
TypeScript
75 lines
3.3 KiB
TypeScript
import { Composer } from "grammy";
|
|
import type { Context } from "#root/bot/context.js";
|
|
import { logHandle } from "#root/bot/helpers/logging.js";
|
|
import { urql } from "#root/main.js";
|
|
import increment from "#root/lib/graphql/mutations/incrementMutation.js";
|
|
|
|
const composer = new Composer<Context>();
|
|
|
|
const feature = composer.chatType(["private", "group", "supergroup"]);
|
|
|
|
/**
|
|
* What triggers this feature and adds to the log when it has been triggered.
|
|
* The trigger is the command "/botInfo"
|
|
*/
|
|
feature.hears(
|
|
/^\/botInfo/,
|
|
logHandle("bot-info-command"),
|
|
async (ctx: Context) => {
|
|
const mutationKey = process.env.GRAPHQL_MUTATION_KEY || "";
|
|
|
|
await urql.mutation(increment, { trigger: true, mutationKey });
|
|
|
|
// Checks if the context includes a message property.
|
|
if (ctx.msg && ctx.chat && ctx.msg.from) {
|
|
// Doesn't respond to regular users in groups. This is to prevent users spamming the command.
|
|
if (ctx.chat.type !== "private") {
|
|
const chatMember = await ctx.getChatMember(ctx.msg.from.id);
|
|
|
|
if (!["creator", "administrator"].includes(chatMember.status)) {
|
|
return;
|
|
}
|
|
}
|
|
|
|
await urql
|
|
.mutation(increment, { command: true, mutationKey })
|
|
.toPromise()
|
|
.then(async () => {
|
|
if (ctx.msg) {
|
|
// Replies to the message.
|
|
await ctx.reply(
|
|
`I am a bot designed to delete any Twitter/X and Meta links along with corresponding reformatting services\\. I now check embedded links\\!`,
|
|
{
|
|
parse_mode: "MarkdownV2",
|
|
reply_parameters: { message_id: ctx.msg.message_id }
|
|
}
|
|
);
|
|
await ctx.reply(
|
|
`[Lucid](https://werewolfkid.monster) made this bot as a protest against the enshittification and Nazi\\-fication of Twitter\\ ever since Elon Musk took it over. The final straw aws when he did a Nazi salute at a Trump Rally celebrating Trump\\'s second inauguration\\.`,
|
|
{
|
|
parse_mode: "MarkdownV2",
|
|
reply_parameters: { message_id: ctx.msg.message_id }
|
|
}
|
|
);
|
|
await ctx.reply(
|
|
`There have been reports of extremist right\\-wing individuals doxxing and harassing anyone left of center\\. The victims have come out to state that they\\'ve had several accounts hacked into\\, including onces with unique passwords\\. It is clear that these assholes are using some kind of script kiddie malware to capture\\/steal credentials and possibly even stored passwords\\.`,
|
|
{
|
|
parse_mode: "MarkdownV2",
|
|
reply_parameters: { message_id: ctx.msg.message_id }
|
|
}
|
|
);
|
|
return await ctx.reply(
|
|
`Lucid decided it was time to make a statement\\. Twitter\\/X is not safe anymore\\. The fandom doesn\\'t need it\\. It should be boycotted and not allowed anymore\\. Thus they decided to try making this bot public\\-use to test it's viability\\. Feel free to add this bot into your own group\\. All it needs is an admin role with the permission to delete messages\\.`,
|
|
{
|
|
parse_mode: "MarkdownV2",
|
|
reply_parameters: { message_id: ctx.msg.message_id }
|
|
}
|
|
);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
);
|
|
|
|
export { composer as botInfoCommand };
|