Skip to content
This repository was archived by the owner on Jul 3, 2020. It is now read-only.

fixes for slack API #143

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 19 additions & 18 deletions slacker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ def admin(self):
def info(self, user):
return self.get('users.info', params={'user': user})

def list(self, presence=False):
return self.get('users.list', params={'presence': int(presence)})
def list(self, cursor=None, limit=None, presence=False):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add these two optional parameters at the end? I just want to make sure that we won't break when it's called with positional arguments.

return self.get('users.list', params={'cursor': cursor, 'limit': limit, 'presence': int(presence)})

def identity(self):
return self.get('users.identity')
Expand Down Expand Up @@ -355,22 +355,23 @@ def post_message(self, channel, text=None, username=None, as_user=None,
if isinstance(attachments, list):
attachments = json.dumps(attachments)

return self.post('chat.postMessage',
data={
'channel': channel,
'text': text,
'username': username,
'as_user': as_user,
'parse': parse,
'link_names': link_names,
'attachments': attachments,
'unfurl_links': unfurl_links,
'unfurl_media': unfurl_media,
'icon_url': icon_url,
'icon_emoji': icon_emoji,
'thread_ts': thread_ts,
'reply_broadcast': reply_broadcast
})
data = {
'channel': channel,
'text': text,
'username': username,
'as_user': as_user,
'parse': parse,
'link_names': link_names,
'attachments': attachments,
'unfurl_links': unfurl_links,
'unfurl_media': unfurl_media,
'icon_url': icon_url,
'icon_emoji': icon_emoji,
'reply_broadcast': reply_broadcast
}
if thread_ts:
data['thread_ts'] = thread_ts
Comment on lines +372 to +373
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we handle this one separately?

return self.post('chat.postMessage', data=data)

def me_message(self, channel, text):
return self.post('chat.meMessage',
Expand Down