Created
May 28, 2016 03:42
-
-
Save Kannanravindran/7b92eb05d244ee61eae3838740078b89 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def slackpush(data): | |
# print data | |
global bufferflush | |
global datalist | |
global eof | |
if eof == '': | |
pass | |
else: | |
data = data.partition(eof)[2] | |
print data | |
temp = data.replace('.','.@') | |
# print data | |
temp = temp.split('@') | |
# print temp | |
for each in temp: | |
datalist.append(each) | |
if datalist[-1] == '.' or datalist[-1] == '': | |
for each in datalist: | |
bufferflush.append(each) | |
else: | |
for each in datalist[:-1]: | |
bufferflush.append(each) | |
datalist.remove(each) | |
# eof = temp[-1] | |
# bufferflush = bufferflush+data | |
# print bufferflush | |
if len(bufferflush) >5: | |
print "sending to slack" | |
outputtext = ' '.join(bufferflush) | |
if outputtext == '': | |
continue | |
sc.api_call('chat.postMessage',as_user='true',channel=chan,text='\n'+outputtext) | |
eof = bufferflush[-1] | |
bufferflush = [] | |
if len(bufferflush) > 0: | |
print "kamahameha" | |
print eof | |
print '\n\n' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment