mirror of
https://github.com/MarkParker5/STARK.git
synced 2025-02-17 11:55:35 +02:00
remove index.html from qa
fix telegram bot voice messages
This commit is contained in:
parent
835cc16574
commit
dd84405067
@ -43,8 +43,12 @@ class TelegramBot(Control, CommandsContextManagerDelegate):
|
||||
if response.text:
|
||||
self.bot.send_message(id, response.text)
|
||||
if response.voice:
|
||||
if bytes := self.voice.generate(response.voice).getBytes():
|
||||
self.bot.send_voice(id, bytes)
|
||||
path = self.voice.generate(response.voice).path
|
||||
voiceFile = open(path, 'rb')
|
||||
try:
|
||||
self.bot.send_voice(id, voiceFile)
|
||||
finally:
|
||||
voiceFile.close()
|
||||
|
||||
# Telebot
|
||||
|
||||
|
@ -52,8 +52,6 @@ class QAHelper():
|
||||
def googleSearch(word):
|
||||
responce = requests.get(f'https://www.google.ru/search?&q={word}&lr=lang_ru&lang=ru',
|
||||
headers = {'User-Agent': 'Mozilla/5.0'})
|
||||
with open('index.html', 'wb') as f:
|
||||
f.write(responce.content)
|
||||
page = BS(responce.content, 'html.parser')
|
||||
info = page.select('div.BNeawe>div>div.BNeawe')
|
||||
return info[0].get_text() if info else ''
|
||||
|
Loading…
x
Reference in New Issue
Block a user