()
| 254 | } |
| 255 | |
| 256 | func 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 | |
| 290 | func initChannel() { |
| 291 | var args []string |
nothing calls this directly
no test coverage detected