diff --git a/go.mod b/go.mod index 25cba58017..6484580858 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.19 require ( github.com/Baidu-AIP/golang-sdk v1.1.1 github.com/Coloured-glaze/gg v1.3.4 - github.com/FloatTech/AnimeAPI v1.6.1-0.20221211044824-a4c95321af15 + github.com/FloatTech/AnimeAPI v1.6.1-0.20221212075306-4d0d5d6a85f7 github.com/FloatTech/floatbox v0.0.0-20221210051813-4bd44af40c60 github.com/FloatTech/sqlite v1.5.7 github.com/FloatTech/ttl v0.0.0-20220715042055-15612be72f5b @@ -25,7 +25,7 @@ require ( github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 github.com/jinzhu/gorm v1.9.16 github.com/jozsefsallai/gophersauce v1.0.1 - github.com/lucas-clemente/quic-go v0.31.0 + github.com/lucas-clemente/quic-go v0.31.1 github.com/mroth/weightedrand v1.0.0 github.com/pkg/errors v0.9.1 github.com/shirou/gopsutil/v3 v3.22.11 diff --git a/go.sum b/go.sum index a380d128a9..5f80159903 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/Coloured-glaze/gg v1.3.4 h1:l31zIF/HaVwkzjrj+A56RGQoSKyKuR1IWtIrqXGFStI= github.com/Coloured-glaze/gg v1.3.4/go.mod h1:Ih5NLNNDHOy3RJbB0EPqGTreIzq/H02TGThIagh8HJg= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= -github.com/FloatTech/AnimeAPI v1.6.1-0.20221211044824-a4c95321af15 h1:/AMRe7SDCqrE0674bz6FakI/UqaxTUbBjbDs+p/ARh8= -github.com/FloatTech/AnimeAPI v1.6.1-0.20221211044824-a4c95321af15/go.mod h1:Sp8rOoJkMq/X0XIqrhcH9fuFTF/HuLDBL26NkA1FEGA= +github.com/FloatTech/AnimeAPI v1.6.1-0.20221212075306-4d0d5d6a85f7 h1:79u3Jqv9KGSnwYFAWHx9Jw83YcDjZTAZejzbcsdIrjQ= +github.com/FloatTech/AnimeAPI v1.6.1-0.20221212075306-4d0d5d6a85f7/go.mod h1:Ri2Qa0552braxZVsk+axbBHL6UIWkGqQRETiIT9QTXI= github.com/FloatTech/floatbox v0.0.0-20221210051813-4bd44af40c60 h1:S4KfcdK6LdOa0+TTyacHYOZ8aWkR6YbvlnI6GWe66Jc= github.com/FloatTech/floatbox v0.0.0-20221210051813-4bd44af40c60/go.mod h1:/k2zxRJtAJ17w9fSpc7xf2QjPDTUBmqhBsOGyHVyX0U= github.com/FloatTech/rendercard v0.0.2-0.20221128165614-a41216d2422e h1:7bF01RHsYS99Zp+OWfob1W/Cymho6fcggoRSpiuiYB8= @@ -126,8 +126,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lib/pq v1.1.1 h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4= github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lucas-clemente/quic-go v0.31.0 h1:MfNp3fk0wjWRajw6quMFA3ap1AVtlU+2mtwmbVogB2M= -github.com/lucas-clemente/quic-go v0.31.0/go.mod h1:0wFbizLgYzqHqtlyxyCaJKlE7bYgE6JQ+54TLd/Dq2g= +github.com/lucas-clemente/quic-go v0.31.1 h1:O8Od7hfioqq0PMYHDyBkxU2aA7iZ2W9pjbrWuja2YR4= +github.com/lucas-clemente/quic-go v0.31.1/go.mod h1:0wFbizLgYzqHqtlyxyCaJKlE7bYgE6JQ+54TLd/Dq2g= github.com/lucasb-eyer/go-colorful v1.0.2/go.mod h1:0MS4r+7BZKSJ5mw4/S5MPN+qHFF1fYclkSPilDOKW0s= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= diff --git a/main.go b/main.go index a354c511a0..7f0bd00799 100644 --- a/main.go +++ b/main.go @@ -30,7 +30,7 @@ import ( _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chat" // 基础词库 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/sleep_manage" // 统计睡眠时间 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/sleep_manage" // 统计睡眠时间 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/atri" // ATRI词库 @@ -58,87 +58,96 @@ import ( // vvvvvvvvvvvvvv // // vvvv // - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/ahsai" // ahsai tts - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/ai_false" // 服务器监控 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/aipaint" // ai绘图 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/aiwife" // 随机老婆 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/alipayvoice" // 支付宝到账语音 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/b14" // base16384加解密 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/baidu" // 百度一下 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/baiduaudit" // 百度内容审核 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/base64gua" // base64卦加解密 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/baseamasiro" // base天城文加解密 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/bilibili" // b站相关 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/book_review" // 哀伤雪刃吧推书记录 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/cangtoushi" // 藏头诗 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/choose" // 选择困难症帮手 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chouxianghua" // 说抽象话 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chrev" // 英文字符翻转 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/coser" // 三次元小姐姐 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/cpstory" // cp短打 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/danbooru" // DeepDanbooru二次元图标签识别 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/diana" // 嘉心糖发病 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/dress" // 女装 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/drift_bottle" // 漂流瓶 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/emojimix" // 合成emoji - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/epidemic" // 城市疫情查询 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/event" // 好友申请群聊邀请事件处理 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/font" // 渲染任意文字到图片 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/fortune" // 运势 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/funny" // 笑话 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/genshin" // 原神抽卡 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/gif" // 制图 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/github" // 搜索GitHub仓库 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/guessmusic" // 猜歌 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/heisi" // 黑丝 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/hs" // 炉石 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/hyaku" // 百人一首 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/image_finder" // 关键字搜图 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/inject" // 注入指令 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/jandan" // 煎蛋网无聊图 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/jiami" // 兽语加密 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/jikipedia" // 小鸡词典 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/jptingroom" // 日语听力学习材料 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/juejuezi" // 绝绝子生成器 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/lolicon" // lolicon 随机图片 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/magicprompt" // magicprompt吟唱提示 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/midicreate" // 简易midi音乐制作 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/moegoe" // 日韩 VITS 模型拟声 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/moyu" // 摸鱼 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/moyu_calendar" // 摸鱼人日历 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/music" // 点歌 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nativesetu" // 本地涩图 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nativewife" // 本地老婆 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nbnhhsh" // 拼音首字母缩写释义工具 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nihongo" // 日语语法学习 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/novel" // 铅笔小说网搜索 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nsfw" // nsfw图片识别 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/omikuji" // 浅草寺求签 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/qqwife" // 一群一天一夫一妻制群老婆 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/quan" // QQ权重查询 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/qzone" // qq空间表白墙 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/realcugan" // realcugan清晰术 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/reborn" // 投胎 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/runcode" // 在线运行代码 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/saucenao" // 以图搜图 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/scale" // 叔叔的AI二次元图片放大 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/score" // 分数 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/setutime" // 来份涩图 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/shadiao" // 沙雕app - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/shindan" // 测定 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/tarot" // 抽塔罗牌 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/tiangou" // 舔狗日记 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/tracemoe" // 搜番 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/translation" // 翻译 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/vitsnyaru" // vits猫雷 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/vtb_quotation" // vtb语录 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wangyiyun" // 网易云音乐热评 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wenben" // 文本指令大全 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wenxinAI" // 百度文心AI画图 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/word_count" // 聊天热词 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wordle" // 猜单词 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/ygo" // 游戏王相关插件 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/ymgal" // 月幕galgame + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/ahsai" // ahsai tts + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/ai_false" // 服务器监控 + + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/aipaint" // ai绘图 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/aiwife" // 随机老婆 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/alipayvoice" // 支付宝到账语音 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/b14" // base16384加解密 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/baidu" // 百度一下 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/baiduaudit" // 百度内容审核 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/base64gua" // base64卦加解密 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/baseamasiro" // base天城文加解密 + + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/bilibili" // b站相关 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/book_review" // 哀伤雪刃吧推书记录 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/cangtoushi" // 藏头诗 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/choose" // 选择困难症帮手 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chouxianghua" // 说抽象话 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chrev" // 英文字符翻转 + + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/coser" // 三次元小姐姐 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/cpstory" // cp短打 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/danbooru" // DeepDanbooru二次元图标签识别 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/diana" // 嘉心糖发病 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/dress" // 女装 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/drift_bottle" // 漂流瓶 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/emojimix" // 合成emoji + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/epidemic" // 城市疫情查询 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/event" // 好友申请群聊邀请事件处理 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/font" // 渲染任意文字到图片 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/fortune" // 运势 + + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/funny" // 笑话 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/genshin" // 原神抽卡 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/gif" // 制图 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/github" // 搜索GitHub仓库 + + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/guessmusic" // 猜歌 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/heisi" // 黑丝 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/hs" // 炉石 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/hyaku" // 百人一首 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/image_finder" // 关键字搜图 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/inject" // 注入指令 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/jandan" // 煎蛋网无聊图 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/jiami" // 兽语加密 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/jikipedia" // 小鸡词典 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/jptingroom" // 日语听力学习材料 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/juejuezi" // 绝绝子生成器 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/lolicon" // lolicon 随机图片 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/magicprompt" // magicprompt吟唱提示 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/midicreate" // 简易midi音乐制作 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/moegoe" // 日韩 VITS 模型拟声 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/moyu" // 摸鱼 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/moyu_calendar" // 摸鱼人日历 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/music" // 点歌 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/nativesetu" // 本地涩图 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/nativewife" // 本地老婆 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nbnhhsh" // 拼音首字母缩写释义工具 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/nihongo" // 日语语法学习 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/novel" // 铅笔小说网搜索 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nsfw" // nsfw图片识别 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/omikuji" // 浅草寺求签 + + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/qqwife" // 一群一天一夫一妻制群老婆 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/quan" // QQ权重查询 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/qzone" // qq空间表白墙 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/realcugan" // realcugan清晰术 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/reborn" // 投胎 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/runcode" // 在线运行代码 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/saucenao" // 以图搜图 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/scale" // 叔叔的AI二次元图片放大 + + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/score" // 分数 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/setutime" // 来份涩图 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/shadiao" // 沙雕app + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/shindan" // 测定 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/tarot" // 抽塔罗牌 + + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/tiangou" // 舔狗日记 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/tracemoe" // 搜番 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/translation" // 翻译 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/vitsnyaru" // vits猫雷 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/vtb_quotation" // vtb语录 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/wangyiyun" // 网易云音乐热评 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/wenben" // 文本指令大全 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/wenxinAI" // 百度文心AI画图 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/word_count" // 聊天热词 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wordle" // 猜单词 + + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/ygo" // 游戏王相关插件 + //_ "github.com/FloatTech/ZeroBot-Plugin/plugin/ymgal" // 月幕galgame // _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wtf" // 鬼东西 diff --git a/plugin/ai_reply/main.go b/plugin/ai_reply/main.go index 42c4b57977..030d81ae17 100644 --- a/plugin/ai_reply/main.go +++ b/plugin/ai_reply/main.go @@ -35,7 +35,7 @@ func init() { // 插件主体 enr := control.Register("aireply", &ctrl.Options[*zero.Ctx]{ DisableOnDefault: false, Brief: "人工智能回复", - Help: "- @Bot 任意文本(任意一句话回复)\n- 设置回复模式[青云客|小爱|ChatGPT]\n- 设置 ChatGPT SessionToken xxx\n- 重置ChatGPT连接", + Help: "- @Bot 任意文本(任意一句话回复)\n- 设置回复模式[青云客|小爱|ChatGPT]\n- 设置 ChatGPT SessionToken xxx\n- 设置 ChatGPT UA xxx\n- 设置 ChatGPT CF xxx\n- 重置ChatGPT连接", PrivateDataFolder: "aireply", }) @@ -64,19 +64,28 @@ func init() { // 插件主体 }) chatgptfile := enr.DataFolder() + "chatgpt.txt" + uafile := enr.DataFolder() + "ua.txt" + cffile := enr.DataFolder() + "cf.txt" cfg := &chatgpt.Config{ - UA: chatgpt.UA, RefreshInterval: time.Hour, Timeout: time.Minute, } data, err := os.ReadFile(chatgptfile) if err == nil { cfg.SessionToken = binary.BytesToString(data) - chats = aireply.NewChatGPT(cfg) + data, err = os.ReadFile(uafile) + if err == nil { + cfg.UA = binary.BytesToString(data) + data, err = os.ReadFile(cffile) + if err == nil { + cfg.CFClearance = binary.BytesToString(data) + } + } } + chats = aireply.NewChatGPT(cfg) go func() { for range time.NewTicker(time.Hour).C { - if chats == nil { + if chats == nil || cfg.SessionToken == "" { continue } err := os.WriteFile(chatgptfile, binary.StringToBytes(cfg.SessionToken), 0644) @@ -99,16 +108,49 @@ func init() { // 插件主体 ctx.SendChain(message.Text("ERROR: ", err)) return } - chats = aireply.NewChatGPT(&chatgpt.Config{ - UA: chatgpt.UA, - SessionToken: token, - RefreshInterval: time.Hour, - Timeout: time.Minute, - }) + cfg.SessionToken = token + ctx.SendChain(message.Text("设置成功")) + }) + + enr.OnRegex(`^设置\s*ChatGPT\s*UA\s*(.*)$`, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).Handle(func(ctx *zero.Ctx) { + ua := ctx.State["regex_matched"].([]string)[1] + f, err := os.Create(uafile) + if err != nil { + ctx.SendChain(message.Text("ERROR: ", err)) + return + } + defer f.Close() + _, err = f.WriteString(ua) + if err != nil { + ctx.SendChain(message.Text("ERROR: ", err)) + return + } + cfg.UA = ua + ctx.SendChain(message.Text("设置成功")) + }) + + enr.OnRegex(`^设置\s*ChatGPT\s*CF\s*(.*)$`, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).Handle(func(ctx *zero.Ctx) { + cf := ctx.State["regex_matched"].([]string)[1] + f, err := os.Create(cffile) + if err != nil { + ctx.SendChain(message.Text("ERROR: ", err)) + return + } + defer f.Close() + _, err = f.WriteString(cf) + if err != nil { + ctx.SendChain(message.Text("ERROR: ", err)) + return + } + cfg.CFClearance = cf ctx.SendChain(message.Text("设置成功")) }) enr.OnFullMatch("重置ChatGPT连接").SetBlock(true).Handle(func(ctx *zero.Ctx) { + if chats == nil { + ctx.SendChain(message.Text("ERROR: chats 为空")) + return + } err := chats.Reset(ctx.Event.UserID) if err != nil { ctx.SendChain(message.Text("ERROR: ", err))