fix-startup #77

Merged
werewolfkid merged 13 commits from fix-startup into main 2025-10-21 00:38:49 -04:00
6 changed files with 90 additions and 61 deletions
Showing only changes of commit d7e71600a6 - Show all commits

View File

@@ -10,18 +10,18 @@ const feature = composer.chatType(["group", "supergroup", "private"]);
* What triggers this feature and adds to the log when it has been triggered.
* The trigger is the command "/help"
*/
feature.hears("/help", logHandle("help"), async (ctx: Context) => {
feature.command("help", logHandle("help"), async (ctx: Context) => {
const GROUP_IDS = process.env.GROUP_IDS
? process.env.GROUP_IDS.split(",")
: undefined;
// Checks there is a chat and msg property in the context.
if (ctx.chat && ctx.msg) {
// CHecks if the chat is private
// 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\\.`,
`Currently I have no commands for the public beta\\. I require no configuration\\. Simply add me to a group and I will start deleting any Twitter\\/X and Meta links I detect\\. I also check embeds and forwards\\. Use /\\botInfo to learn more about my mission and why I was created\\.`,
{
parse_mode: "MarkdownV2",
reply_parameters: { message_id: ctx.msg.message_id }
@@ -29,57 +29,65 @@ feature.hears("/help", logHandle("help"), async (ctx: Context) => {
);
}
return await ctx.reply(
`Currently I have no commands for the public beta\\. I require no configuration\\. I should already be deleting any Twitter\\/X and Meta links I detect\\. I also check embeds and forwards\\. Use /\\botInfo to learn more about my mission and why I was created\\.`,
{
parse_mode: "MarkdownV2",
reply_parameters: { message_id: ctx.msg.message_id }
}
);
// Checks if the whitelist is set up.
if (GROUP_IDS !== undefined) {
const groupID = ctx.chat.id;
const flag = GROUP_IDS.includes(`${groupID}`);
// if (GROUP_IDS !== undefined) {
// const groupID = ctx.chat.id;
// const flag = GROUP_IDS.includes(`${groupID}`);
// Checks if the chat is in the whitelist.
if (flag) {
// Responds with the command list.
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",
reply_parameters: { message_id: ctx.msg.message_id }
}
);
}
// // Checks if the chat is in the whitelist.
// if (flag) {
// // Responds with the command list.
// 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",
// reply_parameters: { message_id: ctx.msg.message_id }
// }
// );
// }
// Checks if the chat is not in the whitelist.
if (!flag) {
await ctx
// 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",
reply_parameters: { message_id: ctx.msg.message_id }
}
)
.then(() => {});
// 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",
reply_parameters: { message_id: ctx.msg.message_id }
}
);
}
}
// Checks if the chat is not in the whitelist.
// if (!flag) {
// await ctx
// // 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",
// reply_parameters: { message_id: ctx.msg.message_id }
// }
// )
// .then(() => {});
// // 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",
// reply_parameters: { message_id: ctx.msg.message_id }
// }
// );
// }
// }
// Checks if the whitelist is not set up.
if (!GROUP_IDS) {
// Sends a warning that the whitelist is not set up or the bot cannot access it.
return 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 }
}
);
}
// if (!GROUP_IDS) {
// // Sends a warning that the whitelist is not set up or the bot cannot access it.
// return 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 }
// }
// );
// }
}
});