forked from LBRYCommunity/lbry-sdk
get channel id from slack for test bot
in case i accidentally delete the bot conf file again and don’t want to look up the channel id
This commit is contained in:
parent
a18f3bf08a
commit
8f04d3418a
1 changed files with 3 additions and 3 deletions
|
@ -7,9 +7,8 @@ from slackclient import SlackClient
|
||||||
def get_conf():
|
def get_conf():
|
||||||
f = open('testbot.conf', 'r')
|
f = open('testbot.conf', 'r')
|
||||||
token = f.readline().replace('\n', '')
|
token = f.readline().replace('\n', '')
|
||||||
channel = f.readline().replace('\n', '')
|
|
||||||
f.close()
|
f.close()
|
||||||
return token, channel
|
return token
|
||||||
|
|
||||||
def test_lbrynet(lbry, slack, channel):
|
def test_lbrynet(lbry, slack, channel):
|
||||||
logfile = open('lbrynet_test_log.txt', 'a')
|
logfile = open('lbrynet_test_log.txt', 'a')
|
||||||
|
@ -48,10 +47,11 @@ def test_lbrynet(lbry, slack, channel):
|
||||||
lbry.delete_lbry_file('test.jpg')
|
lbry.delete_lbry_file('test.jpg')
|
||||||
logfile.close()
|
logfile.close()
|
||||||
|
|
||||||
token, channel = get_conf()
|
token = get_conf()
|
||||||
|
|
||||||
sc = SlackClient(token)
|
sc = SlackClient(token)
|
||||||
sc.rtm_connect()
|
sc.rtm_connect()
|
||||||
|
channel = [c['id'] for c in json.loads(sc.api_call('channels.list'))['channels'] if c['name'] == 'tech'][0]
|
||||||
print 'Connected to slack'
|
print 'Connected to slack'
|
||||||
daemon = xmlrpclib.ServerProxy("http://localhost:7080")
|
daemon = xmlrpclib.ServerProxy("http://localhost:7080")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue