Added help command !movie-help or !tvshow-help

This commit is contained in:
lomion 2020-06-26 17:43:13 +02:00
parent 0eafc0fc3c
commit 8408c63191
2 changed files with 36 additions and 1 deletions

View file

@ -2,6 +2,8 @@
A [maubot](https://github.com/maubot/maubot) to get information about movies from [TheMovieDB.org](https://www.themoviedb.org/). A [maubot](https://github.com/maubot/maubot) to get information about movies from [TheMovieDB.org](https://www.themoviedb.org/).
## Usage ## 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-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-search {title} [y:{release year}]` to get movie detail based on the given title.

View file

@ -39,6 +39,17 @@ class TmdbBot(Plugin):
formatted_body=f"{html_message}") formatted_body=f"{html_message}")
await evt.respond(content) await evt.respond(content)
async def send_help(self, evt: MessageEvent) -> None:
html = """Use <b>!movie-id {tmdb id}</b> to get movie detail for tmdb-id.</br>
Use <b>!movie-search {title} [y:{release year}]</b> to get movie detail based on the given title.</br>
Use <b>!movie-language {language}</b> to set your prefered language.</br>
Use <b>!tvshow-search {title}</b> to get detail about a tv show based on the given title.</br>"""
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: async def send_image(self, evt: MessageEvent, title, image) -> None:
mxc_uri = await self.client.upload_media(image) mxc_uri = await self.client.upload_media(image)
content = MediaMessageEventContent( content = MediaMessageEventContent(
@ -114,6 +125,14 @@ class TmdbBot(Plugin):
body=f"Language set to {message}!") body=f"Language set to {message}!")
await evt.respond(content) 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.new("tvshow-search", help="TV Show lookup by Title")
@command.argument("message", pass_raw=True, required=True) @command.argument("message", pass_raw=True, required=True)
async def tvshow_search(self, evt: MessageEvent, message: str = "") -> None: async def tvshow_search(self, evt: MessageEvent, message: str = "") -> None:
@ -129,3 +148,17 @@ class TmdbBot(Plugin):
msgtype=MessageType.NOTICE, format=Format.HTML, msgtype=MessageType.NOTICE, format=Format.HTML,
body=f"No tv show found!") body=f"No tv show found!")
await evt.respond(content) 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"""<p>Use !movie-id {tmdb id} to get movie detail for tmdb-id.</p>
<p>Use !movie-search {title} [y:{release year}] to get movie detail based on the given title.</p>
<p>Use !movie-language {language} to set your prefered language.</p>
<p>Use !tvshow-search {title} to get detail about a tv show based on the given title.</p>""")
await evt.respond(content)'''