import os

from slackbot.bot import respond_to
from slackbot.bot import listen_to
from wit import Wit

from wit_actions import actions

wit_client = Wit(
        access_token=os.environ['WIT_API_TOKEN'], 
        actions=actions
        )

@respond_to('')
def wit(message):
    message.react('+1')
    message.reply('You said: ' + message.body['text'])

    wit_client.run_actions('asdf', message.body['text'])

@@ -2,16 +2,44 @@
 mport os
+%0Aimport random%0Aimport string
 %0A%0Afrom s
@@ -265,175 +265,361 @@
  )%0A%0A
-@respond_to('')%0Adef wit(message):%0A    message.react('+1')%0A    message.reply('You said: ' + message.body%5B'text'%5D)%0A%0A    wit_client.run_actions('asdf', message.body%5B'text'%5D
+wit_context = %7B%7D%0A%0Adef random_word(length):%0A   return ''.join(random.choice(string.lowercase) for i in range(length))%0A%0A@respond_to('')%0Adef wit(message):%0A    global wit_context%0A%0A    message.react('+1')%0A%0A    wit_context = wit_client.run_actions(%0A                    random_word(10), %0A                    message.body%5B'text'%5D, %0A                    wit_context
 )%0A

Create new session on restart