admin-protections #69
@@ -1,20 +0,0 @@
|
|||||||
import { chatAction } from "@grammyjs/auto-chat-action";
|
|
||||||
import { Composer } from "grammy";
|
|
||||||
import type { Context } from "#root/bot/context.js";
|
|
||||||
// import { isAdmin } from "#root/bot/filters/is-admin.js";
|
|
||||||
import { setCommandsHandler } from "#root/bot/handlers/commands/setcommands.js";
|
|
||||||
import { logHandle } from "#root/bot/helpers/logging.js";
|
|
||||||
|
|
||||||
const composer = new Composer<Context>();
|
|
||||||
|
|
||||||
const feature = composer.chatType("private");
|
|
||||||
// .filter(ctx => isAdmin(ctx.config.botAdmins)(ctx));
|
|
||||||
|
|
||||||
feature.command(
|
|
||||||
"setcommands",
|
|
||||||
logHandle("command-setcommands"),
|
|
||||||
chatAction("typing"),
|
|
||||||
setCommandsHandler
|
|
||||||
);
|
|
||||||
|
|
||||||
export { composer as adminFeature };
|
|
||||||
@@ -4,19 +4,21 @@ import { logHandle } from "#root/bot/helpers/logging.js";
|
|||||||
|
|
||||||
const composer = new Composer<Context>();
|
const composer = new Composer<Context>();
|
||||||
|
|
||||||
const feature = composer.chatType(["group", "supergroup", "private"]);
|
const feature = composer.chatType(["private"]);
|
||||||
|
|
||||||
// const GROUP_IDS = process.env.GROUP_IDS
|
|
||||||
// ? process.env.GROUP_IDS.split(",")
|
|
||||||
// : undefined;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* What triggers this feature and adds to the log when it has been triggered.
|
||||||
|
* The trigger is the command "/botInfo"
|
||||||
|
*/
|
||||||
feature.hears(
|
feature.hears(
|
||||||
"/botInfo",
|
"/botInfo",
|
||||||
logHandle("bot-info-command"),
|
logHandle("bot-info-command"),
|
||||||
async (ctx: Context) => {
|
async (ctx: Context) => {
|
||||||
if (ctx.chat && ctx.msg) {
|
// Checks if the context includes a message property.
|
||||||
await ctx.reply(
|
if (ctx.msg) {
|
||||||
`I am a bot designed to delete any Twitter/X links and reformatting services within groups\\. I now check embedded links\\! By default I only work with whitelisted group IDs\\.\n\nYou can fork me from this link: https://github\\.com/lucid\\-creations\\-media/no\\-twitter\\-bot and deploy me for use in your own groups\\!`,
|
// Replies to the message.
|
||||||
|
return await ctx.reply(
|
||||||
|
`I am a bot designed to delete any Twitter/X and Meta links along with corresponding reformatting services within whitelisted groups\\. I now check embedded links\\! By default I only work with whitelisted group IDs\\.\n\nYou can fork me from this link: https://github\\.com/lucid\\-creations\\-media/no\\-twitter\\-bot and deploy me for use in your own groups\\!`,
|
||||||
{
|
{
|
||||||
parse_mode: "MarkdownV2",
|
parse_mode: "MarkdownV2",
|
||||||
reply_parameters: { message_id: ctx.msg.message_id }
|
reply_parameters: { message_id: ctx.msg.message_id }
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ feature.on("message::url", logHandle("embed-check"), async (ctx: Context) => {
|
|||||||
|
|
||||||
if (!GROUP_IDS) {
|
if (!GROUP_IDS) {
|
||||||
console.info("Group IDS:", process.env.GROUP_IDS);
|
console.info("Group IDS:", process.env.GROUP_IDS);
|
||||||
await ctx.reply(
|
return await ctx.reply(
|
||||||
`There was a problem retrieving the whitelist\\. Check the env variables and try again\\.`,
|
`There was a problem retrieving the whitelist\\. Check the env variables and try again\\.`,
|
||||||
{
|
{
|
||||||
parse_mode: "MarkdownV2",
|
parse_mode: "MarkdownV2",
|
||||||
|
|||||||
@@ -6,24 +6,46 @@ const composer = new Composer<Context>();
|
|||||||
|
|
||||||
const feature = composer.chatType(["group", "supergroup"]);
|
const feature = composer.chatType(["group", "supergroup"]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* What triggers this feature and adds to the log when it has been triggered.
|
||||||
|
* The trigger is the command "/botInfo"
|
||||||
|
*/
|
||||||
feature.hears(
|
feature.hears(
|
||||||
"/getGroupID",
|
"/getGroupID",
|
||||||
logHandle("get-group-id"),
|
logHandle("get-group-id"),
|
||||||
async (ctx: Context) => {
|
async (ctx: Context) => {
|
||||||
|
// Pulling the group IDs from the env variables.
|
||||||
const GROUP_IDS = process.env.GROUP_IDS
|
const GROUP_IDS = process.env.GROUP_IDS
|
||||||
? process.env.GROUP_IDS.split(",")
|
? process.env.GROUP_IDS.split(",")
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
if (ctx.chat && ctx.msg) {
|
// Checks if the context has a chat, msg, and from property.
|
||||||
|
if (ctx.chat && ctx.msg && ctx.msg.from) {
|
||||||
if (GROUP_IDS !== undefined) {
|
if (GROUP_IDS !== undefined) {
|
||||||
const groupID = ctx.chat.id;
|
const groupID = ctx.chat.id;
|
||||||
const flag = GROUP_IDS.includes(`${groupID}`);
|
const flag = GROUP_IDS.includes(`${groupID}`);
|
||||||
|
|
||||||
|
// Checks if the group is whitelisted
|
||||||
if (flag) {
|
if (flag) {
|
||||||
await ctx.reply(`The group id is: \`${groupID}\``, {
|
const chatMember = await ctx.getChatMember(ctx.msg.from.id);
|
||||||
|
|
||||||
|
// Checks if the user is an admin
|
||||||
|
if (["creator", "administrator"].includes(chatMember.status)) {
|
||||||
|
return await ctx.reply(`The group id is: \`${groupID}\``, {
|
||||||
parse_mode: "MarkdownV2",
|
parse_mode: "MarkdownV2",
|
||||||
reply_parameters: { message_id: ctx.msg.message_id }
|
reply_parameters: { message_id: ctx.msg.message_id }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Send a default message if the user is not an admin
|
||||||
|
return await ctx.reply(
|
||||||
|
`You have to be an admin to use this command\\!`,
|
||||||
|
{
|
||||||
|
parse_mode: "MarkdownV2",
|
||||||
|
reply_parameters: { message_id: ctx.msg.message_id }
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,25 +4,41 @@ import { logHandle } from "#root/bot/helpers/logging.js";
|
|||||||
|
|
||||||
const composer = new Composer<Context>();
|
const composer = new Composer<Context>();
|
||||||
|
|
||||||
const feature = composer.chatType(["group", "supergroup"]);
|
const feature = composer.chatType(["group", "supergroup", "private"]);
|
||||||
|
|
||||||
feature.hears(
|
/**
|
||||||
"/help",
|
* What triggers this feature and adds to the log when it has been triggered.
|
||||||
logHandle("blacklist-detection"),
|
* The trigger is the command "/help"
|
||||||
async (ctx: Context) => {
|
*/
|
||||||
|
feature.hears("/help", logHandle("help"), async (ctx: Context) => {
|
||||||
const GROUP_IDS = process.env.GROUP_IDS
|
const GROUP_IDS = process.env.GROUP_IDS
|
||||||
? process.env.GROUP_IDS.split(",")
|
? process.env.GROUP_IDS.split(",")
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
|
// Checks there is a chat and msg property in the context.
|
||||||
if (ctx.chat && ctx.msg) {
|
if (ctx.chat && ctx.msg) {
|
||||||
|
// CHecks if the chat is private
|
||||||
|
if (ctx.chat.type === "private") {
|
||||||
|
// Responds with the command list.
|
||||||
|
return await ctx.reply(
|
||||||
|
`**Here are the available commands you can use:**\n\n/getGroupID _ADMIN ONLY | Only available in groups_\\- Replies with the ID of the group I am in\\.\n\n/isWKCGRoup _ADMIN ONLY_ \\- Checks if this group's ID is on the whitelist and responds accordingly\\.\n\n/botInfo _Private Command_\\- Info about me and how to fork me to deploy for your own use\\.\n\n/help\\- Displays this help message\\.`,
|
||||||
|
{
|
||||||
|
parse_mode: "MarkdownV2",
|
||||||
|
reply_parameters: { message_id: ctx.msg.message_id }
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Checks if the whitelist is set up.
|
||||||
if (GROUP_IDS !== undefined) {
|
if (GROUP_IDS !== undefined) {
|
||||||
const groupID = ctx.chat.id;
|
const groupID = ctx.chat.id;
|
||||||
const flag = GROUP_IDS.includes(`${groupID}`);
|
const flag = GROUP_IDS.includes(`${groupID}`);
|
||||||
// const username = ctx.msg.from?.username;
|
|
||||||
|
|
||||||
|
// Checks if the chat is in the whitelist.
|
||||||
if (flag) {
|
if (flag) {
|
||||||
await ctx.reply(
|
// Responds with the command list.
|
||||||
`**Here are the availible commands you can use:**\n\n/getGroupID \\- replied with the ID of the group I am in\\.\n\n/isLCMGRoup \\- Checks if this group's ID is on the whitelist and responds accordingly\\.\n\n/botInfo \\- Info about me and how to fork me to deploy for your own use\\.\n\n/help \\- Displays this help message\\.`,
|
return await ctx.reply(
|
||||||
|
`**Here are the available commands you can use:**\n\n/getGroupID _ADMIN ONLY_ \\- Replies with the ID of the group I am in\\.\n\n/isWKCGRoup _ADMIN ONLY_ \\- Checks if this group's ID is on the whitelist and responds accordingly\\.\n\n/botInfo _Private Command_\\- Info about me and how to fork me to deploy for your own use\\.\n\n/help\\- Displays this help message\\.`,
|
||||||
{
|
{
|
||||||
parse_mode: "MarkdownV2",
|
parse_mode: "MarkdownV2",
|
||||||
reply_parameters: { message_id: ctx.msg.message_id }
|
reply_parameters: { message_id: ctx.msg.message_id }
|
||||||
@@ -30,16 +46,21 @@ feature.hears(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Checks if the chat is not in the whitelist.
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
await ctx.reply(
|
await ctx
|
||||||
`**Since this is not a whitelisted group the features are limited\\!\\!**\n\nHere are the availible commands you can use:\n\n/isLCMGRoup \\- Checks if this group's ID is on the whitelist and responds accordingly\\.\n\n/botInfo \\- Info about me and how to fork me to deploy for your own use\\.\n\n/help \\- Displays this help message\\.`,
|
// Responds with the command list with a warning that the available commands are limited.
|
||||||
|
.reply(
|
||||||
|
`**Since this is not a whitelisted group the features are limited\\!\\!**\n\nHere are the available commands you can use:\n\n/isWKCGRoup _ADMIN ONLY_\\- Checks if this group's ID is on the whitelist and responds accordingly\\.\n\n/botInfo _Private Command_\\- Info about me and how to fork me to deploy for your own use\\.\n\n/help \\- Displays this help message\\.`,
|
||||||
{
|
{
|
||||||
parse_mode: "MarkdownV2",
|
parse_mode: "MarkdownV2",
|
||||||
reply_parameters: { message_id: ctx.msg.message_id }
|
reply_parameters: { message_id: ctx.msg.message_id }
|
||||||
}
|
}
|
||||||
);
|
)
|
||||||
await ctx.reply(
|
.then(() => {});
|
||||||
`This group is NOT in the whitelisted and is NOT a part of the LCM Telegram groups/communities\\. I am a bot designed to delete any Twitter/X links and reformatting services within groups\\. You can fork me from this link: https://github\\.com/lucid\\-creations\\-media/no\\-twitter\\-bot and deploy me for use in your own groups\\!`,
|
// Sends a follow-up message with information about the bot.
|
||||||
|
return await ctx.reply(
|
||||||
|
`This group is NOT in the whitelisted and is NOT a part of the WKC Telegram groups/communities\\. I am a bot designed to delete any Twitter/X and Meta links along with corresponding reformatting services within whitelisted groups\\. You can fork me from this link: https://github\\.com/lucid\\-creations\\-media/no\\-twitter\\-bot and deploy me for use in your own groups\\!`,
|
||||||
{
|
{
|
||||||
parse_mode: "MarkdownV2",
|
parse_mode: "MarkdownV2",
|
||||||
reply_parameters: { message_id: ctx.msg.message_id }
|
reply_parameters: { message_id: ctx.msg.message_id }
|
||||||
@@ -48,9 +69,11 @@ feature.hears(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Checks if the whitelist is not set up.
|
||||||
if (!GROUP_IDS) {
|
if (!GROUP_IDS) {
|
||||||
await ctx.reply(
|
// Sends a warning that the whitelist is not set up or the bot cannot access it.
|
||||||
`There was a problem retrieving the whitelist. Check the env variables and try again\\.`,
|
return await ctx.reply(
|
||||||
|
`There was a problem retrieving the whitelist\\. Check the env variables and try again\\.`,
|
||||||
{
|
{
|
||||||
parse_mode: "MarkdownV2",
|
parse_mode: "MarkdownV2",
|
||||||
reply_parameters: { message_id: ctx.msg.message_id }
|
reply_parameters: { message_id: ctx.msg.message_id }
|
||||||
@@ -58,7 +81,6 @@ feature.hears(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
export { composer as helpCommand };
|
export { composer as helpCommand };
|
||||||
|
|||||||
@@ -1,57 +0,0 @@
|
|||||||
import { Composer } from "grammy";
|
|
||||||
import type { Context } from "#root/bot/context.js";
|
|
||||||
import { logHandle } from "#root/bot/helpers/logging.js";
|
|
||||||
|
|
||||||
const composer = new Composer<Context>();
|
|
||||||
|
|
||||||
const feature = composer.chatType(["group", "supergroup"]);
|
|
||||||
|
|
||||||
feature.hears(
|
|
||||||
"/isLCMGroup",
|
|
||||||
logHandle("is-LCM-group"),
|
|
||||||
async (ctx: Context) => {
|
|
||||||
const GROUP_IDS = process.env.GROUP_IDS
|
|
||||||
? process.env.GROUP_IDS.split(",")
|
|
||||||
: undefined;
|
|
||||||
|
|
||||||
if (ctx.chat && ctx.msg) {
|
|
||||||
const groupID = ctx.chat.id;
|
|
||||||
|
|
||||||
if (GROUP_IDS !== undefined) {
|
|
||||||
const flag = GROUP_IDS.includes(`${groupID}`);
|
|
||||||
|
|
||||||
if (flag) {
|
|
||||||
await ctx.reply(
|
|
||||||
`This group is in the whitelisted and is a part of the LCM Telegram groups/communities\\. I should be deleting any Twitter/X links and reformatting services within this group\\.`,
|
|
||||||
{
|
|
||||||
parse_mode: "MarkdownV2",
|
|
||||||
reply_parameters: { message_id: ctx.msg.message_id }
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!flag) {
|
|
||||||
await ctx.reply(
|
|
||||||
`This group is NOT in the whitelisted and is NOT a part of the LCM Telegram groups/communities\\. I am a bot designed to delete any Twitter/X links and reformatting services within groups\\. You can fork me from this link: https://github\\.com/lucid\\-creations\\-media/no\\-twitter\\-bot and deploy me for use in your own groups\\!`,
|
|
||||||
{
|
|
||||||
parse_mode: "MarkdownV2",
|
|
||||||
reply_parameters: { message_id: ctx.msg.message_id }
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!GROUP_IDS) {
|
|
||||||
await ctx.reply(
|
|
||||||
`There was a problem retrieving the whitelist\\. Check the env variables and try again\\.`,
|
|
||||||
{
|
|
||||||
parse_mode: "MarkdownV2",
|
|
||||||
reply_parameters: { message_id: ctx.msg.message_id }
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
export { composer as isLCMGroup };
|
|
||||||
80
src/bot/features/isWKCGroup.ts
Normal file
80
src/bot/features/isWKCGroup.ts
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
import { Composer } from "grammy";
|
||||||
|
import type { Context } from "#root/bot/context.js";
|
||||||
|
import { logHandle } from "#root/bot/helpers/logging.js";
|
||||||
|
|
||||||
|
const composer = new Composer<Context>();
|
||||||
|
|
||||||
|
const feature = composer.chatType(["group", "supergroup"]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* What triggers this feature and adds to the log when it has been triggered.
|
||||||
|
* The trigger is the command "/isWKCGroup"
|
||||||
|
*/
|
||||||
|
feature.hears(
|
||||||
|
"/isWKCGroup",
|
||||||
|
logHandle("is-WKC-group"),
|
||||||
|
async (ctx: Context) => {
|
||||||
|
// Pulling the group IDs from the env variables.
|
||||||
|
const GROUP_IDS = process.env.GROUP_IDS
|
||||||
|
? process.env.GROUP_IDS.split(",")
|
||||||
|
: undefined;
|
||||||
|
|
||||||
|
// Checking that context has chat, msg, and msg.from properties
|
||||||
|
if (ctx.chat && ctx.msg && ctx.msg.from) {
|
||||||
|
const groupID = ctx.chat.id;
|
||||||
|
const chatMember = await ctx.getChatMember(ctx.msg.from.id);
|
||||||
|
|
||||||
|
// Checking if the user is an admin.
|
||||||
|
if (["creator", "administrator"].includes(chatMember.status)) {
|
||||||
|
if (GROUP_IDS !== undefined) {
|
||||||
|
const flag = GROUP_IDS.includes(`${groupID}`);
|
||||||
|
|
||||||
|
// Checking if the group is whitelisted.
|
||||||
|
if (flag) {
|
||||||
|
// Confirming that the group is whitelisted and should be deleting detected messages.
|
||||||
|
await ctx.reply(
|
||||||
|
`This group is in the whitelisted and is a part of the WKC Telegram groups/communities\\. I should be deleting any Twitter/X and Meta links along with corresponding reformatting services within this group\\.`,
|
||||||
|
{
|
||||||
|
parse_mode: "MarkdownV2",
|
||||||
|
reply_parameters: { message_id: ctx.msg.message_id }
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!flag) {
|
||||||
|
// Informing the user that features are blocked because the group is not in the whitelist.
|
||||||
|
await ctx.reply(
|
||||||
|
`This group is NOT in the whitelisted and is NOT a part of the WKC Telegram groups/communities\\. I am a bot designed to delete any Twitter/X and Meta links along with corresponding reformatting services within groups\\. You can fork me from this link: https://github\\.com/lucid\\-creations\\-media/no\\-twitter\\-bot and deploy me for use in your own groups\\!`,
|
||||||
|
{
|
||||||
|
parse_mode: "MarkdownV2",
|
||||||
|
reply_parameters: { message_id: ctx.msg.message_id }
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!GROUP_IDS) {
|
||||||
|
// Altering that the whitelist is not set or the bot cannot access it.
|
||||||
|
await ctx.reply(
|
||||||
|
`There was a problem retrieving the whitelist\\. Check the env variables and try again\\.`,
|
||||||
|
{
|
||||||
|
parse_mode: "MarkdownV2",
|
||||||
|
reply_parameters: { message_id: ctx.msg.message_id }
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Informing the user that they need to be an admin to use this command.
|
||||||
|
await ctx.reply(
|
||||||
|
`You have to be an admin of this group to use this command\\!`,
|
||||||
|
{
|
||||||
|
parse_mode: "MarkdownV2",
|
||||||
|
reply_parameters: { message_id: ctx.msg.message_id }
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
export { composer as isWKCGroup };
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
import { Composer } from "grammy";
|
|
||||||
import { changeLanguageData } from "#root/bot/callback-data/change-language.js";
|
|
||||||
import type { Context } from "#root/bot/context.js";
|
|
||||||
import { logHandle } from "#root/bot/helpers/logging.js";
|
|
||||||
import { i18n } from "#root/bot/i18n.js";
|
|
||||||
import { createChangeLanguageKeyboard } from "#root/bot/keyboards/change-language.js";
|
|
||||||
|
|
||||||
const composer = new Composer<Context>();
|
|
||||||
|
|
||||||
const feature = composer.chatType("private");
|
|
||||||
|
|
||||||
feature.command("language", logHandle("command-language"), async ctx => {
|
|
||||||
return ctx.reply(ctx.t("language-select"), {
|
|
||||||
reply_markup: await createChangeLanguageKeyboard(ctx)
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
feature.callbackQuery(
|
|
||||||
changeLanguageData.filter(),
|
|
||||||
logHandle("keyboard-language-select"),
|
|
||||||
async ctx => {
|
|
||||||
const { code: languageCode } = changeLanguageData.unpack(
|
|
||||||
ctx.callbackQuery.data
|
|
||||||
);
|
|
||||||
|
|
||||||
if (i18n.locales.includes(languageCode)) {
|
|
||||||
await ctx.i18n.setLocale(languageCode);
|
|
||||||
|
|
||||||
return ctx.editMessageText(ctx.t("language-changed"), {
|
|
||||||
reply_markup: await createChangeLanguageKeyboard(ctx)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
export { composer as languageFeature };
|
|
||||||
@@ -5,10 +5,14 @@ import { logHandle } from "#root/bot/helpers/logging.js";
|
|||||||
const composer = new Composer<Context>();
|
const composer = new Composer<Context>();
|
||||||
|
|
||||||
const feature = composer.chatType("private");
|
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 => {
|
feature.command("start", logHandle("command-start"), ctx => {
|
||||||
|
// Responds with information about the bot.
|
||||||
return ctx.reply(
|
return ctx.reply(
|
||||||
`Welcome\\! I am a bot created by Lucid for [Lucid Creations Media groups\\.](https://community.lucidcreations.media/) I am designed to delete any Twitter/X and Facebook/Meta links, links to reformatting services for Twitter posts, and other Meta products within groups\\. I now check embedded links\\! By default I only work with whitelisted group IDs\\. You can fork me from this link: https://github\\.com/lucid\\-creations\\-media/no\\-twitter\\-bot and deploy me for use in your own groups\\!\n\nLucid would consider hosting this bot for public use if crowd\\-funding would cover the hosting cost of the bot\\. Reach out if you would like to help\\.`,
|
`Welcome\\! I am a bot created by Lucid for [Werewolf Kid Creations Media groups\\.](https://community.lucidcreations.media/) I am designed to delete any Twitter/X and Meta links along with corresponding reformatting services within the WKC groups\\. I now check embedded links\\! By default I only work with whitelisted group IDs\\. You can fork me from this link: https://github\\.com/lucid\\-creations\\-media/no\\-twitter\\-bot and deploy me for use in your own groups\\!\n\nLucid would consider hosting this bot for public use if crowd\\-funding would cover the hosting cost of the bot\\. Reach out if you would like to help\\.`,
|
||||||
{ parse_mode: "MarkdownV2" }
|
{ parse_mode: "MarkdownV2" }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ import type { Context } from "#root/bot/context.js";
|
|||||||
import type { Config } from "#root/config.js";
|
import type { Config } from "#root/config.js";
|
||||||
import type { Logger } from "#root/logger.js";
|
import type { Logger } from "#root/logger.js";
|
||||||
import type { BotConfig } from "grammy";
|
import type { BotConfig } from "grammy";
|
||||||
// import { adminFeature } from "#root/bot/features/admin.js";
|
|
||||||
import { languageFeature } from "#root/bot/features/language.js";
|
|
||||||
import { unhandledFeature } from "#root/bot/features/unhandled.js";
|
import { unhandledFeature } from "#root/bot/features/unhandled.js";
|
||||||
import { welcomeFeature } from "#root/bot/features/welcome.js";
|
import { welcomeFeature } from "#root/bot/features/welcome.js";
|
||||||
import { errorHandler } from "#root/bot/handlers/error.js";
|
import { errorHandler } from "#root/bot/handlers/error.js";
|
||||||
@@ -20,8 +18,8 @@ import { metaBlacklist } from "./features/metaBlacklist.js";
|
|||||||
import { botInfoCommand } from "./features/botInfoCommand.js";
|
import { botInfoCommand } from "./features/botInfoCommand.js";
|
||||||
import { getGroupIDCommand } from "./features/getGroupIDCommand.js";
|
import { getGroupIDCommand } from "./features/getGroupIDCommand.js";
|
||||||
import { helpCommand } from "./features/helpCommand.js";
|
import { helpCommand } from "./features/helpCommand.js";
|
||||||
import { isLCMGroup } from "./features/isLCMGroup.js";
|
|
||||||
import { embedCheck } from "./features/embedCheck.js";
|
import { embedCheck } from "./features/embedCheck.js";
|
||||||
|
import { isWKCGroup } from "./features/isWKCGroup.js";
|
||||||
|
|
||||||
interface Dependencies {
|
interface Dependencies {
|
||||||
config: Config;
|
config: Config;
|
||||||
@@ -70,13 +68,11 @@ export function createBot(
|
|||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
protectedBot.use(welcomeFeature);
|
protectedBot.use(welcomeFeature);
|
||||||
// protectedBot.use(adminFeature);
|
|
||||||
if (isMultipleLocales) protectedBot.use(languageFeature);
|
|
||||||
|
|
||||||
// Commands
|
// Commands
|
||||||
protectedBot.use(botInfoCommand);
|
protectedBot.use(botInfoCommand);
|
||||||
protectedBot.use(getGroupIDCommand);
|
protectedBot.use(getGroupIDCommand);
|
||||||
protectedBot.use(isLCMGroup);
|
protectedBot.use(isWKCGroup);
|
||||||
protectedBot.use(helpCommand);
|
protectedBot.use(helpCommand);
|
||||||
|
|
||||||
// Blacklist Feature
|
// Blacklist Feature
|
||||||
|
|||||||
Reference in New Issue
Block a user