mirror of
https://git.klmp200.net/ALFRED/ALFRED.git
synced 2025-01-18 10:36:44 +01:00
Fix Arioch
This commit is contained in:
parent
daa77fcfc4
commit
f722e70052
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user