From 0366e5116d79df4d59985df8ae8c106d0fbfc365 Mon Sep 17 00:00:00 2001 From: Violet Scheen Date: Tue, 10 Oct 2023 11:14:57 -0400 Subject: [PATCH] Update discord.go Cleaning up a bit --- discord.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/discord.go b/discord.go index fc7a74f..cf1eb1b 100644 --- a/discord.go +++ b/discord.go @@ -550,15 +550,17 @@ func (d *DiscordDaemon) cmdInvite(s *dg.Session, i *dg.InteractionCreate, lang s //if mins > 0 { // 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) if !ok { d.app.err.Printf("Failed to verify admin") } if !requestoremail.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) currentTime := time.Now() 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 { invite.SendTo = fmt.Sprintf("Failed to send to %s", invuser) d.app.err.Printf("%s: Failed to construct invite message: %v", inviteCode, err) + //add response message } else { var err error err = d.app.discord.SendDM(msg, discord) if err != nil { invite.SendTo = fmt.Sprintf("Failed to send to %s", invuser) d.app.err.Printf("%s: %s: %v", inviteCode, invite.SendTo, err) + //add response message } else { d.app.info.Printf("%s: Sent invite email to \"%s\"", inviteCode, invuser) + //add response message } } }