Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Returns a SlackMessage object
- result = self.server.apiCall(request=request, timeout=timeout, payload=payload)
- echo $(result.ok)
- echo result.text
- #Save to var so we can use it inside msgTypePred's scope
- var r = result
- #Defines predicate for any() call
- proc msgTypePred(x: string): bool {.inline.} = return cmpIgnoreCase(x, r.msgtype) == 0
- #Check if we have any groups that need to be added
- if cmpIgnoreCase(result.msgtype, "im.open") == 0:
- if result.ok and result.ok == true:
- discard self.server.attachChannel(result.user.name, result.channel.id)
- #Substitute msgTypePred call for inline "proc (x: string): bool {.inline.} = return cmpIgnoreCase(x, r.msgtype) == 0" and it fails
- elif any(@["mpim.open", "groups.create", "groups.createchild"], msgTypePred):
- if result.ok and result.ok == true:
- discard self.server.attachChannel(
- name=result.user.name,
- user_id=result.user.id,
- members=payload["group"]["members"]
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement