Browse Source

fix wikihow, add missing requirements (fix #15)

master
Angerstoner 4 years ago
parent
commit
9a78778731
  1. 3
      misc/requirements.txt
  2. 2
      schneiderbot_twitter.py
  3. 4
      web_requests.py

3
misc/requirements.txt

@ -1,4 +1,5 @@
python-telegram-bot
telegram
requests
praw
praw
python-twitter

2
schneiderbot_twitter.py

@ -34,7 +34,7 @@ def check_pepito_and_post_auto(bot, update):
api = get_twitter_instance()
current_status = api.GetUserTimeline(pepito_id)[0]
global last_status
if last_status == None or last_status.AsDict()['id'] != current_status.AsDict()['id']:
if last_status is None or last_status.AsDict()['id'] != current_status.AsDict()['id']:
for group_id in pepito_groups:
bot.send_message(chat_id=group_id, text=current_status.AsDict()['text'])
last_status = current_status

4
web_requests.py

@ -26,11 +26,11 @@ def send_coding_love_gif(bot, update):
bot.send_animation(chat_id=update.message.chat_id, animation=gif_url, caption=caption)
else:
update.message.reply_text("Error fetching image: %s ¯\_(ツ)_/¯" % random_url)
update.message.reply_text("Error fetching image: {} ¯\_(ツ)_/¯".format(random_url))
def send_wiki_how_article(bot, update):
random_howto = requests.get(urls["wikihow"])
howto_title = re.search('<title>(.*)</title>', random_howto.text).group(1)
howto_url = re.search('<link rel="canonical" href="(.*)" />', random_howto.text).group(1)
howto_url = re.search('<link rel="canonical" href="(.*)".*/>', random_howto.text).group(1)
update.message.reply_text(howto_title + "\n" + howto_url)
Loading…
Cancel
Save