buzzk

1.8.2 • Public • Published

BuzzkThumb

뿌지직

BUZZK

뿌지직은 치지직 챗봇을 더욱 쉽게 개발할 수 있도록 돕는 비공식 라이브러리 입니다.

챗봇 개발에 초점이 맞춰저 있어, 여러 계정에 동시 로그인할 수 없습니다.


📖 업데이트 내역

  • 채팅 채널이 없을 때 오류가 생기는 문제 해결
  • onDonation 함수 추가

  • 본인 인증 채팅 지원 추가

  • 채팅 데이터에 hasMod 항목 추가
  • JSON을 Parse 하는 중 오류가 생기는 문제 해결
  • User-Agent 추가 (API 호출에 실패하는 문제 해결)
  • chat 의 메세지를 핸들링하던 중 의도치 않게 오류가 나는 문제 해결
  • WebSocket is not open 문제 해결
  • chat.getUserInfo 함수 추가

✒️ 마이그레이션 가이드 (v.1.2.x -> v.1.3.0)

펼쳐보기
buzzk.channel
BUZZK buzzk.channel.getChannel
buzzk.channel.search

BUZZK buzzk.channel.followChannel
buzzk.channel.follow

BUZZK buzzk.channel.unFollowChannel
buzzk.channel.unFollow

buzzk.live
BUZZK buzzk.live.getLiveDetail
buzzk.live.getDetail

BUZZK buzzk.live.getLiveStatus
buzzk.live.getStatus

buzzk.live.getDetail (getLiveDetail)
BUZZK (return).channel.channelName
(return).channel.name

BUZZK (return).channel.channelImageUrl
(return).channel.imageURL

BUZZK (return).channel.channelId

BUZZK (return).channel.verifiedMark

👋 설치

  1. npm install buzzk
  2. const buzzk = require("buzzk");

🔥 빠른. 시작.

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();

🎀 사용법

login

buzzk.login("NID_AUT 쿠키 값", "NID_SES 쿠키 값");

dotenv와 함께 사용하는 것을 매우 권장합니다.

buzzk.login(process.env.NID_AUT, process.env.NID_SES);

channel

let chSearch = await buzzk.channel.search("녹두로로");
console.log(chSearch);
return
  • Return
    • 0
      • channelID
      • name
      • description
      • follower
      • imageURL
      • isLive
    • 1
    • 2
    • 3
    • ...
let channel = await buzzk.channel.get("channelID 값");
console.log(channel);
return
  • Return
    • channelID
    • name
    • description
    • follower
    • imageURL
    • isLive
await buzzk.channel.follow("channelID 값");
await buzzk.channel.unFollow("channelID 값");

live

const lvDetail = await buzzk.live.getDetail("channelID 값");
console.log(lvDetail);
return
  • Return
    • channelID
    • channel
      • name
      • imageURL
    • chatID
    • chatLimit //팔로워 전용 채팅 등...
    • userCount
      • now
      • total
    • title
    • category
    • startOn
    • closeOn
    • status
    • polling
const lvStatus = await buzzk.live.getStatus("channelID 값");
console.log(lvStatus);
return
  • Return
    • channelID
    • chatID
    • userCount
      • now
      • total
    • title
    • status
    • polling

chat

const buzzkChat = buzzk.chat;
let chat = new buzzkChat("channelID 값");
await chat.connect(); //채팅창 연결
let recentChat = await chat.getRecentChat(갯수); //최근 채팅 가져오기 (기본값 50개)
console.log(recentChat);
return
  • Return
    • 0
      • author
        • id
        • name
        • imageURL
        • hasMod //관리 권한을 가졌는지 (false / true)
      • message
      • time
    • 1
    • 2
    • 3
    • ...
chat.onMessage((data) => { //채팅이 왔을 때
	console.log(data);

    for (let o in data) {
        console.log(data[o].message); //메세지만 전부 꺼내기
    }
});
callback
  • Return
    • 0
      • author
        • id
        • name
        • imageURL
        • hasMod //관리 권한을 가졌는지 (false / true)
      • message
      • time
    • 1
    • 2
    • 3
    • ...
chat.onDonation((data) => { //도네이션이 왔을 때
	console.log(data);

    for (let o in data) {
        console.log(data[o].amount); //후원 금액만 전부 꺼내기
    }
});
callback
  • Return
    • 0
      • amount //후원 금액
      • author
        • id
        • name
        • imageURL
        • hasMod //관리 권한을 가졌는지 (false / true)
      • message
      • time
    • 1
    • 2
    • 3
    • ...
chat.onDisconnect(() => { //채팅창 연결이 끊겼을 때
	//TODO
});
await chat.send("ㅋㅋㅋㅋㅋㅋ"); //채팅 보내기 (login 후에만 가능)
let userInfo = await chat.getUserInfo("유저의 channelID 값");
return
  • Return
    • channelID
    • name
    • imageURL
    • role //ex. streamer
    • followDate //팔로우 날짜 ex. 2024-02-19 23:28:11
await chat.disconnect(); //채팅창 연결 끊기

Package Sidebar

Install

npm i buzzk

Weekly Downloads

17

Version

1.8.2

License

MIT

Unpacked Size

34.9 kB

Total Files

10

Last publish

Collaborators

  • min_g