Add docstrings #189
30
app/meme.py
30
app/meme.py
@ -20,6 +20,7 @@ TEMPLATES = img.get_templates()
|
|||||||
|
|
||||||
|
|
||||||
class MakeMemeCommand(Command):
|
class MakeMemeCommand(Command):
|
||||||
|
"""Class for initial Webex interactive card."""
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
super().__init__(
|
super().__init__(
|
||||||
command_keyword="/meme",
|
command_keyword="/meme",
|
||||||
@ -98,6 +99,7 @@ class MakeMemeCommand(Command):
|
|||||||
|
|
||||||
|
|
||||||
class MakeMemeCallback(Command):
|
class MakeMemeCallback(Command):
|
||||||
|
"""Class to process user data and return meme."""
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
super().__init__(
|
super().__init__(
|
||||||
card_callback_keyword="make_meme_callback_rbamzfyx",
|
card_callback_keyword="make_meme_callback_rbamzfyx",
|
||||||
@ -123,19 +125,21 @@ class MakeMemeCallback(Command):
|
|||||||
|
|
||||||
return "Generating your meme..."
|
return "Generating your meme..."
|
||||||
|
|
||||||
def execute(self, message, attachment_actions, activity) -> str:
|
def execute(self, message, attachment_actions, activity) -> Response | None:
|
||||||
if not self.error:
|
if self.error:
|
||||||
self.meme_filename: str = img.generate_api_url(
|
return None
|
||||||
self.meme, self.text_top, self.text_bottom
|
|
||||||
)
|
self.meme_filename: str = img.generate_api_url(
|
||||||
msg: Response = Response(
|
self.meme, self.text_top, self.text_bottom
|
||||||
attributes={
|
)
|
||||||
"roomId": activity["target"]["globalId"],
|
msg: Response = Response(
|
||||||
"parentId": "",
|
attributes={
|
||||||
"files": [self.meme_filename],
|
"roomId": activity["target"]["globalId"],
|
||||||
}
|
"parentId": "",
|
||||||
)
|
"files": [self.meme_filename],
|
||||||
return msg
|
}
|
||||||
|
)
|
||||||
|
return msg
|
||||||
|
|
||||||
def post_execute(self, message, attachment_actions, activity) -> None:
|
def post_execute(self, message, attachment_actions, activity) -> None:
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user