Add Users infos and gender registration

This commit is contained in:
klmp200 2018-07-24 15:24:09 +02:00
parent 85b52e23e5
commit 7030d6d595
No known key found for this signature in database
GPG key ID: E7245548C53F904B
5 changed files with 126 additions and 8 deletions

30
commands/gender.go Normal file
View file

@ -0,0 +1,30 @@
/*
* @Author: Bartuccio Antoine
* @Date: 2018-07-24 14:55:33
* @Last Modified by: klmp200
* @Last Modified time: 2018-07-24 15:10:37
*/
package commands
import (
"../shared"
tb "gopkg.in/tucnak/telebot.v2"
"strings"
)
func SetGender(m *tb.Message) {
split := strings.Split(m.Text, " ")
data := strings.Join(split[1:], " ")
shared.Users.Set(m.Sender.ID, "gender", data)
shared.Bot.Send(m.Chat, "Votre genre est enregistré, je vous considère maintenant comme « "+data+" ».")
}
func Gender(m *tb.Message) {
data, exists := shared.Users.Get(m.Sender.ID, "gender")
if !exists {
shared.Bot.Send(m.Chat, "Vous n'avez pas enregistré votre genre, je ne voudrais pas l'assumer.")
} else {
shared.Bot.Send(m.Chat, data)
}
}