diff --git a/OshimaWebAPI/Models/QQBot.cs b/OshimaServers/Model/QQBot.cs similarity index 50% rename from OshimaWebAPI/Models/QQBot.cs rename to OshimaServers/Model/QQBot.cs index b1be436..f0c0eaf 100644 --- a/OshimaWebAPI/Models/QQBot.cs +++ b/OshimaServers/Model/QQBot.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Oshima.FunGame.WebAPI.Models +namespace Oshima.FunGame.OshimaServers.Models { public class Payload { @@ -87,6 +87,149 @@ namespace Oshima.FunGame.WebAPI.Models public string ImageUrl { get; set; } } + public class BotReply + { + // 纯文本内容(兼容旧版) + public string? Text { get; set; } + + // Markdown 消息(与 Text 互斥,若提供则发送 Markdown) + public MarkdownMessage? Markdown { get; set; } + + // Markdown 附带键盘(仅当 Markdown 不为 null 时有效) + public KeyboardMessage? Keyboard { get; set; } + + // 方便从 string 隐式转换,旧代码无感知 + public static implicit operator BotReply(string text) => new() { Text = text }; + } + + public static class BotReplyExtension + { + /// + /// 增加键盘按钮 + /// + /// 键盘消息 + /// 每行按钮数量,自动检查如果超过则新建行 + /// 按钮 + /// + public static KeyboardMessage AppendButtons(this KeyboardMessage kb, int btnCountPerRow, params IEnumerable