This repository was archived by the owner on Aug 15, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +21
-4
lines changed
Expand file tree Collapse file tree 4 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 1+ from slackclient import SlackClient
2+ from rtmbot import RtmBot
3+
4+ client = None
5+
6+ def init (config ):
7+ global client
8+ bot = RtmBot (config )
9+ client = bot .slack_client
10+ return bot
Original file line number Diff line number Diff line change 1+ from __future__ import unicode_literals
2+ from client import client as sc
3+
4+ for user in sc .api_call ("users.list" )["members" ]:
5+ print (user ["name" ], user ["id" ])
Original file line number Diff line number Diff line change 11#!/usr/bin/env python
22import sys
3+ import os
4+ sys .path .append (os .getcwd ())
5+
36from argparse import ArgumentParser
47
58import yaml
6- from rtmbot import RtmBot
9+ import client
710
811
912def parse_args ():
@@ -19,7 +22,7 @@ def parse_args():
1922# load args with config path
2023args = parse_args ()
2124config = yaml .load (open (args .config or 'rtmbot.conf' , 'r' ))
22- bot = RtmBot (config )
25+ bot = client . init (config )
2326try :
2427 bot .start ()
2528except KeyboardInterrupt :
Original file line number Diff line number Diff line change @@ -48,15 +48,14 @@ def __init__(self, config):
4848 # initialize stateful fields
4949 self .last_ping = 0
5050 self .bot_plugins = []
51- self .slack_client = None
51+ self .slack_client = SlackClient ( self . token )
5252
5353 def _dbg (self , debug_string ):
5454 if self .debug :
5555 logging .info (debug_string )
5656
5757 def connect (self ):
5858 """Convenience method that creates Server instance"""
59- self .slack_client = SlackClient (self .token )
6059 self .slack_client .rtm_connect ()
6160
6261 def _start (self ):
You can’t perform that action at this time.
0 commit comments