fuuslack
fuuslack
useless crap slack stuff.
Send messages to both Slack and Twitter.
Would like to add messages i reply and responces but don't want to get in trouble with organisers.
In [3]:
import slacker
from TwitterFollowBot import TwitterBot
import getpass
In [7]:
myusr = getpass.getuser()
In [ ]:
In [8]:
my_bot = TwitterBot('/home/' + myusr + '/config.txt')
In [ ]:
In [9]:
opslkey = open('/home/' + myusr + '/Downloads/slacker.txt', 'r')
In [10]:
rdops = opslkey.read()
In [11]:
stslack = rdops.strip('\n')
In [12]:
slack = slacker.Slacker(stslack)
# Send a message to #general channel
# Get users list
response = slack.users.list()
users = response.body['members']
In [13]:
lusr = len(users)
In [14]:
lusr
Out[14]:
In [15]:
slms = slack.search.messages('irc')
In [16]:
matlens = len(slms.body['messages']['matches'])
In [17]:
matlens
Out[17]:
In [18]:
for mlen in range(0, matlens):
print(mlen)
print((slms.body['messages']['matches'][mlen]['previous']['text'][0:90]))
print((slms.body['messages']['matches'][mlen]['previous']['username']))
#Got in trouble for tweeting others slack messages so disabling this and just
#using
#input to send messages to both slack and twitter.
#my_bot.send_tweet(slms.body['messages']['matches'][mlen]['previous']['username'] + ': ' + (slms.body['messages']['matches'][mlen]['previous']['text'][0:90]) + ' #lca2016')
print((slms.body['messages']['matches'][mlen]['text'][0:90]))
print((slms.body['messages']['matches'][mlen]['username']))
print((slms.body['messages']['matches'][mlen]['next']['text'][0:120]))
print((slms.body['messages']['matches'][mlen]['next']['username']))
#my_bot.send_tweet((slms.body['messages']['matches'][mlen]['username']) + ': ' + )
In [172]:
(slms.body['messages']['matches'][0]['next']['text'])
Out[172]:
In [173]:
schli = slack.channels.list()
In [174]:
for slchan in range(0, len(schli.body['channels'])):
print(slchan)
print(schli.body['channels'][slchan]['name'])
In [22]:
poswhat = input('What to post: ')
In [23]:
slack.chat.post_message('#general', poswhat, as_user=True)
Out[23]:
In [24]:
my_bot.send_tweet(poswhat + ' #lca16')
Out[24]:
Comments
Comments powered by Disqus