npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@d2n0s4ur/chzzk-chat

v2.0.0

Published

chzzk-chat: node.js 개발자를 위한 chzzk 채팅 & 후원 비공식 라이브러리

Downloads

98

Readme

Chzzk-Chat library

Test workflow status Npm Version Downloads Issues Node version

Javascript를 통해 치지직 채팅을 크롤링하는 코드입니다.

Important Update

  • 각 Handler의 인자가 변경되었습니다.(중괄호로 감쌈) 이전 버전과 호환되지 않습니다.
  • 개발자 여러분들은 바뀐 핸들러 코드를 확인하고 소스코드를 수정해주세요.

Install

Node

NPM

$ npm install @d2n0s4ur/chzzk-chat

Yarn

$ yarn add @d2n0s4ur/chzzk-chat

Usage

import { ChzzkChat } from "@d2n0s4ur/chzzk-chat";

const chzzkChat = new ChzzkChat("YOUR_CHZZK_USER_HASH");
// ex) ChzzkChat('dfffd9591264f43f4cbe3e2e3252c35c')

1. Add message Handler

const messageHandler: messageHandler = ({
  badges: string[],
  nick: string,
  message: string
}) => {
  console.log(`${nick}: ${message}`);
};

chzzkChat.addMessageHandler(messageHandler);

2. Add donation Handler

const donationHandler: donationHandler = ({
  badges: string[],
  nick: string,
  message: string,
  isAnonymous: boolean,
  amount: number
}) => {
  if (!isAnonymous) {
    console.log(`${nick}님이 ${amount}원을 후원했습니다: ${message}`);
  } else {
    console.log(`익명의 후원자가 ${amount}원을 후원했습니다: ${message}`);
  }
};

chzzkChat.addDonationHandler(donationHandler);

3. Add subscription Handler

const subscriptionHandler: subscriptionHandler = ({
  badges: string[],
  nick: string,
  message: string,
  month: number,
  tierName: string,
  tierNo: number
}) => {
  console.log(
    `${nick}님이 ${month}개월 ${tierName}를 구독했습니다: ${message}`
  );
};

chzzkChat.addSubscriptionHandler(subscriptionHandler);

4. get Emoji Url from EmojiID

const emojiRegex = /:\w+:/g;
const emojiMatches = message.match(emojiRegex);

if (emojiMatches) {
    emojiMatches.forEach((emoji) => {
        const emojiName = emoji.slice(1, -1);
        const emojiUrl = chzzkChat.getEmojiUrl(emojiName);
        console.log(emojiUrl);
    });
}

사용이 끝난 후, chzzkChat.close()를 호출하여 웹소켓을 닫아주세요.

After using the library, please call chzzkChat.close() to close the websocket.

chzzkChat.close();