from random import choice import string import sys import time from credentials import credentials import pandas as pd from slackclient import SlackClient from slacker import Slacker import bot_capabilities bot_capabilities = reload(bot_capabilities) from bot_capabilities import bot_capabilities from group_recommender import GroupRecommender slack_bot_token, bot_id = credentials.require(['slack_bot_token', 'bot_id']) slack = Slacker(slack_bot_token) try: r = slack.api.test() assert r.successful == True except: print("Check your tokens!") sys.exit(1) AT_BOT = "<@" + str(bot_id) + ">:" # Load recommendation engine data data_cuisine = pickle.load(open("data/user_by_cuisine_ratings.pkl", 'rb')) df_cuisine = pd.DataFrame(data_cuisine) data_items = pickle.load(open("data/user_by_cuisine_by_dish_ratings.pkl", 'rb'))
from textblob import TextBlob from TwitterAPI import TwitterAPI from TwitterAPI import TwitterRestPager from TwitterAPI import TwitterRequestError from TwitterAPI import TwitterConnectionError import pandas as pd from collections import defaultdict import time import json import os import sys from credentials import credentials #Variables that contains the user credentials to access Twitter API # Load credentials from ~/.credentials.json creds = credentials.require( ['access_token', 'access_token_secret', 'consumer_key', 'consumer_secret']) api = TwitterAPI(creds.consumer_key, creds.consumer_secret, creds.access_token, creds.access_token_secret, auth_type='oAuth2') #Grab Draft King data data_pitchers = pd.read_csv( "../Data_Engineering_Project/data/pitchers_2016_06_26.csv") data_batters = pd.read_csv( "../Data_Engineering_Project/data/batters_2016_06_26.csv") data_DK = pd.read_csv( "../Data_Engineering_Project/data/DKSalaries_2016_06_26.csv") #Grab the players
Given a group of Slack users, order the best group meal for them. """ import os from collections import namedtuple from datetime import datetime from random import choice import time from credentials import credentials from slackclient import SlackClient from slacker import Slacker from group_recommender import GroupRecommender slack_bot_token, bot_id = credentials.require(['slack_bot_token', 'bot_id']) slack = Slacker(slack_bot_token) confirmation_messages = ["Okay.", "Got it!", "Okay-dookay", "I added you to the group", "Awesome"] # constants AT_BOT = "<@" + str(bot_id) + ">:" BotDo = namedtuple("BotDo", ['response', 'action']) dialogue = {'test': BotDo("Command received", None), 'add_me': BotDo(confirmation_messages, "add_self_to_lunchers"), 'add_person': BotDo(confirmation_messages, "add_person_to_lunchers"), 'fit_model': BotDo(["Sounds good. Based on your group preferences here are my suggestions: ..."],