You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const buzzk = require("buzzk");
buzzk.login("NID_AUT 쿠키 값", "NID_SES 쿠키 값");
const buzzkChat = buzzk.chat;
async function test () {
let chSearch = await buzzk.channel.search("녹두로로"); //채널 검색
let channel = chSearch[0]; //검색 결과 첫번째 채널
const lvDetail = await buzzk.live.getDetail(channel.channelID); //현재 방송 정보
let chat = new buzzkChat(channel.channelID);
await chat.connect(); //채팅창 연결
let recentChat = await chat.getRecentChat(); //최근 채팅 가져오기 (기본값 50개)
console.log(recentChat);
chat.onMessage(async (data) => { //채팅이 왔을 때
for (let o in data) {
console.log(data[o].message);
if (data[o].message === "!ping") await chat.send("pong!");
//채팅 보내기 (login 후에만 가능)
let userInfo = await chat.getUserInfo(data[o].author.id);
console.log(userInfo);
//채팅 보낸 유저의 정보
}
});
chat.onDisconnect(async () => { //채팅창 연결이 끊겼을 때
//TODO
});
}
test();