Skip to content

Commit

Permalink
Merge branch 'master' of github.com:raelga/pybot
Browse files Browse the repository at this point in the history
  • Loading branch information
raelga committed Mar 19, 2019
2 parents 68b42a5 + b5140a1 commit f56de29
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .circleci/config.yml
Expand Up @@ -5,8 +5,6 @@ defaults: &defaults
jobs:
build:
<<: *defaults
docker:
- image: circleci/python:3.6.4
steps:
- checkout
- setup_remote_docker
Expand All @@ -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: |
Expand Down
6 changes: 6 additions & 0 deletions Dockerfile
@@ -1 +1,7 @@
FROM python:3-onbuild

COPY . /usr/src/pybot

WORKDIR /usr/src/pybot

CMD bin/pybot telegram
2 changes: 2 additions & 0 deletions README.md
@@ -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.
Expand Down
54 changes: 54 additions & 0 deletions pybot/common/menu.py
@@ -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.