Merge pull request #28 from NoiTheCat/fixvanishingtz

Fix time zone unset when updating birthday (#26)
This commit is contained in:
Noi 2022-09-20 15:23:08 -07:00 committed by GitHub
commit 21785acfb1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,6 @@ using Discord.Interactions;
using System.Text;
namespace BirthdayBot.ApplicationCommands;
[RequireGuildContext]
[Group("birthday", HelpCmdBirthday)]
public class BirthdayModule : BotModuleBase {
@ -47,7 +46,7 @@ public class BirthdayModule : BotModuleBase {
if (user.IsNew) db.UserEntries.Add(user);
user.BirthMonth = inmonth;
user.BirthDay = inday;
user.TimeZone = inzone;
user.TimeZone = inzone ?? user.TimeZone;
try {
await db.SaveChangesAsync();
} catch (Microsoft.EntityFrameworkCore.DbUpdateException e)