From 9f26cfdd501233f9db8c62ddf207543a22c1d246 Mon Sep 17 00:00:00 2001 From: Kyle Roth Date: Tue, 5 Sep 2023 14:03:41 +0000 Subject: [PATCH 1/2] point to waiting room for help Also correct small typo. --- pkg/bouncerbot/bouncerbot.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/bouncerbot/bouncerbot.go b/pkg/bouncerbot/bouncerbot.go index d0efad8..997d7c6 100644 --- a/pkg/bouncerbot/bouncerbot.go +++ b/pkg/bouncerbot/bouncerbot.go @@ -176,22 +176,22 @@ var messages = map[string][]string{ messageSuccessful: {"I found your info! I'll let you in now. :)"}, messageBadKey: { "Sorry, that key did not work. The key should be 64 hexadecimal characters, sent as " + - "plain text a single message by itself.", - "If you still have trouble, reach out to the admins for help.", + "plain text in a single message by itself.", + "If you still have trouble, ask for help in the waiting room channel.", }, - messageNotFound: {"Sorry, that key did not work. Reach out to the admins for help!"}, + messageNotFound: {"Sorry, that key did not work. Ask for help in the waiting room channel!"}, messageDecryptionError: { - "There was a decryption error with that key. Reach out to the admins for help!", + "There was a decryption error with that key. Ask for help in the waiting room channel!", }, messageNickPerm: { "Everything worked except I wasn't able to set your nickname because of your high role.", "Please set your nickname by sending `/nick FIRST LAST` in one of the channels.", }, messageAdmitError: { - "There was an error while trying to admit you. Reach out to the admins for help!", + "There was an error while trying to admit you. Ask for help in the waiting room channel!", }, messageOtherError: { - "There was an error with a message I tried to send. Reach out to the admins to complain!", + "There was an error with a message I tried to send. Complain in the waiting room channel!", }, } From c8a6f78daf596283c45ae65f90b9344da5346ebf Mon Sep 17 00:00:00 2001 From: Kyle Roth Date: Tue, 5 Sep 2023 14:04:42 +0000 Subject: [PATCH 2/2] set nickname after roles This is for privacy reasons. Before, there was a brief moment when the user's real name was visible in the waiting room. --- pkg/bouncerbot/bouncerbot.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/bouncerbot/bouncerbot.go b/pkg/bouncerbot/bouncerbot.go index 997d7c6..e6f3638 100644 --- a/pkg/bouncerbot/bouncerbot.go +++ b/pkg/bouncerbot/bouncerbot.go @@ -221,25 +221,25 @@ func (b *Bot) admit(u *db.User, dID string) error { var errs []error - err := b.GuildMemberNickname(b.Guild.GuildID, dID, u.Name) - if err != nil { - errs = append(errs, fmt.Errorf("set nick: %w", err)) - } - rolesToAdd := b.Guild.GetRoleIDsForUser(b.l, u) for _, roleID := range rolesToAdd { - err = b.GuildMemberRoleAdd(b.Guild.GuildID, dID, roleID) + err := b.GuildMemberRoleAdd(b.Guild.GuildID, dID, roleID) if err != nil { errs = append(errs, fmt.Errorf("set role '%s': %w", roleID, err)) } } - err = b.GuildMemberRoleRemove(b.Guild.GuildID, dID, b.Guild.NewbieRole) + err := b.GuildMemberRoleRemove(b.Guild.GuildID, dID, b.Guild.NewbieRole) if err != nil { errs = append(errs, fmt.Errorf("remove newbie role: %w", err)) } + err = b.GuildMemberNickname(b.Guild.GuildID, dID, u.Name) + if err != nil { + errs = append(errs, fmt.Errorf("set nick: %w", err)) + } + return errors.Join(errs...) }