(WIP) Bilibili-live danmu listener with type.

Overview

blive-message-listener

npm

Bilibili-live danmu listener with type.

Bilibili 直播间弹幕监听器,支持类型输出。

Features

  • 完整的类型支持

Install

npm i blive-message-listener

Usage

import { startListen, type MsgHandler } from 'blive-message-listener'

const handler: MsgHandler = {
  onIncomeDanmu: (msg) => {
    console.log(msg.id, msg.data)
  },
  onIncomeSuperChat: (msg) => {
    console.log(msg.id, msg.data)
  },
}

startListen(652581, handler)

Full type definition can be found in src/parser.

Credits

License

MIT

You might also like...

📝 [WIP] Write your reports in markdown, and get them in docx.

md-report What's md-report The repo name md-report stands for both "Write your reports in markdown, and get them in docx." and "Made report again." ("

Jun 12, 2022

A programming language (WIP)

Umo programming language Concept Effect system (not implemented) Subtyping (not implemented) Opt-in shared mutability (not implemented) Gradual typing

Feb 25, 2022

WIP : Un pictionary mais avec 15 trait droits (sans courbes)

TODO Signer l'ID Ban dès le lobby Limiter la taille des pseudos Joueur déconnecté avec une couleur Afficher un message en cas de kick Limiter les devi

Apr 25, 2022

Minimal framework for SSG (WIP, PoC)

Frostleaf https://zenn.dev/0918nobita/scraps/64a268583b8463 Development Install tools asdf plugin-add nodejs asdf plugin-add pnpm asdf install Install

Jun 4, 2022

WIP: Hevm based debugger for hardhat-huff projects

Huff Debug An easy hevm debug integration for hardhat-huff projects What does it do: Speed up your development experience by gaining rich feedback in

Jul 15, 2022

🖼️ Bringing Material Design 3 to the Astro Blog. [WIP]

🖼️ Gumori You [WIP] Bringing Material Design 3 to the Astro Blog. 👥 Contributing If you're interested in contributing to Gumori You, pls read the fo

Aug 28, 2022

🚧 WIP: Bartosz Milewski's "Category Theory for Programmers" Korean translation 📚

🚧 WIP: Bartosz Milewski's

프로그래머를 위한 범주론 본 레파지토리는 Bartosz Milewsk의 Category Theory for Programmers을 번역하며 학습한 레파지토리입니다. 🗂 목차 Part 1. 범주:합성의 본질 타입과 함수 크고 작은 범주 Kleisli Categories

Aug 18, 2022

NPMJS Alternative (WIP)

SNPM (WIP) SNPM is an "alternative" for NPM, but it's not meant to replace NPM/Yarn/PNPM DISCLAIMER 🚧 This project was made to learn more about Packa

Sep 14, 2022

WIP: Power-pack for Turbo Streams

TurboPower turbo_power is a power-pack for Turbo Streams. It provides Turbo Streams with a bunch of new actions and additionally adds the morph action

Sep 20, 2022
Comments
  • electron preload 中 exposeInMainWorld 使用该库报错

    electron preload 中 exposeInMainWorld 使用该库报错

    安装

    yarn add blive-message-listener

    引入错误:

    Error: require() of ES Module C:\Users\why00\Documents\project\2someone-app\node_modules\blive-message-listener\dist\index.js from C:\Users\why00\Documents\project\2someone-app\dist\preload\index.js not supported.
    Instead change the require of C:\Users\why00\Documents\project\2someone-app\node_modules\blive-message-listener\dist\index.js in C:\Users\why00\Documents\project\2someone-app\dist\preload\index.js to a dynamic import() which is available in all CommonJS modules.
        at __node_internal_captureLargerStackTrace (node:internal/errors:465:5)
        at new NodeError (node:internal/errors:372:5)
        at Module._extensions..js (node:internal/modules/cjs/loader:1148:19)
        at Module.load (node:internal/modules/cjs/loader:988:32)
        at Module._load (node:internal/modules/cjs/loader:829:12)
        at c._load (node:electron/js2c/asar_bundle:5:13343)
        at i._load (node:electron/js2c/renderer_init:33:356)
        at Module.require (node:internal/modules/cjs/loader:1012:19)
        at require (node:internal/modules/cjs/helpers:102:18)
        at Object.<anonymous> (C:\Users\why00\Documents\project\2someone-app\dist\preload\index.js:3:37)
        at Object.<anonymous> (C:\Users\why00\Documents\project\2someone-app\dist\preload\index.js:13:3)
        at Module._compile (node:internal/modules/cjs/loader:1120:14)
        at Module._extensions..js (node:internal/modules/cjs/loader:1175:10)
        at Module.load (node:internal/modules/cjs/loader:988:32)
        at Module._load (node:internal/modules/cjs/loader:829:12)
        at c._load (node:electron/js2c/asar_bundle:5:13343)
        at i._load (node:electron/js2c/renderer_init:33:356)
        at Object.<anonymous> (node:electron/js2c/renderer_init:73:2296)
        at ./lib/renderer/init.ts (node:electron/js2c/renderer_init:73:2423)
        at __webpack_require__ (node:electron/js2c/renderer_init:1:170)
        at node:electron/js2c/renderer_init:1:1242
        at ___electron_webpack_init__ (node:electron/js2c/renderer_init:1:1310)
        at node:electron/js2c/renderer_init:141:194
        at NativeModule.compileForInternalLoader (node:internal/bootstrap/loaders:312:7)
        at NativeModule.compileForPublicLoader (node:internal/bootstrap/loaders:252:10)
        at loadNativeModule (node:internal/modules/cjs/helpers:49:9)
        at Module._load (node:internal/modules/cjs/loader:811:15)
        at c._load (node:electron/js2c/asar_bundle:5:13343)
        at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
        at node:internal/main/run_main_module:17:47
    

    使用预加载脚本报错:

    源代码:

    // preload/index.ts
    import { startListen } from 'blive-message-listener'
    contextBridge.exposeInMainWorld(
      'biliApi',
      {
        startListen,
      },
    )
    
    // ****.vue
     window.biliApi.startListen(inputRoomId, handler)
    console.log(typeof window.biliApi.startListen)     // undefine
    

    报错:

    TypeError: Cannot read properties of undefined (reading 'startListen')
        at DanmuTest.vue:31:5
        at callWithErrorHandling (runtime-core.esm-bundler.js:155:22)
        at callWithAsyncErrorHandling (runtime-core.esm-bundler.js:164:21)
        at hook.__weh.hook.__weh (runtime-core.esm-bundler.js:2684:29)
        at flushPostFlushCbs (runtime-core.esm-bundler.js:341:32)
        at render2 (runtime-core.esm-bundler.js:6234:9)
        at mount (runtime-core.esm-bundler.js:4424:25)
        at app.mount (runtime-dom.esm-bundler.js:1606:23)
        at main.ts:4:16
    

    大佬能从报错看出问题吗?如果需要看源码请直接回复。

    bug 
    opened by Tymon42 2
Releases(v0.1.6)
This plugin can generate timestamps for video, audio and Bilibili video, it takes you to the corresponding video/audio position when clicked.

logseq-plugin-media-ts 本插件能够生成视频、音频以及 B 站视频的时间戳,点击时间戳后会跳转到对应的音视频位置。 This plugin can generate timestamps for video, audio and Bilibili video, it takes

Seth Yuan 46 Sep 21, 2022
A Bilibili Cross-Platform Desktop Client Powered By Tauri

BBHouse 取自常见的『我在B站买了房』的评论 BBHouse 是一款 哔哩哔哩 的第三方应用,基于 Tauri 跨平台构建,支持 Windows macOS Linux. 核心功能 一个支持对视频动态分区展示的首页, 去除了B博和推荐流 一个支持无限添加的 (临时的) 稍后播放列表与配套的播放

ziyu 115 Sep 19, 2022
Type predicate functions for checking if a value is of a specific type or asserting that it is.

As-Is Description As-Is contains two modules. Is - Type predicates for checking values are of certain types. As - Asserting values are of a certain ty

Declan Fitzpatrick 8 Feb 10, 2022
Combine type and value imports using Typescript 4.5 type modifier syntax

type-import-codemod Combines your type and value imports together into a single statement, using Typescript 4.5's type modifier syntax. Before: import

Ian VanSchooten 3 Sep 2, 2022
🧬 A type builder for pagination with prisma and type-graphql.

?? Prisma TypeGraphql Pagination Prisma TypeGraphql Pagination builds prisma pagination types for type-graphql. import { ... } from 'type-graphql'

Arthur Fiorette 2 Apr 21, 2022
🐬 A simplified implementation of TypeScript's type system written in TypeScript's type system

?? HypeScript Introduction This is a simplified implementation of TypeScript's type system that's written in TypeScript's type annotations. This means

Ronen Amiel 1.7k Sep 22, 2022
A type programming language which compiles to and interops with type-level TypeScript

Prakaar Prakaar (hindi for "type") is a type programming language which compiles to and interops with type-level TypeScript. Prakaar itself is also a

Devansh Jethmalani 15 Sep 14, 2022
🐧 [WIP] Genshin Impact Chat Bot

Genshin Bot Config $ cp config/bot.sample.ts config/bot.ts Development $ yarn $ yarn dev $ open http://localhost:7001/ Npm Scripts Use yarn lint to ch

CanisMinor 2 Dec 20, 2021
[WIP] WebGL API implementation for Deno, built on GLFW using FFI.

Note I'm no longer working on this project because I have just realized macOS does not support OpenGL ES API, and adding Desktop GL backend to this mo

DjDeveloper 14 Jun 11, 2022
[WIP] A solid directive for adding colorful shadows to images.

solid-cosha A solid directive for adding colorful shadows to images (based on cosha). Quick start Install it: yarn add solid-cosha Use it: import { co

Robert Soriano 2 Feb 3, 2022