Skip to content
Permalink
Browse files

Merge branch 'master' of github.com:raelga/pybot

  • Loading branch information
raelga committed Mar 18, 2019
2 parents 68b42a5 + b5140a1 commit f56de29d092abcf6615b8a0d418d7b27e33d7939
Showing with 63 additions and 2 deletions.
  1. +1 −2 .circleci/config.yml
  2. +6 −0 Dockerfile
  3. +2 −0 README.md
  4. +54 −0 pybot/common/menu.py
@@ -5,8 +5,6 @@ defaults: &defaults
jobs:
build:
<<: *defaults
docker:
- image: circleci/python:3.6.4
steps:
- checkout
- setup_remote_docker
@@ -22,6 +20,7 @@ jobs:
DOCKER_IMAGE_TAG=${CIRCLE_BRANCH}
echo "$DOCKER_IMAGE_NAME:$DOCKER_IMAGE_TAG" > full_docker_image_name
fi
- run:
name: Build image
command: |
@@ -1 +1,7 @@
FROM python:3-onbuild

COPY . /usr/src/pybot

WORKDIR /usr/src/pybot

CMD bin/pybot telegram
@@ -1,3 +1,5 @@
[![CircleCI](https://circleci.com/gh/raelga/pybot/tree/master.svg?style=svg)](https://circleci.com/gh/raelga/pybot/tree/master)

# pybot

Wrapper for python-telegram-bot to allow dynamic plug-in architecture, an attempt to make python-telegram-bot more hubottish.
@@ -0,0 +1,54 @@
#!/usr/bin/env python

"This module contains an object that represents a message."


class Menu(object):
"""This objectes represents a person.
Use :class:`Person` methods to get instances of this class.
Attributes:
message_id (int): Message identifier
user (:class:`pytbot.common.User`): User who sent the message
chat (:class:`pytbot.common.Chat`): Chat where the message was posted
date (:class:`datetime.datetime`): Timestamp of the message
text (str): Message text
media (str): Additional media attached to the message
menu (dict): Additional menu attached to the message
Args:
message_id (int):
user (:class:`pytbot.common.User`)
chat (:class:`pytbot.common.Chat`)
date (:class:`datetime.datetime`)
text (str): Message text
"""

def __init__(self,
menu_id,
name,
text,
callback,
options):

# Required
self.menu_id = int(menu_id)
self.name = name
self.text = text
self.callback = callback
self.options = options

def __repr__(self):
from pprint import pformat
return pformat(vars(self), indent=4, width=1)

def add_separator(self):
"Adds a empty element to the menu."
self.options.append([])

def add(self, option_title, option_value):
"Adds a new element to the menu."
self.options.append([option_title, option_value])

0 comments on commit f56de29

Please sign in to comment.
You can’t perform that action at this time.