Skip to content
This repository has been archived by the owner on Feb 8, 2025. It is now read-only.

Commit

Permalink
chore:mainly update
Browse files Browse the repository at this point in the history
  • Loading branch information
MoYoez committed May 23, 2024
1 parent 1562072 commit 17630a7
Show file tree
Hide file tree
Showing 14 changed files with 521 additions and 533 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Lucy_ReiBot

Lucy | Ver.1.0 (Nightly)
Lucy | Ver.2.0 (BETAAAAAAAAA 2.0 ver1)

基于 [ReiBot-Plugin](https://github.com/floattech/reibot-plugin) **的 三方 Bot 计划 Lucy**

Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/MoYoez/Lucy_reibot

go 1.21
go 1.22.2

require (
github.com/FloatTech/floatbox v0.0.0-20230331064925-9af336a84944
Expand Down Expand Up @@ -30,6 +30,7 @@ require (
require (
github.com/FloatTech/AnimeAPI v1.7.0 // indirect
github.com/FloatTech/ttl v0.0.0-20220715042055-15612be72f5b // indirect
github.com/MoYoez/LucyBaseRouter-Toolchain v0.0.0-20240513105735-fa25f6949091 // indirect
github.com/RomiChan/syncx v0.0.0-20221202055724-5f842c53020e // indirect
github.com/ericpauley/go-quantize v0.0.0-20200331213906-ae555eb2afa4 // indirect
github.com/fumiama/cron v1.3.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ github.com/FloatTech/ttl v0.0.0-20220715042055-15612be72f5b h1:tvciXWq2nuvTbFeJG
github.com/FloatTech/ttl v0.0.0-20220715042055-15612be72f5b/go.mod h1:fHZFWGquNXuHttu9dUYoKuNbm3dzLETnIOnm1muSfDs=
github.com/FloatTech/zbpctrl v1.5.3-0.20230130095145-714ad318cd52 h1:BrStRXeosWh8L0iA/EjPd8w6xNexDkqki39ITZko/9Q=
github.com/FloatTech/zbpctrl v1.5.3-0.20230130095145-714ad318cd52/go.mod h1:qqMLUwR7tKpqnAqsgI7aZbn0hbs2FEVF4ylMXqIpBdY=
github.com/MoYoez/LucyBaseRouter-Toolchain v0.0.0-20240513105735-fa25f6949091 h1:S/bbzRiSkKRu/IJOu0WAPfvs0nJ2cMr2f6frUizIS7Y=
github.com/MoYoez/LucyBaseRouter-Toolchain v0.0.0-20240513105735-fa25f6949091/go.mod h1:cPlGyxReSzPHtl31iX2bYj0VzAXugUqLAImnyJcT3m4=
github.com/MoYoez/ReiBot v0.0.0-20240311142840-76873b41aa4a h1:hVdKlkVTX2ta8BFo2xcH7wBuQVsVzzRNKUbZklyaeNI=
github.com/MoYoez/ReiBot v0.0.0-20240311142840-76873b41aa4a/go.mod h1:d8YGk5jIN2VyMMnMJg6edBt7I7yDhpTXSUELGuLxCCQ=
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
rei "github.com/fumiama/ReiBot"

_ "github.com/MoYoez/Lucy_reibot/plugin/chat"
_ "github.com/MoYoez/Lucy_reibot/plugin/chun"
_ "github.com/MoYoez/Lucy_reibot/plugin/fortune"
_ "github.com/MoYoez/Lucy_reibot/plugin/lolicon"
_ "github.com/MoYoez/Lucy_reibot/plugin/mai"
Expand Down
16 changes: 0 additions & 16 deletions plugin/blocker/main.go

This file was deleted.

76 changes: 76 additions & 0 deletions plugin/chun/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package chun

import (
"encoding/json"
"github.com/FloatTech/gg"
ctrl "github.com/FloatTech/zbpctrl"
"github.com/MoYoez/Lucy_reibot/plugin/mai"
"github.com/MoYoez/Lucy_reibot/utils/toolchain"
rei "github.com/fumiama/ReiBot"
tgba "github.com/go-telegram-bot-api/telegram-bot-api/v5"
"strconv"
)

var engine = rei.Register("chun", &ctrl.Options[*rei.Ctx]{
DisableOnDefault: false,
Help: "chun for Lucy",
PrivateDataFolder: "chun",
})

func init() {
engine.OnMessageCommand("chun").SetBlock(true).Handle(func(ctx *rei.Ctx) {
getSplitLength, GetSplitInfo := toolchain.SplitCommandTo(ctx.Message.Text, 3)
if getSplitLength >= 2 {
switch {
case GetSplitInfo[1] == "raw":
// baserender
ChunRender(ctx, true)
case GetSplitInfo[1] == "bind":
if getSplitLength < 3 {
ctx.SendPlainMessage(true, "w? 绑定错了啊 是 /chun bind <username> ")
return
}
getUsername := GetSplitInfo[2]
mai.BindUserToMaimai(ctx, getUsername)
return
}

} else {
ChunRender(ctx, false)
}

})
}

func ChunRender(ctx *rei.Ctx, israw bool) {
// check the user using.
getUserID, _ := toolchain.GetChatUserInfoID(ctx)
getUsername := mai.GetUserInfoNameFromDatabase(getUserID)
if getUsername == "" {
ctx.SendPlainMessage(true, "你还没有绑定呢!使用/chun bind <UserName> 以绑定")
return
}
getUserData, err := QueryChunDataFromUserName(getUsername)
if err != nil {
ctx.SendPlainMessage(true, err)
return
}
var data ChunData
_ = json.Unmarshal(getUserData, &data)
renderImg := BaseRender(data, ctx)
_ = gg.NewContextForImage(renderImg).SaveJPG(engine.DataFolder()+"save/"+strconv.Itoa(int(getUserID))+".png", 80)

if israw {
getDocumentType := &tgba.DocumentConfig{
BaseFile: tgba.BaseFile{BaseChat: tgba.BaseChat{
ChatConfig: tgba.ChatConfig{ChatID: ctx.Message.Chat.ID},
},
File: tgba.FilePath(engine.DataFolder() + "save/" + strconv.Itoa(int(getUserID)) + ".png")},
Caption: "",
CaptionEntities: nil,
}
ctx.Send(true, getDocumentType)
} else {
ctx.SendPhoto(tgba.FilePath(engine.DataFolder()+"save/"+strconv.Itoa(int(getUserID))+".png"), true, "")
}
}
Loading

0 comments on commit 17630a7

Please sign in to comment.