Created
July 30, 2017 15:14
-
-
Save jamesmorgan/03be52ca5c139e35b54e26aa588e828a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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