mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-21 23:50:09 +08:00
💩👌 make lint happy
This commit is contained in:
parent
8c8cd709b5
commit
af8e6a63b9
@ -1,3 +1,4 @@
|
|||||||
|
// Package aireply AI 回复
|
||||||
package aireply
|
package aireply
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|||||||
@ -49,7 +49,7 @@ func init() { // 插件主体
|
|||||||
digest := md5.Sum(helper.StringToBytes(url))
|
digest := md5.Sum(helper.StringToBytes(url))
|
||||||
f := cachefile + hex.EncodeToString(digest[:])
|
f := cachefile + hex.EncodeToString(digest[:])
|
||||||
if file.IsNotExist(f) {
|
if file.IsNotExist(f) {
|
||||||
t.Canvas.SavePNG(f)
|
_ = t.Canvas.SavePNG(f)
|
||||||
}
|
}
|
||||||
ctx.SendChain(message.Image("file:///" + file.BOTPATH + "/" + f))
|
ctx.SendChain(message.Image("file:///" + file.BOTPATH + "/" + f))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package plugin_gif
|
package gif
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
@ -33,11 +33,11 @@ func dlblock(name string) string {
|
|||||||
return target
|
return target
|
||||||
}
|
}
|
||||||
|
|
||||||
func dlrange(prefix string, suffix string, end int) *[]chan *string {
|
func dlrange(prefix string, end int) *[]chan *string {
|
||||||
c := make([]chan *string, end)
|
c := make([]chan *string, end)
|
||||||
for i := range c {
|
for i := range c {
|
||||||
c[i] = make(chan *string)
|
c[i] = make(chan *string)
|
||||||
go dlchan(prefix+strconv.Itoa(i)+suffix, &c[i])
|
go dlchan(prefix+"/"+strconv.Itoa(i)+".png", &c[i])
|
||||||
}
|
}
|
||||||
return &c
|
return &c
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package plugin_gif
|
package gif
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"image"
|
"image"
|
||||||
@ -8,8 +8,8 @@ import (
|
|||||||
|
|
||||||
// 摸
|
// 摸
|
||||||
func (cc *context) mo() string {
|
func (cc *context) mo() string {
|
||||||
name := cc.usrdir + `摸.gif`
|
name := cc.usrdir + "摸.gif"
|
||||||
c := dlrange(`mo/`, `.png`, 5)
|
c := dlrange("mo", 5)
|
||||||
tou := img.LoadFirstFrame(cc.headimgsdir[0], 0, 0).Circle(0).Im
|
tou := img.LoadFirstFrame(cc.headimgsdir[0], 0, 0).Circle(0).Im
|
||||||
mo := []*image.NRGBA{
|
mo := []*image.NRGBA{
|
||||||
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertBottom(tou, 80, 80, 32, 32).Im,
|
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertBottom(tou, 80, 80, 32, 32).Im,
|
||||||
@ -24,8 +24,8 @@ func (cc *context) mo() string {
|
|||||||
|
|
||||||
// 搓
|
// 搓
|
||||||
func (cc *context) cuo() string {
|
func (cc *context) cuo() string {
|
||||||
name := cc.usrdir + `搓.gif`
|
name := cc.usrdir + "搓.gif"
|
||||||
c := dlrange(`cuo/`, `.png`, 5)
|
c := dlrange("cuo", 5)
|
||||||
tou := img.LoadFirstFrame(cc.headimgsdir[0], 110, 110).Circle(0).Im
|
tou := img.LoadFirstFrame(cc.headimgsdir[0], 110, 110).Circle(0).Im
|
||||||
m1 := img.Rotate(tou, 72, 0, 0)
|
m1 := img.Rotate(tou, 72, 0, 0)
|
||||||
m2 := img.Rotate(tou, 144, 0, 0)
|
m2 := img.Rotate(tou, 144, 0, 0)
|
||||||
@ -44,8 +44,8 @@ func (cc *context) cuo() string {
|
|||||||
|
|
||||||
// 敲
|
// 敲
|
||||||
func (cc *context) qiao() string {
|
func (cc *context) qiao() string {
|
||||||
name := cc.usrdir + `敲.gif`
|
name := cc.usrdir + "敲.gif"
|
||||||
c := dlrange(`qiao/`, `.png`, 2)
|
c := dlrange("qiao", 2)
|
||||||
tou := img.LoadFirstFrame(cc.headimgsdir[0], 40, 40).Circle(0).Im
|
tou := img.LoadFirstFrame(cc.headimgsdir[0], 40, 40).Circle(0).Im
|
||||||
qiao := []*image.NRGBA{
|
qiao := []*image.NRGBA{
|
||||||
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertUp(tou, 40, 33, 57, 52).Im,
|
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertUp(tou, 40, 33, 57, 52).Im,
|
||||||
@ -57,8 +57,8 @@ func (cc *context) qiao() string {
|
|||||||
|
|
||||||
// 吃
|
// 吃
|
||||||
func (cc *context) chi() string {
|
func (cc *context) chi() string {
|
||||||
name := cc.usrdir + `吃.gif`
|
name := cc.usrdir + "吃.gif"
|
||||||
c := dlrange(`chi/`, `.png`, 3)
|
c := dlrange("chi", 3)
|
||||||
tou := img.LoadFirstFrame(cc.headimgsdir[0], 32, 32).Im
|
tou := img.LoadFirstFrame(cc.headimgsdir[0], 32, 32).Im
|
||||||
chi := []*image.NRGBA{
|
chi := []*image.NRGBA{
|
||||||
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertBottom(tou, 0, 0, 1, 38).Im,
|
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertBottom(tou, 0, 0, 1, 38).Im,
|
||||||
@ -71,8 +71,8 @@ func (cc *context) chi() string {
|
|||||||
|
|
||||||
// 蹭
|
// 蹭
|
||||||
func (cc *context) ceng() string {
|
func (cc *context) ceng() string {
|
||||||
name := cc.usrdir + `蹭.gif`
|
name := cc.usrdir + "蹭.gif"
|
||||||
c := dlrange(`ceng/`, `.png`, 6)
|
c := dlrange("ceng", 6)
|
||||||
tou := img.LoadFirstFrame(cc.headimgsdir[0], 100, 100).Circle(0).Im
|
tou := img.LoadFirstFrame(cc.headimgsdir[0], 100, 100).Circle(0).Im
|
||||||
tou2 := img.LoadFirstFrame(cc.headimgsdir[1], 100, 100).Circle(0).Im
|
tou2 := img.LoadFirstFrame(cc.headimgsdir[1], 100, 100).Circle(0).Im
|
||||||
ceng := []*image.NRGBA{
|
ceng := []*image.NRGBA{
|
||||||
@ -89,8 +89,8 @@ func (cc *context) ceng() string {
|
|||||||
|
|
||||||
// 啃
|
// 啃
|
||||||
func (cc *context) ken() string {
|
func (cc *context) ken() string {
|
||||||
name := cc.usrdir + `啃.gif`
|
name := cc.usrdir + "啃.gif"
|
||||||
c := dlrange(`ken/`, `.png`, 16)
|
c := dlrange("ken", 16)
|
||||||
tou := img.LoadFirstFrame(cc.headimgsdir[0], 100, 100).Im
|
tou := img.LoadFirstFrame(cc.headimgsdir[0], 100, 100).Im
|
||||||
ken := []*image.NRGBA{
|
ken := []*image.NRGBA{
|
||||||
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertBottom(tou, 90, 90, 105, 150).Im,
|
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertBottom(tou, 90, 90, 105, 150).Im,
|
||||||
@ -116,8 +116,8 @@ func (cc *context) ken() string {
|
|||||||
|
|
||||||
// 拍
|
// 拍
|
||||||
func (cc *context) pai() string {
|
func (cc *context) pai() string {
|
||||||
name := cc.usrdir + `拍.gif`
|
name := cc.usrdir + "拍.gif"
|
||||||
c := dlrange(`pai/`, `.png`, 2)
|
c := dlrange("pai", 2)
|
||||||
tou := img.LoadFirstFrame(cc.headimgsdir[0], 30, 30).Circle(0).Im
|
tou := img.LoadFirstFrame(cc.headimgsdir[0], 30, 30).Circle(0).Im
|
||||||
pai := []*image.NRGBA{
|
pai := []*image.NRGBA{
|
||||||
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertUp(tou, 0, 0, 1, 47).Im,
|
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertUp(tou, 0, 0, 1, 47).Im,
|
||||||
@ -129,8 +129,8 @@ func (cc *context) pai() string {
|
|||||||
|
|
||||||
// 冲
|
// 冲
|
||||||
func (cc *context) chong() string {
|
func (cc *context) chong() string {
|
||||||
name := cc.usrdir + `冲.gif`
|
name := cc.usrdir + "冲.gif"
|
||||||
c := dlrange(`xqe/`, `.png`, 2)
|
c := dlrange("xqe", 2)
|
||||||
tou := img.LoadFirstFrame(cc.headimgsdir[0], 0, 0).Circle(0).Im
|
tou := img.LoadFirstFrame(cc.headimgsdir[0], 0, 0).Circle(0).Im
|
||||||
chong := []*image.NRGBA{
|
chong := []*image.NRGBA{
|
||||||
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertUp(tou, 30, 30, 15, 53).Im,
|
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertUp(tou, 30, 30, 15, 53).Im,
|
||||||
@ -142,8 +142,8 @@ func (cc *context) chong() string {
|
|||||||
|
|
||||||
// 丢
|
// 丢
|
||||||
func (cc *context) diu() string {
|
func (cc *context) diu() string {
|
||||||
name := cc.usrdir + `丢.gif`
|
name := cc.usrdir + "丢.gif"
|
||||||
c := dlrange(`diu/`, `.png`, 8)
|
c := dlrange("diu", 8)
|
||||||
tou := img.LoadFirstFrame(cc.headimgsdir[0], 0, 0).Circle(0).Im
|
tou := img.LoadFirstFrame(cc.headimgsdir[0], 0, 0).Circle(0).Im
|
||||||
diu := []*image.NRGBA{
|
diu := []*image.NRGBA{
|
||||||
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertUp(tou, 32, 32, 108, 36).Im,
|
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertUp(tou, 32, 32, 108, 36).Im,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package plugin_gif
|
package gif
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -11,9 +11,9 @@ func (c *context) prepareLogos(s ...string) {
|
|||||||
for i, v := range s {
|
for i, v := range s {
|
||||||
_, err := strconv.Atoi(v)
|
_, err := strconv.Atoi(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
file.DownloadTo("https://gchat.qpic.cn/gchatpic_new//--"+strings.ToUpper(v)+"/0", c.usrdir+strconv.Itoa(i)+".gif", true)
|
_ = file.DownloadTo("https://gchat.qpic.cn/gchatpic_new//--"+strings.ToUpper(v)+"/0", c.usrdir+strconv.Itoa(i)+".gif", true)
|
||||||
} else {
|
} else {
|
||||||
file.DownloadTo("http://q4.qlogo.cn/g?b=qq&nk="+v+"&s=640", c.usrdir+strconv.Itoa(i)+".gif", true)
|
_ = file.DownloadTo("http://q4.qlogo.cn/g?b=qq&nk="+v+"&s=640", c.usrdir+strconv.Itoa(i)+".gif", true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package plugin_gif
|
package gif
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"image"
|
"image"
|
||||||
@ -39,28 +39,31 @@ func (cc *context) other(value ...string) string {
|
|||||||
// 加载图片
|
// 加载图片
|
||||||
im := img.LoadFirstFrame(cc.headimgsdir[0], 0, 0)
|
im := img.LoadFirstFrame(cc.headimgsdir[0], 0, 0)
|
||||||
var a *image.NRGBA
|
var a *image.NRGBA
|
||||||
if value[0] == "上翻" || value[0] == "下翻" {
|
|
||||||
|
switch value[0] {
|
||||||
|
case "上翻", "下翻":
|
||||||
a = im.FlipV().Im
|
a = im.FlipV().Im
|
||||||
} else if value[0] == "左翻" || value[0] == "右翻" {
|
case "左翻", "右翻":
|
||||||
a = im.FlipH().Im
|
a = im.FlipH().Im
|
||||||
} else if value[0] == "反色" {
|
case "反色":
|
||||||
a = im.Invert().Im
|
a = im.Invert().Im
|
||||||
} else if value[0] == "灰度" {
|
case "灰度":
|
||||||
a = im.Grayscale().Im
|
a = im.Grayscale().Im
|
||||||
} else if value[0] == "负片" {
|
case "负片":
|
||||||
a = im.Invert().Grayscale().Im
|
a = im.Invert().Grayscale().Im
|
||||||
} else if value[0] == "浮雕" {
|
case "浮雕":
|
||||||
a = im.Convolve3x3().Im
|
a = im.Convolve3x3().Im
|
||||||
} else if value[0] == "打码" {
|
case "打码":
|
||||||
a = im.Blur(10).Im
|
a = im.Blur(10).Im
|
||||||
} else if value[0] == "旋转" {
|
case "旋转":
|
||||||
r, _ := strconv.ParseFloat(value[1], 64)
|
r, _ := strconv.ParseFloat(value[1], 64)
|
||||||
a = img.Rotate(im.Im, r, 0, 0).Im
|
a = img.Rotate(im.Im, r, 0, 0).Im
|
||||||
} else if value[0] == "变形" {
|
case "变形":
|
||||||
w, _ := strconv.Atoi(value[1])
|
w, _ := strconv.Atoi(value[1])
|
||||||
h, _ := strconv.Atoi(value[2])
|
h, _ := strconv.Atoi(value[2])
|
||||||
a = img.Size(im.Im, w, h).Im
|
a = img.Size(im.Im, w, h).Im
|
||||||
}
|
}
|
||||||
|
|
||||||
_ = img.SavePng(a, name)
|
_ = img.SavePng(a, name)
|
||||||
return "file:///" + name
|
return "file:///" + name
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
// Package plugin_gif 制图
|
// Package gif 制图
|
||||||
package plugin_gif
|
package gif
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user