Code Monkey home page Code Monkey logo

nekobot's Introduction

NekoBot

Hello! 这里是 NekoBot ^ >ω< ^
是一个使用 Telegram.Bot 进行开发的模块化 TelegramBot

Usage

1. 获取可执行文件

您可以将repo clone到本地,自行构建

git clone https://github.com/LeZi9916/NekoBot
cd NekoBot
dotnet build

或直接从 Release 下载

2. 配置Bot

首次运行 NekoBot,Bot会在所在路径生成"Database"、"Temp"、"logs"、"Scripts"目录与"NekoBot.conf"配置文件
请在"NekoBot.conf"中填入您的Bot信息

Authenticator:        # HOTP相关
    Counter: 0
    Digits: 8         # HOTP Code长度
    SecretKey: ''     # 自动生成
    FailureCount: 0
DbAutoSave: true      # Database自动保存
AutoSaveInterval: 600 # Database在更改多久(秒)后保存
Token: ''             # 请输入您的Bot Token
Proxy:
    UseProxy: false   # 如为True,Bot将通过Proxy连接至Telegram
    Address: 
Analyzer:             # 统计器
    TotalHandleCount: 0
    TotalHandleTime: 0
Assembly: []          # 引用的外部程序集
                      # e.g. ExampleAssembly.dll

Assembly

NekoBot会在启动时会加载配置文件Assembly中定义的C#程序集,程序集需位于 Scripts/Library
您可以在C# Script中使用 using 调用这些程序集的Namespace

Extension

Extension是NekoBot的核心;NekoBot允许动态编译C# Script作为Extension,并在runtime动态地加载与卸载
C# Script应当根据ExtensionType分类并存放在Scripts目录下

所有Extension必须实现接口IExtension

Module

基类: Extension
接口: IExtension
目录: Scripts/Module

Handler

基类: Extension
接口: IExtension, IHandler
目录: Scripts/Handler
文件名: {UpdateType}Handler.csx

处理botClient传入的Update并返回一个匿名函数交由ScriptManager调用

Database

基类: Database<T>
接口: IExtension, IDatabase<T>, IDestroyable
目录: Scripts/Database

Serializer

基类: Extension
接口: IExtension, ISerializer
目录: Scripts/Serializer

Enum

ExtensionType:

  • Handler
  • Module
  • Database
  • Serializer

UpdateType:

  • Message
  • InlineQuery
  • ChosenInlineResult
  • CallbackQuery
  • EditedMessage
  • ChannelPost
  • EditedChannelPost
  • ShippingQuery
  • PreCheckoutQuery
  • Poll
  • PollAnswer
  • MyChatMember
  • ChatMember
  • ChatJoinRequest
  • Unknown

nekobot's People

Contributors

lezi9916 avatar

Stargazers

四月櫻花 洇染成殤 avatar  avatar Kirikaze Chiyuki avatar

Watchers

 avatar

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.