diff --git a/plugins/first.go b/plugins/first.go index 0ea7971..4cdcc12 100644 --- a/plugins/first.go +++ b/plugins/first.go @@ -32,10 +32,15 @@ func NewFirstPlugin(b *bot.Bot) *FirstPlugin { query := bson.M{"day": midnight(time.Now().UTC())} coll.Find(query).All(&firsts) + var first *FirstEntry + if len(firsts) > 0 { + first = &firsts[0] + } + return &FirstPlugin{ Bot: b, Coll: coll, - First: &firsts[0], + First: first, } }