Created
March 5, 2017 02:10
-
-
Save kfatehi/92d124d1d1cceefc782636cde3ae998f to your computer and use it in GitHub Desktop.
puppet get avatar url for matrix user id
This file contains 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 { Puppet } = require("matrix-puppet-bridge"); | |
const puppet = new Puppet('./config.json'); | |
puppet.startClient().then(()=>{ | |
let client = puppet.getClient(); | |
const getAvatarUrlForMatrixUser = (uid) => { | |
client.getProfileInfo(uid, 'avatar_url').then(({avatar_url})=>{ | |
if (avatar_url) { | |
console.log('has avatar url', avatar_url); | |
} else { | |
console.log('has no avatar url'); | |
} | |
}).catch(err=>{ | |
console.log('err', err); | |
}); | |
} | |
getAvatarUrlForMatrixUser('@slack_ftc_U3V839H46:synapse.keyvan.pw'); | |
getAvatarUrlForMatrixUser('@slack_ftc_B4DRZBKGV:synapse.keyvan.pw'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment