コード例 #1
0
def handle_command(command, channel, slack_client):
    """
        Executes bot command if the command is known
    """
    EXAMPLE_COMMAND = "do"
    response = None

    # This is where you start to implement more commands!
    if command.startswith(EXAMPLE_COMMAND):
        response = "Sure...write some more code then I can do that!"
    elif response == None:
        response = bot.questions(command)
    if response == []:
        a = []
        a.append(command)
        robo = cb.AbortGreet(a)
        response = robo.greeting()

    # Sends the response back to the channel
    try:
        slack_client.api_call("chat.postMessage",
                              channel=channel,
                              text=response)
        return response, channel
    except:
        p = "Invalid api call"
        return p
コード例 #2
0
    def test_workings2(self):
        a = ['hhhhhh']

        robo = cb.AbortGreet(a)
        response = robo.greeting()
        self.assertNotIn(response, [
            "'sup bro", "hey", "sasriakaal", "hi", "namastey",
            "awesome girl if you are"
        ])
コード例 #3
0
    def setUp(self):
        a = ["hello"]
        a1 = ["hi"]
        a2 = ["greetings"]
        a3 = ['ROFL']
        self.cw = cw.AbortGreet(a)
        self.cw1 = cw.AbortGreet(a1)
        self.cw2 = cw.AbortGreet(a2)
        self.cw3 = cw.AbortGreet(a3)
        a4 = [int(444)]
        self.cw5 = cw.AbortGreet(a4)

        self.cw4 = cw.Greet(a4)
コード例 #4
0
 def test_workings4(self):
     a = [int(5)]
     a2 = cb.AbortGreet(a)
     response = a2.greeting()
     self.assertEqual(response, 'Bot insist for retry')
コード例 #5
0
 def test_workings3(self):
     a = [int(5)]
     a1 = cb.Greet(a)
     response = a1.greeting()
     self.assertEqual(response, 'Please pass alist of greeting')