Conditions | 5 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | from st2actions.runners.pythonrunner import Action |
||
4 | def run(self, corpID, corpSecret, agentid, message, touser=None, togroup=None, totag=None): |
||
5 | receivers=dict() |
||
6 | if touser: |
||
7 | receivers={"touser": touser} |
||
8 | |||
9 | if togroup: |
||
10 | receivers.update({"toparty": togroup}) |
||
11 | |||
12 | if totag: |
||
13 | receivers.update({"totag": totag}) |
||
14 | |||
15 | if len(receivers) == 0: |
||
16 | raise KeyError('touser, togroup, totag can not be empty at the same time') |
||
17 | |||
18 | wechatClient=WechatClient(corpID, corpSecret) |
||
19 | wechatClient.sendTextMessage(agentid, message,**receivers) |
||
20 | return |