Fix Arioch
the build was successful Details

This commit is contained in:
Antoine Bartuccio 2019-01-04 11:45:28 +01:00
parent daa77fcfc4
commit f722e70052
1 changed files with 12 additions and 10 deletions

View File

@ -2,7 +2,7 @@
* @Author: Bartuccio Antoine
* @Date: 2018-07-25 18:51:38
* @Last Modified by: Bartuccio Antoine
* @Last Modified time: 2019-01-04 10:47:25
* @Last Modified time: 2019-01-04 11:44:47
*/
package commands
@ -93,19 +93,21 @@ func TwitterSJW(m *tb.Message) {
testOrInitTwitter()
lastUse, exists := shared.ChatData.Get(m.Chat.ID, "last chaos use")
if exists {
var date *time.Time
if lastUseConverted, isString := lastUse.(string); isString {
parsedDate, err := time.Parse(time.RFC3339, lastUseConverted)
date := time.Now()
switch serializedDate := lastUse.(type) {
case string:
parsedDate, err := time.Parse(time.RFC3339, serializedDate)
if err == nil {
date = &parsedDate
date = parsedDate
}
case time.Time:
date = serializedDate
default:
shared.Bot.Send(m.Chat, "Arioch ne répondra pas à votre appel.")
return
}
if lastUseConverted, isDate := lastUse.(time.Time); isDate {
date = &lastUseConverted
}
if date != nil || time.Now().Before(date.Add(time.Hour*24)) {
if time.Now().Before(date.Add(time.Hour * 24)) {
shared.Bot.Send(m.Chat, "Arioch ne répondra pas à votre appel.")
return
}