some code optimizations in progress..
This commit is contained in:
parent
00c7c0f60a
commit
3223f2c631
2 changed files with 17 additions and 21 deletions
|
@ -1,5 +1,5 @@
|
|||
'''This is most huge module for autobioeb, autohealing and etc...'''
|
||||
from s import states
|
||||
from s import states, config
|
||||
|
||||
from telethon import events, utils, functions
|
||||
from loguru import logger
|
||||
|
@ -10,7 +10,7 @@ import random
|
|||
import re
|
||||
|
||||
|
||||
async def eb(client, db_sqlite3, db_pymysql, c, conn, con, d, get_id, my_id, message_q, a_404_patient, a_h):
|
||||
async def eb(client, c, conn, con, d, get_id, my_id, message_q):
|
||||
@client.on(events.NewMessage(
|
||||
pattern='.*йобнув.*|.*подверг(ла)?.*|.*infected.*|.*сикди.*|.*насрал.*|.*выебал.*|.*за допомогою довіреності.*|.*by authorization infected.*|.*при помощи анонимуса атаковала.*',
|
||||
from_users=(6333102398, 'me')))
|
||||
|
@ -138,7 +138,7 @@ async def eb(client, db_sqlite3, db_pymysql, c, conn, con, d, get_id, my_id, mes
|
|||
do_int = datetime.timestamp(a)
|
||||
do_txt = str(a.strftime("%d.%m.%y"))
|
||||
if u1id > 0 and u2id > 0:
|
||||
if db_sqlite3 and u1id == my_id:
|
||||
if config.db_sqlite3 and u1id == my_id:
|
||||
try:
|
||||
c.execute("INSERT INTO avocado(user_id,when_int,bio_int,expr_int,expr_str) VALUES (?, ?, ?, ?, ?)", (
|
||||
int(u2id), int(when), int(exp_int), int(datetime.timestamp(a)), str(a.strftime("%d.%m.%y"))))
|
||||
|
@ -155,7 +155,7 @@ async def eb(client, db_sqlite3, db_pymysql, c, conn, con, d, get_id, my_id, mes
|
|||
except Exception as Err:
|
||||
logger.exception(f'err: {Err} avocado')
|
||||
states.last_reply_bioeb_avocado = time.time()
|
||||
if db_sqlite3 and u1id != my_id and u2id not in bio_excludes:
|
||||
if config.db_sqlite3 and u1id != my_id and u2id not in bio_excludes:
|
||||
try:
|
||||
c.execute("INSERT INTO avocado(user_id,when_int,bio_int,expr_int) VALUES (?, ?, ?, ?)", (
|
||||
int(u2id), int(when), int(exp_int), 0))
|
||||
|
@ -170,7 +170,7 @@ async def eb(client, db_sqlite3, db_pymysql, c, conn, con, d, get_id, my_id, mes
|
|||
conn.commit()
|
||||
logger.debug(
|
||||
'[upd] success updated bio attack')
|
||||
if db_pymysql:
|
||||
if config.db_pymysql:
|
||||
try:
|
||||
# from_infect who_id user_id profit until_infect until_str
|
||||
d.execute("INSERT INTO `tg_bio_attack` (`who_id`, `user_id`, `from_infect`, `profit`, `until_infect`, `until_str`) VALUES (%s,%s,%s,%s,%s,%s) ON DUPLICATE KEY UPDATE from_infect=VALUES (from_infect),profit=VALUES (profit),until_infect=VALUES (until_infect),until_str = VALUES (until_str);", (int(
|
||||
|
@ -369,7 +369,7 @@ async def eb(client, db_sqlite3, db_pymysql, c, conn, con, d, get_id, my_id, mes
|
|||
# iris off bio 31.12.24
|
||||
m = event.message
|
||||
t = m.raw_text
|
||||
if a_404_patient and len(m.entities) > 1 and states.where_send_check_avocado:
|
||||
if config.a_404_patient and len(m.entities) > 1 and states.where_send_check_avocado:
|
||||
h = utils.sanitize_parse_mode(
|
||||
'html').unparse(t, m.entities) # HTML
|
||||
r = re.findall(
|
||||
|
@ -388,7 +388,7 @@ async def eb(client, db_sqlite3, db_pymysql, c, conn, con, d, get_id, my_id, mes
|
|||
@client.on(events.NewMessage(pattern='⏱?🚫 Жертва', from_users=(6333102398,)))
|
||||
async def infection_not_found(event):
|
||||
m = event.message
|
||||
if a_404_patient and m.mentioned:
|
||||
if config.a_404_patient and m.mentioned:
|
||||
await asyncio.sleep(random.uniform(1.0001, 2.22394))
|
||||
result = await client(functions.messages.GetBotCallbackAnswerRequest( # src https://tl.telethon.dev/methods/messages/get_bot_callback_answer.html
|
||||
peer=m.peer_id,
|
||||
|
@ -405,7 +405,7 @@ async def eb(client, db_sqlite3, db_pymysql, c, conn, con, d, get_id, my_id, mes
|
|||
m = event.message
|
||||
# reply = await client.get_messages(m.peer_id, ids=m.reply_to.reply_to_msg_id)
|
||||
# logger.debug(reply)
|
||||
if a_h and m.mentioned:
|
||||
if config.a_h and m.mentioned:
|
||||
# нада хил
|
||||
ah = await message_q( # отправляет сообщение боту
|
||||
"Хил",
|
||||
|
|
22
ubot.py
22
ubot.py
|
@ -1,26 +1,22 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# https://docs-python.ru/packages/telegram-klient-telethon-python/ <-info
|
||||
from s import is_termux, sessdb, default_directory, config, states
|
||||
from src import autobioebbing, avocmine, victimsbackup, updatenotif
|
||||
import asyncio
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
# from telethon.sync import TelegramClient
|
||||
# https://docs-python.ru/packages/telegram-klient-telethon-python/ <-info
|
||||
from telethon import TelegramClient, events
|
||||
from telethon import functions, types
|
||||
from loguru import logger
|
||||
|
||||
import sys
|
||||
import os
|
||||
import json
|
||||
import re
|
||||
import random
|
||||
import time
|
||||
import sys
|
||||
import asyncio
|
||||
import re
|
||||
|
||||
import pymysql
|
||||
import pymysql.cursors
|
||||
|
||||
import sqlite3
|
||||
from loguru import logger
|
||||
|
||||
|
||||
logger.remove()
|
||||
logger.level("DEBUG", color='<magenta>')
|
||||
logger.add(sys.stderr, level="DEBUG")
|
||||
|
@ -176,9 +172,9 @@ async def main():
|
|||
await victimsbackup.bio_backup_stealing(client, c, conn, default_directory)
|
||||
|
||||
if config.db_pymysql:
|
||||
await autobioebbing.eb(client, config.db_sqlite3, config.db_pymysql, c, conn, con, d, get_id, my_id, message_q, config.a_404_patient, config.a_h)
|
||||
await autobioebbing.eb(client, c, conn, con, d, get_id, my_id, message_q)
|
||||
else:
|
||||
await autobioebbing.eb(client, config.db_sqlite3, config.db_pymysql, c, conn, None, None, get_id, my_id, message_q, config.a_404_patient, config.a_h)
|
||||
await autobioebbing.eb(client, c, conn, None, None, get_id, my_id, message_q)
|
||||
|
||||
asyncio.ensure_future(avocmine.automine_avocado_task(client))
|
||||
|
||||
|
|
Loading…
Reference in a new issue