bots: Rename BotHandlerApi object client
to bot_handler
.
This commit is contained in:
parent
c193443541
commit
fcb4cf6721
24 changed files with 91 additions and 91 deletions
|
@ -8,14 +8,14 @@ class YoutubeHandler(object):
|
|||
This bot will return the first Youtube search result for the give query.
|
||||
'''
|
||||
|
||||
def handle_message(self, message, client, state_handler):
|
||||
def handle_message(self, message, bot_handler, state_handler):
|
||||
help_content = '''
|
||||
To use the, Youtube Bot send `@mention-bot search terms`
|
||||
Example:
|
||||
@mention-bot funny cats
|
||||
'''.strip()
|
||||
if message['content'] == '':
|
||||
client.send_reply(message, help_content)
|
||||
bot_handler.send_reply(message, help_content)
|
||||
else:
|
||||
text_to_search = message['content']
|
||||
url = "https://www.youtube.com/results?search_query=" + text_to_search
|
||||
|
@ -24,8 +24,8 @@ class YoutubeHandler(object):
|
|||
video_id = soup.find(attrs={'class': 'yt-uix-tile-link'})
|
||||
try:
|
||||
link = 'https://www.youtube.com' + video_id['href']
|
||||
client.send_reply(message, link)
|
||||
bot_handler.send_reply(message, link)
|
||||
except TypeError:
|
||||
client.send_reply(message, 'No video found for specified search terms')
|
||||
bot_handler.send_reply(message, 'No video found for specified search terms')
|
||||
|
||||
handler_class = YoutubeHandler
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue