maybe fixed avocado mining, and some peer_id related problems on new accounts

This commit is contained in:
Your Name 2025-01-04 01:34:10 +03:00
parent 85b6cc5c79
commit 425edbfde3
5 changed files with 20 additions and 5 deletions

1
s.py
View file

@ -31,6 +31,7 @@ if is_termux:
# Название сессии
sessdb = 'tl-ub'
avocado_id = 6333102398
avocado_username = '@bio_attacker_bot'
default_directory = ''
default_config_file_path = 'config.json'
treat_as_true = ('true', '1', 't', 'y', 'yes', 'yeah', 'yup', 'certainly', 'uh-huh')

View file

@ -124,6 +124,7 @@ async def eb(client, c, conn, con, d, get_id, my_id, message_q):
'html').unparse(t, m.entities) # HTML
r, bio_attack_theme = find_infect_theme(h)
if r == []:
stat.bio.victims_failed_parse += 1
logger.warning(
'theme not found or lost part of message, showing original message: ' + m.text)
logger.debug(str(r))
@ -184,6 +185,7 @@ async def eb(client, c, conn, con, d, get_id, my_id, message_q):
int(u2id), int(when), int(exp_int), 0))
conn.commit()
logger.debug('[new] success writen bio attack')
stat.bio.victims_new += 1
except:
# NOTE: this maybe useful if you want sort database by bio-experience, but as S1S13AF7 said this
# can be like: in database you have +10k today, tomorrow it changed to +1...
@ -193,6 +195,7 @@ async def eb(client, c, conn, con, d, get_id, my_id, message_q):
conn.commit()
logger.debug(
'[upd] success updated bio attack')
stat.bio.victims_updated += 1
if config.db_pymysql:
try:
# from_infect who_id user_id profit until_infect until_str

View file

@ -1,4 +1,4 @@
from s import states, avocado_id
from s import states, avocado_id, avocado_username
from telethon import events
from loguru import logger
@ -47,6 +47,9 @@ async def automine_avocado_task(client):
if states.automine_enabled is False:
break
logger.debug('trying mine...')
await client.send_message(avocado_id, 'майн')
try:
await client.send_message(avocado_id, 'майн')
except:
await client.send_message(avocado_username, 'майн')
await asyncio.sleep(5) # because avocado may slow answer
logger.warning('Automine stopped by user')

View file

@ -6,16 +6,21 @@ from telethon import events
class bio:
medkit_usage = 0
most_infect_spam_chats = Counter()
victims_updated = 0
victims_new = 0
victims_failed_parse = 0
async def biomod(client):
@client.on(events.NewMessage(outgoing=True, pattern=r'\.bstat$'))
async def bio_stat(event):
stats_most_chats = bio.most_infect_spam_chats.most_common()
stats_most_chats = str(stats_most_chats).replace(',', '\n')
msg = "Session stats:\n" \
f"Medkit usage: {bio.medkit_usage}\n" \
f"Most common chats:\n" \
f"{stats_most_chats}".replace(',', '\n')
f"{stats_most_chats}" \
f"\nUpdated victims: {bio.victims_updated}\n" \
f"New victims: {bio.victims_new}\n" \
f"Failed to parse victims: {bio.victims_failed_parse}\n"
await event.edit(msg)

View file

@ -34,6 +34,9 @@ async def main():
my_id = int(me.id)
my_fn = me.first_name
logger.info(f'your id: {my_id}')
logger.info('loading dialogs...')
await client.get_dialogs()
logger.success('dialogs loaded')
if os.name == 'nt':
win32api.SetConsoleTitle(f'{my_id}')
elif os.name == 'posix':