ZeroBot-Plugin/plugin_jandan/jandan.go
himawari 45edd86cb8
feat:增加煎蛋网无聊图 (#115)
* feat:添加煎蛋网无聊图

* fix:修lint

* fix:修改model和名称

* fix:删除不要的驱动

* fix:修改日志错误的地方

* fix:修改权限

* fix:去掉数据库

Co-authored-by: Guohuiyuan <haibaraguo@yeahka.com>
2022-02-08 15:05:58 +08:00

40 lines
901 B
Go

// Package jandan 煎蛋网无聊图
package jandan
import (
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control"
"github.com/wdvxdr1123/ZeroBot/message"
"math/rand"
"time"
zero "github.com/wdvxdr1123/ZeroBot"
)
const (
jandanPictureURL = "http://jandan.net/pic"
)
var (
pictureList []string
)
func init() {
engine := control.Register("jandan", order.PrioJandan, &control.Options{
DisableOnDefault: false,
Help: "煎蛋网无聊图\n- 来份屌图\n- 更新屌图\n",
})
engine.OnFullMatch("来份屌图").SetBlock(true).
Handle(func(ctx *zero.Ctx) {
rand.Seed(time.Now().Unix())
ctx.SendChain(message.Image(pictureList[rand.Intn(len(pictureList))]))
})
engine.OnFullMatch("更新屌图", zero.SuperUserPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.Send("少女更新中......")
travelWebpage()
})
}