From c4633d4e025208ddf1c4f6b6c6b8fcd378dabe1f Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 19 Dec 2024 01:45:13 +0300 Subject: [PATCH 01/18] fix google translate in ukr Termux instruction --- Termux.ukr.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Termux.ukr.md b/Termux.ukr.md index f599284..bcd7619 100644 --- a/Termux.ukr.md +++ b/Termux.ukr.md @@ -16,8 +16,8 @@ Termux:API apk, якщо ви хочете отримувати сповіщен Для повторного запуску бота (якщо Termux перезавантажено) просто введіть:
`cd ub4tg; ./run`
-Для швидкого доступу до бота створіть псевдонім:
-`echo "псевдонім ub4tg='cd ~/ub4tg; ./run'" >> .bashrc`
+Для швидкого доступу до бота створіть alias:
+`echo "alias ub4tg='cd ~/ub4tg; ./run'" >> .bashrc`
потім
-`джерело ~/.bashrc`
+`source ~/.bashrc`
Тепер ви можете запускати бота у будь-якому каталозі, просто введіть: `ub4tg` From 46add00fbfeebefb2cf7ac5f05f3f36f959cad69 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 19 Dec 2024 01:55:50 +0300 Subject: [PATCH 02/18] shlex totally fucked up updater, trying use file as input via pipe --- src/updatenotif.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/updatenotif.py b/src/updatenotif.py index 5002e88..26f11ce 100644 --- a/src/updatenotif.py +++ b/src/updatenotif.py @@ -1,7 +1,6 @@ from loguru import logger import os import asyncio -import shlex async def git_notifications_update(): @@ -14,14 +13,16 @@ async def git_notifications_update(): logger.info('Checking for updates...') fetching_git = os.system('git fetch') if fetching_git == 0: + os.system("printf 'For apply tap button Get update and restart bot\nChanges:\n' > upd_info") commits = os.popen( "git log --pretty=format:'%h %s%n%b' HEAD..origin/$(git rev-parse --abbrev-ref HEAD)").read() + os.popen( + "git log --pretty=format:'%h %s%n%b' HEAD..origin/$(git rev-parse --abbrev-ref HEAD) >> upd_info") if len(commits) <= 5: logger.info('updates not found, nothing to do') else: - commits = shlex.quote(commits) os.system( - f"termux-notification -i ub4tgupd --title 'ub4tg: update avalaible!' --content 'For apply tap button Get update and restart bot\nChanges:\n{commits}' --button1 'Get update' --button1-action 'termux-notification-remove ub4tgupd; cd {cwd}; git pull; termux-toast 'ub4tg updated, now restart it for apply update'") + f"cat upd_info | termux-notification -i ub4tgupd --title 'ub4tg: update avalaible!' --button1 'Get update' --button1-action 'termux-notification-remove ub4tgupd; cd {cwd}; git pull; termux-toast 'ub4tg updated, now restart it for apply update'") else: os.system( "termux-toast '[ub4tg]: failed fetching update, maybe connection error, check console log for more info'") From 1203049e60873f7c9b61fdc0a0a4f1bc1c50a6e1 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 19 Dec 2024 11:31:12 +0300 Subject: [PATCH 03/18] i forgot what tee command exists --- src/updatenotif.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/updatenotif.py b/src/updatenotif.py index 26f11ce..55c295d 100644 --- a/src/updatenotif.py +++ b/src/updatenotif.py @@ -15,9 +15,7 @@ async def git_notifications_update(): if fetching_git == 0: os.system("printf 'For apply tap button Get update and restart bot\nChanges:\n' > upd_info") commits = os.popen( - "git log --pretty=format:'%h %s%n%b' HEAD..origin/$(git rev-parse --abbrev-ref HEAD)").read() - os.popen( - "git log --pretty=format:'%h %s%n%b' HEAD..origin/$(git rev-parse --abbrev-ref HEAD) >> upd_info") + "git log --pretty=format:'%h %s%n%b' HEAD..origin/$(git rev-parse --abbrev-ref HEAD) | tee upd_info").read() if len(commits) <= 5: logger.info('updates not found, nothing to do') else: From c898e6b161a6569101f005d45c2473a04a89271d Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 19 Dec 2024 11:33:48 +0300 Subject: [PATCH 04/18] forgotten quote --- src/updatenotif.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/updatenotif.py b/src/updatenotif.py index 55c295d..c96f2f0 100644 --- a/src/updatenotif.py +++ b/src/updatenotif.py @@ -20,7 +20,7 @@ async def git_notifications_update(): logger.info('updates not found, nothing to do') else: os.system( - f"cat upd_info | termux-notification -i ub4tgupd --title 'ub4tg: update avalaible!' --button1 'Get update' --button1-action 'termux-notification-remove ub4tgupd; cd {cwd}; git pull; termux-toast 'ub4tg updated, now restart it for apply update'") + f"cat upd_info | termux-notification -i ub4tgupd --title 'ub4tg: update avalaible!' --button1 'Get update' --button1-action 'termux-notification-remove ub4tgupd'; cd {cwd}; git pull; termux-toast 'ub4tg updated, now restart it for apply update'") else: os.system( "termux-toast '[ub4tg]: failed fetching update, maybe connection error, check console log for more info'") From 65c8fead146e8c96ea87461c0bb2b626de9d978e Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 19 Dec 2024 12:43:51 +0300 Subject: [PATCH 05/18] system requirements for termux --- installing-on-termux.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/installing-on-termux.md b/installing-on-termux.md index 3605cc6..c8d5fb6 100644 --- a/installing-on-termux.md +++ b/installing-on-termux.md @@ -1,5 +1,13 @@ Termux apk here: https://f-droid.org/repo/com.termux_1020.apk Termux:API apk if you want get notifications about updates of this code: https://f-droid.org/repo/com.termux.api_51.apk + +System requirements: +Android 7+ and at least 500 Mb - 5 GB on storage, is official requirements from their wiki https://wiki.termux.com/wiki/FAQ#What_are_system_requirements +Personally I recommend also: +* 1.5 GB in storage is minimum for good perfomance, do not continue, if you have small storage, because it cause "no enough space" error +* arm64 proccessor and 64-bit OS, because on S1S13AF7 smartphone (Redmi 6A) have perfomance issues with 32 bit system, but maybe if install PostmarketOS on this smartphone it will be better because is more native Linux system than java wrapped Termux... Maybe also MIUI firmware issues +Anyway if you have low-end device, in step 1 when copying oneliner skip part with 'pkg update && pkg upgrade', but no any warranty, it can broke bot without upgrade Termux bootstrap packages. Also if your speed downloading updates very slow, press Ctrl+C, and try run `termux-change-repo` and select other region. + 0. Optional step: allow permission on storage in Termux before start, after this, step 3-4 can be skipped 1. Run termux and enter this oneliner: From c916b9e0ae71866ee880e8a0b130b0cbc2319526 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 19 Dec 2024 12:47:04 +0300 Subject: [PATCH 06/18] fuckin' markdown --- installing-on-termux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installing-on-termux.md b/installing-on-termux.md index c8d5fb6..acc288a 100644 --- a/installing-on-termux.md +++ b/installing-on-termux.md @@ -5,7 +5,7 @@ System requirements: Android 7+ and at least 500 Mb - 5 GB on storage, is official requirements from their wiki https://wiki.termux.com/wiki/FAQ#What_are_system_requirements Personally I recommend also: * 1.5 GB in storage is minimum for good perfomance, do not continue, if you have small storage, because it cause "no enough space" error -* arm64 proccessor and 64-bit OS, because on S1S13AF7 smartphone (Redmi 6A) have perfomance issues with 32 bit system, but maybe if install PostmarketOS on this smartphone it will be better because is more native Linux system than java wrapped Termux... Maybe also MIUI firmware issues +* arm64 proccessor and 64-bit OS, because on S1S13AF7 smartphone (Redmi 6A) have perfomance issues with 32 bit system, but maybe if install PostmarketOS on this smartphone it will be better because is more native Linux system than java wrapped Termux... Maybe also MIUI firmware issues. Anyway if you have low-end device, in step 1 when copying oneliner skip part with 'pkg update && pkg upgrade', but no any warranty, it can broke bot without upgrade Termux bootstrap packages. Also if your speed downloading updates very slow, press Ctrl+C, and try run `termux-change-repo` and select other region. From 9833a1a1f2a209f1b30b27852b0ffeb5aeb6b676 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 19 Dec 2024 12:48:18 +0300 Subject: [PATCH 07/18] part --- installing-on-termux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installing-on-termux.md b/installing-on-termux.md index acc288a..318b0f0 100644 --- a/installing-on-termux.md +++ b/installing-on-termux.md @@ -6,7 +6,7 @@ Android 7+ and at least 500 Mb - 5 GB on storage, is official requirements from Personally I recommend also: * 1.5 GB in storage is minimum for good perfomance, do not continue, if you have small storage, because it cause "no enough space" error * arm64 proccessor and 64-bit OS, because on S1S13AF7 smartphone (Redmi 6A) have perfomance issues with 32 bit system, but maybe if install PostmarketOS on this smartphone it will be better because is more native Linux system than java wrapped Termux... Maybe also MIUI firmware issues. -Anyway if you have low-end device, in step 1 when copying oneliner skip part with 'pkg update && pkg upgrade', but no any warranty, it can broke bot without upgrade Termux bootstrap packages. Also if your speed downloading updates very slow, press Ctrl+C, and try run `termux-change-repo` and select other region. +Anyway if you have low-end device, in step 1 when copying oneliner skip part with 'pkg update && pkg upgrade && ', but no any warranty, it can broke bot without upgrade Termux bootstrap packages. Also if your speed downloading updates very slow, press Ctrl+C, and try run `termux-change-repo` and select other region. 0. Optional step: allow permission on storage in Termux before start, after this, step 3-4 can be skipped From 418e2b77536143b382dad262efa4d1e748633904 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 19 Dec 2024 13:03:26 +0300 Subject: [PATCH 08/18] =?UTF-8?q?=D0=B0=D1=84=D0=B5=D1=80=D0=B8=D1=81?= =?UTF-8?q?=D1=82=D1=8B=20=D0=B2=20=D1=81=D0=B5=D1=82=D1=8F=D1=85=20theme?= =?UTF-8?q?=20added?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/autobioebbing.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/autobioebbing.py b/src/autobioebbing.py index 49aed02..9f156d1 100644 --- a/src/autobioebbing.py +++ b/src/autobioebbing.py @@ -68,6 +68,11 @@ async def eb(client, c, conn, con, d, get_id, my_id, message_q): r"кончила ([0-9\.\,k]+)", r' ещё ([0-9\ ]+) д.*', default_pathogen_remaining_theme), + # "Аферисты в сетях" theme + (r'.* атаковал.+', + r"приносит: ([0-9\.\,k]+)", + default_infected_days_theme, + default_pathogen_remaining_theme), # UA theme [via trust] (r'.* за допомогою довіреності зазнала зараження.+', r"([0-9\.\,k]+) біо-ресурса", From c1d8006cca042bbafd5bfa5834406c742fa088a9 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 19 Dec 2024 14:53:05 +0300 Subject: [PATCH 09/18] forgot database column remove --- src/victimsbackup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/victimsbackup.py b/src/victimsbackup.py index 11b6432..672d070 100644 --- a/src/victimsbackup.py +++ b/src/victimsbackup.py @@ -85,7 +85,7 @@ async def bio_backup_stealing(client, c, conn, default_directory): else: profit_int = int(profit) if not c.execute(f'SELECT user_id FROM avocado WHERE user_id == {user_id}').fetchone() and not c.execute(f'SELECT user_id FROM avocado_exclude WHERE user_id == {user_id}').fetchone(): - c.execute("INSERT INTO avocado(user_id,when_int,bio_str,bio_int,expr_int) VALUES (?, ?, ?, ?, ?)", + c.execute("INSERT INTO avocado(user_id,when_int,bio_int,expr_int) VALUES (?, ?, ?, ?)", (int(user_id), int(when), str(profit), int(profit_int), 0)) added += 1 logger.debug(f'added {user_id} - {profit_int}') From 72c8879989780c36970ceb1a6d99e6556716afcf Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 19 Dec 2024 14:54:34 +0300 Subject: [PATCH 10/18] forgot database column remove --- src/victimsbackup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/victimsbackup.py b/src/victimsbackup.py index 672d070..7095715 100644 --- a/src/victimsbackup.py +++ b/src/victimsbackup.py @@ -86,7 +86,7 @@ async def bio_backup_stealing(client, c, conn, default_directory): profit_int = int(profit) if not c.execute(f'SELECT user_id FROM avocado WHERE user_id == {user_id}').fetchone() and not c.execute(f'SELECT user_id FROM avocado_exclude WHERE user_id == {user_id}').fetchone(): c.execute("INSERT INTO avocado(user_id,when_int,bio_int,expr_int) VALUES (?, ?, ?, ?)", - (int(user_id), int(when), str(profit), int(profit_int), 0)) + (int(user_id), int(when), int(profit_int), 0)) added += 1 logger.debug(f'added {user_id} - {profit_int}') else: From e4141534b2e5fa323dd44c6f7126ab4d33b0df54 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 19 Dec 2024 15:09:30 +0300 Subject: [PATCH 11/18] theme fix --- src/autobioebbing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/autobioebbing.py b/src/autobioebbing.py index 9f156d1..4aea00a 100644 --- a/src/autobioebbing.py +++ b/src/autobioebbing.py @@ -64,7 +64,7 @@ async def eb(client, c, conn, con, d, get_id, my_id, message_q): default_infected_days_theme, default_pathogen_remaining_theme), # "Сексуальная индустрия" theme - (r'.* выебал.+', + (r'.*.+выебал.+', r"кончила ([0-9\.\,k]+)", r' ещё ([0-9\ ]+) д.*', default_pathogen_remaining_theme), From 722a3d95af78133bfe079abba673d3a14f4b4221 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 19 Dec 2024 15:40:53 +0300 Subject: [PATCH 12/18] fix bioebmass arg --- src/autobioebbing.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/autobioebbing.py b/src/autobioebbing.py index 4aea00a..0dedb10 100644 --- a/src/autobioebbing.py +++ b/src/autobioebbing.py @@ -329,6 +329,9 @@ async def eb(client, c, conn, con, d, get_id, my_id, message_q): arg = int(arg[1]) except: await event.edit('Argument should be integer from 1 to 10') + + else: + arg = None reply = await client.get_messages(event.peer_id, ids=event.reply_to.reply_to_msg_id) when = int(datetime.timestamp(event.date)) t = reply.raw_text From 68252d61023e1cf398cca455d9818bf5ae8c1dce Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 19 Dec 2024 21:52:26 +0300 Subject: [PATCH 13/18] theme finder in separated definition --- src/autobioebbing.py | 168 ++++++++++++++++++++++--------------------- 1 file changed, 86 insertions(+), 82 deletions(-) diff --git a/src/autobioebbing.py b/src/autobioebbing.py index 0dedb10..61ba731 100644 --- a/src/autobioebbing.py +++ b/src/autobioebbing.py @@ -10,6 +10,88 @@ import random import re +def find_infect_theme(text): + # NOTE: theme hell... any ideas for improvment required + # but not use huge regular expression like|that|fuckin|way|a|aaaa|aaaaaaaa + # because it makes re.findall like mess... + default_bioexpr_theme = r"Прибыль: ([0-9\.\,k]+)" + default_infected_days_theme = r' на ([0-9\ ]+) д.*' + default_pathogen_remaining_theme = r'Осталось: ([0-9\ ]+)' + bio_attack_themes = ( # I guess if too many themes it will be slow, but acceptable, because python slow as is. + # current order in theme: + # ('infected', 'bio_expr', 'infected days', 'pathogen remaining') + # UA theme + (r'.* йобнув.+', + r"([0-9\.\,k]+) біо-ресурса", + default_infected_days_theme, + default_pathogen_remaining_theme), + # RU theme + (r'.* подверг.+', + default_bioexpr_theme, + default_infected_days_theme, + default_pathogen_remaining_theme), + # EN theme + (r'.* infected.+', + r"([0-9\.\,k]+) pcs\.", + r' for ([0-9\ ]+) d.*', + r'Remaining: ([0-9\ ]+)'), + # AZ theme + (r'.* сикди.+', + r"верир: ([0-9\.\,k]+)", + default_infected_days_theme, + default_pathogen_remaining_theme), + # "ПК гик" theme + (r'.* насрал.+', + r"потеряет: ([0-9\.\,k]+)", + default_infected_days_theme, + default_pathogen_remaining_theme), + # "Новогодняя" theme + (r'.* подверг заморозке.+', + default_bioexpr_theme, + default_infected_days_theme, + default_pathogen_remaining_theme), + # "Сексуальная индустрия" theme + (r'.*.+выебал.+', + r"кончила ([0-9\.\,k]+)", + r' ещё ([0-9\ ]+) д.*', + default_pathogen_remaining_theme), + # "Аферисты в сетях" theme + (r'.* атаковал.+', + r"приносит: ([0-9\.\,k]+)", + default_infected_days_theme, + default_pathogen_remaining_theme), + # UA theme [via trust] + (r'.* за допомогою довіреності зазнала зараження.+', + r"([0-9\.\,k]+) біо-ресурса", + default_infected_days_theme, + default_pathogen_remaining_theme), + # RU theme [via trust] + (r'.* при помощи доверенности подвергла заражению.+', + default_bioexpr_theme, + default_infected_days_theme, + default_pathogen_remaining_theme), + # EN theme [via trust] + (r'.* by authorization infected.+', + r"([0-9\.\,k]+) pcs\.", + r' for ([0-9\ ]+) d.*', + r'Remaining: ([0-9\ ]+)'), + # idk what is theme [via trust] + (r'.* при помощи анонимуса атаковала.+', + r'приносит: ([0-9\.\,k]+)', + default_infected_days_theme, + default_pathogen_remaining_theme), + ) + for theme in bio_attack_themes: + trying_theme_index = bio_attack_themes.index(theme) + logger.debug(f'trying theme {trying_theme_index}...') + r = re.findall(theme[0], text) + if r: + logger.debug(f'found theme {trying_theme_index}') + return r, bio_attack_themes[trying_theme_index] + return r, None + + + async def eb(client, c, conn, con, d, get_id, my_id, message_q): @client.on(events.NewMessage( pattern='.*йобнув.*|.*подверг(ла)?.*|.*infected.*|.*сикди.*|.*насрал.*|.*выебал.*|.*за допомогою довіреності.*|.*by authorization infected.*|.*при помощи анонимуса атаковала.*', @@ -24,87 +106,10 @@ async def eb(client, c, conn, con, d, get_id, my_id, message_q): logger.debug(f"in chat '{chat_name}'") states.stats_most_infect_spam_chats[chat_name] += 1 t = m.raw_text - # NOTE: theme hell... any ideas for improvment required - # but not use huge regular expression like|that|fuckin|way|a|aaaa|aaaaaaaa - # because it makes re.findall like mess... - default_bioexpr_theme = r"Прибыль: ([0-9\.\,k]+)" - default_infected_days_theme = r' на ([0-9\ ]+) д.*' - default_pathogen_remaining_theme = r'Осталось: ([0-9\ ]+)' - bio_attack_themes = ( # I guess if too many themes it will be slow, but acceptable, because python slow as is. - # current order in theme: - # ('infected', 'bio_expr', 'infected days', 'pathogen remaining') - # UA theme - (r'.* йобнув.+', - r"([0-9\.\,k]+) біо-ресурса", - default_infected_days_theme, - default_pathogen_remaining_theme), - # RU theme - (r'.* подверг.+', - default_bioexpr_theme, - default_infected_days_theme, - default_pathogen_remaining_theme), - # EN theme - (r'.* infected.+', - r"([0-9\.\,k]+) pcs\.", - r' for ([0-9\ ]+) d.*', - r'Remaining: ([0-9\ ]+)'), - # AZ theme - (r'.* сикди.+', - r"верир: ([0-9\.\,k]+)", - default_infected_days_theme, - default_pathogen_remaining_theme), - # "ПК гик" theme - (r'.* насрал.+', - r"потеряет: ([0-9\.\,k]+)", - default_infected_days_theme, - default_pathogen_remaining_theme), - # "Новогодняя" theme - (r'.* подверг заморозке.+', - default_bioexpr_theme, - default_infected_days_theme, - default_pathogen_remaining_theme), - # "Сексуальная индустрия" theme - (r'.*.+выебал.+', - r"кончила ([0-9\.\,k]+)", - r' ещё ([0-9\ ]+) д.*', - default_pathogen_remaining_theme), - # "Аферисты в сетях" theme - (r'.* атаковал.+', - r"приносит: ([0-9\.\,k]+)", - default_infected_days_theme, - default_pathogen_remaining_theme), - # UA theme [via trust] - (r'.* за допомогою довіреності зазнала зараження.+', - r"([0-9\.\,k]+) біо-ресурса", - default_infected_days_theme, - default_pathogen_remaining_theme), - # RU theme [via trust] - (r'.* при помощи доверенности подвергла заражению.+', - default_bioexpr_theme, - default_infected_days_theme, - default_pathogen_remaining_theme), - # EN theme [via trust] - (r'.* by authorization infected.+', - r"([0-9\.\,k]+) pcs\.", - r' for ([0-9\ ]+) d.*', - r'Remaining: ([0-9\ ]+)'), - # idk what is theme [via trust] - (r'.* при помощи анонимуса атаковала.+', - r'приносит: ([0-9\.\,k]+)', - default_infected_days_theme, - default_pathogen_remaining_theme), - ) - if len(m.entities) > 1: h = utils.sanitize_parse_mode( 'html').unparse(t, m.entities) # HTML - for theme in bio_attack_themes: - trying_theme_index = bio_attack_themes.index(theme) - logger.debug(f'trying theme {trying_theme_index}...') - r = re.findall(theme[0], h) - if r: - logger.debug(f'found theme {trying_theme_index}') - break + r, bio_attack_theme = find_infect_theme(h) if r == []: logger.warning( 'theme not found or lost part of message, showing original message: ' + m.text) @@ -116,12 +121,11 @@ async def eb(client, c, conn, con, d, get_id, my_id, message_q): u2id = await get_id(u2url) bio_excludes = [x[0] for x in c.execute( 'select user_id from avocado_exclude').fetchall()] - # print(f'{u1url} [@{u1id}] подверг(ла) {u2url} [@{u2id}]')#показать when = int(datetime.timestamp(m.date)) - days = int(re.findall(bio_attack_themes[trying_theme_index][2], t)[ + days = int(re.findall(bio_attack_theme[2], t)[ 0].replace(' ', '')) experience = re.findall( - bio_attack_themes[trying_theme_index][1], t)[0].strip() + bio_attack_theme[1], t)[0].strip() if ',' in experience: experience = re.sub(r',', r'.', experience) if 'k' in experience: @@ -130,7 +134,7 @@ async def eb(client, c, conn, con, d, get_id, my_id, message_q): else: exp_int = int(experience) pathogen_remaining = int(re.findall( - bio_attack_themes[trying_theme_index][3], t)[0]) + bio_attack_theme[3], t)[0]) if pathogen_remaining <= states.auto_bioeb_pathogen_threshold and u1id == my_id: states.auto_bioeb_sleep_interval = states.auto_bioeb_max_interval logger.warning( From e00b3ff2bf3dad5e2f3f9d3578255614ab1e6153 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 19 Dec 2024 22:40:09 +0300 Subject: [PATCH 14/18] detection theme changes: Try parse invisible labs Full matching theme instead only one index, this prevent some errors --- src/autobioebbing.py | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/autobioebbing.py b/src/autobioebbing.py index 61ba731..06bb25f 100644 --- a/src/autobioebbing.py +++ b/src/autobioebbing.py @@ -21,62 +21,67 @@ def find_infect_theme(text): # current order in theme: # ('infected', 'bio_expr', 'infected days', 'pathogen remaining') # UA theme - (r'.* йобнув.+', + (r'.* йобнув.+', r"([0-9\.\,k]+) біо-ресурса", default_infected_days_theme, default_pathogen_remaining_theme), # RU theme - (r'.* подверг.+', + (r'.* подверг.+', default_bioexpr_theme, default_infected_days_theme, default_pathogen_remaining_theme), # EN theme - (r'.* infected.+', + (r'.* infected.+', r"([0-9\.\,k]+) pcs\.", r' for ([0-9\ ]+) d.*', r'Remaining: ([0-9\ ]+)'), # AZ theme - (r'.* сикди.+', + (r'.* сикди.+', r"верир: ([0-9\.\,k]+)", default_infected_days_theme, default_pathogen_remaining_theme), # "ПК гик" theme - (r'.* насрал.+', + (r'.* насрал.+', r"потеряет: ([0-9\.\,k]+)", default_infected_days_theme, default_pathogen_remaining_theme), # "Новогодняя" theme - (r'.* подверг заморозке.+', + (r'.* подверг заморозке.+', default_bioexpr_theme, default_infected_days_theme, default_pathogen_remaining_theme), # "Сексуальная индустрия" theme - (r'.*.+выебал.+', + (r'.*.+выебал.+', r"кончила ([0-9\.\,k]+)", r' ещё ([0-9\ ]+) д.*', default_pathogen_remaining_theme), # "Аферисты в сетях" theme - (r'.* атаковал.+', + (r'.* атаковал.+', r"приносит: ([0-9\.\,k]+)", default_infected_days_theme, default_pathogen_remaining_theme), + # "Квадробер" theme + (r'.*.+бешенству.+', + r"корма: ([0-9\.\,k]+)", + default_infected_days_theme, + default_pathogen_remaining_theme), # UA theme [via trust] - (r'.* за допомогою довіреності зазнала зараження.+', + (r'.* за допомогою довіреності зазнала зараження.+', r"([0-9\.\,k]+) біо-ресурса", default_infected_days_theme, default_pathogen_remaining_theme), # RU theme [via trust] - (r'.* при помощи доверенности подвергла заражению.+', + (r'.* при помощи доверенности подвергла заражению.+', default_bioexpr_theme, default_infected_days_theme, default_pathogen_remaining_theme), # EN theme [via trust] - (r'.* by authorization infected.+', + (r'.* by authorization infected.+', r"([0-9\.\,k]+) pcs\.", r' for ([0-9\ ]+) d.*', r'Remaining: ([0-9\ ]+)'), # idk what is theme [via trust] - (r'.* при помощи анонимуса атаковала.+', + (r'.* при помощи анонимуса атаковала.+', r'приносит: ([0-9\.\,k]+)', default_infected_days_theme, default_pathogen_remaining_theme), @@ -84,14 +89,13 @@ def find_infect_theme(text): for theme in bio_attack_themes: trying_theme_index = bio_attack_themes.index(theme) logger.debug(f'trying theme {trying_theme_index}...') - r = re.findall(theme[0], text) - if r: + r, bioexp, days, remaining = re.findall(theme[0], text), re.findall(theme[1], text), re.findall(theme[2], text), re.findall(theme[3], text) + if r and bioexp and days and remaining: logger.debug(f'found theme {trying_theme_index}') return r, bio_attack_themes[trying_theme_index] return r, None - async def eb(client, c, conn, con, d, get_id, my_id, message_q): @client.on(events.NewMessage( pattern='.*йобнув.*|.*подверг(ла)?.*|.*infected.*|.*сикди.*|.*насрал.*|.*выебал.*|.*за допомогою довіреності.*|.*by authorization infected.*|.*при помощи анонимуса атаковала.*', From 22422e5d0b072ed45dba44ee391c981eb19526ff Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 19 Dec 2024 23:19:31 +0300 Subject: [PATCH 15/18] now really works parse invisible lab infection --- src/autobioebbing.py | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/autobioebbing.py b/src/autobioebbing.py index 06bb25f..b28cccc 100644 --- a/src/autobioebbing.py +++ b/src/autobioebbing.py @@ -21,67 +21,67 @@ def find_infect_theme(text): # current order in theme: # ('infected', 'bio_expr', 'infected days', 'pathogen remaining') # UA theme - (r'.* йобнув.+', + (r'.* йобнув.+', r"([0-9\.\,k]+) біо-ресурса", default_infected_days_theme, default_pathogen_remaining_theme), # RU theme - (r'.* подверг.+', + (r'.* подверг.+', default_bioexpr_theme, default_infected_days_theme, default_pathogen_remaining_theme), # EN theme - (r'.* infected.+', + (r'.* infected.+', r"([0-9\.\,k]+) pcs\.", r' for ([0-9\ ]+) d.*', r'Remaining: ([0-9\ ]+)'), # AZ theme - (r'.* сикди.+', + (r'.* сикди.+', r"верир: ([0-9\.\,k]+)", default_infected_days_theme, default_pathogen_remaining_theme), # "ПК гик" theme - (r'.* насрал.+', + (r'.* насрал.+', r"потеряет: ([0-9\.\,k]+)", default_infected_days_theme, default_pathogen_remaining_theme), # "Новогодняя" theme - (r'.* подверг заморозке.+', + (r'.* подверг заморозке.+', default_bioexpr_theme, default_infected_days_theme, default_pathogen_remaining_theme), # "Сексуальная индустрия" theme - (r'.*.+выебал.+', + (r'.*.+выебал.+', r"кончила ([0-9\.\,k]+)", r' ещё ([0-9\ ]+) д.*', default_pathogen_remaining_theme), # "Аферисты в сетях" theme - (r'.* атаковал.+', + (r'.* атаковал.+', r"приносит: ([0-9\.\,k]+)", default_infected_days_theme, default_pathogen_remaining_theme), # "Квадробер" theme - (r'.*.+бешенству.+', + (r'.*.+бешенству.+', r"корма: ([0-9\.\,k]+)", default_infected_days_theme, default_pathogen_remaining_theme), # UA theme [via trust] - (r'.* за допомогою довіреності зазнала зараження.+', + (r'.* за допомогою довіреності зазнала зараження.+', r"([0-9\.\,k]+) біо-ресурса", default_infected_days_theme, default_pathogen_remaining_theme), # RU theme [via trust] - (r'.* при помощи доверенности подвергла заражению.+', + (r'.* при помощи доверенности подвергла заражению.+', default_bioexpr_theme, default_infected_days_theme, default_pathogen_remaining_theme), # EN theme [via trust] - (r'.* by authorization infected.+', + (r'.* by authorization infected.+', r"([0-9\.\,k]+) pcs\.", r' for ([0-9\ ]+) d.*', r'Remaining: ([0-9\ ]+)'), # idk what is theme [via trust] - (r'.* при помощи анонимуса атаковала.+', + (r'.* при помощи анонимуса атаковала.+', r'приносит: ([0-9\.\,k]+)', default_infected_days_theme, default_pathogen_remaining_theme), @@ -90,9 +90,14 @@ def find_infect_theme(text): trying_theme_index = bio_attack_themes.index(theme) logger.debug(f'trying theme {trying_theme_index}...') r, bioexp, days, remaining = re.findall(theme[0], text), re.findall(theme[1], text), re.findall(theme[2], text), re.findall(theme[3], text) - if r and bioexp and days and remaining: + if len(r) > 2 and bioexp and days and remaining: logger.debug(f'found theme {trying_theme_index}') return r, bio_attack_themes[trying_theme_index] + r = re.findall(theme[0].split('', 1)[1], text) + if len(r) == 1 and bioexp and days and remaining: + logger.debug(f'found theme {trying_theme_index}, but invisible first lab it will be replaced to avocado id') + r = [(f'tg://openmessage?user_id={avocado_id}', r[0])] + return r, bio_attack_themes[trying_theme_index] return r, None From 70cff5f756a0c1c9f55d10affb196f051f4551f2 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 19 Dec 2024 23:45:35 +0300 Subject: [PATCH 16/18] invisible labs should works... yes, again --- src/autobioebbing.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/autobioebbing.py b/src/autobioebbing.py index b28cccc..200c5bd 100644 --- a/src/autobioebbing.py +++ b/src/autobioebbing.py @@ -90,11 +90,14 @@ def find_infect_theme(text): trying_theme_index = bio_attack_themes.index(theme) logger.debug(f'trying theme {trying_theme_index}...') r, bioexp, days, remaining = re.findall(theme[0], text), re.findall(theme[1], text), re.findall(theme[2], text), re.findall(theme[3], text) - if len(r) > 2 and bioexp and days and remaining: + if r and bioexp and days and remaining: logger.debug(f'found theme {trying_theme_index}') return r, bio_attack_themes[trying_theme_index] - r = re.findall(theme[0].split('', 1)[1], text) - if len(r) == 1 and bioexp and days and remaining: + for theme in bio_attack_themes: + trying_theme_index = bio_attack_themes.index(theme) + logger.debug(f'trying theme {trying_theme_index} [without first lab]...') + r, bioexp, days, remaining = re.findall(theme[0].split('', 1)[1], text), re.findall(theme[1], text), re.findall(theme[2], text), re.findall(theme[3], text) + if r and bioexp and days and remaining: logger.debug(f'found theme {trying_theme_index}, but invisible first lab it will be replaced to avocado id') r = [(f'tg://openmessage?user_id={avocado_id}', r[0])] return r, bio_attack_themes[trying_theme_index] From 698462b3d5e35af87aa2e9b95c52389d6f6be9e9 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 21 Dec 2024 08:45:19 +0300 Subject: [PATCH 17/18] fix aiohttp fails to build on python 3.13, YOU SHOULD pip3 install -r requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 5ce5e0f..69d1e96 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ # requirements.txt loguru -aiohttp==3.9.0b0 +aiohttp==3.11.11 Telethon-Mod #aiosqlite asyncio From 5ea22e534b3f2388b1645908abb400f88ce1e8ac Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 21 Dec 2024 08:45:41 +0300 Subject: [PATCH 18/18] set title of running bot user id --- ubot.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ubot.py b/ubot.py index c46986a..d7b19df 100644 --- a/ubot.py +++ b/ubot.py @@ -9,6 +9,7 @@ from loguru import logger import time import sys +import os import asyncio import re @@ -169,7 +170,8 @@ async def main(): #################################################################### if is_termux: asyncio.ensure_future(updatenotif.git_notifications_update()) - + elif os.name == 'posix': + print(f'\33]0;bot {my_id}\a', end='', flush=True) await victimsbackup.bio_backup_stealing(client, c, conn, default_directory) if config.db_pymysql: