Skip to content

Instantly share code, notes, and snippets.

@jamesmorgan
Created July 30, 2017 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesmorgan/03be52ca5c139e35b54e26aa588e828a to your computer and use it in GitHub Desktop.
Save jamesmorgan/03be52ca5c139e35b54e26aa588e828a to your computer and use it in GitHub Desktop.
const userId = session.message.message.user.id;
const channelId = session.message.address.channelId;
// Load the specified user
firebase.database().ref(`chat-users/${channelId}/${userId}`)
.once('value')
.then((snapshot) => {
// Get the ref data
let user = snapshot.val();
// Send a direct message
bot.send(new builder.Message()
.address(user.address) // Only users at this address will receive the message
.text("Hi, this is a direct message"));
})
.catch((err) => console.log(err));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment