Exemplo n.º 1
0
func add(ctx *bot.Context) {
	n, c := ctx.Storable()
	quote := quotes.NewQuote(ctx.Text(), n, c)
	quote.QID = qc.NewQID()
	if err := qc.Insert(quote); err == nil {
		ctx.ReplyN("Quote added succesfully, id #%d.", quote.QID)
	} else {
		ctx.ReplyN("Error adding quote: %s.", err)
	}
}
Exemplo n.º 2
0
func add(line *base.Line) {
	n, c := line.Storable()
	quote := quotes.NewQuote(line.Args[1], n, c)
	quote.QID = qc.NewQID()
	if err := qc.Insert(quote); err == nil {
		bot.ReplyN(line, "Quote added succesfully, id #%d.", quote.QID)
	} else {
		bot.ReplyN(line, "Error adding quote: %s.", err)
	}
}