Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2123bf2dec | |||
| 68895a79e8 | |||
| cfc30097d5 | |||
| 705bb73f19 |
+17
-17
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "no-twitter-bot",
|
||||
"type": "module",
|
||||
"version": "3.1.0",
|
||||
"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/*"
|
||||
@@ -27,35 +27,35 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@grammyjs/auto-chat-action": "0.1.1",
|
||||
"@grammyjs/commands": "1.2.0",
|
||||
"@grammyjs/commands": "1.3.2",
|
||||
"@grammyjs/hydrate": "1.6.0",
|
||||
"@grammyjs/i18n": "1.1.2",
|
||||
"@grammyjs/parse-mode": "1.11.1",
|
||||
"@grammyjs/runner": "2.0.3",
|
||||
"@grammyjs/types": "3.23.0",
|
||||
"@hono/node-server": "1.19.9",
|
||||
"@grammyjs/types": "3.25.0",
|
||||
"@hono/node-server": "1.19.12",
|
||||
"@urql/core": "^6.0.1",
|
||||
"axios": "^1.13.3",
|
||||
"axios": "^1.14.0",
|
||||
"callback-data": "1.1.1",
|
||||
"grammy": "1.39.3",
|
||||
"hono": "4.11.6",
|
||||
"grammy": "1.41.1",
|
||||
"hono": "4.12.9",
|
||||
"iso-639-1": "3.1.5",
|
||||
"pino": "10.3.0",
|
||||
"pino": "10.3.1",
|
||||
"pino-pretty": "13.1.3",
|
||||
"tsx": "4.21.0",
|
||||
"valibot": "1.2.0"
|
||||
"valibot": "1.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "7.2.0",
|
||||
"@eslint/js": "^9.39.2",
|
||||
"@types/node": "^25.0.10",
|
||||
"eslint": "^9.39.2",
|
||||
"@antfu/eslint-config": "8.0.0",
|
||||
"@eslint/js": "^10.0.1",
|
||||
"@types/node": "^25.5.0",
|
||||
"eslint": "^10.1.0",
|
||||
"husky": "^9.1.7",
|
||||
"lint-staged": "^16.2.7",
|
||||
"lint-staged": "^16.4.0",
|
||||
"prettier": "3.8.1",
|
||||
"tsc-watch": "^7.2.0",
|
||||
"typescript": "^5.9.3",
|
||||
"typescript-eslint": "^8.54.0"
|
||||
"typescript": "^6.0.2",
|
||||
"typescript-eslint": "^8.58.0"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.ts": "eslint"
|
||||
|
||||
@@ -26,7 +26,7 @@ feature.on("message::url", logHandle("embed-check"), async (ctx: Context) => {
|
||||
const groupName = ctx.chat?.title || "";
|
||||
const groupID = ctx.chat?.id.toString() || "";
|
||||
const groupUsername = ctx.chat?.username || "";
|
||||
let deletedLinks = 0;
|
||||
let detectedLinks = 0;
|
||||
|
||||
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);
|
||||
|
||||
// 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) {
|
||||
const metaLinks = allEmbeds.filter(({ url }) => metaLinkCheck(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
|
||||
if (metaLinks.length) {
|
||||
deletedLinks += metaLinks.length;
|
||||
detectedLinks += metaLinks.length;
|
||||
}
|
||||
|
||||
// Handles Twitter/X links.
|
||||
if (twitterLinks.length) {
|
||||
deletedLinks += twitterLinks.length;
|
||||
detectedLinks += twitterLinks.length;
|
||||
}
|
||||
|
||||
// Handles TikTok links.
|
||||
if (tiktokLinks.length) {
|
||||
deletedLinks += tiktokLinks.length;
|
||||
detectedLinks += tiktokLinks.length;
|
||||
}
|
||||
}
|
||||
|
||||
if (deletedLinks) {
|
||||
ctx.msg.delete();
|
||||
|
||||
if (detectedLinks) {
|
||||
return await urql
|
||||
.mutation(addGroup, {
|
||||
groupID,
|
||||
@@ -76,13 +74,13 @@ feature.on("message::url", logHandle("embed-check"), async (ctx: Context) => {
|
||||
urql
|
||||
.mutation(incrementGroup, {
|
||||
groupID,
|
||||
linksDeleted: deletedLinks,
|
||||
linksDeleted: detectedLinks,
|
||||
mutationKey
|
||||
})
|
||||
.then(
|
||||
async () =>
|
||||
await urql
|
||||
.mutation(increment, { link: deletedLinks, mutationKey })
|
||||
.mutation(increment, { link: detectedLinks, mutationKey })
|
||||
.toPromise()
|
||||
.then(async () => {
|
||||
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\\.`,
|
||||
{ parse_mode: "MarkdownV2" }
|
||||
);
|
||||
|
||||
// Deletes the offending message
|
||||
ctx.msg.delete();
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
@@ -25,8 +25,6 @@ feature.hears(
|
||||
|
||||
if (ctx.chat && ctx.msg) {
|
||||
const username = ctx.msg.from?.username;
|
||||
// Deletes the offending message.
|
||||
ctx.msg.delete();
|
||||
|
||||
return await urql
|
||||
.mutation(increment, { link: 1, mutationKey })
|
||||
@@ -43,6 +41,9 @@ feature.hears(
|
||||
const groupID = ctx.chat?.id.toString() || "";
|
||||
const groupUsername = ctx.chat?.username || "";
|
||||
|
||||
// Deletes the offending message.
|
||||
ctx.msg.delete();
|
||||
|
||||
return await urql
|
||||
.mutation(addGroup, {
|
||||
groupID,
|
||||
|
||||
@@ -25,8 +25,6 @@ feature.hears(
|
||||
|
||||
if (ctx.chat && ctx.msg) {
|
||||
const username = ctx.msg.from?.username;
|
||||
// Deletes the offending message.
|
||||
ctx.msg.delete();
|
||||
|
||||
return await urql
|
||||
.mutation(increment, { link: 1, mutationKey })
|
||||
@@ -43,6 +41,9 @@ feature.hears(
|
||||
const groupID = ctx.chat?.id.toString() || "";
|
||||
const groupUsername = ctx.chat?.username || "";
|
||||
|
||||
// Deletes the offending message.
|
||||
ctx.msg.delete();
|
||||
|
||||
return await urql
|
||||
.mutation(addGroup, {
|
||||
groupID,
|
||||
|
||||
@@ -25,8 +25,6 @@ feature.hears(
|
||||
|
||||
if (ctx.chat && ctx.msg) {
|
||||
const username = ctx.msg.from?.username;
|
||||
// Deletes the offending message.
|
||||
ctx.msg.delete();
|
||||
|
||||
return await urql
|
||||
.mutation(increment, { link: 1, mutationKey })
|
||||
@@ -43,6 +41,9 @@ feature.hears(
|
||||
const groupID = ctx.chat?.id.toString() || "";
|
||||
const groupUsername = ctx.chat?.username || "";
|
||||
|
||||
// Deletes the offending message.
|
||||
ctx.msg.delete();
|
||||
|
||||
return await urql
|
||||
.mutation(addGroup, {
|
||||
groupID,
|
||||
|
||||
Reference in New Issue
Block a user