MCPcopy Create free account
hub / github.com/FloatTech/ZeroBot-Plugin-Playground / init

Function init

plugin/subweibo/subweibo.go:256–288  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

254}
255
256func init() {
257 go func() {
258 err := db.Open(time.Hour * 24)
259 if err != nil {
260 panic(err)
261 }
262 err = db.Create("weiboMsg", &weiboDBData{})
263 if err != nil {
264 panic(err)
265 }
266 }()
267
268 engine.OnFullMatch("开启订阅", zero.OnlyGroup).SetBlock(true).Handle(func(ctx *zero.Ctx) {
269 running(ctx)
270 })
271 engine.OnFullMatch("关闭订阅", zero.OnlyGroup).SetBlock(true).Handle(func(ctx *zero.Ctx) {
272 stop(ctx)
273 })
274 engine.OnFullMatch("查看订阅", zero.OnlyGroup).SetBlock(true).Handle(func(ctx *zero.Ctx) {
275 selectAllSubChannelsInfo(ctx)
276 })
277 engine.OnPrefix("订阅微博", zero.OnlyGroup).SetBlock(true).Handle(func(ctx *zero.Ctx) {
278 args := ctx.State["args"].(string)
279 msg := getChannels(args)
280 ctx.SendChain(message.Text(msg))
281 })
282 engine.OnPrefix("退订微博", zero.OnlyGroup).SetBlock(true).Handle(func(ctx *zero.Ctx) {
283 arg := ctx.State["args"].(string)
284 msg := delChannels(arg)
285 ctx.SendChain(message.Text(msg))
286 })
287 initChannel()
288}
289
290func initChannel() {
291 var args []string

Callers

nothing calls this directly

Calls 6

runningFunction · 0.85
stopFunction · 0.85
selectAllSubChannelsInfoFunction · 0.85
getChannelsFunction · 0.85
delChannelsFunction · 0.85
initChannelFunction · 0.85

Tested by

no test coverage detected