Skip to content

New Typescript SDK for QQ bot relying on mirai-api-http v2

Notifications You must be signed in to change notification settings

Enzymii/mirainya2

Repository files navigation

mirainya2

Commitizen friendly

A new version of typescript QQ bot SDK based on mirai-api-http v2

This repo is under quite slow construction

Trying my best to make progress every day

Usage

Firstly you need to guarantee that you have the mirai-api-http^2 env

I have published it by yarn, so you can use

yarn install mirainya2

An example program can be:

import { Bot, Logger, MakeMsg } from 'mirainya2';

const main = async (): Promise<void> => {
  const myBot = new Bot(botConfig); // the sample of botConfig can be found in ./src/config_sample

  await myBot.initialize();
  await myBot.login();

  myBot.listen(async (msg) => {
    Logger.log(JSON.stringify(msg));
    if (msg.type === 'FriendMessage') {
      await myBot.api?.sendFriendMessage(msg.sender.id, [MakeMsg.plain('QAQ')]);
    }
  }, 'msg');
};

main();

Welcome contribution

About

New Typescript SDK for QQ bot relying on mirai-api-http v2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published