Beispiel #1
0
from python_rucaptcha import ImageCaptcha
from vkbottle.exceptions import VKError
from vkbottle.framework.blueprint.user import Blueprint

from objects import Database

user = Blueprint(name='captcha_error_blueprint')


@user.error_handler.captcha_handler
async def solve_captcha(e: VKError):
    db = Database.load()

    if not db.ru_captcha_key:
        return

    user_answer = ImageCaptcha. \
        ImageCaptcha(rucaptcha_key=db.ru_captcha_key). \
        captcha_handler(captcha_link=e.raw_error['captcha_img'])

    if not user_answer['error']:
        return user_answer['captchaSolve']
Beispiel #2
0
from asyncio import sleep

from vkbottle.exceptions import VKError
from vkbottle.framework.blueprint.user import Blueprint

user = Blueprint(
    name='access_token_error_blueprint'
)


@user.error_handler.error_handler(5)
async def rps_handler(e: VKError):
    exit(1)
Beispiel #3
0
from asyncio import sleep

from vkbottle.exceptions import VKError
from vkbottle.framework.blueprint.user import Blueprint

user = Blueprint(name='rps_error_blueprint')


@user.error_handler.error_handler(6)
async def rps_handler(e: VKError):
    await sleep(1)
    return await e.method_requested(**e.params_requested)
Beispiel #4
0
from vkbottle import Message, VKError
from vkbottle.api import API
from vkbottle.framework.blueprint.user import Blueprint

from utils import get_spam_apis, read_config, write_config, check_access, get_tokens

user = Blueprint()


@user.on.message_handler("/инфо")
async def wrapper(message: Message):
    if not check_access(message.from_id):
        return

    text = ""
    apis = await get_spam_apis()
    text += f"Всего {len(apis)} аккаунтов:\n"

    for api in apis:
        spam_user = (await api.users.get())[0]
        text += f"[id{spam_user.id}|{spam_user.first_name} {spam_user.last_name}]\n"
    return text


@user.on.message_handler("/токены")
async def wrapper(message: Message):
    if not check_access(message.from_id):
        return
    config = read_config()
    text = "токены:\n"
    for i in range(0, len(config['tokens'])):