nuxt-ferry
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

Nuxt Ferry

npm version npm downloads bundle JSDocs License

适用于 Nuxt 的微信机器人框架,使用如下开源项目强力驱动:

Features

  • ⛰ 享用 Nuxt 的所有特性
  • 🚠 定义路由就是机器人的技能
  • 🌲 可编程的 Nitro Corn Task
  • 🦾 无需关心回调

Quick Setup

Install:

pnpx nuxi module add nuxt-ferry

Command:

// server/routes/*.ts
/**
 * 在群里说:@机器人 ping
 * 机器人回复:pong
 */
export default defineBotCommandEventHandler({
  command: "ping",
  handler({ message }) {
    message.say("pong");
  },
});

Message:

// server/routes/*.ts
/**
 * 私聊机器人
 * 机器人说:hi
 */
export default defineBotEventHandler({
  hooks: "ferry:message:contact",
  handler({ message }) {
    message.say("hi!");
  },
});

Tasks:

// server/tasks/*.ts
/**
 * 每晚 11 点对自己说 hi!
 */
export default defineCronTask({
  pattern: "0 23 * * *",
  run({ message }) {
    useBot().say('hi!')
  },
});

That's it! You can now use Nuxt Ferry in your Nuxt app ✨

Funding

Contribution

Local development
# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the playground
npm run dev:build

# Run ESLint
npm run lint

# Run Vitest
npm run test
npm run test:watch

# Release new version
npm run release

License

MIT License © 2024-PRESENT mrrhq

Readme

Keywords

none

Package Sidebar

Install

npm i nuxt-ferry

Weekly Downloads

11

Version

0.0.1

License

MIT

Unpacked Size

14.6 kB

Total Files

29

Last publish

Collaborators

  • kejunmao