Improved feedback message for /addstaff when user is already staff

This commit is contained in:
Toastie 2024-12-27 18:18:23 +13:00
parent c6c7379f20
commit 586f9c8f07
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4

View file

@ -43,8 +43,10 @@ public class AddStaffCommand
return;
}
bool alreadyStaff = Database.IsStaff(staffMember.Id);
await using MySqlConnection c = Database.GetConnection();
MySqlCommand cmd = Database.IsStaff(staffMember.Id) ? new MySqlCommand(@"UPDATE staff SET name = @name WHERE user_id = @user_id", c) : new MySqlCommand(@"INSERT INTO staff (user_id, name) VALUES (@user_id, @name);", c);
MySqlCommand cmd = alreadyStaff ? new MySqlCommand(@"UPDATE staff SET name = @name WHERE user_id = @user_id", c) : new MySqlCommand(@"INSERT INTO staff (user_id, name) VALUES (@user_id, @name);", c);
c.Open();
cmd.Parameters.AddWithValue("@user_id", staffMember.Id);
@ -55,7 +57,7 @@ public class AddStaffCommand
await command.RespondAsync(new DiscordEmbedBuilder
{
Color = DiscordColor.Green,
Description = staffMember.Mention + " was added to staff."
Description = alreadyStaff ? staffMember.Mention + " is already a staff member, refreshed username in database." : staffMember.Mention + " was added to staff."
}, true);
try