Giter Club home page Giter Club logo

novabot_v2's Introduction

NoneBotPluginLogo

NovaBot2

novabot2

✨ 来自NovaBot二代目✨

license nonebot2 python

基于nonebot2go-cqhttp开发的QQ群机器人

📖 介绍

因为一直用别人的BOT不好魔改所以就写了自己的BOT啦, 我是比较想叫它Skadi Bot嘛,但是想了想还是叫做Nova Bot

  • 支持各种事件的群权限管理系统(包括定时事件及各类提示事件)
  • 易调用易修改的插件配置系统
  • ...

💿 安装

从 github 安装

打开命令行, 输入以下命令克隆此储存库

git clone https://github.com/Nova-Noir/novabot_v2.git

正在更新...

⚙️ 配置

在项目的.env文件中添加下表中的必填配置

配置项 必填 默认值 说明
配置项1 配置说明
配置项2 配置说明

🎉 使用

删除线标注的内容为未开发完成, 可能存在不兼容更新

Service_Manager

plugins.service_manager

基础插件。提供整个Bot的插件管理系统。功能灵感来源于HoshinoBot(用习惯了)

采用修改matcherRule的方式, 使matcher功能增强, 可复用。(性能就不提了)

之前写的那个非藕合的过于复杂, 且对所有matcher均有效而无法进行精细化自定义, 也无法对定时任务做管理, 于是重写了这个。

插件调用方式

matcher 类型

对于普通的matcher:

from novabot.plugins.service_manager import Service

cmd = on_*(...)
cmd = service("plugin_name", cmd, ...)

一个可能的例子:

from novabot.plugins.service_manager import Service as service

cmd = on_command("abc")
cmd = service("abc", cmd, cd=20, cd_reply="HI!")

cmd1 = on_command("abd")
cmd1 = service("abd", cmd1, visible=False, limit=3, limit_reply="Another Hi!")

cmd2 = on_command("abe")
cmd2 = service("abee", cmd2, enable_on_default=False) # plugin_name: abee

notice_test = on_notice()
notice_test = service("notice_test", notice_test)
apscheduler (定时任务) 类型

对于apscheduler的定时任务:

from novabot.plugins.service_manager import service_scheduler

@service_scheduler.scheduled_job("plugin_name", 'cron', ...)
async def _(bot: Bot, groups: List[int]):
    ...
    

一个可能的例子:

from typing import List

from nonebot.adapters.onebot.v11 import Bot, MessageSegment
from novabot.plugins.service_manager import service_scheduler


@service_scheduler.scheduled_job("test_plugin", 'cron', id='test_plugin', second='0/30')
async def _(bot: Bot, groups: List[int]):
    for i in groups:
        await bot.call_api('send_group_msg', group_id=i, message=MessageSegment.text("Test on group %s" % i))

插件数据类型

Service
参数 类型 可省略 说明 默认值
service_name str 插件名称
matcher Type[Matcher] 所要包裹的Matcher实例
use_priv int 插件使用权限, 未开发, 可使用permission代替 0
manage_priv int 插件管理权限, 未开发 0
enable_on_default bool 是否默认启用 True
visible bool 是否在帮助 / lssv中可见 True
help_ str 帮助文档 None
bundle str 插件分类 "默认"
cd int 插件调用CD, 针对个人, 单位为 0
limit int 插件日调用次数限制, 针对个人, 0为无限制, 单位为 0
cd_reply str 插件CD中回复, 空为不回复, 可以使用%cool%表示剩余时间 ""
limit_reply str 插件日调用次数上限回复, 空为不回复 ""
SchedulerService
参数 类型 可省略 说明 默认值
plugin_name str 插件名称
manage_priv int 插件管理权限, 未开发 0
enable_on_default bool 是否默认启用 True
visible bool 是否在帮助 / lssv中可见 True
help_ str 帮助文档 None
bundle str 插件分类 "默认"

指令表

指令 别名 参数 权限 需要@ 范围 说明
lssv 服务列表 | 功能列表 show_all 群管理员 | 群主 | 超级管理员 群聊 列出服务列表, 参数可为任意值, 存在则将同时显示visible=False的服务
enable 启用 | 打开 | 开启 service_name 群管理员 | 群主 | 超级管理员 群聊 启用service_name插件. 可使用空格(" ")分隔多个service_name, 可使用关键字all全部开启所有服务
disable 禁用 | 关闭 service_name 群管理员 | 群主 | 超级管理员 群聊 禁用service_name插件. 可使用空格(" ")分隔多个service_name, 可使用关键字all全部开启所有服务

novabot_v2's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

shuiyiyihan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.