importDlivefrom'dlivetv-unofficial-api'constblockchainName='YOUR BLOCKCHAIN NAME (e.g. dlive-1234567890)'// Our Blockchain usernameconstaccessKey='YOUR KEY'// Our access key// Chat cooldownconstcoolDown=3000// 3 seconds// Parameter 1: Blockchain username// Parameter 2: Your access key for sending messagesletexample=newDlive(blockchainName,accessKey)// Joining sampepperexample.on('ChatText',(message)=>{console.log(`Messages in Channel ${example.getChannel}: ${message.content}`)if(message.content==='!song'){example.sendMessage('Currently no track available...').then((result)=>{console.log('Message sended!')console.log(result)}).catch((error)=>{console.log(`Error while sending message! ${error}`)// Now we can use our function to try to resend, at this point you would directly use our own function. Please do not use this example in productive use, because it is ...sendMessage('Currently no track available...')})}})example.on('ChatFollow',(message)=>{// Say thanks to this user for his follow!sendMessage(`Thanks for the follow, @${message.sender.displayname}`)})example.on('ChatGift',(message)=>{// Say thanks to this user for his gift!sendMessage(`Thanks for ${message.amount}x ${message.gift}, @${message.sender.displayname}`)})// Get our channel informationsexample.getChannelInformationByDisplayName('pewdiepie'/* enter a displayname, not the Blockchain username */).then((result)=>{console.log(result)}).catch((error)=>{console.log(error)})functionsendMessage(message){example.sendMessage(message).catch((error)=>{console.log(`Oh no.. error! ${error} - Retry in ${coolDown/1000} seconds!`)setTimeout(sendMessage,coolDown,message)})}