Added comments.
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@
|
||||
"type": "module",
|
||||
"version": "3.2.0",
|
||||
"private": true,
|
||||
"packageManager": "yarn@4.12.0",
|
||||
"packageManager": "yarn@4.13.0",
|
||||
"description": "This grammY powered Telegram bot is designed to delete Twitter/X links and reformat services from whitelisted groups. This one is the main bot for the LCM Telegram groups/communities.",
|
||||
"imports": {
|
||||
"#root/*": "./build/src/*"
|
||||
|
||||
@@ -32,7 +32,7 @@ feature.hears(
|
||||
}
|
||||
|
||||
await urql
|
||||
.mutation(increment, { command: true, mutationKey })
|
||||
.mutation(increment, { command: true, mutationKey }) // Increments the trigger count
|
||||
.toPromise()
|
||||
.then(async () => {
|
||||
if (ctx.msg) {
|
||||
|
||||
@@ -32,7 +32,7 @@ feature.hears(
|
||||
}
|
||||
|
||||
await urql
|
||||
.mutation(increment, { command: true, mutationKey })
|
||||
.mutation(increment, { command: true, mutationKey }) // Increments the trigger count
|
||||
.toPromise()
|
||||
.then(async () => {
|
||||
if (ctx.msg) {
|
||||
|
||||
@@ -18,7 +18,9 @@ feature.hears(/^\/help/, logHandle("help"), async (ctx: Context) => {
|
||||
const mutationKey = process.env.GRAPHQL_MUTATION_KEY || "";
|
||||
const statsSite = process.env.STATS_SITE || "";
|
||||
|
||||
// Increments the trigger count
|
||||
await urql.mutation(increment, { trigger: true, mutationKey });
|
||||
// Retrieve the command list
|
||||
const commandsListArr = await getCommandsList(`${statsSite}api/bot`, apiKey);
|
||||
|
||||
// const GROUP_IDS = process.env.GROUP_IDS
|
||||
@@ -67,6 +69,7 @@ feature.hears(/^\/help/, logHandle("help"), async (ctx: Context) => {
|
||||
}
|
||||
}
|
||||
|
||||
// Create a readable command list string.
|
||||
const commandsListStr = commandsListArr.reduce((prev, curr) => {
|
||||
const { command, description, groups } = curr;
|
||||
|
||||
|
||||
@@ -21,8 +21,10 @@ feature.hears(
|
||||
async (ctx: Context) => {
|
||||
const mutationKey = process.env.GRAPHQL_MUTATION_KEY || "";
|
||||
|
||||
// Increments the trigger count
|
||||
await urql.mutation(increment, { trigger: true, mutationKey });
|
||||
|
||||
// Checks there is a chat and msg property in the context.
|
||||
if (ctx.chat && ctx.msg) {
|
||||
const username = ctx.msg.from?.username;
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ feature.hears(
|
||||
async (ctx: Context) => {
|
||||
const mutationKey = process.env.GRAPHQL_MUTATION_KEY || "";
|
||||
|
||||
// Increments the trigger count
|
||||
await urql.mutation(increment, { trigger: true, mutationKey });
|
||||
|
||||
// Checks if the context includes a message property.
|
||||
|
||||
@@ -21,6 +21,7 @@ feature.hears(
|
||||
async (ctx: Context) => {
|
||||
const mutationKey = process.env.GRAPHQL_MUTATION_KEY || "";
|
||||
|
||||
// Increments the trigger count
|
||||
await urql.mutation(increment, { trigger: true, mutationKey });
|
||||
|
||||
if (ctx.chat && ctx.msg) {
|
||||
|
||||
@@ -15,6 +15,7 @@ const feature = composer.chatType("private");
|
||||
feature.command("start", logHandle("command-start"), async ctx => {
|
||||
const mutationKey = process.env.GRAPHQL_MUTATION_KEY || "";
|
||||
|
||||
// Increments the trigger count
|
||||
await urql.mutation(increment, { trigger: true, mutationKey });
|
||||
|
||||
await urql
|
||||
|
||||
@@ -6,6 +6,13 @@ export interface Commands {
|
||||
groups: boolean;
|
||||
private: boolean;
|
||||
}
|
||||
/**
|
||||
* Fetched a list of commands with a provided url and API key.
|
||||
* @param url The url to query.
|
||||
* @interface Commands
|
||||
* @param apiKey The api for the url.
|
||||
* @returns Array of Commands object.
|
||||
*/
|
||||
|
||||
const fetchCommandsList = async (
|
||||
url: string,
|
||||
|
||||
@@ -6,7 +6,7 @@ const metaRegex =
|
||||
* This function will check if a url matches Meta services links using regex.
|
||||
*
|
||||
* @param linkUrl representing a suspected url on the banlist
|
||||
* @returns flag
|
||||
* @returns @type boolean
|
||||
*/
|
||||
const metaLinkCheck = (linkUrl: string): boolean => {
|
||||
let flag = false;
|
||||
|
||||
@@ -5,7 +5,7 @@ const tiktokRegex = /(tiktok\.com)/gi;
|
||||
* This function will check if a url matches TikTok services links using regex.
|
||||
*
|
||||
* @param linkUrl representing a suspected url on the banlist
|
||||
* @return flag
|
||||
* @returns @type boolean
|
||||
*/
|
||||
const tiktokLinkCheck = (linkUrl: string): boolean => {
|
||||
let flag = false;
|
||||
|
||||
@@ -5,7 +5,7 @@ const twitterRegex = /(x\.com|twitter\.com)/gi;
|
||||
* This function will check if a url matches Twitter/X services links using regex.
|
||||
*
|
||||
* @param linkUrl representing a suspected url on the banlist
|
||||
* @return flag
|
||||
* @returns @type boolean
|
||||
*/
|
||||
const twitterLinkCheck = (linkUrl: string): boolean => {
|
||||
let flag = false;
|
||||
|
||||
Reference in New Issue
Block a user