From 60c29b2d124784a238e9a50b467aa0ef0756ae00 Mon Sep 17 00:00:00 2001 From: fumiama Date: Mon, 9 Aug 2021 12:36:57 +0800 Subject: [PATCH 01/29] =?UTF-8?q?=E2=9C=A8=20=E5=A2=9E=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E7=BE=A4=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 +- main.go | 2 +- plugin_manager/manager.go | 173 +++++++++-- plugin_manager/manager.pb.go | 561 +++++++++++++++++++++++++++++++++++ plugin_manager/manager.proto | 7 + 5 files changed, 726 insertions(+), 27 deletions(-) create mode 100644 plugin_manager/manager.pb.go create mode 100644 plugin_manager/manager.proto diff --git a/README.md b/README.md index 579c2c73..e4153c6d 100644 --- a/README.md +++ b/README.md @@ -45,12 +45,14 @@ - [x] 退出群聊[群号] - [x] *入群欢迎 - [x] *退群通知 - - [x] 在[月份]月[日期]日的[小时]点[分钟]分时(用[url])提醒大家[消息] - - [x] 在[月份]月[每周or周几]的[小时]点[分钟]分时(用[url])提醒大家[消息] - - [x] 取消在[月份]月[日期]日的[小时]点[分钟]分的提醒 - - [x] 取消在[月份]月[每周or周几]的[小时]点[分钟]分的提醒 + - [x] 设置欢迎语[欢迎~] + - [x] 在MM月dd日的hh点mm分时(用http://url)提醒大家xxx + - [x] 在MM月[每周|周几]的hh点mm分时(用http://url)提醒大家xxx + - [x] 取消在MM月dd日的hh点mm分的提醒 + - [x] 取消在MM月[每周|周几]的hh点mm分的提醒 - [x] 列出所有提醒 - [x] 翻牌 + - [x] [开启|关闭]入群验证 - [ ] 同意入群请求 - [ ] 同意好友请求 - [ ] 撤回[@xxx] [xxx] diff --git a/main.go b/main.go index 6903eabe..841d2146 100644 --- a/main.go +++ b/main.go @@ -60,7 +60,7 @@ func init() { func main() { fmt.Print( - "======================[ZeroBot-Plugin]======================", + "\n======================[ZeroBot-Plugin]======================", "\n", banner, "\n", "============================================================\n", ) // 启动打印 diff --git a/plugin_manager/manager.go b/plugin_manager/manager.go index 20abae21..7ee7844e 100644 --- a/plugin_manager/manager.go +++ b/plugin_manager/manager.go @@ -3,7 +3,9 @@ package manager import ( "fmt" + "io" "math/rand" + "os" "strconv" "strings" "time" @@ -14,27 +16,44 @@ import ( timer "github.com/FloatTech/ZeroBot-Plugin-Timer" ) +const ( + datapath = "data/manager/" + confile = datapath + "config.pb" + hint = "====群管====\n" + + "- 禁言@QQ 1分钟\n" + + "- 解除禁言 @QQ\n" + + "- 我要自闭 1分钟\n" + + "- 开启全员禁言\n" + + "- 解除全员禁言\n" + + "- 升为管理@QQ\n" + + "- 取消管理@QQ\n" + + "- 修改名片@QQ XXX\n" + + "- 修改头衔@QQ XXX\n" + + "- 申请头衔 XXX\n" + + "- 踢出群聊@QQ\n" + + "- 退出群聊 1234\n" + + "- 群聊转发 1234 XXX\n" + + "- 私聊转发 0000 XXX\n" + + "- 在MM月dd日的hh点mm分时(用http://url)提醒大家XXX\n" + + "- 在MM月[每周|周几]的hh点mm分时(用http://url)提醒大家XXX\n" + + "- 取消在MM月dd日的hh点mm分的提醒\n" + + "- 取消在MM月[每周|周几]的hh点mm分的提醒\n" + + "- 列出所有提醒\n" + + "- 翻牌\n" + + "- 设置欢迎语XXX\n" + + "- [开启|关闭]入群验证" +) + +var ( + config Config +) + func init() { // 插件主体 + loadConfig() // 菜单 zero.OnFullMatch("群管系统", zero.AdminPermission).SetBlock(true).FirstPriority(). Handle(func(ctx *zero.Ctx) { - ctx.SendChain(message.Text( - "====群管====", "\n", - "- 禁言@QQ 1分钟", "\n", - "- 解除禁言 @QQ", "\n", - "- 我要自闭 1分钟", "\n", - "- 开启全员禁言", "\n", - "- 解除全员禁言", "\n", - "- 升为管理@QQ", "\n", - "- 取消管理@QQ", "\n", - "- 修改名片@QQ XXX", "\n", - "- 修改头衔@QQ XXX", "\n", - "- 申请头衔 XXX", "\n", - "- 踢出群聊@QQ", "\n", - "- 退出群聊 1234", "\n", - "- 群聊转发 1234 XXX", "\n", - "- 私聊转发 0000 XXX", - )) + ctx.Send(hint) }) // 升为管理 zero.OnRegex(`^升为管理.*?(\d+)`, zero.OnlyGroup, zero.SuperUserPermission).SetBlock(true).SetPriority(40). @@ -222,7 +241,7 @@ func init() { // 插件主体 ctx.SendChain(message.Text("📧 --> " + ctx.State["regex_matched"].([]string)[1])) }) // 定时提醒 - zero.OnRegex(`^在(.{1,2})月(.{1,3}日|每?周.?)的(.{1,3})点(.{1,3})分时(用.+)?提醒大家(.*)`, zero.SuperUserPermission).SetBlock(true).SetPriority(40). + zero.OnRegex(`^在(.{1,2})月(.{1,3}日|每?周.?)的(.{1,3})点(.{1,3})分时(用.+)?提醒大家(.*)`, zero.AdminPermission).SetBlock(true).SetPriority(40). Handle(func(ctx *zero.Ctx) { if ctx.Event.GroupID > 0 { dateStrs := ctx.State["regex_matched"].([]string) @@ -237,7 +256,7 @@ func init() { // 插件主体 } }) // 取消定时 - zero.OnRegex(`^取消在(.{1,2})月(.{1,3}日|每?周.?)的(.{1,3})点(.{1,3})分的提醒`, zero.SuperUserPermission).SetBlock(true).SetPriority(40). + zero.OnRegex(`^取消在(.{1,2})月(.{1,3}日|每?周.?)的(.{1,3})点(.{1,3})分的提醒`, zero.AdminPermission).SetBlock(true).SetPriority(40). Handle(func(ctx *zero.Ctx) { if ctx.Event.GroupID > 0 { dateStrs := ctx.State["regex_matched"].([]string) @@ -256,7 +275,7 @@ func init() { // 插件主体 } }) // 列出本群所有定时 - zero.OnFullMatch("列出所有提醒", zero.SuperUserPermission).SetBlock(true).SetPriority(40). + zero.OnFullMatch("列出所有提醒", zero.AdminPermission).SetBlock(true).SetPriority(40). Handle(func(ctx *zero.Ctx) { if ctx.Event.GroupID > 0 { ctx.Send(fmt.Sprint(timer.ListTimers(uint64(ctx.Event.GroupID)))) @@ -277,10 +296,52 @@ func init() { // 插件主体 } }) // 入群欢迎 - zero.OnNotice().SetBlock(false).SetPriority(40). + zero.OnNotice().SetBlock(false).FirstPriority(). Handle(func(ctx *zero.Ctx) { if ctx.Event.NoticeType == "group_increase" { - ctx.SendChain(message.Text("欢迎~")) + word, ok := config.Welcome[uint64(ctx.Event.GroupID)] + if ok { + ctx.Send(word) + } else { + ctx.Send("欢迎~") + } + enable, ok1 := config.Checkin[uint64(ctx.Event.GroupID)] + if ok1 && enable { + uid := ctx.Event.UserID + a := rand.Intn(100) + b := rand.Intn(100) + r := a + b + ctx.SendChain(message.At(uid), message.Text(fmt.Sprintf("考你一道题:%d+%d=?\n如果60秒之内答不上来,%s就要把你踢出去了哦~", a, b, zero.BotConfig.NickName[0]))) + // 匹配发送者进行验证 + rule := func(ctx *zero.Ctx) bool { + for _, elem := range ctx.Event.Message { + if elem.Type == "text" { + text := strings.ReplaceAll(elem.Data["text"], " ", "") + ans, err := strconv.Atoi(text) + if err == nil { + if ans != r { + ctx.Send("答案不对哦,再想想吧~") + return false + } else { + return true + } + } + } + } + return false + } + next := zero.NewFutureEvent("message", 999, false, zero.CheckUser(ctx.Event.UserID), rule) + recv, cancel := next.Repeat() + select { + case <-time.After(time.Minute): + ctx.Send("拜拜啦~") + ctx.SetGroupKick(ctx.Event.GroupID, uid, false) + cancel() + case <-recv: + cancel() + ctx.Send("答对啦~") + } + } } }) // 退群提醒 @@ -290,6 +351,34 @@ func init() { // 插件主体 ctx.SendChain(message.Text("有人跑路了~")) } }) + // 设置欢迎语 + zero.OnRegex(`^设置欢迎语(.*)$`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(40). + Handle(func(ctx *zero.Ctx) { + config.Welcome[uint64(ctx.Event.GroupID)] = ctx.State["regex_matched"].([]string)[1] + if saveConfig() == nil { + ctx.Send("记住啦!") + } else { + ctx.Send("出错啦!") + } + }) + // 入群验证开关 + zero.OnRegex(`^(.*)入群验证$`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(40). + Handle(func(ctx *zero.Ctx) { + option := ctx.State["regex_matched"].([]string)[1] + switch option { + case "开启": + config.Checkin[uint64(ctx.Event.GroupID)] = true + case "关闭": + config.Checkin[uint64(ctx.Event.GroupID)] = false + default: + return + } + if saveConfig() == nil { + ctx.Send("已" + option) + } else { + ctx.Send("出错啦!") + } + }) // 运行 CQ 码 zero.OnRegex(`^run(.*)$`, zero.SuperUserPermission).SetBlock(true).SetPriority(0). Handle(func(ctx *zero.Ctx) { @@ -304,3 +393,43 @@ func strToInt(str string) int64 { val, _ := strconv.ParseInt(str, 10, 64) return val } + +func loadConfig() { + mkdirerr := os.MkdirAll(datapath, 0755) + if mkdirerr == nil { + if _, err := os.Stat(confile); err == nil || os.IsExist(err) { + f, err := os.Open(confile) + if err == nil { + data, err1 := io.ReadAll(f) + if err1 == nil { + if len(data) > 0 { + config.Unmarshal(data) + return + } + } + } + } + config.Checkin = make(map[uint64]bool) + config.Welcome = make(map[uint64]string) + } else { + panic(mkdirerr) + } +} + +func saveConfig() error { + data, err := config.Marshal() + if err != nil { + return err + } else if _, err := os.Stat(datapath); err == nil || os.IsExist(err) { + f, err1 := os.OpenFile(confile, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0644) + if err1 != nil { + return err1 + } else { + defer f.Close() + _, err2 := f.Write(data) + return err2 + } + } else { + return nil + } +} diff --git a/plugin_manager/manager.pb.go b/plugin_manager/manager.pb.go new file mode 100644 index 00000000..a0ac3fcc --- /dev/null +++ b/plugin_manager/manager.pb.go @@ -0,0 +1,561 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: manager.proto + +package manager + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type Config struct { + Checkin map[uint64]bool `protobuf:"bytes,1,rep,name=checkin,proto3" json:"checkin,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` + Welcome map[uint64]string `protobuf:"bytes,2,rep,name=welcome,proto3" json:"welcome,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Config) Reset() { *m = Config{} } +func (m *Config) String() string { return proto.CompactTextString(m) } +func (*Config) ProtoMessage() {} +func (*Config) Descriptor() ([]byte, []int) { + return fileDescriptor_cde9ec64f0d2c859, []int{0} +} +func (m *Config) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Config) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Config.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Config) XXX_Merge(src proto.Message) { + xxx_messageInfo_Config.Merge(m, src) +} +func (m *Config) XXX_Size() int { + return m.Size() +} +func (m *Config) XXX_DiscardUnknown() { + xxx_messageInfo_Config.DiscardUnknown(m) +} + +var xxx_messageInfo_Config proto.InternalMessageInfo + +func (m *Config) GetCheckin() map[uint64]bool { + if m != nil { + return m.Checkin + } + return nil +} + +func (m *Config) GetWelcome() map[uint64]string { + if m != nil { + return m.Welcome + } + return nil +} + +func init() { + proto.RegisterType((*Config)(nil), "manager.config") + proto.RegisterMapType((map[uint64]bool)(nil), "manager.config.CheckinEntry") + proto.RegisterMapType((map[uint64]string)(nil), "manager.config.WelcomeEntry") +} + +func init() { proto.RegisterFile("manager.proto", fileDescriptor_cde9ec64f0d2c859) } + +var fileDescriptor_cde9ec64f0d2c859 = []byte{ + // 186 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcd, 0x4d, 0xcc, 0x4b, + 0x4c, 0x4f, 0x2d, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x87, 0x72, 0x95, 0x3e, 0x30, + 0x72, 0xb1, 0x25, 0xe7, 0xe7, 0xa5, 0x65, 0xa6, 0x0b, 0x99, 0x71, 0xb1, 0x27, 0x67, 0xa4, 0x26, + 0x67, 0x67, 0xe6, 0x49, 0x30, 0x2a, 0x30, 0x6b, 0x70, 0x1b, 0xc9, 0xe8, 0xc1, 0x34, 0x41, 0x54, + 0xe8, 0x39, 0x43, 0xa4, 0x5d, 0xf3, 0x4a, 0x8a, 0x2a, 0x83, 0x60, 0x8a, 0x41, 0xfa, 0xca, 0x53, + 0x73, 0x92, 0xf3, 0x73, 0x53, 0x25, 0x98, 0xb0, 0xeb, 0x0b, 0x87, 0x48, 0x43, 0xf5, 0x41, 0x15, + 0x4b, 0x59, 0x71, 0xf1, 0x20, 0x1b, 0x28, 0x24, 0xc0, 0xc5, 0x9c, 0x9d, 0x5a, 0x29, 0xc1, 0xa8, + 0xc0, 0xa8, 0xc1, 0x12, 0x04, 0x62, 0x0a, 0x89, 0x70, 0xb1, 0x96, 0x25, 0xe6, 0x94, 0x82, 0xcc, + 0x65, 0xd4, 0xe0, 0x08, 0x82, 0x70, 0xac, 0x98, 0x2c, 0x18, 0x41, 0x7a, 0x91, 0x0d, 0x25, 0xa4, + 0x97, 0x13, 0x49, 0xaf, 0x93, 0xc0, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, + 0x24, 0xc7, 0x38, 0xe3, 0xb1, 0x1c, 0x43, 0x12, 0x1b, 0x38, 0x50, 0x8c, 0x01, 0x01, 0x00, 0x00, + 0xff, 0xff, 0x2a, 0xe6, 0x90, 0x6e, 0x25, 0x01, 0x00, 0x00, +} + +func (m *Config) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Config) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Config) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Welcome) > 0 { + for k := range m.Welcome { + v := m.Welcome[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintManager(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i = encodeVarintManager(dAtA, i, uint64(k)) + i-- + dAtA[i] = 0x8 + i = encodeVarintManager(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Checkin) > 0 { + for k := range m.Checkin { + v := m.Checkin[k] + baseI := i + i-- + if v { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + i = encodeVarintManager(dAtA, i, uint64(k)) + i-- + dAtA[i] = 0x8 + i = encodeVarintManager(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintManager(dAtA []byte, offset int, v uint64) int { + offset -= sovManager(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Config) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Checkin) > 0 { + for k, v := range m.Checkin { + _ = k + _ = v + mapEntrySize := 1 + sovManager(uint64(k)) + 1 + 1 + n += mapEntrySize + 1 + sovManager(uint64(mapEntrySize)) + } + } + if len(m.Welcome) > 0 { + for k, v := range m.Welcome { + _ = k + _ = v + mapEntrySize := 1 + sovManager(uint64(k)) + 1 + len(v) + sovManager(uint64(len(v))) + n += mapEntrySize + 1 + sovManager(uint64(mapEntrySize)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovManager(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozManager(x uint64) (n int) { + return sovManager(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Config) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Checkin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthManager + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthManager + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Checkin == nil { + m.Checkin = make(map[uint64]bool) + } + var mapkey uint64 + var mapvalue bool + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else if fieldNum == 2 { + var mapvaluetemp int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapvaluetemp |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + mapvalue = bool(mapvaluetemp != 0) + } else { + iNdEx = entryPreIndex + skippy, err := skipManager(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthManager + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Checkin[mapkey] = mapvalue + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Welcome", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthManager + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthManager + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Welcome == nil { + m.Welcome = make(map[uint64]string) + } + var mapkey uint64 + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthManager + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return ErrInvalidLengthManager + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skipManager(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthManager + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Welcome[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipManager(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthManager + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipManager(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowManager + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowManager + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowManager + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthManager + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupManager + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthManager + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthManager = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowManager = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupManager = fmt.Errorf("proto: unexpected end of group") +) diff --git a/plugin_manager/manager.proto b/plugin_manager/manager.proto new file mode 100644 index 00000000..cd53bf10 --- /dev/null +++ b/plugin_manager/manager.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; +package manager; + +message config { + map checkin = 1; + map welcome = 2; +} From 3005ee5b02ed44e3635dfb9e7783c8ee962ea5ff Mon Sep 17 00:00:00 2001 From: fumiama Date: Mon, 9 Aug 2021 12:40:10 +0800 Subject: [PATCH 02/29] =?UTF-8?q?=E2=9C=A8=20=E5=AE=8C=E5=96=84=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_manager/manager.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugin_manager/manager.go b/plugin_manager/manager.go index 7ee7844e..35bfebe1 100644 --- a/plugin_manager/manager.go +++ b/plugin_manager/manager.go @@ -403,8 +403,9 @@ func loadConfig() { data, err1 := io.ReadAll(f) if err1 == nil { if len(data) > 0 { - config.Unmarshal(data) - return + if config.Unmarshal(data) == nil { + return + } } } } From ab7e86218d33e06d1d1b0a0a2380297ef8a18668 Mon Sep 17 00:00:00 2001 From: fumiama Date: Mon, 9 Aug 2021 12:50:04 +0800 Subject: [PATCH 03/29] =?UTF-8?q?=F0=9F=92=A9=F0=9F=91=8C=20make=20lint=20?= =?UTF-8?q?happy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_manager/manager.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugin_manager/manager.go b/plugin_manager/manager.go index 35bfebe1..0ec62e8d 100644 --- a/plugin_manager/manager.go +++ b/plugin_manager/manager.go @@ -322,9 +322,8 @@ func init() { // 插件主体 if ans != r { ctx.Send("答案不对哦,再想想吧~") return false - } else { - return true } + return true } } } @@ -430,7 +429,6 @@ func saveConfig() error { _, err2 := f.Write(data) return err2 } - } else { - return nil } + return nil } From c7d2a061471541ac7b7dfa21ad07226684d750cc Mon Sep 17 00:00:00 2001 From: fumiama Date: Mon, 9 Aug 2021 12:53:45 +0800 Subject: [PATCH 04/29] =?UTF-8?q?=E6=94=B9=E8=BF=9Bpushlint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/push.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index ad5510b0..4dbe5b27 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -5,11 +5,12 @@ jobs: name: lint_golangci-lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.4 + - uses: actions/checkout@v2 - name: golangci-lint - uses: golangci/golangci-lint-action@v2.5.2 + uses: golangci/golangci-lint-action@v2 with: version: latest + args: --issues-exit-code=0 - name: Commit back continue-on-error: true run: | From 98a92afb954f2b90d840fcdd4fc8146b4acbde29 Mon Sep 17 00:00:00 2001 From: fumiama Date: Mon, 9 Aug 2021 13:05:59 +0800 Subject: [PATCH 05/29] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_manager/manager.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugin_manager/manager.go b/plugin_manager/manager.go index 0ec62e8d..69208d3d 100644 --- a/plugin_manager/manager.go +++ b/plugin_manager/manager.go @@ -393,6 +393,7 @@ func strToInt(str string) int64 { return val } +// loadConfig 加载设置,没有则手动初始化 func loadConfig() { mkdirerr := os.MkdirAll(datapath, 0755) if mkdirerr == nil { @@ -416,6 +417,7 @@ func loadConfig() { } } +// saveConfig 保存设置,无此文件则新建 func saveConfig() error { data, err := config.Marshal() if err != nil { From 0568a5da10731ee80a9897e9b1559460c7279e93 Mon Sep 17 00:00:00 2001 From: fumiama Date: Mon, 9 Aug 2021 13:08:18 +0800 Subject: [PATCH 06/29] =?UTF-8?q?=F0=9F=92=A9=F0=9F=91=8C=20make=20lint=20?= =?UTF-8?q?happy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_manager/manager.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugin_manager/manager.go b/plugin_manager/manager.go index 69208d3d..e0aeed5a 100644 --- a/plugin_manager/manager.go +++ b/plugin_manager/manager.go @@ -426,11 +426,10 @@ func saveConfig() error { f, err1 := os.OpenFile(confile, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0644) if err1 != nil { return err1 - } else { - defer f.Close() - _, err2 := f.Write(data) - return err2 } + defer f.Close() + _, err2 := f.Write(data) + return err2 } return nil } From f2fdad9f5a2e618731e25a45952f751cc5041706 Mon Sep 17 00:00:00 2001 From: fumiama Date: Mon, 9 Aug 2021 14:16:21 +0800 Subject: [PATCH 07/29] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20=E6=AC=A2=E8=BF=8E?= =?UTF-8?q?=E8=AF=AD=E6=94=AF=E6=8C=81=E6=8D=A2=E8=A1=8C=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 31 ++++++++++++++++--------------- plugin_manager/manager.go | 2 +- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index e4153c6d..a7800ebf 100644 --- a/README.md +++ b/README.md @@ -59,21 +59,21 @@ - [ ] 警告[@xxx] - [x] run[xxx] - **GitHub仓库搜索** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_github"` - - [x] >github [xxx] - - [x] >github -p [xxx] + - [x] >github [xxx] + - [x] >github -p [xxx] - **在线代码运行** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_runcode"` - [x] >runcode help - [x] >runcode [on/off] - - [x] >runcode [language] [code block] + - [x] >runcode [language] [code block] - **点歌** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_music"` - [x] 点歌[xxx] - [x] 网易点歌[xxx] - [x] 酷我点歌[xxx] - [x] 酷狗点歌[xxx] - **shindan** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_shindan"` - - [x] 今天是什么少女[@xxx] - - [x] 异世界转生[@xxx] - - [x] 卖萌[@xxx] + - [x] 今天是什么少女[@xxx] + - [x] 异世界转生[@xxx] + - [x] 卖萌[@xxx] - **涩图** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_setutime"` - [x] 来份[涩图/二次元/风景/车万] - [x] 添加[涩图/二次元/风景/车万][P站图片ID] @@ -84,7 +84,7 @@ - **搜图** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_saucenao"` - [x] 以图搜图|搜索图片|以图识图[图片] - [x] 搜图[P站图片ID] -- **随机图片与AI点评** `github.com/FloatTech/ZeroBot-ACGImage` +- **随机图片与AI点评** `github.com/FloatTech/ZeroBot-Plugin/plugin_acgimage` - [x] 随机图片(评级大于6的图将私发) - [x] 直接随机(无r18检测,务必小心,仅管理可用) - [x] 设置随机图片网址[url] @@ -96,7 +96,7 @@ - [x] @BOT 小作文 - [x] @BOT 发大病 - [x] @BOT 教你一篇小作文[作文] -- **AIfalse** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_AIfalse"` +- **AIfalse** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_ai_false"` - [x] 查询计算机当前活跃度 [身体检查] - [ ] 简易语音 - [ ] 爬图合成 [@xxx] @@ -116,11 +116,12 @@ | [yyuueexxiinngg/cqhttp-mirai](https://github.com/yyuueexxiinngg/cqhttp-mirai) | [Mirai](https://github.com/mamoe/mirai) | yyuueexxiinngg | | | [takayama-lily/onebot](https://github.com/takayama-lily/onebot) | [OICQ](https://github.com/takayama-lily/oicq) | takayama | | -### 使用稳定版 -可以前往[Release](https://github.com/FloatTech/ZeroBot-Plugin/releases)页面下载对应系统的稳定版,默认开启全部插件。 +### 使用稳定版/测试版 +> 需要将`data`目录放置到与编译好的可执行文件相同目录下才可正常执行。 +可以前往[Release](https://github.com/FloatTech/ZeroBot-Plugin/releases)页面下载对应系统版本可执行文件,编译时开启了全部插件。 ### 本地运行 -1. 下载安装 [Go](https://studygolang.com/dl/golang/go1.16.2.windows-amd64.msi) 环境 +1. 下载安装 [Go](https://studygolang.com/dl) 环境 2. 下载本项目[压缩包](https://github.com/Yiwen-Chan/ZeroBot-Plugin/archive/master.zip),本地解压 3. 编辑 main.go 文件,内容按需修改 4. 双击 build.bat 文件 或 直接双击 run.bat 文件 @@ -138,7 +139,7 @@ 6. 啾咪~ #### 本地编译/交叉编译 -1. 下载安装 [Go](https://studygolang.com/dl/golang/go1.16.2.windows-amd64.msi) 环境 +1. 下载安装 [Go](https://studygolang.com/dl) 环境 2. clone 并进入本项目,下载所需包 ```bash git clone --depth=1 https://github.com/FloatTech/ZeroBot-Plugin.git @@ -152,11 +153,11 @@ go mod tidy 4. 按照平台输入命令编译,下面举了两个不太常见的例子 ```bash # 本机平台 -go build -ldflags "-s -w -extldflags '-static-libgo'" -o zerobot +go build -ldflags "-s -w" -o zerobot # armv6 Linux 平台 如树莓派 zero W -GOOS=linux GOARCH=arm GOARM=6 CGO_ENABLED=0 go build -ldflags "-s -w -extldflags '-static-libgo'" -o zerobot +GOOS=linux GOARCH=arm GOARM=6 CGO_ENABLED=0 go build -ldflags "-s -w" -o zerobot # mips Linux 平台 如 路由器 wndr4300 -GOOS=linux GOARCH=mips GOMIPS=softfloat CGO_ENABLED=0 go build -ldflags "-s -w -extldflags '-static-libgo'" -o zerobot +GOOS=linux GOARCH=mips GOMIPS=softfloat CGO_ENABLED=0 go build -ldflags "-s -w" -o zerobot ``` 5. 运行 OneBot 框架,并同时运行本插件 diff --git a/plugin_manager/manager.go b/plugin_manager/manager.go index e0aeed5a..10bf988d 100644 --- a/plugin_manager/manager.go +++ b/plugin_manager/manager.go @@ -351,7 +351,7 @@ func init() { // 插件主体 } }) // 设置欢迎语 - zero.OnRegex(`^设置欢迎语(.*)$`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(40). + zero.OnRegex(`^设置欢迎语([\s\S]*)$`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(40). Handle(func(ctx *zero.Ctx) { config.Welcome[uint64(ctx.Event.GroupID)] = ctx.State["regex_matched"].([]string)[1] if saveConfig() == nil { From c875d2beea655294cc8b7993de41a766fb326d0d Mon Sep 17 00:00:00 2001 From: fumiama Date: Wed, 11 Aug 2021 22:06:53 +0800 Subject: [PATCH 08/29] =?UTF-8?q?=E7=BE=A4=E7=AE=A1=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E6=8F=90=E9=86=92=E4=BC=98=E5=8C=96=E5=88=97=E5=87=BA=E6=89=80?= =?UTF-8?q?=E6=9C=89=E6=8F=90=E9=86=92=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 6 +----- go.sum | 28 ++++++++-------------------- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/go.mod b/go.mod index b30d36dc..df2a648f 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/FloatTech/AnimeAPI v1.1.3 - github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.2 + github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3 github.com/StackExchange/wmi v1.2.1 // indirect github.com/golang/protobuf v1.5.2 github.com/robfig/cron v1.2.0 @@ -12,11 +12,7 @@ require ( github.com/sirupsen/logrus v1.8.1 github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816 github.com/tidwall/gjson v1.8.1 - github.com/tidwall/pretty v1.2.0 // indirect github.com/tklauser/go-sysconf v0.3.7 // indirect github.com/wdvxdr1123/ZeroBot v1.2.2 - golang.org/x/text v0.3.6 // indirect - golang.org/x/tools v0.1.5 // indirect - google.golang.org/protobuf v1.27.1 // indirect modernc.org/sqlite v1.12.0 ) diff --git a/go.sum b/go.sum index 0dc14146..06cc252e 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ github.com/FloatTech/AnimeAPI v1.1.3 h1:VZA0XDEKOGAtmm0PU6/8ty6wI2n0Xg21QmngQVvUMhw= github.com/FloatTech/AnimeAPI v1.1.3/go.mod h1:CC+vF30UGBlcIUxwFOcXIEHoJ4r7c5x2iLQsnUCVdDI= -github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.2 h1:w/JerL8DwdyoxZYB4HRMaHANRV2j+r5XxaQhVB0sjBw= -github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.2/go.mod h1:MVOQQ4e6AVGFm993blXXU4Sd6bAsLY2+Zb+/HMrEeEc= +github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3 h1:jn/dH+OwPSRozkmeCeQQPrAGJRBudcm3OK5tXhGItRk= +github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3/go.mod h1:MVOQQ4e6AVGFm993blXXU4Sd6bAsLY2+Zb+/HMrEeEc= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= github.com/antchfx/htmlquery v1.2.3 h1:sP3NFDneHx2stfNXCKbhHFo8XgNjCACnU/4AO5gWz6M= @@ -72,9 +72,8 @@ github.com/tidwall/gjson v1.8.1 h1:8j5EE9Hrh3l9Od1OIEDAb7IpezNA20UdRngNAj5N0WU= github.com/tidwall/gjson v1.8.1/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk= github.com/tidwall/match v1.0.3 h1:FQUVvBImDutD8wJLN6c5eMzWtjgONK9MwIBCOrUJKeE= github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= +github.com/tidwall/pretty v1.1.0 h1:K3hMW5epkdAVwibsQEfR/7Zj0Qgt4DxtNumTq/VloO8= github.com/tidwall/pretty v1.1.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= -github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tklauser/go-sysconf v0.3.7 h1:HT7h4+536gjqeq1ZIJPgOl1rg1XFatQGVZWp7Py53eg= github.com/tklauser/go-sysconf v0.3.7/go.mod h1:JZIdXh4RmBvZDBZ41ld2bGxRV3n4daiiqA3skYhAoQ4= github.com/tklauser/numcpus v0.2.3 h1:nQ0QYpiritP6ViFhrKYsiv6VVxOpum2Gks5GhnJbS/8= @@ -82,24 +81,20 @@ github.com/tklauser/numcpus v0.2.3/go.mod h1:vpEPS/JC+oZGGQ/My/vJnNsvMDQL6PwOqt8 github.com/wdvxdr1123/ZeroBot v1.2.2 h1:BKEy3l80BMrQWpFWaII0AfFMyf9bqrB0TxfWhTdoV58= github.com/wdvxdr1123/ZeroBot v1.2.2/go.mod h1:83nHtG8V5TAxPwH/LCDxLpZk4khIgs29dkr5TBWf7fc= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -109,32 +104,25 @@ golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201126233918-771906719818/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78 h1:M8tBwCtWD/cZV9DZpFYRUgaymAYAr+aIUTWzDaM3uPs= golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA= -golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= From 0e47191b654cd57dfed4868e89ebfc5d70403e53 Mon Sep 17 00:00:00 2001 From: fumiama Date: Thu, 12 Aug 2021 23:39:53 +0800 Subject: [PATCH 09/29] =?UTF-8?q?acgimg=20api=E6=9B=B4=E6=94=B9=E5=88=B0?= =?UTF-8?q?=E6=9C=80=E6=96=B0=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_acgimage/classify.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin_acgimage/classify.go b/plugin_acgimage/classify.go index 886aa6d7..f4671cc8 100644 --- a/plugin_acgimage/classify.go +++ b/plugin_acgimage/classify.go @@ -14,7 +14,7 @@ import ( ) const ( - lolipxy = "http://sayuri.fumiama.top:62002/dice?class=0&loli=true&r18=true" + lolipxy = "http://sayuri.fumiama.top:8080/dice?class=0&loli=true&r18=true" apihead = "http://sayuri.fumiama.top:8080/img?path=" ) From 9ea8e46a56c3b3042d73a00e4efd86f392bca517 Mon Sep 17 00:00:00 2001 From: fumiama Date: Thu, 12 Aug 2021 23:51:17 +0800 Subject: [PATCH 10/29] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20=E6=9B=B4=E6=96=B0An?= =?UTF-8?q?imeAPI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index df2a648f..5a9c1a07 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/FloatTech/ZeroBot-Plugin go 1.16 require ( - github.com/FloatTech/AnimeAPI v1.1.3 + github.com/FloatTech/AnimeAPI v1.1.5 github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3 github.com/StackExchange/wmi v1.2.1 // indirect github.com/golang/protobuf v1.5.2 diff --git a/go.sum b/go.sum index 06cc252e..5dabd42e 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/FloatTech/AnimeAPI v1.1.3 h1:VZA0XDEKOGAtmm0PU6/8ty6wI2n0Xg21QmngQVvUMhw= -github.com/FloatTech/AnimeAPI v1.1.3/go.mod h1:CC+vF30UGBlcIUxwFOcXIEHoJ4r7c5x2iLQsnUCVdDI= +github.com/FloatTech/AnimeAPI v1.1.5 h1:iZzmqEuzNG7i88cxqDYKpnarTVbAB//a/lIiTcZ1kB4= +github.com/FloatTech/AnimeAPI v1.1.5/go.mod h1:CC+vF30UGBlcIUxwFOcXIEHoJ4r7c5x2iLQsnUCVdDI= github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3 h1:jn/dH+OwPSRozkmeCeQQPrAGJRBudcm3OK5tXhGItRk= github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3/go.mod h1:MVOQQ4e6AVGFm993blXXU4Sd6bAsLY2+Zb+/HMrEeEc= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= From 0a5178e0a47a4ee03b70af227e0b666bda56689e Mon Sep 17 00:00:00 2001 From: Kanri Date: Wed, 18 Aug 2021 23:26:21 +0800 Subject: [PATCH 11/29] =?UTF-8?q?=E2=9C=A8=20=E5=A2=9E=E5=8A=A0=E5=88=B6?= =?UTF-8?q?=E5=9B=BE=E6=8F=92=E4=BB=B6=20plugin=5Fgif?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index a7800ebf..86a69d5d 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,11 @@ - [x] 今天是什么少女[@xxx] - [x] 异世界转生[@xxx] - [x] 卖萌[@xxx] +- **gif** `import _ "github.com/tdf1939/ZeroBot-Plugin-Gif/plugin_gif"` + - [x] 爬[@xxx] + - [x] 摸[@xxx] + - [x] 搓[@xxx] + - 注:详情见项目 --> https://github.com/tdf1939/ZeroBot-Plugin-Gif - **涩图** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_setutime"` - [x] 来份[涩图/二次元/风景/车万] - [x] 添加[涩图/二次元/风景/车万][P站图片ID] From d46a4743644f9de7001ae9dd50e112bf7cdc9d53 Mon Sep 17 00:00:00 2001 From: fumiama Date: Sat, 21 Aug 2021 16:07:43 +0800 Subject: [PATCH 12/29] =?UTF-8?q?=E5=8D=87=E7=BA=A7AI=E6=89=93=E5=88=86?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8=E5=88=B0https?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- plugin_acgimage/classify.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 86a69d5d..c4829435 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ - [x] 爬[@xxx] - [x] 摸[@xxx] - [x] 搓[@xxx] - - 注:详情见项目 --> https://github.com/tdf1939/ZeroBot-Plugin-Gif + - 注:`main.go`中并未import该插件。详情见项目 --> https://github.com/tdf1939/ZeroBot-Plugin-Gif - **涩图** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_setutime"` - [x] 来份[涩图/二次元/风景/车万] - [x] 添加[涩图/二次元/风景/车万][P站图片ID] diff --git a/plugin_acgimage/classify.go b/plugin_acgimage/classify.go index f4671cc8..7e18a51b 100644 --- a/plugin_acgimage/classify.go +++ b/plugin_acgimage/classify.go @@ -14,8 +14,8 @@ import ( ) const ( - lolipxy = "http://sayuri.fumiama.top:8080/dice?class=0&loli=true&r18=true" - apihead = "http://sayuri.fumiama.top:8080/img?path=" + lolipxy = "https://sayuri.fumiama.top/dice?class=0&loli=true&r18=true" + apihead = "https://sayuri.fumiama.top/img?path=" ) var ( From 6994b276567598f7c29b350850168a4aaa6f6bd1 Mon Sep 17 00:00:00 2001 From: fumiama Date: Sat, 21 Aug 2021 16:15:46 +0800 Subject: [PATCH 13/29] =?UTF-8?q?=E5=8D=87=E7=BA=A7AnimeAPI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 5a9c1a07..21f2c3f8 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/FloatTech/ZeroBot-Plugin go 1.16 require ( - github.com/FloatTech/AnimeAPI v1.1.5 + github.com/FloatTech/AnimeAPI v1.1.6 github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3 github.com/StackExchange/wmi v1.2.1 // indirect github.com/golang/protobuf v1.5.2 diff --git a/go.sum b/go.sum index 5dabd42e..60cf325f 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/FloatTech/AnimeAPI v1.1.5 h1:iZzmqEuzNG7i88cxqDYKpnarTVbAB//a/lIiTcZ1kB4= -github.com/FloatTech/AnimeAPI v1.1.5/go.mod h1:CC+vF30UGBlcIUxwFOcXIEHoJ4r7c5x2iLQsnUCVdDI= +github.com/FloatTech/AnimeAPI v1.1.6 h1:M+970Vfi0ax0ElcS3fQXNKKlB+TiKWnL9gEePj/z0oo= +github.com/FloatTech/AnimeAPI v1.1.6/go.mod h1:CC+vF30UGBlcIUxwFOcXIEHoJ4r7c5x2iLQsnUCVdDI= github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3 h1:jn/dH+OwPSRozkmeCeQQPrAGJRBudcm3OK5tXhGItRk= github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3/go.mod h1:MVOQQ4e6AVGFm993blXXU4Sd6bAsLY2+Zb+/HMrEeEc= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= From 33b00f369f60c0ece42919ca0bab3b1866ec2f8c Mon Sep 17 00:00:00 2001 From: fumiama Date: Wed, 25 Aug 2021 21:22:36 +0800 Subject: [PATCH 14/29] =?UTF-8?q?=E2=9C=A8=20=E5=A2=9E=E5=8A=A0=E6=B5=85?= =?UTF-8?q?=E8=8D=89=E5=AF=BA=E6=B1=82=E7=AD=BE=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ main.go | 1 + plugin_omikuji/sensou.go | 21 +++++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 plugin_omikuji/sensou.go diff --git a/README.md b/README.md index c4829435..6d800efa 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,8 @@ - [x] 设置随机图片网址[url] - [x] 太涩了(撤回最近发的图) - [x] 评价图片(发送一张图片让bot评分) +- **浅草寺求签** `github.com/FloatTech/ZeroBot-Plugin/plugin_omikuji` + - [x] @BOT 求签|运势|占卜 - **bilibili** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_bilibili"` - [x] >bili info [名字] - **嘉然** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_diana"` diff --git a/main.go b/main.go index 841d2146..812cd291 100644 --- a/main.go +++ b/main.go @@ -20,6 +20,7 @@ import ( _ "github.com/FloatTech/ZeroBot-Plugin/plugin_ai_false" // 服务器监控 _ "github.com/FloatTech/ZeroBot-Plugin/plugin_minecraft" // MCSManager _ "github.com/FloatTech/ZeroBot-Plugin/plugin_music" // 点歌 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin_omikuji" // 浅草寺求签 _ "github.com/FloatTech/ZeroBot-Plugin/plugin_shindan" // 测定 // b站相关 diff --git a/plugin_omikuji/sensou.go b/plugin_omikuji/sensou.go new file mode 100644 index 00000000..70bc189e --- /dev/null +++ b/plugin_omikuji/sensou.go @@ -0,0 +1,21 @@ +package omikuji + +import ( + "fmt" + "math/rand" + + zero "github.com/wdvxdr1123/ZeroBot" + "github.com/wdvxdr1123/ZeroBot/message" +) + +const ( + bed = "https://codechina.csdn.net/u011570312/senso-ji-omikuji/-/raw/main/%d_%d.jpg" +) + +func init() { // 插件主体 + zero.OnFullMatchGroup([]string{"求签", "运势", "占卜"}, zero.OnlyToMe). + Handle(func(ctx *zero.Ctx) { + miku := rand.Intn(100) + 1 + ctx.SendChain(message.Image(fmt.Sprintf(bed, miku, 0)), message.Image(fmt.Sprintf(bed, miku, 1))) + }) +} From 928719f5a1c23222e36dcfb5806e763f6048aae9 Mon Sep 17 00:00:00 2001 From: Kanri Date: Wed, 25 Aug 2021 21:50:54 +0800 Subject: [PATCH 15/29] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=20GitHub=20=E9=95=9C=E5=83=8F=20404?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_atri/atri.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin_atri/atri.go b/plugin_atri/atri.go index 3485812b..476e6edc 100644 --- a/plugin_atri/atri.go +++ b/plugin_atri/atri.go @@ -16,8 +16,8 @@ import ( var ( // ATRI 所有命令的优先级 prio = -1 - // ATRI 表情的 GitHub 镜像位置 - res = "https://raw.dihe.moe/Yiwen-Chan/ZeroBot-Plugin/master/plugin_atri/" + // ATRI 表情的 GitHub 位置,如果发现图片不能下载请使用镜像 + res = "https://raw.githubusercontent.com/FloatTech/ZeroBot-Plugin/master/plugin_atri/" // ATRI 的总开关 enable = true ) From a402d913679191a7c99b927331cb0e06ce530e63 Mon Sep 17 00:00:00 2001 From: Kanri Date: Wed, 25 Aug 2021 21:51:13 +0800 Subject: [PATCH 16/29] =?UTF-8?q?=E2=9C=A8=20=E5=A2=9E=E5=8A=A0=E6=8A=BD?= =?UTF-8?q?=E8=80=81=E5=A9=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_shindan/shindan.go | 1 + 1 file changed, 1 insertion(+) diff --git a/plugin_shindan/shindan.go b/plugin_shindan/shindan.go index c34892c5..51bcdbb3 100644 --- a/plugin_shindan/shindan.go +++ b/plugin_shindan/shindan.go @@ -21,6 +21,7 @@ func init() { zero.OnPrefix("异世界转生", number(587874)).SetBlock(true).FirstPriority().Handle(handle) zero.OnPrefix("今天是什么少女", number(162207)).SetBlock(true).FirstPriority().Handle(handle) zero.OnPrefix("卖萌", number(360578)).SetBlock(true).FirstPriority().Handle(handle) + zero.OnPrefix("抽老婆", number(1075116)).SetBlock(true).FirstPriority().Handle(handle) } // shindanmaker 处理函数 From bf4aa59467706307a777f265bd3d05c69a1d9804 Mon Sep 17 00:00:00 2001 From: Kanri Date: Wed, 25 Aug 2021 21:51:31 +0800 Subject: [PATCH 17/29] =?UTF-8?q?=E2=9E=95=20=E5=8D=87=E7=BA=A7=E4=BE=9D?= =?UTF-8?q?=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 3 ++- go.sum | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 21f2c3f8..440c5190 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/FloatTech/ZeroBot-Plugin go 1.16 require ( - github.com/FloatTech/AnimeAPI v1.1.6 + github.com/FloatTech/AnimeAPI v1.1.8 github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3 github.com/StackExchange/wmi v1.2.1 // indirect github.com/golang/protobuf v1.5.2 @@ -12,6 +12,7 @@ require ( github.com/sirupsen/logrus v1.8.1 github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816 github.com/tidwall/gjson v1.8.1 + github.com/tidwall/pretty v1.2.0 // indirect github.com/tklauser/go-sysconf v0.3.7 // indirect github.com/wdvxdr1123/ZeroBot v1.2.2 modernc.org/sqlite v1.12.0 diff --git a/go.sum b/go.sum index 60cf325f..cce3c261 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/FloatTech/AnimeAPI v1.1.6 h1:M+970Vfi0ax0ElcS3fQXNKKlB+TiKWnL9gEePj/z0oo= -github.com/FloatTech/AnimeAPI v1.1.6/go.mod h1:CC+vF30UGBlcIUxwFOcXIEHoJ4r7c5x2iLQsnUCVdDI= +github.com/FloatTech/AnimeAPI v1.1.8 h1:v+VxMnYBCn5ANQBXcubzWOD2DZ0RxqwvI9zVBgwl4oE= +github.com/FloatTech/AnimeAPI v1.1.8/go.mod h1:CC+vF30UGBlcIUxwFOcXIEHoJ4r7c5x2iLQsnUCVdDI= github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3 h1:jn/dH+OwPSRozkmeCeQQPrAGJRBudcm3OK5tXhGItRk= github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3/go.mod h1:MVOQQ4e6AVGFm993blXXU4Sd6bAsLY2+Zb+/HMrEeEc= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= @@ -72,8 +72,9 @@ github.com/tidwall/gjson v1.8.1 h1:8j5EE9Hrh3l9Od1OIEDAb7IpezNA20UdRngNAj5N0WU= github.com/tidwall/gjson v1.8.1/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk= github.com/tidwall/match v1.0.3 h1:FQUVvBImDutD8wJLN6c5eMzWtjgONK9MwIBCOrUJKeE= github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= -github.com/tidwall/pretty v1.1.0 h1:K3hMW5epkdAVwibsQEfR/7Zj0Qgt4DxtNumTq/VloO8= github.com/tidwall/pretty v1.1.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= +github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tklauser/go-sysconf v0.3.7 h1:HT7h4+536gjqeq1ZIJPgOl1rg1XFatQGVZWp7Py53eg= github.com/tklauser/go-sysconf v0.3.7/go.mod h1:JZIdXh4RmBvZDBZ41ld2bGxRV3n4daiiqA3skYhAoQ4= github.com/tklauser/numcpus v0.2.3 h1:nQ0QYpiritP6ViFhrKYsiv6VVxOpum2Gks5GhnJbS/8= From 10c79456a525751fec2e313c302d6ffcb93a0680 Mon Sep 17 00:00:00 2001 From: fumiama Date: Wed, 25 Aug 2021 22:00:11 +0800 Subject: [PATCH 18/29] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20=E6=8F=90=E9=AB=98?= =?UTF-8?q?=E6=B1=82=E7=AD=BE=E4=BC=98=E5=85=88=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_omikuji/sensou.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin_omikuji/sensou.go b/plugin_omikuji/sensou.go index 70bc189e..957a3966 100644 --- a/plugin_omikuji/sensou.go +++ b/plugin_omikuji/sensou.go @@ -13,7 +13,7 @@ const ( ) func init() { // 插件主体 - zero.OnFullMatchGroup([]string{"求签", "运势", "占卜"}, zero.OnlyToMe). + zero.OnFullMatchGroup([]string{"求签", "运势", "占卜"}, zero.OnlyToMe).SetPriority(10). Handle(func(ctx *zero.Ctx) { miku := rand.Intn(100) + 1 ctx.SendChain(message.Image(fmt.Sprintf(bed, miku, 0)), message.Image(fmt.Sprintf(bed, miku, 1))) From 452b39075b93d498ecc6ae7a148b9c16c51d9180 Mon Sep 17 00:00:00 2001 From: fumiama Date: Wed, 25 Aug 2021 22:39:30 +0800 Subject: [PATCH 19/29] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20=E4=B8=BADiana?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=8A=A8=E4=B8=8B=E8=BD=BD=E5=B0=8F?= =?UTF-8?q?=E4=BD=9C=E6=96=87=EF=BC=8C=E6=9B=B4=E6=96=B0atri=E9=95=9C?= =?UTF-8?q?=E5=83=8Furl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + plugin_atri/atri.go | 4 ++-- plugin_diana/data/text.go | 23 +++++++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 9842d743..9f8659ce 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ data/SetuTime/cache data/SetuTime/search data/manager +data/acgimage .idea/ .DS_Store .vscode diff --git a/plugin_atri/atri.go b/plugin_atri/atri.go index 476e6edc..55b656f2 100644 --- a/plugin_atri/atri.go +++ b/plugin_atri/atri.go @@ -16,8 +16,8 @@ import ( var ( // ATRI 所有命令的优先级 prio = -1 - // ATRI 表情的 GitHub 位置,如果发现图片不能下载请使用镜像 - res = "https://raw.githubusercontent.com/FloatTech/ZeroBot-Plugin/master/plugin_atri/" + // ATRI 表情的 codechina 镜像 + res = "https://codechina.csdn.net/u011570312/ZeroBot-Plugin/-/raw/master/plugin_atri/" // ATRI 的总开关 enable = true ) diff --git a/plugin_diana/data/text.go b/plugin_diana/data/text.go index 10a87e26..14d8e68a 100644 --- a/plugin_diana/data/text.go +++ b/plugin_diana/data/text.go @@ -3,6 +3,7 @@ package data import ( "io" + "net/http" "os" "time" @@ -12,6 +13,7 @@ import ( const ( datapath = "data/Diana" pbfile = datapath + "/text.pb" + pburl = "https://codechina.csdn.net/u011570312/ZeroBot-Plugin/-/raw/master/data/Diana/text.pb" ) var ( @@ -41,6 +43,7 @@ func LoadText() error { if _, err := os.Stat(pbfile); err == nil || os.IsExist(err) { f, err := os.Open(pbfile) if err == nil { + defer f.Close() data, err1 := io.ReadAll(f) if err1 == nil { if len(data) > 0 { @@ -49,6 +52,26 @@ func LoadText() error { } return err1 } + } else { // 如果没有小作文,则从 url 下载 + f, err := os.Create(pbfile) + if err != nil { + return err + } + defer f.Close() + resp, err := http.Get(pburl) + if err == nil { + defer resp.Body.Close() + if resp.ContentLength > 0 { + log.Printf("[Diana]从镜像下载小作文%d字节...", resp.ContentLength) + data, err := io.ReadAll(resp.Body) + if err == nil && len(data) > 0 { + f.Write(data) + return compo.Unmarshal(data) + } + return err + } + return nil + } return err } return nil From 433b0ae4c1928bc621935731e26b0844e89c8cc5 Mon Sep 17 00:00:00 2001 From: fumiama Date: Wed, 25 Aug 2021 22:49:53 +0800 Subject: [PATCH 20/29] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20=E5=A2=9E=E5=8A=A0Se?= =?UTF-8?q?tu=E6=95=B0=E6=8D=AE=E5=BA=93=E8=87=AA=E5=8A=A8=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_setutime/setu_geter.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/plugin_setutime/setu_geter.go b/plugin_setutime/setu_geter.go index 52c338c3..198de29f 100644 --- a/plugin_setutime/setu_geter.go +++ b/plugin_setutime/setu_geter.go @@ -3,6 +3,9 @@ package setutime import ( "fmt" + "io" + "log" + "net/http" "os" "strconv" "strings" @@ -28,6 +31,10 @@ type imgpool struct { Form int64 } +const ( + dburl = "https://codechina.csdn.net/u011570312/ZeroBot-Plugin/-/raw/master/data/SetuTime/SetuTime.db" +) + // NewPoolsCache 返回一个缓冲池对象 func newPools() *imgpool { cache := &imgpool{ @@ -43,6 +50,24 @@ func newPools() *imgpool { if err != nil { panic(err) } + // 如果数据库不存在则下载 + if _, err := os.Stat(cache.DB.DBPath); err != nil || os.IsNotExist(err) { + f, err := os.Create(cache.DB.DBPath) + if err == nil { + resp, err := http.Get(dburl) + if err == nil { + defer resp.Body.Close() + if resp.ContentLength > 0 { + log.Printf("[Setu]从镜像下载数据库%d字节...", resp.ContentLength) + data, err := io.ReadAll(resp.Body) + if err == nil && len(data) > 0 { + f.Write(data) + } + } + } + f.Close() + } + } for i := range cache.List { if err := cache.DB.create(cache.List[i], &pixiv.Illust{}); err != nil { panic(err) From 63f3b3861e21db846ed8f67050120c200e833c0a Mon Sep 17 00:00:00 2001 From: fumiama Date: Wed, 25 Aug 2021 22:51:22 +0800 Subject: [PATCH 21/29] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20=E5=88=A0=E5=8E=BB?= =?UTF-8?q?=E8=BF=87=E6=97=B6=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 6d800efa..09fabb13 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,6 @@ | [takayama-lily/onebot](https://github.com/takayama-lily/onebot) | [OICQ](https://github.com/takayama-lily/oicq) | takayama | | ### 使用稳定版/测试版 -> 需要将`data`目录放置到与编译好的可执行文件相同目录下才可正常执行。 可以前往[Release](https://github.com/FloatTech/ZeroBot-Plugin/releases)页面下载对应系统版本可执行文件,编译时开启了全部插件。 ### 本地运行 @@ -135,7 +134,6 @@ 5. 运行 OneBot 框架,并同时运行本插件 ### 编译运行 -> 需要将`data`目录放置到与编译好的可执行文件相同目录下才可正常执行。 #### 利用 Actions 在线编译 (推荐) 1. 点击右上角 Fork 本项目,并转跳到自己 Fork 的仓库 From 59c6fe593a35852badc01aa91d4a48e86979d95d Mon Sep 17 00:00:00 2001 From: fumiama Date: Wed, 25 Aug 2021 23:02:44 +0800 Subject: [PATCH 22/29] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20=E6=B1=82=E7=AD=BE?= =?UTF-8?q?=E8=AE=BE=E7=BD=AEseed=E9=81=BF=E5=85=8D=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_omikuji/sensou.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugin_omikuji/sensou.go b/plugin_omikuji/sensou.go index 957a3966..8ca41033 100644 --- a/plugin_omikuji/sensou.go +++ b/plugin_omikuji/sensou.go @@ -3,6 +3,7 @@ package omikuji import ( "fmt" "math/rand" + "time" zero "github.com/wdvxdr1123/ZeroBot" "github.com/wdvxdr1123/ZeroBot/message" @@ -13,6 +14,7 @@ const ( ) func init() { // 插件主体 + rand.Seed(time.Now().UnixMicro()) zero.OnFullMatchGroup([]string{"求签", "运势", "占卜"}, zero.OnlyToMe).SetPriority(10). Handle(func(ctx *zero.Ctx) { miku := rand.Intn(100) + 1 From 9f0d93bca21413171790bfd4f16a2e97c4d857db Mon Sep 17 00:00:00 2001 From: fumiama Date: Wed, 25 Aug 2021 23:29:23 +0800 Subject: [PATCH 23/29] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20=E5=8D=87=E7=BA=A7go?= =?UTF-8?q?=E5=88=B01.17?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/latest.yml | 52 -------------------------------- .github/workflows/prerelease.yml | 2 +- .github/workflows/release.yml | 2 +- 3 files changed, 2 insertions(+), 54 deletions(-) delete mode 100644 .github/workflows/latest.yml diff --git a/.github/workflows/latest.yml b/.github/workflows/latest.yml deleted file mode 100644 index 9fbd2008..00000000 --- a/.github/workflows/latest.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: 最新版 -on: - push: - branches: - - dev - -env: - GITHUB_TOKEN: ${{ github.token }} - -jobs: - my-job: - name: Build ZeroBot-Plugin on Push 🚀 - runs-on: ubuntu-latest - steps: - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.16 - - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - - name: Cache Go - id: cache - uses: actions/cache@v2 - with: - # A list of files, directories, and wildcard patterns to cache and restore - path: ~/go/pkg/mod - key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }} - - - name: Tidy Go modules - run: go mod tidy - - - name: Build linux-x64 - run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x64 - - name: Build linux-x86 - run: CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x86 - - name: Build windows-x64 - run: CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-windows-x64.exe - - name: Build windows-x86 - run: CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-windows-x86.exe - - name: Build arm64 - run: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GOARM=7 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-arm64 - - name: Build armv6 - run: CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-armv6 - - - name: Upload Build Artifact - uses: actions/upload-artifact@v2 - with: - name: zerobot-plugin-all.zip - path: ./artifacts/zerobot-plugin-* \ No newline at end of file diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index bef9f483..772e5ec0 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.16 + go-version: 1.17 - name: Check out code into the Go module directory uses: actions/checkout@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d59f4750..10c1731e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.16 + go-version: 1.17 - name: Check out code into the Go module directory uses: actions/checkout@v2 From c10cb49c3000d6fa49d405dcb8532b9c097a9f68 Mon Sep 17 00:00:00 2001 From: fumiama Date: Wed, 25 Aug 2021 23:31:48 +0800 Subject: [PATCH 24/29] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20=E6=9B=B4=E6=96=B0RE?= =?UTF-8?q?ADME?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 09fabb13..db26385b 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ - [x] 今天是什么少女[@xxx] - [x] 异世界转生[@xxx] - [x] 卖萌[@xxx] + - [x] 抽老婆[@xxx] - **gif** `import _ "github.com/tdf1939/ZeroBot-Plugin-Gif/plugin_gif"` - [x] 爬[@xxx] - [x] 摸[@xxx] @@ -96,6 +97,7 @@ - [x] 太涩了(撤回最近发的图) - [x] 评价图片(发送一张图片让bot评分) - **浅草寺求签** `github.com/FloatTech/ZeroBot-Plugin/plugin_omikuji` + - 本插件要求`Go`版本大于等于`1.17` - [x] @BOT 求签|运势|占卜 - **bilibili** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_bilibili"` - [x] >bili info [名字] From 4776da458486da14cb11e81f8d80224354f87f01 Mon Sep 17 00:00:00 2001 From: fumiama Date: Thu, 26 Aug 2021 00:59:46 +0800 Subject: [PATCH 25/29] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20shindan=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=8F=91=E9=80=81=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_shindan/shindan.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/plugin_shindan/shindan.go b/plugin_shindan/shindan.go index 51bcdbb3..5eff7428 100644 --- a/plugin_shindan/shindan.go +++ b/plugin_shindan/shindan.go @@ -5,11 +5,10 @@ import ( "strconv" "time" + "github.com/FloatTech/AnimeAPI/shindanmaker" zero "github.com/wdvxdr1123/ZeroBot" "github.com/wdvxdr1123/ZeroBot/extension/rate" "github.com/wdvxdr1123/ZeroBot/message" - - "github.com/FloatTech/AnimeAPI/shindanmaker" ) var ( @@ -25,7 +24,7 @@ func init() { } // shindanmaker 处理函数 -var handle = func(ctx *zero.Ctx) { +func handle(ctx *zero.Ctx) { if !limit.Load(ctx.Event.UserID).Acquire() { ctx.SendChain(message.Text("请稍后重试0x0...")) return @@ -43,11 +42,11 @@ var handle = func(ctx *zero.Ctx) { if err != nil { ctx.SendChain(message.Text("ERROR: ", err)) } - ctx.SendChain(message.Text(text)) + ctx.Send(text) } // 传入 shindanmaker id -var number = func(id int64) func(ctx *zero.Ctx) bool { +func number(id int64) func(ctx *zero.Ctx) bool { return func(ctx *zero.Ctx) bool { ctx.State["id"] = id return true From 5b8fd14d096d5df104f1d0462e19b6b5ce9cf4df Mon Sep 17 00:00:00 2001 From: fumiama Date: Thu, 26 Aug 2021 01:08:42 +0800 Subject: [PATCH 26/29] =?UTF-8?q?=E2=9E=95=20=E5=8D=87=E7=BA=A7AnimeAPI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 440c5190..bcb3650b 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/FloatTech/ZeroBot-Plugin go 1.16 require ( - github.com/FloatTech/AnimeAPI v1.1.8 + github.com/FloatTech/AnimeAPI v1.1.9 github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3 github.com/StackExchange/wmi v1.2.1 // indirect github.com/golang/protobuf v1.5.2 diff --git a/go.sum b/go.sum index cce3c261..7dae58e7 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/FloatTech/AnimeAPI v1.1.8 h1:v+VxMnYBCn5ANQBXcubzWOD2DZ0RxqwvI9zVBgwl4oE= -github.com/FloatTech/AnimeAPI v1.1.8/go.mod h1:CC+vF30UGBlcIUxwFOcXIEHoJ4r7c5x2iLQsnUCVdDI= +github.com/FloatTech/AnimeAPI v1.1.9 h1:H1hZmgwZPNHdx39K9JvY3awT8TTsCl9kKA1uVMyCjRg= +github.com/FloatTech/AnimeAPI v1.1.9/go.mod h1:CC+vF30UGBlcIUxwFOcXIEHoJ4r7c5x2iLQsnUCVdDI= github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3 h1:jn/dH+OwPSRozkmeCeQQPrAGJRBudcm3OK5tXhGItRk= github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3/go.mod h1:MVOQQ4e6AVGFm993blXXU4Sd6bAsLY2+Zb+/HMrEeEc= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= From 7ac9d34cc44142c2c6906327dce10bc9f2203993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=9C=E9=BB=8E?= <65600313+DawnNights@users.noreply.github.com> Date: Fri, 27 Aug 2021 07:31:18 +0800 Subject: [PATCH 27/29] =?UTF-8?q?=E4=BF=AE=E5=A4=8DQQ=E7=82=B9=E6=AD=8C?= =?UTF-8?q?=E5=B0=81=E9=9D=A2=E9=93=BE=E6=8E=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_music/selecter.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin_music/selecter.go b/plugin_music/selecter.go index e40d0ebd..db4ae577 100644 --- a/plugin_music/selecter.go +++ b/plugin_music/selecter.go @@ -177,9 +177,9 @@ func qqmusic(keyword string) message.MessageSegment { }.Encode() audio := gjson.ParseBytes(netGet(music.String(), h2)) // 获得音乐封面 - image := "https://y.gtimg.cn/music/photo_new" + + image := "https://y.gtimg.cn/music/photo_new/" + find( - "src=\"//y.gtimg.cn/music/photo_new", + `photo_new\u002F`, "?max_age", string( netGet("https://y.qq.com/n/yqq/song/"+info.Get("songmid").Str+".html", nil), From 736f645e9da39a5802eb649c592b6e3b390eebb2 Mon Sep 17 00:00:00 2001 From: fumiama Date: Fri, 27 Aug 2021 11:30:58 +0800 Subject: [PATCH 28/29] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20=E6=B1=82=E7=AD=BE?= =?UTF-8?q?=E8=89=BE=E7=89=B9=E6=9C=AC=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_omikuji/sensou.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin_omikuji/sensou.go b/plugin_omikuji/sensou.go index 8ca41033..bd89f9b5 100644 --- a/plugin_omikuji/sensou.go +++ b/plugin_omikuji/sensou.go @@ -18,6 +18,6 @@ func init() { // 插件主体 zero.OnFullMatchGroup([]string{"求签", "运势", "占卜"}, zero.OnlyToMe).SetPriority(10). Handle(func(ctx *zero.Ctx) { miku := rand.Intn(100) + 1 - ctx.SendChain(message.Image(fmt.Sprintf(bed, miku, 0)), message.Image(fmt.Sprintf(bed, miku, 1))) + ctx.SendChain(message.At(ctx.Event.UserID), message.Image(fmt.Sprintf(bed, miku, 0)), message.Image(fmt.Sprintf(bed, miku, 1))) }) } From ac4d8429d4b676f061930a7ac2df61a5e384b767 Mon Sep 17 00:00:00 2001 From: fumiama Date: Fri, 27 Aug 2021 12:34:07 +0800 Subject: [PATCH 29/29] =?UTF-8?q?=E2=9C=A8=20=E5=A2=9E=E5=8A=A0=E9=9A=8F?= =?UTF-8?q?=E6=9C=BAwife=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ main.go | 1 + plugin_aiwife/non-existent.go | 24 ++++++++++++++++++++++++ plugin_omikuji/sensou.go | 1 + 4 files changed, 28 insertions(+) create mode 100644 plugin_aiwife/non-existent.go diff --git a/README.md b/README.md index db26385b..ee42e6c9 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,8 @@ - [x] 异世界转生[@xxx] - [x] 卖萌[@xxx] - [x] 抽老婆[@xxx] +- **AIWife** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_aiwife"` + - [x] waifu|随机waifu(从[100000个AI生成的waifu](https://www.thiswaifudoesnotexist.net/)中随机一位) - **gif** `import _ "github.com/tdf1939/ZeroBot-Plugin-Gif/plugin_gif"` - [x] 爬[@xxx] - [x] 摸[@xxx] diff --git a/main.go b/main.go index 812cd291..d80c92d4 100644 --- a/main.go +++ b/main.go @@ -29,6 +29,7 @@ import ( // 二次元图片 _ "github.com/FloatTech/ZeroBot-Plugin/plugin_acgimage" // 随机图片与AI点评 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin_aiwife" // 随机老婆 _ "github.com/FloatTech/ZeroBot-Plugin/plugin_image_finder" // 关键字搜图 _ "github.com/FloatTech/ZeroBot-Plugin/plugin_lolicon" // lolicon 随机图片 _ "github.com/FloatTech/ZeroBot-Plugin/plugin_saucenao" // 以图搜图 diff --git a/plugin_aiwife/non-existent.go b/plugin_aiwife/non-existent.go new file mode 100644 index 00000000..b66b0fa9 --- /dev/null +++ b/plugin_aiwife/non-existent.go @@ -0,0 +1,24 @@ +// Package aiwife 随机老婆 +package aiwife + +import ( + "fmt" + "math/rand" + "time" + + zero "github.com/wdvxdr1123/ZeroBot" + "github.com/wdvxdr1123/ZeroBot/message" +) + +const ( + bed = "https://www.thiswaifudoesnotexist.net/example-%d.jpg" +) + +func init() { // 插件主体 + rand.Seed(time.Now().UnixMicro()) + zero.OnFullMatchGroup([]string{"waifu", "随机waifu"}).SetPriority(10). + Handle(func(ctx *zero.Ctx) { + miku := rand.Intn(100000) + 1 + ctx.SendChain(message.At(ctx.Event.UserID), message.Image(fmt.Sprintf(bed, miku))) + }) +} diff --git a/plugin_omikuji/sensou.go b/plugin_omikuji/sensou.go index bd89f9b5..48e83c30 100644 --- a/plugin_omikuji/sensou.go +++ b/plugin_omikuji/sensou.go @@ -1,3 +1,4 @@ +// Package omikuji 浅草寺求签 package omikuji import (