Add Discord time formatting
This commit is contained in:
@ -180,7 +180,7 @@ func BumpSet(b BotCommand) bool {
|
||||
return false
|
||||
}
|
||||
config.BumpTime = time.Now().Add(time.Duration(timer) * time.Minute).Add(-2 * time.Hour)
|
||||
b.Session.ChannelMessageSend(b.Message.ChannelID, fmt.Sprintf("New last bump time: %+v, expecting next bump at %+v", config.BumpTime.Format("15:04:05"), config.BumpTime.Add(2*time.Hour).Format("15:04:05")))
|
||||
b.Session.ChannelMessageSend(b.Message.ChannelID, fmt.Sprintf("New last bump time: <t:%+v:t>, expecting next bump at <t:%+v:t>", config.BumpTime.Unix(), config.BumpTime.Add(2*time.Hour).Unix()))
|
||||
return true
|
||||
}
|
||||
|
||||
@ -234,14 +234,14 @@ func Status(b BotCommand) bool {
|
||||
defer log.PanicSafe()
|
||||
status := fmt.Sprintf("Uptime: %+v\n", time.Since(startupTime))
|
||||
status += fmt.Sprintf("Last active time: %+v\n", time.Since(lastActiveTime))
|
||||
status += fmt.Sprintf("Last bump: %+v\n", time.Since(config.BumpTime))
|
||||
status += fmt.Sprintf("Last bump: <t:%+v:t>\n", config.BumpTime.Unix())
|
||||
status += fmt.Sprintf("Last bumper: %+v\n", userFromID(config.LastBumper).Username)
|
||||
status += fmt.Sprintf("Bump needed: %+v\n", bump)
|
||||
if len(config.Unverified) > 0 {
|
||||
status += "Unverified users:\n```"
|
||||
for k, v := range config.Unverified {
|
||||
uvUser := userFromID(k)
|
||||
status += fmt.Sprintf("\n%+v will be removed in %+v", uvUser.Username, time.Until(v.Add(1*time.Hour)))
|
||||
status += fmt.Sprintf("\n%+v will be removed at <t:%+v:t>", uvUser.Username, v.Add(1*time.Hour).Unix())
|
||||
}
|
||||
status += "```"
|
||||
} else {
|
||||
@ -261,7 +261,7 @@ func Status(b BotCommand) bool {
|
||||
status += "\nThe following users are on probation: \n```"
|
||||
for uid, join := range config.Probations {
|
||||
probationUser := userFromID(uid)
|
||||
status += fmt.Sprintf("%+v for another %+v\n", probationUser.Username, time.Until(join.Add(2*time.Hour)))
|
||||
status += fmt.Sprintf("%+v for until <t:%+v:t>\n", probationUser.Username, join.Add(2*time.Hour).Unix())
|
||||
}
|
||||
status += "```"
|
||||
} else {
|
||||
|
||||
4
main.go
4
main.go
@ -125,7 +125,7 @@ func runPurge(s *discordgo.Session) {
|
||||
lastPM[k] = time.Now()
|
||||
pmChann, _ := s.UserChannelCreate(k)
|
||||
s.ChannelMessageSend(pmChann.ID,
|
||||
fmt.Sprintf("This is a reminder that you have not verified with me and will be removed in %+v. You may reply to this message for verification instructions.", time.Until(v.Add(1*time.Hour))))
|
||||
fmt.Sprintf("This is a reminder that you have not verified with me and will be removed at <t:%+v:t>. You may reply to this message for verification instructions.", v.Add(1*time.Hour).Unix()))
|
||||
if time.Since(v) > (time.Hour * 1) {
|
||||
s.ChannelMessageSend(config.AdminChannel, fmt.Sprintf("%+v was removed.", m.Mention()))
|
||||
s.GuildMemberDeleteWithReason(config.GuildID, k, fmt.Sprintf("Unverified user %+v.", v))
|
||||
@ -188,7 +188,7 @@ func rejectVerification(s *discordgo.Session, u discordgo.User) {
|
||||
defer log.PanicSafe()
|
||||
st, _ := s.UserChannelCreate(u.ID)
|
||||
if st != nil {
|
||||
s.ChannelMessageSend(st.ID, fmt.Sprintf("Your verification has been rejected. This means it did not clearly show your face, with your pinkie finger held to the corner of your mouth, or the photo looked edited/filtered. No filters will be accepted.\n\nPlease try again before %+v", time.Until(time.Now().Add(1*time.Hour))))
|
||||
s.ChannelMessageSend(st.ID, fmt.Sprintf("Your verification has been rejected. This means it did not clearly show your face, with your pinkie finger held to the corner of your mouth, or the photo looked edited/filtered. No filters will be accepted.\n\nPlease try again before <t:%+v:t>", time.Now().Add(1*time.Hour).Unix()))
|
||||
}
|
||||
config.Unverified[u.ID] = time.Now()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user