Prevent handling yourself victims backup if not json

This commit is contained in:
Your Name 2025-01-04 03:34:42 +03:00
parent d59552ae7d
commit eaa5579b90

View file

@ -6,11 +6,13 @@ Currently supported original avocado json backup and "aska" txt backups
# TODO: make support for zipped and multiple files # TODO: make support for zipped and multiple files
# make some user_id checks before add (too slow) # make some user_id checks before add (too slow)
from s import termux_api
from loguru import logger from loguru import logger
from telethon import events from telethon import events
from datetime import datetime from datetime import datetime
import json import json
import re import re
import os
async def bio_backup_stealing(client, c, conn, default_directory): async def bio_backup_stealing(client, c, conn, default_directory):
@ -36,6 +38,9 @@ async def bio_backup_stealing(client, c, conn, default_directory):
file_format = 'json' file_format = 'json'
await event.edit('Processing json victims...') await event.edit('Processing json victims...')
elif file_path.lower().endswith('.txt'): elif file_path.lower().endswith('.txt'):
if cmd == 'me':
await event.edit('Your backup should be json avocado victims file')
return
raw_victims = stealed_backup.readlines() raw_victims = stealed_backup.readlines()
file_format = 'txt' file_format = 'txt'
await event.edit('Processing raw txt victims...') await event.edit('Processing raw txt victims...')
@ -99,6 +104,8 @@ async def bio_backup_stealing(client, c, conn, default_directory):
conn.commit() conn.commit()
logger.success('database rebased') logger.success('database rebased')
logger.success('backup success stealed') logger.success('backup success stealed')
if termux_api:
os.system("termux-toast -b black -c green 'Your victims backup imported in database'")
del my_victims_ids del my_victims_ids
del victims # free memory del victims # free memory
del raw_victims del raw_victims