Beispiel #1
0
def handle_command(command, channel, ts):	
    response = "We still need to add this command"
    if command.startswith('show karik'):
        response = "https://ibb.co/goaOgF"

    elif command.startswith('ace song'):
        response = ace_song()

    elif command.startswith('web'):
        response = r"\\dom1\data\hq\102pf\shared\group_lcdshd2\analytical services\cicfas\teams\ace\projects\20 ddd frontpage - discovery-alpha\datainput\index.html"
    elif command.startswith('file link'):
        response = r"\\dom1\data\hq\102pf\shared\group_lcdshd2\analytical services\cicfas\teams\ace" + "\\" + command[10:]
    elif command =="tumbleweed":
        response = "https://media.giphy.com/media/5x89XRx3sBZFC/giphy.gif"

    elif command == "doc library":
        response = "coding doc, folder doc, learn python, learn R, data security, software doc"
    elif command == "coding doc":
        response = "https://docs.google.com/document/d/1bqVkH9k4Nv4Av_-Lvewcl6un_aedOkK6v4s7Nm0V_Qk/edit"
    elif command =="folder doc":
        response = "https://docs.google.com/document/d/1BL57inTbBxukVJ_ti35L7fz_Un1WYybSkRi8UKEb1tA/edit#heading=h.6v5ejfe0vgdg"
    elif command == "learn python":
        response = "https://docs.google.com/document/d/1aAeiiXhrAVZPVrbKK3k6ELxbZyeKuTHnr2-pCIyAtfQ/edit#heading=h.dqyv71zc3gzp"
    elif command =="learn R":
        response = "https://docs.google.com/document/d/1R4hBMf26T9HEnCdVz56PpZhwiCv5RhberYL3BxOSKsA/edit"
    elif command == "software doc":
        response = "https://docs.google.com/document/d/1avLqSnh6cB5FFktr1PZZbWTstkuWlGOHGBLeREA_ow4/edit?pli=1"
    elif command.startswith('data security'):
        response = r"\\dom1\data\hq\102pf\shared\group_lcdshd2\analytical services\cicfas\teams\ace\policies\20160712 data security and the macbook platform final.doc"

    elif 'dsh' in command or 'dash' in command:
        response = "AceBot does not recognise this team name.  Please use 'ACE' or 'the team formerly known as ACE' when talking to me"

    elif 'pie chart' in command:
        response = "AceBot is disgusted by pie charts.  They are held in the same regard as the name DaSH."

    elif 'weather' in command:
        response = "It is always sunny in the land of ACE."

    elif command.startswith('magic8'):
    	response = magic_8()
    
    elif command == "help":
    	response = help()

    elif command =="github":
        response = "https://github.com/rosswyatt/acebot"
        
    elif command =="benugo menu":
        response = menu()

    elif command =="halloumi":
        answer = menu_search("halloumi")
        if answer[0]:
            response = ("%s available on %s" % answer[1],answer[0])
        else:
            response = ("Sadness, no halloumi this week.")
        answer = None
    elif command.startswith('i want'):
        eats = command[7:]
        response = halloumi(eats)
    elif command.startswith('python'):
        response=pyHelp(command)



    slack_client.api_call("chat.postMessage", channel=channel, text=response, as_user=True)
Beispiel #2
0
def handle_command(command, channel, ts, user):
    response = "We still need to add this command"
    if command.startswith('show karik'):
        response = "https://ibb.co/goaOgF"

    elif command.startswith('ace song'):
        response = ace_song()

    elif command.startswith('web'):
        response = r"\\dom1\data\hq\102pf\shared\group_lcdshd2\analytical services\cicfas\teams\ace\projects\20 ddd frontpage - discovery-alpha\datainput\index.html"
    elif command.startswith('file link'):
        response = r"\\dom1\data\hq\102pf\shared\group_lcdshd2\analytical services\cicfas\teams\ace" + "\\" + command[
            10:]
    elif command == "tumbleweed":
        response = "https://media.giphy.com/media/5x89XRx3sBZFC/giphy.gif"

    elif command == "doc library":
        response = "coding doc, folder doc, learn python, learn R, data security, software doc"
    elif command == "coding doc":
        response = "https://docs.google.com/document/d/1bqVkH9k4Nv4Av_-Lvewcl6un_aedOkK6v4s7Nm0V_Qk/edit"
    elif command == "folder doc":
        response = "https://docs.google.com/document/d/1BL57inTbBxukVJ_ti35L7fz_Un1WYybSkRi8UKEb1tA/edit#heading=h.6v5ejfe0vgdg"
    elif command == "learn python":
        response = "https://docs.google.com/document/d/1aAeiiXhrAVZPVrbKK3k6ELxbZyeKuTHnr2-pCIyAtfQ/edit#heading=h.dqyv71zc3gzp"
    elif command == "learn R":
        response = "https://docs.google.com/document/d/1R4hBMf26T9HEnCdVz56PpZhwiCv5RhberYL3BxOSKsA/edit"
    elif command == "software doc":
        response = "https://docs.google.com/document/d/1avLqSnh6cB5FFktr1PZZbWTstkuWlGOHGBLeREA_ow4/edit?pli=1"
    elif command.startswith('data security'):
        response = r"\\dom1\data\hq\102pf\shared\group_lcdshd2\analytical services\cicfas\teams\ace\policies\20160712 data security and the macbook platform final.doc"

    elif 'dsh' in command or 'dash' in command:
        response = "AceBot does not recognise this team name.  Please use 'ACE' or 'the team formerly known as ACE' when talking to me"

    elif 'pie chart' in command:
        response = "AceBot is disgusted by pie charts.  They are held in the same regard as the name DaSH."

    elif command.startswith('weather'):
        response = weather_emoji(command)

    elif command.startswith('magic8'):
        response = magic_8()

    elif command == "help":
        response = help()

    elif command == "github":
        response = "https://github.com/rosswyatt/acebot"

    elif command == "benugo menu":
        response = menu()

    elif command == "halloumi":
        answer = menu_search("halloumi")
        if answer[0]:
            response = ("%s available on %s" % answer[1], answer[0])
        else:
            response = ("Sadness, no halloumi this week.")
        answer = None
    elif command.startswith('i want'):
        eats = command[7:]
        response = halloumi(eats)
    elif command.startswith('python'):
        response = pyHelp(command)

    elif command.startswith('what project'):
        response = handle_who_what(command)

    elif command.startswith('who knows'):
        response = return_expert(command)
    elif command.startswith('i know'):
        response = add_expert(command, user)

    elif command.startswith('pf'):
        response = pf(command)

    elif command.startswith('allocate'):
        response = shitty_task(command)

    elif command.startswith('next holiday'):
        response = nh()

    elif command.startswith('random song'):
        response = song_url()

    elif command.startswith("traintimes"):
        try:
            results = CallTrainTimes(command)
            for response in results:
                slack_client.api_call("chat.postMessage",
                                      channel=channel,
                                      text=response,
                                      as_user=True)
            response = "Have a lovely journey"
        except (UnboundLocalError, ValueError, urllib.error.HTTPError):
            response = "For train times, type traintimes [origin destination time(optional) date(optional)] \
            time in 24hr e.g. 15:00, date in format yyyy-mm-dd"

    elif command.startswith('book a room'):
        try:
            results = roomcleaning(command)
            for response in results:
                response = "Your search results have opened in the browser"
        except ():
            response = "To book a room, type book a room [now/today/tomorrow/thisweek/nextweek] [number of people] [length(minutes)]"
    elif "stats" in command:
        cdummy = command.replace("stats", "")
        response = linker(cdummy)

    elif command.startswith("calculate"):
        response = InputsCalc(command)

    slack_client.api_call("chat.postMessage",
                          channel=channel,
                          text=response,
                          as_user=True)
Beispiel #3
0
def handle_command(command, channel, ts):
    response = "We still need to add this command"
    if command.startswith('show karik'):
        response = "https://ibb.co/goaOgF"

    elif command.startswith('ace song'):
        response = ace_song()

    elif command.startswith('file link'):
        response = r"\\dom1\data\hq\102pf\shared\group_lcdshd2\analytical services\cicfas\teams\ace" + "\\" + command[
            10:]
    elif command == "tumbleweed":
        response = "https://media.giphy.com/media/5x89XRx3sBZFC/giphy.gif"

    elif command == "doc library":
        response = "coding doc, folder doc, learn python, learn R, data security, software doc"
    elif command == "coding doc":
        response = "https://docs.google.com/document/d/1bqVkH9k4Nv4Av_-Lvewcl6un_aedOkK6v4s7Nm0V_Qk/edit"
    elif command == "folder doc":
        response = "https://docs.google.com/document/d/1BL57inTbBxukVJ_ti35L7fz_Un1WYybSkRi8UKEb1tA/edit#heading=h.6v5ejfe0vgdg"
    elif command == "learn python":
        response = "https://docs.google.com/document/d/1aAeiiXhrAVZPVrbKK3k6ELxbZyeKuTHnr2-pCIyAtfQ/edit#heading=h.dqyv71zc3gzp"
    elif command == "learn R":
        response = "https://docs.google.com/document/d/1R4hBMf26T9HEnCdVz56PpZhwiCv5RhberYL3BxOSKsA/edit"
    elif command == "software doc":
        response = "https://docs.google.com/document/d/1avLqSnh6cB5FFktr1PZZbWTstkuWlGOHGBLeREA_ow4/edit?pli=1"
    elif command.startswith('data security'):
        response = r"\\dom1\data\hq\102pf\shared\group_lcdshd2\analytical services\cicfas\teams\ace\policies\20160712 data security and the macbook platform final.doc"
    elif command.startswith('webpage'):
        response = "http://dash.mojanalytics.xyz/"
    elif command.startswith('it number'):
        response = "0800 783 0162"
    elif command.startswith('name my project'):
        response = projectnamer()
    elif command.startswith('wutang my project'):
        response = wutang(command)

    elif 'dsh' in command or 'dash' in command:
        response = "AceBot does not recognise this team name.  Please use 'ACE' or 'the team formerly known as ACE' when talking to me"

    elif 'pie chart' in command:
        response = "AceBot is disgusted by pie charts.  They are held in the same regard as the name DaSH."

    elif command.startswith('weather'):
        response = weather_emoji(command)

    elif command.startswith('magic8'):
        response = magic_8()

    elif command == "help":
        response = help()

    elif command == "github":
        response = "https://github.com/rosswyatt/acebot"

    elif command == "benugo menu":
        response = menu()

    elif command == "halloumi":
        answer = menu_search("halloumi")
        if answer[0]:
            response = ("%s available on %s" % answer[1], answer[0])
        else:
            response = ("Sadness, no halloumi this week.")
        answer = None
    elif command.startswith('i want'):
        eats = command[7:]
        response = halloumi(eats)
    elif command.startswith('python'):
        response = pyHelp(command)

    elif command.startswith('what project'):
        response = handle_who_what(command)

    elif command.startswith('next holiday'):
        response = nh()

    elif command.startswith('random song'):
        response = song_url()

    elif command.startswith("traintimes"):
        try:
            results = CallTrainTimes(command)
            for response in results:
                slack_client.api_call("chat.postMessage",
                                      channel=channel,
                                      text=response,
                                      as_user=True)
            response = "Safe travels"
        except (UnboundLocalError, ValueError):
            response = "For train times, type traintimes [origin destination time(optional) date(optional)] \
            time in 24hr e.g. 15:00, date in format ddmmyy"

    elif command.startswith('book a room'):
        try:
            results = roomcleaning(command)
            for response in results:
                response = "Your search results have opened in the browser"
        except ():
            response = "To book a room, type book a room [now/today/tomorrow/thisweek/nextweek] [number of people] [length(minutes)]"
    elif "stats" in command:
        cdummy = command.replace("stats", "")
        response = linker(cdummy)

    elif command.startswith("calculate"):
        response = "The calculator has been disabled due to abuse, sorry"

    elif command.startswith("allocate  "):
        response = "The winner is <@apoulton> again"
    elif command.startswith("allocate"):
        response = shitty_task(command)

    elif command.startswith("what are you thinking"):
        response = random_musings()

    elif command.startswith("prison population"):
        k = prisStats.handleResponse(command)
        if len(k) > 10:
            response = k
        else:
            slack_client.api_call("chat.postMessage",
                                  channel=channel,
                                  text="Total prisoners: " + str(k[0] + k[1]),
                                  as_user=True)
            slack_client.api_call("chat.postMessage",
                                  channel=channel,
                                  text="Male prisoners: " + str(k[0]),
                                  as_user=True)
            slack_client.api_call("chat.postMessage",
                                  channel=channel,
                                  text="Female prisoners: " + str(k[1]),
                                  as_user=True)
            response = "Figures correct as of " + str(k[2])
        if not k[3]:
            response = "It looks like you were looking for older figures, but I couldn't work out which ones.  Sorry about that."

    slack_client.api_call("chat.postMessage",
                          channel=channel,
                          text=response,
                          as_user=True)