mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-23 01:20:11 +00:00
Update discord.go
Cleaning up a bit
This commit is contained in:
parent
dd93758b0e
commit
0366e5116d
@ -550,15 +550,17 @@ func (d *DiscordDaemon) cmdInvite(s *dg.Session, i *dg.InteractionCreate, lang s
|
|||||||
//if mins > 0 {
|
//if mins > 0 {
|
||||||
// expmin = mins
|
// expmin = mins
|
||||||
//}
|
//}
|
||||||
// Need to check whether requestor is linked to the admin account *possibly add Admin bool to DiscordUser struct
|
// Check whether requestor is linked to the admin account
|
||||||
requestoremail, ok := d.app.storage.GetEmailsKey(requestor.JellyfinID)
|
requestoremail, ok := d.app.storage.GetEmailsKey(requestor.JellyfinID)
|
||||||
if !ok {
|
if !ok {
|
||||||
d.app.err.Printf("Failed to verify admin")
|
d.app.err.Printf("Failed to verify admin")
|
||||||
}
|
}
|
||||||
if !requestoremail.Admin {
|
if !requestoremail.Admin {
|
||||||
d.app.err.Printf("User is not admin")
|
d.app.err.Printf("User is not admin")
|
||||||
|
//add response message
|
||||||
|
return
|
||||||
}
|
}
|
||||||
// variation of app.GenerateInvite, some parts commented to potentially add back in later with the other options
|
// variation of app.GenerateInvite, some parts commented to potentially add back in later with the other command options
|
||||||
//d.app.debug.Println("Generating new invite with options: %s: %i: %s: %s", invuser, expmin, profile, label)
|
//d.app.debug.Println("Generating new invite with options: %s: %i: %s: %s", invuser, expmin, profile, label)
|
||||||
currentTime := time.Now()
|
currentTime := time.Now()
|
||||||
validTill := currentTime.Add(time.Minute*time.Duration(expmin))
|
validTill := currentTime.Add(time.Minute*time.Duration(expmin))
|
||||||
@ -593,14 +595,17 @@ func (d *DiscordDaemon) cmdInvite(s *dg.Session, i *dg.InteractionCreate, lang s
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
invite.SendTo = fmt.Sprintf("Failed to send to %s", invuser)
|
invite.SendTo = fmt.Sprintf("Failed to send to %s", invuser)
|
||||||
d.app.err.Printf("%s: Failed to construct invite message: %v", inviteCode, err)
|
d.app.err.Printf("%s: Failed to construct invite message: %v", inviteCode, err)
|
||||||
|
//add response message
|
||||||
} else {
|
} else {
|
||||||
var err error
|
var err error
|
||||||
err = d.app.discord.SendDM(msg, discord)
|
err = d.app.discord.SendDM(msg, discord)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
invite.SendTo = fmt.Sprintf("Failed to send to %s", invuser)
|
invite.SendTo = fmt.Sprintf("Failed to send to %s", invuser)
|
||||||
d.app.err.Printf("%s: %s: %v", inviteCode, invite.SendTo, err)
|
d.app.err.Printf("%s: %s: %v", inviteCode, invite.SendTo, err)
|
||||||
|
//add response message
|
||||||
} else {
|
} else {
|
||||||
d.app.info.Printf("%s: Sent invite email to \"%s\"", inviteCode, invuser)
|
d.app.info.Printf("%s: Sent invite email to \"%s\"", inviteCode, invuser)
|
||||||
|
//add response message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user