浏览代码

now playing

pull/2/head
calexil 4 年前
父节点
当前提交
02f6ed9838
  1. 52
      bot.js

52
bot.js

@ -59,58 +59,6 @@ client.on('message', message => { @@ -59,58 +59,6 @@ client.on('message', message => {
}
});
var LastFmNode = require('lastfm').LastFmNode;
var lastfm = new LastFmNode({
api_key: '99187e91b94f44ce4f2d71bcfe303147',
secret: '71656c0d03209d8b56a50ae852e89b68'
});
var trackStream = lastfm.stream('calexil');
trackStream.on('lastPlayed', function(track) {
console.log('Last played: ' + track.name);
});
trackStream.on('nowPlaying', function(track) {
console.log('Now playing: ' + track.name);
});
trackStream.on('scrobbled', function(track) {
console.log('Scrobbled: ' + track.name);
});
trackStream.on('stoppedPlaying', function(track) {
console.log('Stopped playing: ' + track.name);
});
trackStream.on('error', function(error) {
console.log('Error: ' + error.message);
});
trackStream.start();
var session = lastfm.session({
token: token,
handlers: {
success: function(session) {
lastfm.update('nowplaying', session, { track: track } );
lastfm.update('scrobble', session, { track: track, timestamp: 12345678 });
}
}
});
var request = lastfm.request("artist.getInfo", {
artist: "The Mae Shi",
handlers: {
success: function(data) {
console.log("Success: " + data);
},
error: function(error) {
console.log("Error: " + error.message);
}
}
});
// THIS MUST BE THIS WAY
client.login(process.env.BOT_TOKEN);

正在加载...
取消
保存