Add default values to guildsettings model

This commit is contained in:
runebaas 2018-08-26 18:05:50 +02:00
parent 74619a4434
commit d1e9992a8c
No known key found for this signature in database
GPG key ID: 2677AF508D0300D6
2 changed files with 15 additions and 15 deletions

View file

@ -10,20 +10,20 @@ namespace Geekbot.net.Database.Models
[Required]
public long GuildId { get; set; }
public bool Ping { get; set; }
public bool Ping { get; set; } = false;
public bool Hui { get; set; }
public bool Hui { get; set; } = false;
public long ModChannel { get; set; }
public long ModChannel { get; set; } = 0;
public string WelcomeMessage { get; set; }
public bool ShowDelete { get; set; }
public bool ShowDelete { get; set; } = false;
public bool ShowLeave { get; set; }
public bool ShowLeave { get; set; } = false;
public string WikiLang { get; set; }
public string WikiLang { get; set; } = "en";
public string Language { get; set; }
public string Language { get; set; } = "EN";
}
}

View file

@ -184,7 +184,7 @@ namespace Geekbot.net
{
var guildSocketData = ((IGuildChannel) channel).Guild;
var guild = _database.GuildSettings.FirstOrDefault(g => g.GuildId.Equals(guildSocketData.Id.AsLong()));
if (guild?.ShowDelete ?? false)
if ((guild?.ShowDelete ?? false) && guild?.ModChannel != 0)
{
var modChannelSocket = (ISocketMessageChannel) await _client.GetChannelAsync(guild.ModChannel.AsUlong());
var sb = new StringBuilder();