Merge pull request 'fix-action-flow' (#82) from fix-action-flow into main
Main / build-and-push-docker-image (20.x) (push) Successful in 4m6s
Main / build-and-push-docker-image (20.x) (push) Successful in 4m6s
Reviewed-on: #82
This commit was merged in pull request #82.
This commit is contained in:
+17
-17
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "no-twitter-bot",
|
"name": "no-twitter-bot",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "3.1.0",
|
"version": "3.2.0",
|
||||||
"private": true,
|
"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.",
|
"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": {
|
"imports": {
|
||||||
"#root/*": "./build/src/*"
|
"#root/*": "./build/src/*"
|
||||||
@@ -27,35 +27,35 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@grammyjs/auto-chat-action": "0.1.1",
|
"@grammyjs/auto-chat-action": "0.1.1",
|
||||||
"@grammyjs/commands": "1.2.0",
|
"@grammyjs/commands": "1.3.2",
|
||||||
"@grammyjs/hydrate": "1.6.0",
|
"@grammyjs/hydrate": "1.6.0",
|
||||||
"@grammyjs/i18n": "1.1.2",
|
"@grammyjs/i18n": "1.1.2",
|
||||||
"@grammyjs/parse-mode": "1.11.1",
|
"@grammyjs/parse-mode": "1.11.1",
|
||||||
"@grammyjs/runner": "2.0.3",
|
"@grammyjs/runner": "2.0.3",
|
||||||
"@grammyjs/types": "3.23.0",
|
"@grammyjs/types": "3.25.0",
|
||||||
"@hono/node-server": "1.19.9",
|
"@hono/node-server": "1.19.12",
|
||||||
"@urql/core": "^6.0.1",
|
"@urql/core": "^6.0.1",
|
||||||
"axios": "^1.13.3",
|
"axios": "^1.14.0",
|
||||||
"callback-data": "1.1.1",
|
"callback-data": "1.1.1",
|
||||||
"grammy": "1.39.3",
|
"grammy": "1.41.1",
|
||||||
"hono": "4.11.6",
|
"hono": "4.12.9",
|
||||||
"iso-639-1": "3.1.5",
|
"iso-639-1": "3.1.5",
|
||||||
"pino": "10.3.0",
|
"pino": "10.3.1",
|
||||||
"pino-pretty": "13.1.3",
|
"pino-pretty": "13.1.3",
|
||||||
"tsx": "4.21.0",
|
"tsx": "4.21.0",
|
||||||
"valibot": "1.2.0"
|
"valibot": "1.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@antfu/eslint-config": "7.2.0",
|
"@antfu/eslint-config": "8.0.0",
|
||||||
"@eslint/js": "^9.39.2",
|
"@eslint/js": "^10.0.1",
|
||||||
"@types/node": "^25.0.10",
|
"@types/node": "^25.5.0",
|
||||||
"eslint": "^9.39.2",
|
"eslint": "^10.1.0",
|
||||||
"husky": "^9.1.7",
|
"husky": "^9.1.7",
|
||||||
"lint-staged": "^16.2.7",
|
"lint-staged": "^16.4.0",
|
||||||
"prettier": "3.8.1",
|
"prettier": "3.8.1",
|
||||||
"tsc-watch": "^7.2.0",
|
"tsc-watch": "^7.2.0",
|
||||||
"typescript": "^5.9.3",
|
"typescript": "^6.0.2",
|
||||||
"typescript-eslint": "^8.54.0"
|
"typescript-eslint": "^8.58.0"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.ts": "eslint"
|
"*.ts": "eslint"
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ feature.on("message::url", logHandle("embed-check"), async (ctx: Context) => {
|
|||||||
const groupName = ctx.chat?.title || "";
|
const groupName = ctx.chat?.title || "";
|
||||||
const groupID = ctx.chat?.id.toString() || "";
|
const groupID = ctx.chat?.id.toString() || "";
|
||||||
const groupUsername = ctx.chat?.username || "";
|
const groupUsername = ctx.chat?.username || "";
|
||||||
let deletedLinks = 0;
|
let detectedLinks = 0;
|
||||||
|
|
||||||
const username = ctx.msg.from?.username;
|
const username = ctx.msg.from?.username;
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ feature.on("message::url", logHandle("embed-check"), async (ctx: Context) => {
|
|||||||
: [];
|
: [];
|
||||||
const allEmbeds = embeds.concat(captionEmbeds);
|
const allEmbeds = embeds.concat(captionEmbeds);
|
||||||
|
|
||||||
// If the caption embeds array isn't empty filter through them to check if any is a Twitter/X or Meta url.
|
// If the all embeds array isn't empty filter through them to check for every type of disallowed link.
|
||||||
if (allEmbeds.length) {
|
if (allEmbeds.length) {
|
||||||
const metaLinks = allEmbeds.filter(({ url }) => metaLinkCheck(url));
|
const metaLinks = allEmbeds.filter(({ url }) => metaLinkCheck(url));
|
||||||
const twitterLinks = allEmbeds.filter(({ url }) => twitterLinkCheck(url));
|
const twitterLinks = allEmbeds.filter(({ url }) => twitterLinkCheck(url));
|
||||||
@@ -47,23 +47,21 @@ feature.on("message::url", logHandle("embed-check"), async (ctx: Context) => {
|
|||||||
|
|
||||||
// Handles Meta & Facebook Links
|
// Handles Meta & Facebook Links
|
||||||
if (metaLinks.length) {
|
if (metaLinks.length) {
|
||||||
deletedLinks += metaLinks.length;
|
detectedLinks += metaLinks.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handles Twitter/X links.
|
// Handles Twitter/X links.
|
||||||
if (twitterLinks.length) {
|
if (twitterLinks.length) {
|
||||||
deletedLinks += twitterLinks.length;
|
detectedLinks += twitterLinks.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handles TikTok links.
|
// Handles TikTok links.
|
||||||
if (tiktokLinks.length) {
|
if (tiktokLinks.length) {
|
||||||
deletedLinks += tiktokLinks.length;
|
detectedLinks += tiktokLinks.length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deletedLinks) {
|
if (detectedLinks) {
|
||||||
ctx.msg.delete();
|
|
||||||
|
|
||||||
return await urql
|
return await urql
|
||||||
.mutation(addGroup, {
|
.mutation(addGroup, {
|
||||||
groupID,
|
groupID,
|
||||||
@@ -76,13 +74,13 @@ feature.on("message::url", logHandle("embed-check"), async (ctx: Context) => {
|
|||||||
urql
|
urql
|
||||||
.mutation(incrementGroup, {
|
.mutation(incrementGroup, {
|
||||||
groupID,
|
groupID,
|
||||||
linksDeleted: deletedLinks,
|
linksDeleted: detectedLinks,
|
||||||
mutationKey
|
mutationKey
|
||||||
})
|
})
|
||||||
.then(
|
.then(
|
||||||
async () =>
|
async () =>
|
||||||
await urql
|
await urql
|
||||||
.mutation(increment, { link: deletedLinks, mutationKey })
|
.mutation(increment, { link: detectedLinks, mutationKey })
|
||||||
.toPromise()
|
.toPromise()
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
if (ctx.msg) {
|
if (ctx.msg) {
|
||||||
@@ -91,6 +89,9 @@ feature.on("message::url", logHandle("embed-check"), async (ctx: Context) => {
|
|||||||
`@${username} One or more links in your last message were on the banlist\\. Remember TikTok, Meta & Facebook, and Twitter\\/X links along with any reformatting services for them are not allowed here\\. Please consider sharing the media directly or from other social media sources or websites\\.\n\nNo administration action was taken against you other than the message being deleted\\.\n\nIf this was forwarded from a channel consider forwarding without the caption so the media isn't deleted\\.`,
|
`@${username} One or more links in your last message were on the banlist\\. Remember TikTok, Meta & Facebook, and Twitter\\/X links along with any reformatting services for them are not allowed here\\. Please consider sharing the media directly or from other social media sources or websites\\.\n\nNo administration action was taken against you other than the message being deleted\\.\n\nIf this was forwarded from a channel consider forwarding without the caption so the media isn't deleted\\.`,
|
||||||
{ parse_mode: "MarkdownV2" }
|
{ parse_mode: "MarkdownV2" }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Deletes the offending message
|
||||||
|
ctx.msg.delete();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -25,8 +25,6 @@ feature.hears(
|
|||||||
|
|
||||||
if (ctx.chat && ctx.msg) {
|
if (ctx.chat && ctx.msg) {
|
||||||
const username = ctx.msg.from?.username;
|
const username = ctx.msg.from?.username;
|
||||||
// Deletes the offending message.
|
|
||||||
ctx.msg.delete();
|
|
||||||
|
|
||||||
return await urql
|
return await urql
|
||||||
.mutation(increment, { link: 1, mutationKey })
|
.mutation(increment, { link: 1, mutationKey })
|
||||||
@@ -43,6 +41,9 @@ feature.hears(
|
|||||||
const groupID = ctx.chat?.id.toString() || "";
|
const groupID = ctx.chat?.id.toString() || "";
|
||||||
const groupUsername = ctx.chat?.username || "";
|
const groupUsername = ctx.chat?.username || "";
|
||||||
|
|
||||||
|
// Deletes the offending message.
|
||||||
|
ctx.msg.delete();
|
||||||
|
|
||||||
return await urql
|
return await urql
|
||||||
.mutation(addGroup, {
|
.mutation(addGroup, {
|
||||||
groupID,
|
groupID,
|
||||||
|
|||||||
@@ -25,8 +25,6 @@ feature.hears(
|
|||||||
|
|
||||||
if (ctx.chat && ctx.msg) {
|
if (ctx.chat && ctx.msg) {
|
||||||
const username = ctx.msg.from?.username;
|
const username = ctx.msg.from?.username;
|
||||||
// Deletes the offending message.
|
|
||||||
ctx.msg.delete();
|
|
||||||
|
|
||||||
return await urql
|
return await urql
|
||||||
.mutation(increment, { link: 1, mutationKey })
|
.mutation(increment, { link: 1, mutationKey })
|
||||||
@@ -43,6 +41,9 @@ feature.hears(
|
|||||||
const groupID = ctx.chat?.id.toString() || "";
|
const groupID = ctx.chat?.id.toString() || "";
|
||||||
const groupUsername = ctx.chat?.username || "";
|
const groupUsername = ctx.chat?.username || "";
|
||||||
|
|
||||||
|
// Deletes the offending message.
|
||||||
|
ctx.msg.delete();
|
||||||
|
|
||||||
return await urql
|
return await urql
|
||||||
.mutation(addGroup, {
|
.mutation(addGroup, {
|
||||||
groupID,
|
groupID,
|
||||||
|
|||||||
@@ -25,8 +25,6 @@ feature.hears(
|
|||||||
|
|
||||||
if (ctx.chat && ctx.msg) {
|
if (ctx.chat && ctx.msg) {
|
||||||
const username = ctx.msg.from?.username;
|
const username = ctx.msg.from?.username;
|
||||||
// Deletes the offending message.
|
|
||||||
ctx.msg.delete();
|
|
||||||
|
|
||||||
return await urql
|
return await urql
|
||||||
.mutation(increment, { link: 1, mutationKey })
|
.mutation(increment, { link: 1, mutationKey })
|
||||||
@@ -43,6 +41,9 @@ feature.hears(
|
|||||||
const groupID = ctx.chat?.id.toString() || "";
|
const groupID = ctx.chat?.id.toString() || "";
|
||||||
const groupUsername = ctx.chat?.username || "";
|
const groupUsername = ctx.chat?.username || "";
|
||||||
|
|
||||||
|
// Deletes the offending message.
|
||||||
|
ctx.msg.delete();
|
||||||
|
|
||||||
return await urql
|
return await urql
|
||||||
.mutation(addGroup, {
|
.mutation(addGroup, {
|
||||||
groupID,
|
groupID,
|
||||||
|
|||||||
Reference in New Issue
Block a user