fixed .log command not showing
This commit is contained in:
		| @@ -124,49 +124,49 @@ namespace NadekoBot.Modules.Administration | ||||
|                     switch (type) | ||||
|                     { | ||||
|                         case LogType.Other: | ||||
|                             channelId = logSetting.LogOtherId = (logSetting.LogOtherId == null ? channel.Id : default); | ||||
|                             channelId = logSetting.LogOtherId = (logSetting.LogOtherId == null ? (ulong?)channel.Id : default); | ||||
|                             break; | ||||
|                         case LogType.MessageUpdated: | ||||
|                             channelId = logSetting.MessageUpdatedId = (logSetting.MessageUpdatedId == null ? channel.Id : default); | ||||
|                             channelId = logSetting.MessageUpdatedId = (logSetting.MessageUpdatedId == null ? (ulong?)channel.Id : default); | ||||
|                             break; | ||||
|                         case LogType.MessageDeleted: | ||||
|                             channelId = logSetting.MessageDeletedId = (logSetting.MessageDeletedId == null ? channel.Id : default); | ||||
|                             channelId = logSetting.MessageDeletedId = (logSetting.MessageDeletedId == null ? (ulong?)channel.Id : default); | ||||
|                             break; | ||||
|                         case LogType.UserJoined: | ||||
|                             channelId = logSetting.UserJoinedId = (logSetting.UserJoinedId == null ? channel.Id : default); | ||||
|                             channelId = logSetting.UserJoinedId = (logSetting.UserJoinedId == null ? (ulong?)channel.Id : default); | ||||
|                             break; | ||||
|                         case LogType.UserLeft: | ||||
|                             channelId = logSetting.UserLeftId = (logSetting.UserLeftId == null ? channel.Id : default); | ||||
|                             channelId = logSetting.UserLeftId = (logSetting.UserLeftId == null ? (ulong?)channel.Id : default); | ||||
|                             break; | ||||
|                         case LogType.UserBanned: | ||||
|                             channelId = logSetting.UserBannedId = (logSetting.UserBannedId == null ? channel.Id : default); | ||||
|                             channelId = logSetting.UserBannedId = (logSetting.UserBannedId == null ? (ulong?)channel.Id : default); | ||||
|                             break; | ||||
|                         case LogType.UserUnbanned: | ||||
|                             channelId = logSetting.UserUnbannedId = (logSetting.UserUnbannedId == null ? channel.Id : default); | ||||
|                             channelId = logSetting.UserUnbannedId = (logSetting.UserUnbannedId == null ? (ulong?)channel.Id : default); | ||||
|                             break; | ||||
|                         case LogType.UserUpdated: | ||||
|                             channelId = logSetting.UserUpdatedId = (logSetting.UserUpdatedId == null ? channel.Id : default); | ||||
|                             channelId = logSetting.UserUpdatedId = (logSetting.UserUpdatedId == null ? (ulong?)channel.Id : default); | ||||
|                             break; | ||||
|                         case LogType.UserMuted: | ||||
|                             channelId = logSetting.UserMutedId = (logSetting.UserMutedId == null ? channel.Id : default); | ||||
|                             channelId = logSetting.UserMutedId = (logSetting.UserMutedId == null ? (ulong?)channel.Id : default); | ||||
|                             break; | ||||
|                         case LogType.ChannelCreated: | ||||
|                             channelId = logSetting.ChannelCreatedId = (logSetting.ChannelCreatedId == null ? channel.Id : default); | ||||
|                             channelId = logSetting.ChannelCreatedId = (logSetting.ChannelCreatedId == null ? (ulong?)channel.Id : default); | ||||
|                             break; | ||||
|                         case LogType.ChannelDestroyed: | ||||
|                             channelId = logSetting.ChannelDestroyedId = (logSetting.ChannelDestroyedId == null ? channel.Id : default); | ||||
|                             channelId = logSetting.ChannelDestroyedId = (logSetting.ChannelDestroyedId == null ? (ulong?)channel.Id : default); | ||||
|                             break; | ||||
|                         case LogType.ChannelUpdated: | ||||
|                             channelId = logSetting.ChannelUpdatedId = (logSetting.ChannelUpdatedId == null ? channel.Id : default); | ||||
|                             channelId = logSetting.ChannelUpdatedId = (logSetting.ChannelUpdatedId == null ? (ulong?)channel.Id : default); | ||||
|                             break; | ||||
|                         case LogType.UserPresence: | ||||
|                             channelId = logSetting.LogUserPresenceId = (logSetting.LogUserPresenceId == null ? channel.Id : default); | ||||
|                             channelId = logSetting.LogUserPresenceId = (logSetting.LogUserPresenceId == null ? (ulong?)channel.Id : default); | ||||
|                             break; | ||||
|                         case LogType.VoicePresence: | ||||
|                             channelId = logSetting.LogVoicePresenceId = (logSetting.LogVoicePresenceId == null ? channel.Id : default); | ||||
|                             channelId = logSetting.LogVoicePresenceId = (logSetting.LogVoicePresenceId == null ? (ulong?)channel.Id : default); | ||||
|                             break; | ||||
|                         case LogType.VoicePresenceTTS: | ||||
|                             channelId = logSetting.LogVoicePresenceTTSId = (logSetting.LogVoicePresenceTTSId == null ? channel.Id : default); | ||||
|                             channelId = logSetting.LogVoicePresenceTTSId = (logSetting.LogVoicePresenceTTSId == null ? (ulong?)channel.Id : default); | ||||
|                             break; | ||||
|                     } | ||||
|  | ||||
|   | ||||
| @@ -950,7 +950,7 @@ namespace NadekoBot.Modules.Administration.Services | ||||
|                     break; | ||||
|             } | ||||
|  | ||||
|             if (!id.HasValue) | ||||
|             if (!id.HasValue || id == 0) | ||||
|             { | ||||
|                 UnsetLogSetting(guild.Id, logChannelType); | ||||
|                 return null; | ||||
|   | ||||
| @@ -8,5 +8,7 @@ namespace NadekoBot.Modules.Gambling.Services | ||||
|     { | ||||
|         public ConcurrentDictionary<ulong, DateTime> DivorceCooldowns { get; } = new ConcurrentDictionary<ulong, DateTime>(); | ||||
|         public ConcurrentDictionary<ulong, DateTime> AffinityCooldowns { get; } = new ConcurrentDictionary<ulong, DateTime>(); | ||||
|  | ||||
|          | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -16,17 +16,25 @@ namespace NadekoBot.Modules.Permissions | ||||
|     public partial class Permissions | ||||
|     { | ||||
|         [Group] | ||||
|         public class FilterCommands : NadekoSubmodule | ||||
|         public class FilterCommands : NadekoSubmodule<FilterService> | ||||
|         { | ||||
|             private readonly DbService _db; | ||||
|             private readonly FilterService _service; | ||||
|  | ||||
|             public FilterCommands(FilterService service, DbService db) | ||||
|             public FilterCommands(DbService db) | ||||
|             { | ||||
|                 _service = service; | ||||
|                 _db = db; | ||||
|             } | ||||
|  | ||||
|             //[NadekoCommand, Usage, Description, Aliases] | ||||
|             //[RequireContext(ContextType.Guild)] | ||||
|             //public async Task SrvrFilterLinks() | ||||
|             //{ | ||||
|             //    using (var uow = _db.UnitOfWork) | ||||
|             //    { | ||||
|             //        var config =  | ||||
|             //    } | ||||
|             //} | ||||
|  | ||||
|             [NadekoCommand, Usage, Description, Aliases] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task SrvrFilterInv() | ||||
|   | ||||
| @@ -27,6 +27,9 @@ namespace NadekoBot.Modules.Permissions.Services | ||||
|         public ConcurrentHashSet<ulong> WordFilteringChannels { get; } | ||||
|         public ConcurrentHashSet<ulong> WordFilteringServers { get; } | ||||
|  | ||||
|         //public ConcurrentHashSet<ulong> LinkFilteringServers { get; } | ||||
|         //public ConcurrentDictionary<ulong, bool> LinkFilteringChannelSettings { get; } | ||||
|  | ||||
|         public ConcurrentHashSet<string> FilteredWordsForChannel(ulong channelId, ulong guildId) | ||||
|         { | ||||
|             ConcurrentHashSet<string> words = new ConcurrentHashSet<string>(); | ||||
| @@ -56,9 +59,10 @@ namespace NadekoBot.Modules.Permissions.Services | ||||
|  | ||||
|             var serverFiltering = bot.AllGuildConfigs.Where(gc => gc.FilterWords); | ||||
|             WordFilteringServers = new ConcurrentHashSet<ulong>(serverFiltering.Select(gc => gc.GuildId)); | ||||
|  | ||||
|             WordFilteringChannels = new ConcurrentHashSet<ulong>(bot.AllGuildConfigs.SelectMany(gc => gc.FilterWordsChannelIds.Select(fwci => fwci.ChannelId))); | ||||
|  | ||||
|             //LinkFilteringServers = new ConcurrentHashSet<ulong>(bot.AllGuildConfigs.Where(gc => gc.FilterLinks).Select(x => x.GuildId)); | ||||
|  | ||||
|             _client.MessageUpdated += (oldData, newMsg, channel) => | ||||
|             { | ||||
|                 var _ = Task.Run(() => | ||||
|   | ||||
| @@ -55,6 +55,9 @@ namespace NadekoBot.Core.Services.Database.Models | ||||
|         public bool FilterInvites { get; set; } | ||||
|         public HashSet<FilterChannelId> FilterInvitesChannelIds { get; set; } = new HashSet<FilterChannelId>(); | ||||
|  | ||||
|         public bool FilterLinks { get; set; } | ||||
|         public HashSet<FilterLinksChannelId> FilterLinksChannels { get; set; } = new HashSet<FilterLinksChannelId>(); | ||||
|          | ||||
|         public bool FilterWords { get; set; } | ||||
|         public HashSet<FilteredWord> FilteredWords { get; set; } = new HashSet<FilteredWord>(); | ||||
|         public HashSet<FilterChannelId> FilterWordsChannelIds { get; set; } = new HashSet<FilterChannelId>(); | ||||
| @@ -211,6 +214,23 @@ namespace NadekoBot.Core.Services.Database.Models | ||||
|         public ulong ChannelId { get; set; } | ||||
|     } | ||||
|  | ||||
|     public class FilterLinksChannelId : DbEntity | ||||
|     { | ||||
|         public ulong ChannelId { get; set; } | ||||
|  | ||||
|         public override bool Equals(object obj) | ||||
|         { | ||||
|             return obj is FilterLinksChannelId f | ||||
|                 ? f.ChannelId == ChannelId | ||||
|                 : false; | ||||
|         } | ||||
|  | ||||
|         public override int GetHashCode() | ||||
|         { | ||||
|             return ChannelId.GetHashCode(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public class FilteredWord : DbEntity | ||||
|     { | ||||
|         public string Word { get; set; } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user