diff --git a/README.md b/README.md index 4ada9d9..c0164cd 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ A [maubot](https://github.com/maubot/maubot) to get information about movies from [TheMovieDB.org](https://www.themoviedb.org/). ## Usage +Use `!movie-help` to get help about the bot usage. + Use `!movie-id {tmdb id}` to get movie detail for tmdb-id. Use `!movie-search {title} [y:{release year}]` to get movie detail based on the given title. diff --git a/tmdb/tmdb.py b/tmdb/tmdb.py index 2afd256..f298746 100644 --- a/tmdb/tmdb.py +++ b/tmdb/tmdb.py @@ -39,6 +39,17 @@ class TmdbBot(Plugin): formatted_body=f"{html_message}") await evt.respond(content) + async def send_help(self, evt: MessageEvent) -> None: + html = """Use !movie-id {tmdb id} to get movie detail for tmdb-id.
+ Use !movie-search {title} [y:{release year}] to get movie detail based on the given title.
+ Use !movie-language {language} to set your prefered language.
+ Use !tvshow-search {title} to get detail about a tv show based on the given title.
""" + content = TextMessageEventContent( + msgtype=MessageType.TEXT, format=Format.HTML, + body=f"Help for TMDB Bot", + formatted_body=f"{html}") + await evt.respond(content) + async def send_image(self, evt: MessageEvent, title, image) -> None: mxc_uri = await self.client.upload_media(image) content = MediaMessageEventContent( @@ -114,6 +125,14 @@ class TmdbBot(Plugin): body=f"Language set to {message}!") await evt.respond(content) + @command.new("movie-help", help="Help for TMDB Bot") + async def movie_help(self, evt: MessageEvent, message: str = "") -> None: + await self.send_help(evt) + + @command.new("tvshow-help", help="Help for TMDB Bot") + async def tvshow_help(self, evt: MessageEvent, message: str = "") -> None: + await self.send_help(evt) + @command.new("tvshow-search", help="TV Show lookup by Title") @command.argument("message", pass_raw=True, required=True) async def tvshow_search(self, evt: MessageEvent, message: str = "") -> None: @@ -128,4 +147,18 @@ class TmdbBot(Plugin): content = TextMessageEventContent( msgtype=MessageType.NOTICE, format=Format.HTML, body=f"No tv show found!") - await evt.respond(content) \ No newline at end of file + await evt.respond(content) + +# @command.new("movie-help", help="Help text") +''' @command.new("tvshow-help", help="Help text") + @command.argument("message", pass_raw=True, required=True) + async def movie_help(self, evt: MessageEvent, message: str = "") -> None: + content = TextMessageEventContent( + msgtype=MessageType.NOTICE, format=Format.HTML, + body=f"Help for TMDB Bot") + , + formatted_body = f"""

Use !movie-id {tmdb id} to get movie detail for tmdb-id.

+

Use !movie-search {title} [y:{release year}] to get movie detail based on the given title.

+

Use !movie-language {language} to set your prefered language.

+

Use !tvshow-search {title} to get detail about a tv show based on the given title.

""") + await evt.respond(content)''' \ No newline at end of file