Esempio n. 1
0
func (this Sticker) ToNote(msg telebot.Message, tags ...string) Note {

	tags = append(tags, this.Ids...)
	tags = append(tags, this.SaveTag)

	return Note{
		UserId: msg.Sender.ID,
		Added:  msg.Time(),
		Text:   this.Meaning,
		Tag:    strings.Join(tags, ","),
		Remind: time.Now().AddDate(0, 0, 7)}

}
Esempio n. 2
0
func NewNote(msg telebot.Message, tags ...string) *Note {

	answer := msg.Text
	cmdTag := tagFromMsg(answer)

	if answer != "" && cmdTag != "" {
		//e.g. remove '/say' from the message
		if strings.Contains(answer, cmdTag) {
			answer = strings.TrimSpace(strings.Split(answer, cmdTag)[1])
		}
	}

	return &Note{
		UserId: msg.Sender.ID,
		Added:  msg.Time(),
		Text:   answer,
		Tag:    strings.Join(append(tags, cmdTag), ","),
	}
}