-
Notifications
You must be signed in to change notification settings - Fork 39
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
Add GetSenderInfo function to get message sender info #58
base: develop
Are you sure you want to change the base?
Conversation
ef763dc
to
7de01c1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@risboo6909, thanks for the PR. Do you mind adding a sample/example under sample dir?
req.Header.Set("Content-Type", "application/json") | ||
req.Header.Set("Authorization", "Bearer "+token) | ||
|
||
httpClient := &http.Client{} | ||
resp, err := httpClient.Do(req) | ||
if err != nil { | ||
return nil, err | ||
} | ||
defer resp.Body.Close() | ||
|
||
body, err := ioutil.ReadAll(resp.Body) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return body, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use client.sendRequest()
method to avoid duplicate code?
|
||
return resp, nil | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return resp, nil | |
return resp, nil |
[nit] unnecessary new lines
So I missed the feature to get an email address of the user sending message to my bot.
Opening PR, because this feature may be helpful for other people.
Usage pattern is like this (I omitted errors handling for simplicity):
senderInfo
will contain user info (including email address, id, name, etc).