Skip to content
CreativeBuilds edited this page May 5, 2019 · 3 revisions

Welcome to the dlive-js wiki!

To get started you can make a basic bot like this

const DLive = require('dlive-js');
let dlive = new DLive({
  authKey: 'INSERT YOUR DLIVE AUTH KEY HERE',
  blockchainPrivKey: 'THIS IS YOUR LINO BLOCKCHAIN WALLET KEY'
});
// NOTE YOU NEED TO SUPPLY AN AUTHKEY BUT NOT A BLOCKCHAINPRIVKEY, YOU ONLY NEED TO SUPPLY THAT IF YOU WANT TO USE THE SEND LINO FUNCTION.

/* Next connect to the channel to receive new messages! */

dlive.listenToChat('creativebuilds').then(messages => {
  // messages is an rxjs BehaviourSubject which you need to subscribe to, and it will run the function every time a new message is found!
  messages.subscribe(message => {
    console.log('GOT A NEW MESSAGE', message);
    // You can reply to a message like so
    message.reply('Thanks for that message son!');
  });
});

This will create a basic bot for you to mess around with. If you want more in depth information on the actual variables and functions you can run from the classes.

Get started with further in-depth coder stuff you may be interested in here

Clone this wiki locally