Implement separate function to send random tweet

main
Hammy 4 years ago
parent d16c8b22d7
commit c16910706e

@ -1,5 +1,4 @@
import logging import logging
import random
from bot.winston import Winston from bot.winston import Winston
@ -22,4 +21,4 @@ def event_handler(event, context):
for key, values in event.items(): for key, values in event.items():
Actions[key](values) Actions[key](values)
winston.send_tweet(random.choice(winston.potential_tweets)) winston.send_random_tweet()

@ -1,3 +1,5 @@
import random
import filetype as filetype import filetype as filetype
from twython import Twython from twython import Twython
@ -16,7 +18,7 @@ class Winston:
"I didn't pay my taxes!", "I didn't pay my taxes!",
"I'm wanted in over 60 countries! I'm still on the run :D", "I'm wanted in over 60 countries! I'm still on the run :D",
"Overwatch", "Overwatch",
] ]
def send_tweet(self, tweet_text): def send_tweet(self, tweet_text):
@ -24,6 +26,11 @@ class Winston:
self.bot.update_status(status=tweet_text) self.bot.update_status(status=tweet_text)
def send_random_tweet(self):
"""Tweet something random from potential tweets"""
self.bot.update_status(status=random.choice(self.potential_tweets))
def tweet_with_media(self, text_and_media): def tweet_with_media(self, text_and_media):
"""Tweet with media + optional text""" """Tweet with media + optional text"""

Loading…
Cancel
Save