def refresh(): rost = Roster("password.json", "EAST") rost.setEmployees() rost.setOutOfQueue() s = SlackBot() s.refreshOOQ() print(f"Refresh Complete! Value of inTraining: {s.inTraining}")
def daily(): rost = Roster("password.json", "EAST") rost.setEmployees() rost.setOutOfQueue() s = SlackBot() print("From cron.py") print(s.inTraining) if s.inTraining: for engineer in s.inTraining: s.setStatus(engineer) s.msgOutOfQueue() s.msgAllStaff()
def daily(): rost = Roster("password.json", "EAST") rost.setEmployees() rost.setOutOfQueue() s = SlackBot() print("From cron.py") #debugging print(s.inTraining) #iterate through list of CEs that are out of queue if s.inTraining: for engineer in s.inTraining: s.setStatus(engineer) #send message to staff channels with current out of queue people s.msgOutOfQueue() s.msgAllStaff()
def post_install(): # Retrieve the auth code from the request params auth_code = request.args['code'] name = request.args['state'].split(' ') first_name = name[0] if len(name) == 3: last_name = name[2] first_name += ' ' + name[1] else: last_name = name[1] client = slack.WebClient(token="") # Request the auth tokens from Slack response = client.oauth_access(client_id=client_id, client_secret=client_secret, code=auth_code) # Save the token to an to data store for later use person = { 'access_token': response['access_token'], 'user_id': response['user_id'], } employees.update({ 'first_name': first_name, 'last_name': last_name }, {'$set': person}, upsert=False) r = Roster("password.json", "EAST") r.setOutOfQueue() #set the user to Out of Queue if it is their OOQ day completed = employees.find_one({ 'first_name': first_name, 'last_name': last_name }) choose_command.apply_async(args=("run", response['user_id']), queue="commands") return "Auth complete! You will receive a notification on your Out of Queue day, and your status will be updated! \n\n Please check out #sup-ooq for discussion"
import os import json from slackbot import SlackBot from roster import Roster rost = Roster("password.json", "EAST") rost.setEmployees() rost.setOutOfQueue() s = SlackBot() print("From cron.py") print(s.inTraining) if s.inTraining: for engineer in s.inTraining: s.setStatus(engineer) s.msgOutOfQueue() s.msgAllStaff()