public static Embed CreateJailCommandEmbed(this JailConfigModel model) { return(new EmbedBuilder() .WithTitle("Jail Command Config") .AddField("Is Logged", model.ShouldLog?"True":"False") .AddField("Logging Channel", model.LogChannel == 0?"-":MentionUtils.MentionChannel(model.LogChannel)) .AddField("Roles To Add", (model.Roles != null && model.Roles.ToAdd != null)?model.Roles.ToAdd.GetRoleMentions():"-") .AddField("Roles To Remove", (model.Roles != null && model.Roles.ToRemove != null)?model.Roles.ToRemove.GetRoleMentions():"-") .WithColor(116, 223, 207) .WithCurrentTimestamp() .Build()); }
public async Task <Result <ulong> > StoreJailConfig(JailConfigModel config) { var storage = config.ToStorage(); var entity = await(_context.JailConfigModels as IQueryable <JailConfigStorageModel>) .FirstOrDefaultAsync(x => x.GuildId == storage.GuildId); if (entity is null) { _context.JailConfigModels.Add(storage); } else { _context.Entry(entity).CurrentValues.SetValues(storage); } await _context.SaveChangesAsync(); return(config.GuildId); }