|
|
|
@ -106,16 +106,22 @@ func genPassword(length int) string {
@@ -106,16 +106,22 @@ func genPassword(length int) string {
|
|
|
|
|
} |
|
|
|
|
func sendPassword(user string, ipaddr string) { |
|
|
|
|
defer log.PanicSafe() |
|
|
|
|
log.LogInfo("sending password to %+v for %+v", ipaddr, user) |
|
|
|
|
str := genPassword(8) |
|
|
|
|
m, _ := dg.GuildMember(config.GuildID, user) |
|
|
|
|
log.LogInfo("sending password to %+v for %+v: %+v", ipaddr, user, str) |
|
|
|
|
m, err := dg.GuildMember(config.GuildID, user) |
|
|
|
|
if err != nil { |
|
|
|
|
log.LogErrorType(err) |
|
|
|
|
} |
|
|
|
|
toks[m.User.Username] = tokens{ |
|
|
|
|
username: user, |
|
|
|
|
ip: ipaddr, |
|
|
|
|
password: str, |
|
|
|
|
timestamp: time.Now(), |
|
|
|
|
} |
|
|
|
|
pmChann, _ := dg.UserChannelCreate(user) |
|
|
|
|
pmChann, err := dg.UserChannelCreate(user) |
|
|
|
|
if err != nil { |
|
|
|
|
log.LogErrorType(err) |
|
|
|
|
} |
|
|
|
|
dg.ChannelMessageSend(pmChann.ID, fmt.Sprintf("A temporary password was requested from %s:", ipaddr)) |
|
|
|
|
dg.ChannelMessageSend(pmChann.ID, fmt.Sprintf("```%s```", str)) |
|
|
|
|
|
|
|
|
|