Skip to main content

Bot framework for Vk.com

Project description

Как пользоваться

Установка

pip install vk-api botframe

Пример

from botframe import Bot


bot = Bot('123abc', 123465)


@bot.arg()
def name(event, bot):
    text = event.message['text'].split()
    if len(text) > 2:
        for num in range(2, len(text)):
            if " ".join([text[num-2], text[num-1]]).lower() == 'i am':
                return text[num]
    return None


@bot.command(["i am"], all_text=True)
def hello(api, name):
    if name:
        message = f"Hello, {name}"
    else:
        message = f"Hello"
    api.reply(message=message)
    return "world"


if __name__ == "__main__":
    bot.run()
>> Hello, Bot. I am Eugene
<< Hello, Eugene

>> word word i am
<< Hello

Спасибо python273 за vk_api, который используется в этом проекте как бэкэнд.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

botframe-0.0a4.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

botframe-0.0a4-py3-none-any.whl (15.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page