File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -116,12 +116,19 @@ def output(self):
116116 for plugin in self .bot_plugins :
117117 limiter = False
118118 for output in plugin .do_output ():
119- channel = self .slack_client .server .channels .find (output [0 ])
120- if channel is not None and output [1 ] is not None :
119+ destination = output [0 ]
120+ message = output [1 ]
121+ # things that start with U are users. convert to an IM channel.
122+ if destination .startswith ('U' ):
123+ result = json .loads (self .slack_client .api_call ('im.open' , user = destination ))
124+ channel = self .slack_client .server .channels .find (result [u'channel' ][u'id' ])
125+ else :
126+ channel = self .slack_client .server .channels .find (destination )
127+ if channel != None and message != None :
121128 if limiter :
122129 time .sleep (.1 )
123130 limiter = False
124- channel .send_message (output [ 1 ] )
131+ channel .send_message (message )
125132 limiter = True
126133
127134 def crons (self ):
You can’t perform that action at this time.
0 commit comments