GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - theGravityLab/HyperaiX

BranchesTags
Open more actions menu

Latest commit

 

History

52 Commits
52 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

HyperaiX

下一代 Hyperai。

// SomeUnit.cs
[Receiver(MessageEventType.Group | MessageEventType.Friend)]
[Extract("!reply {image:Image}")]
public async Task ReplyImageAsync(Image image, MessageChain chain)
{
    var builder = chain.CanBeReplied() ? chain.MakeReply() : new MessageChainBuilder();
    builder.Add(image);
    await Context.SendMessageAsync(builder.Build());
}

[Receiver(MessageEventType.Group | MessageEventType.Friend)]
[Extract("{owner}/{repo}")]
public Image Github(string owner, string repo)
{
    return new Image(new Uri($"https://opengraph.githubassets.com/0/{owner}/{repo}"));
}

Install for Bot

dotnet add package HyperaiX

添加到程序通用/Web主机中:

host.ConfigureServices( services => services
    .AddHyperaiX()
    .AddSingleton<Bridge>());
// 别忘了实现 IApiClient

class Bridge: IApiClient
{
    // 实例负责接收/发送事件
    // 接收到的事件被发送到 HyperaiX 管线中处理
}

Install for Development

HyperaiX.Abstractions 提供了大部分对qq消息处理的基础类型,在需要的地方使用该包。

dotnet add package HyperaiX.Abstractions

需要的场景:

  • 框架
  • API
  • BOT

Documents

没有。看看上一代的文档吧。

TODO

日后实现

Unit Scope(弃案,Unit不应该用来保存状态)

通过切换 Unit 的上下文实现对于一个 Unit 在同一时间只为一个用户提供服务。也就是说一个或不同的 Unit 中的 UnitContext 会保证在同一个用户下一致。

Unit Context 保存了 Unit 的状态,其中有 Unit 的持久化数据(kv数据库,Unit生命中周期为一次事务),其他不知道,以后再加。

使用 Attribute 来决定上下文共享方式,例如[SharingScope(UnitContextScope)]。其中 UnitContextScope 具有以下值:

  • 单Unit单用户
  • 单Unit多用户
  • 多Unit单用户
  • 全局共享

Session(完成)

Unit Service 会提供一个集中保存状态的地方,并用Session表示,可以被注入到 Action。

PersistenceAttribute标记的 Action 就可以获得的Session。

Unit 的事件捕获支持

等到 C# 10 正式出来支持 Generic Attribute 之后再搞。

About

No description, website, or topics provided.

Resources

Readme
MIT license
Activity
Custom properties

Stars

2 stars

Watchers

1 watching

Forks

0 forks
Report repository

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.