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...'''
|
'''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 telethon import events, utils, functions
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
@ -10,7 +10,7 @@ import random
|
||||||
import re
|
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(
|
@client.on(events.NewMessage(
|
||||||
pattern='.*йобнув.*|.*подверг(ла)?.*|.*infected.*|.*сикди.*|.*насрал.*|.*выебал.*|.*за допомогою довіреності.*|.*by authorization infected.*|.*при помощи анонимуса атаковала.*',
|
pattern='.*йобнув.*|.*подверг(ла)?.*|.*infected.*|.*сикди.*|.*насрал.*|.*выебал.*|.*за допомогою довіреності.*|.*by authorization infected.*|.*при помощи анонимуса атаковала.*',
|
||||||
from_users=(6333102398, 'me')))
|
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_int = datetime.timestamp(a)
|
||||||
do_txt = str(a.strftime("%d.%m.%y"))
|
do_txt = str(a.strftime("%d.%m.%y"))
|
||||||
if u1id > 0 and u2id > 0:
|
if u1id > 0 and u2id > 0:
|
||||||
if db_sqlite3 and u1id == my_id:
|
if config.db_sqlite3 and u1id == my_id:
|
||||||
try:
|
try:
|
||||||
c.execute("INSERT INTO avocado(user_id,when_int,bio_int,expr_int,expr_str) VALUES (?, ?, ?, ?, ?)", (
|
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"))))
|
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:
|
except Exception as Err:
|
||||||
logger.exception(f'err: {Err} avocado')
|
logger.exception(f'err: {Err} avocado')
|
||||||
states.last_reply_bioeb_avocado = time.time()
|
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:
|
try:
|
||||||
c.execute("INSERT INTO avocado(user_id,when_int,bio_int,expr_int) VALUES (?, ?, ?, ?)", (
|
c.execute("INSERT INTO avocado(user_id,when_int,bio_int,expr_int) VALUES (?, ?, ?, ?)", (
|
||||||
int(u2id), int(when), int(exp_int), 0))
|
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()
|
conn.commit()
|
||||||
logger.debug(
|
logger.debug(
|
||||||
'[upd] success updated bio attack')
|
'[upd] success updated bio attack')
|
||||||
if db_pymysql:
|
if config.db_pymysql:
|
||||||
try:
|
try:
|
||||||
# from_infect who_id user_id profit until_infect until_str
|
# 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(
|
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
|
# iris off bio 31.12.24
|
||||||
m = event.message
|
m = event.message
|
||||||
t = m.raw_text
|
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(
|
h = utils.sanitize_parse_mode(
|
||||||
'html').unparse(t, m.entities) # HTML
|
'html').unparse(t, m.entities) # HTML
|
||||||
r = re.findall(
|
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,)))
|
@client.on(events.NewMessage(pattern='⏱?🚫 Жертва', from_users=(6333102398,)))
|
||||||
async def infection_not_found(event):
|
async def infection_not_found(event):
|
||||||
m = event.message
|
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))
|
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
|
result = await client(functions.messages.GetBotCallbackAnswerRequest( # src https://tl.telethon.dev/methods/messages/get_bot_callback_answer.html
|
||||||
peer=m.peer_id,
|
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
|
m = event.message
|
||||||
# reply = await client.get_messages(m.peer_id, ids=m.reply_to.reply_to_msg_id)
|
# reply = await client.get_messages(m.peer_id, ids=m.reply_to.reply_to_msg_id)
|
||||||
# logger.debug(reply)
|
# logger.debug(reply)
|
||||||
if a_h and m.mentioned:
|
if config.a_h and m.mentioned:
|
||||||
# нада хил
|
# нада хил
|
||||||
ah = await message_q( # отправляет сообщение боту
|
ah = await message_q( # отправляет сообщение боту
|
||||||
"Хил",
|
"Хил",
|
||||||
|
|
22
ubot.py
22
ubot.py
|
@ -1,26 +1,22 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# https://docs-python.ru/packages/telegram-klient-telethon-python/ <-info
|
|
||||||
from s import is_termux, sessdb, default_directory, config, states
|
from s import is_termux, sessdb, default_directory, config, states
|
||||||
from src import autobioebbing, avocmine, victimsbackup, updatenotif
|
from src import autobioebbing, avocmine, victimsbackup, updatenotif
|
||||||
import asyncio
|
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
|
||||||
# from telethon.sync import TelegramClient
|
# from telethon.sync import TelegramClient
|
||||||
|
# https://docs-python.ru/packages/telegram-klient-telethon-python/ <-info
|
||||||
from telethon import TelegramClient, events
|
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 time
|
||||||
|
import sys
|
||||||
|
import asyncio
|
||||||
|
import re
|
||||||
|
|
||||||
import pymysql
|
import pymysql
|
||||||
import pymysql.cursors
|
import pymysql.cursors
|
||||||
|
|
||||||
import sqlite3
|
import sqlite3
|
||||||
from loguru import logger
|
|
||||||
|
|
||||||
logger.remove()
|
logger.remove()
|
||||||
logger.level("DEBUG", color='<magenta>')
|
logger.level("DEBUG", color='<magenta>')
|
||||||
logger.add(sys.stderr, level="DEBUG")
|
logger.add(sys.stderr, level="DEBUG")
|
||||||
|
@ -176,9 +172,9 @@ async def main():
|
||||||
await victimsbackup.bio_backup_stealing(client, c, conn, default_directory)
|
await victimsbackup.bio_backup_stealing(client, c, conn, default_directory)
|
||||||
|
|
||||||
if config.db_pymysql:
|
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:
|
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))
|
asyncio.ensure_future(avocmine.automine_avocado_task(client))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue