Fixed MoviesPopular
This commit is contained in:
parent
28c2a9e474
commit
16336d61f3
|
@ -161,11 +161,15 @@ class TmdbBot(Plugin):
|
|||
|
||||
async def movie_popular(self, evt: MessageEvent, message: str = "") -> None:
|
||||
popular = MoviePopular()
|
||||
await popular.load_parameters()
|
||||
language = self.db.get_language(evt.sender)
|
||||
if language:
|
||||
popular.set_language(language)
|
||||
length = 5
|
||||
await self.send_html_message(evt, popular.getListText(length), popular.getListHtml(length))
|
||||
await popular.query()
|
||||
text = popular.getListText(length)
|
||||
html = popular.getListHtml(length)
|
||||
await self.send_html_message(evt, text, html)
|
||||
|
||||
@command.new("movie-search", help="Movie lookup by Title")
|
||||
@command.argument("message", pass_raw=True, required=True)
|
||||
|
|
|
@ -88,14 +88,13 @@ class MoviePopular(TmdbApi):
|
|||
self.list = []
|
||||
self.length = 0
|
||||
|
||||
def query(self) -> int:
|
||||
result = self.request('/movie/popular')
|
||||
async def query(self) -> int:
|
||||
result = await self.request('/movie/popular')
|
||||
self.length = result['total_results']
|
||||
self.list = result['results']
|
||||
return self.length
|
||||
|
||||
def getListHtml(self, length: int = None) -> str:
|
||||
self.query()
|
||||
html = ""
|
||||
if length:
|
||||
loop = length
|
||||
|
@ -106,7 +105,6 @@ class MoviePopular(TmdbApi):
|
|||
return html
|
||||
|
||||
def getListText(self, length: int = None) -> str:
|
||||
self.query()
|
||||
text = ""
|
||||
if length:
|
||||
loop = length
|
||||
|
|
Loading…
Reference in a new issue