Skip to content

Channel Class

CreativeBuilds edited this page Jun 8, 2019 · 3 revisions

Channel Class


Can be found from listening to messages.

const Channel = require("dlive-js/src/classes/Channel");
new Channel({dliveUsername, blockchainUsername, User}, permissionObj) // Returns a dlive-js Channel Object

Properties

name returns description
dliveUsername string the displayname of the streamer
blockchainUsername string an id of the streamer that cant be changed, and is their "lino username"
user User returns a dlive-js User object of the user who sent the message
rxLivestream RXJS BehaviorSubject Subscribe to this in order to receive updates on when livestream goes live, or offline (updates in viewers etc) Updates every 30 seconds
updateInterval Interval An Interval that runs every 30 seconds to update rxLivestream (only set once you subscribe to rxLivestream for the first time)

Functions

name returns description
getPermissionObj Function() -> PermissionObj returns the permission object that was passed into it on creation
updateLivestream Function() -> Promise(DLiveLivestreamObject) returns a promise of the livestream object (and also pushes this object to the rxLivstream Behavior Subject (Runs every 30 seconds from updateInterval
sendMessage Function(message) -> Promise() returns promise after sending a message to the channel
follow Function() -> Promise() returns promise after trying to follow a channel
unfollow Function() -> Promise() returns promise after trying to unfollow a channel
getChatroomInfo Function() -> Promise(chatroomInfo) returns promise of raw data from dlive after trying to get current chatroom info
getIsLive Function() -> Promise(Boolean) returns promise of a boolean value if the stream is live or not
getViewers Function() -> Promise(Integer) returns promise of how many viewers are in stream
muteUser Function(blockchainUsername) -> Promise() returns promise result from dlive after trying to ban user in chat (have to be mod)
unmuteUser Function(blockchainUsername) -> Promise() returns promise result from dlive after trying to unban/pardon user in chat (have to be mod)

Clone this wiki locally