예제 #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)
	}
}
예제 #2
0
파일: commands.go 프로젝트: pzsz/sp0rkle
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)
	}
}