Пример #1
0
async def process_start_command(message: types.Message):
    if len(message.get_args()) != 0:
        contents = requests.get(
            f'{scathachBase}/{api.yande()}/?tags={message.get_args()}').json()
        getItem = contents['url']
        if not getItem:
            await bot.send_message(message.from_user.id,
                                   text=decorator.ErrorFlag())
            logger.info(decorator.badrequestMsg() + message.get_args())
        else:
            await bot.send_message(message.from_user.id, text=getItem)
            logger.info(decorator.successMsg() + message.get_args())

    else:
        await message.answer(decorator.ngaturArgs())
Пример #2
0
async def process_start_command(message: types.Message):
    if len(message.get_args()) != 0:
        contents = requests.get(
            f'https://nekos.life/api/v2/img/{message.get_args()}').json()
        try:
            getItem = contents['url']
            await bot.send_animation(message.from_user.id, getItem)
            logger.info(decorator.successMsg() + message.get_args())

        except:
            await bot.send_message(message.from_user.id,
                                   text=decorator.ErrorFlag())
            logger.info(decorator.badrequestMsg() + message.get_args())
    else:
        await message.answer(decorator.ngaturArgs() + "\n" + decorator.nekos())
Пример #3
0
async def process_start_command(message: types.Message):
    if len(message.get_args()) != 0:
        spell = message.get_args().lower()
        contents = requests.get(
            f'{scathachBase}/{api.crypto()}/?tags={spell}').json()
        getCoin = contents['coin']
        if not getCoin:
            await bot.send_message(message.from_user.id,
                                   text=decorator.ErrorFlag())
            logger.info(decorator.badrequestMsg() + spell)
        else:
            await message.answer(getCoin)
            logger.info(decorator.successMsg() + spell)

    else:
        await message.answer(decorator.ngaturArgs())
Пример #4
0
async def process_start_command(message: types.Message):
    if len(message.get_args()) != 0:
        text = message.get_args().replace(" ", "_")
        heroesName = text.title()
        for r in (("Of", "of"), ("The", "the")):
            heroesName = heroesName.replace(*r)

        contents = requests.get(
            f'{scathachBase}/hero/?tags={heroesName}').json()
        getItem = contents['url']
        gb = f'https://www.dotabuff.com/assets/heroes/{text.replace("_","-").lower()}.jpg'
        if not getItem:
            await bot.send_message(message.from_user.id,
                                   text=decorator.ErrorFlag() +
                                   decorator.badHero())
            logger.info(decorator.badrequestMsg() + heroesName)
        else:
            await bot.send_photo(message.from_user.id,
                                 photo=gb,
                                 caption=getItem)
            logger.info(decorator.successMsg() + heroesName)

    else:
        await message.answer(decorator.ngaturArgs())