NambaOne BotAPI wrapper
You can install or upgrade python-nambaone-bot with:
$ pip install nambaone --upgrade
- Contructor
Bot(token,
base_url=None, # api endpoint (https://api.namba1.co by default)
error_handler=None, # error handler function that should accept Update and Error objects
# following handlers should accept Bot and Update objects
user_follow_handler=None,
user_unfollow_handler=None,
message_new_handler=None,
message_update_handler=None,
chat_new_handler=None
)- Send message
Bot.send_message(chat_id, content, content_type) # according to api docs, returns Message object or raises nambaone.ClientException- Create chat
Bot.create_chat(user_id, name='', image='') # according to api docs, returns Chat object or raises nambaone.ClientException- Start typing
Bot.typing_start(chat_id) # sends `typing` event to chat or raises nambaone.ClientException- Stop typing
Bot.typing_stop(chat_id) # sends `stoptyping` event to chat or raises nambaone.ClientExceptionupdate.message.reply_text(plain_text)
update.message.reply_typing()
update.message.reply_typing_stop()Live usage case can be found in Django Echo Bot