-
Notifications
You must be signed in to change notification settings - Fork 637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When receiving a bot writing message using the User OAuth Token, the res.message.user has room property only #615
Comments
Is it correct patch? diff --git a/src/client.coffee b/src/client.coffee
index 98e27ab..432f253 100644
--- a/src/client.coffee
+++ b/src/client.coffee
@@ -332,10 +332,10 @@ class SlackClient
if @eventHandler
# fetch full representations of the user, bot, and potentially the item_user.
fetches = {}
- if event.bot_id
- fetches.bot = @fetchBotUser event.bot_id
- else if event.user
+ if event.user
fetches.user = @fetchUser event.user
+ else if event.bot_id
+ fetches.bot = @fetchBotUser event.bot_id
if event.item_user
fetches.item_user = @fetchUser event.item_user |
This patch has been worked in my environment and situation. |
@buzztaiki Thanks for taking the time to report this. I've confirmed that the payload for messages posted using a user token includes {
"bot_id": "B111",
"suppress_notification": false,
"type": "message",
"text": "thanks a lot",
"user": "U111",
"team": "T111",
"bot_profile": {},
"source_team": "T111",
"user_team": "T111",
"channel": "C111",
"event_ts": "1609114401.001400",
"ts": "1609114401.001400"
} Regarding the fix, it looks great to me. If you don't mind, could you send a pull request? |
Sorry, I missed look at your comment. I will send PR. |
Description
When receiving a bot writing message using the User OAuth Token, the
res.message.user
hasroom
property only.I expect it is user object. Until hubot-slack 4.5.5, it is user object in this situation.
What type of issue is this? (place an
x
in one of the[ ]
)Requirements (place an
x
in each of the[ ]
)Bug Report
Reproducible in:
hubot-slack version: 4.8.1
node version: 15.4.0
OS version(s):
Steps to reproduce:
Run following hubot script:
Create slack app (not hobot)
chat:write
Install slack app to my workspace.
Copy [OAuth Access Token] value.
Run following script
Expected result:
I expect get a user object from
res.message.user
.Actual result:
res.message.user
has room property only.Attachments:
The text was updated successfully, but these errors were encountered: