From 8f04d3418a6525ee3ac0eb8210dda89d33600936 Mon Sep 17 00:00:00 2001 From: Jack Date: Fri, 26 Feb 2016 11:20:31 -0500 Subject: [PATCH] get channel id from slack for test bot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit in case i accidentally delete the bot conf file again and don’t want to look up the channel id --- tests/lbrynet_test_bot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/lbrynet_test_bot.py b/tests/lbrynet_test_bot.py index a76a366d8..46e5d9f0a 100644 --- a/tests/lbrynet_test_bot.py +++ b/tests/lbrynet_test_bot.py @@ -7,9 +7,8 @@ from slackclient import SlackClient def get_conf(): f = open('testbot.conf', 'r') token = f.readline().replace('\n', '') - channel = f.readline().replace('\n', '') f.close() - return token, channel + return token def test_lbrynet(lbry, slack, channel): logfile = open('lbrynet_test_log.txt', 'a') @@ -48,10 +47,11 @@ def test_lbrynet(lbry, slack, channel): lbry.delete_lbry_file('test.jpg') logfile.close() -token, channel = get_conf() +token = get_conf() sc = SlackClient(token) 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' daemon = xmlrpclib.ServerProxy("http://localhost:7080")