mirror of
https://git.klmp200.net/ALFRED/ALFRED.git
synced 2025-01-18 18:46:44 +01:00
Fix Arioch
This commit is contained in:
parent
daa77fcfc4
commit
f722e70052
@ -2,7 +2,7 @@
|
|||||||
* @Author: Bartuccio Antoine
|
* @Author: Bartuccio Antoine
|
||||||
* @Date: 2018-07-25 18:51:38
|
* @Date: 2018-07-25 18:51:38
|
||||||
* @Last Modified by: Bartuccio Antoine
|
* @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
|
package commands
|
||||||
@ -93,19 +93,21 @@ func TwitterSJW(m *tb.Message) {
|
|||||||
testOrInitTwitter()
|
testOrInitTwitter()
|
||||||
lastUse, exists := shared.ChatData.Get(m.Chat.ID, "last chaos use")
|
lastUse, exists := shared.ChatData.Get(m.Chat.ID, "last chaos use")
|
||||||
if exists {
|
if exists {
|
||||||
var date *time.Time
|
date := time.Now()
|
||||||
if lastUseConverted, isString := lastUse.(string); isString {
|
switch serializedDate := lastUse.(type) {
|
||||||
parsedDate, err := time.Parse(time.RFC3339, lastUseConverted)
|
case string:
|
||||||
|
parsedDate, err := time.Parse(time.RFC3339, serializedDate)
|
||||||
if err == nil {
|
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 {
|
if time.Now().Before(date.Add(time.Hour * 24)) {
|
||||||
date = &lastUseConverted
|
|
||||||
}
|
|
||||||
|
|
||||||
if date != nil || time.Now().Before(date.Add(time.Hour*24)) {
|
|
||||||
shared.Bot.Send(m.Chat, "Arioch ne répondra pas à votre appel.")
|
shared.Bot.Send(m.Chat, "Arioch ne répondra pas à votre appel.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user