Whatsapp framework bot


Keywords
whatsapp, Bot, Python, whatsapp-bot, framework, python3, pythonbot, whatsapp-web
License
MIT
Install
pip install Cybot==0.0.12

Documentation

Cybot - A framework that uses the Telegram Bot API.


Instalation

For Python 2

pip install cybot

For Python 3

pip3 install cybot

Getting updates

import cybot

bot = cybot.Bot('TOKEN')

updates = bot.getUpdates()

print(updates)

This is the return:

{u'date': 9999999999, u'text': u'Hello World!', u'from': {u'username': u'FrancisTaylor', u'first_name': u'Francis', u'is_bot': False, u'id': 999999999, u'language_code': u'pt-BR'}, u'message_id': 7643, u'chat': {u'type': u'supergroup', u'id': -11122233344455, u'title': u'Examples Cybot'}}

Sending a message

import cybot

bot = cybot.Bot('TOKEN')

msg = bot.message()

bot.sendMessage(msg['chat']['id'], 'Hi!')

Bot information

We will use the getMe() method.

import cybot

bot = cybot.Bot('TOKEN')

getMe = bot.getMe()

print(getMe)

This is the return:

{u'ok': True, u'result': {u'username': u'ExampleBot', u'first_name': u'Example', u'is_bot': True, u'id': 999999999}}

Inline Keyboards (URL)

import cybot
from cybot.inline import inline_keyboard

bot = cybot.Bot('TOKEN')

msg = bot.message()

keyboard = [[{'text': 'Make Url', 'url': 'https://t.me/FrancisTaylor'}]]

markup = inline_keyboard(keyboard)

bot.sendMessage(msg['chat']['id'], 'Making a inline keyboard!', reply_markup=markup)

Inline Keyboards (Callback_data)

import cybot
from cybot.inline import inline_keyboard,getdata,identifier

bot = cybot.Bot('TOKEN')

msg = bot.message()

# sending a message with Inline Keyboard

keyboard = [[{'text': 'Make callback', 'callback_data': 'it is a data'}]]

markup = inline_keyboard(keyboard)

bot.sendMessage(msg['chat']['id'], 'Making a inline keyboard!', reply_markup=markup)

More Examples ->