New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

onebot-client

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

onebot-client

onebot client SDK

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

onebot-client

oneBot 客户端SDK

Install

1 使用包管理器

npm i onebot-client

2 使用cdn链接


<script src="https://cdn.jsdelivr.net/npm/onebot-client@1.1.0/lib/index.umd.js"></script>

Usage

1. linkServer

const {Client} = require('onebot-client')
const client=new Client(147258369,{
    remote_url:'ws://localhost:6700',// 你onebot启动时设置的websocket连接地址
    access_token:'',//鉴权token
})
clent.start.then(()=>{
    // do sth
})

2. listen event

client.on('message.private',(event)=>{
    event.reply('hello') // listen all private message, reply hello
})
client.pickFriend(22998833).on('message',(event)=>{
    event.reply('hi') // listen friend(22998833) reply hi
})
client.pickGroup(42342342).pickMember(532422).on('message',(event)=>{
    event.recall() // listen group(42342342) member(532422) message, recall that
})

3. send message

client.sendPrivateMsg(22998833,'hello') // send hello to friend 22998833
client.sendGroupMsg(42342342,'hi') // send hi to group 42342342

4. getClient info

client.getGroupList() // 
client.pickGroup(42342342).info // get groupInfo
client.getFriendList() //
client.pickFriend(22998833).info // get friendInfo
client.getGroupMemberList(42342342) // get groupMemberList
client.pickGroup(42342342).pickMember(22998833).info  // get memberInfo

fix request/notice

client.on('notice',(notice)=>{
    // fix all notice
})
client.on('request',(notice)=>{
    // fix all request
})
client.pickGroup(42342342).on('notice') // fix group(42342342) notice
client.pickGroup(42342342).on('request') // fix group(42342342) request
client.pickGroup(42342342).on('notice.increase') // fix group(42342342) increase notice
client.pickGroup(42342342).on('request.add') // fix group(42342342) add request

more

TypeDocs

Keywords

onebot

FAQs

Package last updated on 02 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts