Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion lib/facebot.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ Facebot.prototype.respondToCreateChatMessages = function(message) {
.fail(err => {
return this.postMessage(
message.channel,
`Unable to connect the chat: ${err.error}`,
`Unable to connect the chat: ${err.message}`,
{ as_user: true }
);
});
Expand Down
7 changes: 2 additions & 5 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ async function findFBUser(api, search_str, allowNonFriends) {
// If the search string isnt a userID, we should search
// for the user by name
if (!USER_ID_REGEX.test(search_str)) {
let userData = await Q.nfcall(api.getUserID, name);
let userData = await Q.nfcall(api.getUserID, search_str);
userID = userData[0].userID;
}

const userInfoMap = await getFBUserInfoByID(api, userID);
const userInfo = userInfoMap[userID];

if (!userInfo.isFriend && !allowNonFriends)
throw new Error(
'User not your friend, they may not be your top ' +
Expand All @@ -28,8 +26,7 @@ async function findFBUser(api, search_str, allowNonFriends) {
);

// The userinfo object doesnt have an id with it, so add it as its useful
userID.id = userID;

userInfo.id = userID;
return userInfo;
}

Expand Down