def orders(): """Handle orders given to the bot via replies""" log = config.log_file time = config.time_tolerance master = config.master_account ban_command = config.ban_command master_account = config.master_account mentions = requests.mentions(config.bot_account, api) mentions = requests.mentions(config.bot_account, config.api) master_mentions = requests.master_mentions(mentions, log, master_account) relevant_mentions = requests.relevant_mentions(mentions, log, time) for tweet in relevant_mentions: if requests.is_img_request(tweet, config.request_command): if requests.mentions_third_user(tweet): respond_to_gift_request(tweet) else: respond_to_simple_request(tweet) for tweet in master_mentions: if requests.is_delete_order(tweet, master, ban_command): id_to_delete = tweet.in_reply_to_status_id timeline.delete_tweet_by_id(tweet.in_reply_to_status_id, api) banner.ban_image_by_tweet_id(id_to_delete, config.banned_file, config.log_file) logger.add_banned_to_log(post_number, tweet.id, config.log_file)
def orders(): """Handle orders given to the bot via replies""" mentions = requests.mentions(config.bot_account, config.api) relevant_mentions = requests.relevant_mentions(mentions, config.log_file) master = config.master_account ban_command = config.ban_command for tweet in relevant_mentions: if requests.is_delete_order(tweet, master, ban_command): timeline.delete_last_tweet(api) banner.ban_last_image(config.banned_file, config.log_file) logger.addBanned(tweet.id, config.log_file) if requests.is_img_request(tweet, config.request_command): if requests.mentions_third_user(tweet): respond_to_gift_requests(tweet) else: respond_to_simple_request(tweet)