ChatGift
Event triggered upon receiving a gift (Lemon, ice cream, etc...)
The ChatGift event triggers when someone donates a gift to the streamer.
const bot = new Dlive(key);
bot.on('ChatGift', msg => {
console.log(`${msg.sender.displayname} donated ${msg.amount} ${msg.gift}'s`);
});
Sevith donated 5 LEMON's
{
"__typename": "ChatGift",
"type": "Gift",
"id": "16ca6342-9a60-48d4-9abf-ed0262f4ebeb",
"sender": {
"__typename": "StreamchatUser",
"id": "streamchatuser:dlive-31986754",
"username": "dlive-31986754",
"displayname": "Sevith",
"avatar": "https://images.prd.dlivecdn.com/avatar/4047f01b-6fa4-11e9-a1fa-b68de99f895b",
"partnerStatus": "NONE",
"badges": []
},
"role": "None",
"roomRole": "Member",
"subscribing": false,
"createdAt": "1557935908331061978",
"gift": "LEMON",
"amount": "5",
"recentCount": 1,
"expireDuration": 0
}
The above example shows a simple event listener. When someone donates to the streamer 'LKD', the event will fire resulting in a console message stating the donors name, amount girted, and gift type.
Gift | Type ID | Value |
---|---|---|
Lemon | LEMON | $0.012 |
Ice Cream | ICE_CREAM | $0.12 |
Diamond | DIAMOND | $1.20 |
Ninjaghini | NINJAGHINI | $12.00 |
Ninjet | NINJET | $120.00 |
Updated over 5 years ago