Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:raelga/pybot
- Loading branch information
Showing
4 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
FROM python:3-onbuild | ||
|
||
COPY . /usr/src/pybot | ||
|
||
WORKDIR /usr/src/pybot | ||
|
||
CMD bin/pybot telegram |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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]) |