scrapinghub / slackbot

A chat bot for Slack (https://slack.com).
MIT License
1.26k stars 394 forks source link

get username from a `slackbot.dispatcher.Message` object. #43

Closed owocki closed 8 years ago

owocki commented 8 years ago

It'd be great to be able to get the message sender from the slackbot.dispatcher.Message object:

ipdb> message.
message.body          message.reply         message.send
message.channel       message.reply_webapi  message.send_webapi

message.body['user'] is the closest thing I could find, but it's only a unicode ID:

ipdb> message.body['user']
u'U055J62L4'
owocki commented 8 years ago

Nevermind, it seems message.channel._client.users[message.body['user']][u'name'] will get me this data.

kevinsheehan commented 8 years ago

Thanks for the response @owocki I hadn't realized I could get more than the unique id without hitting the API again.

melvilgit commented 7 years ago

@kevinsheehan @owocki How to get the slack message sent from the object ?

melvilgit commented 7 years ago

What is the message object structure for slack bot ?