diff --git a/src/NadekoBot/Modules/Administration/Commands/LogCommand.cs b/src/NadekoBot/Modules/Administration/Commands/LogCommand.cs index b7be6999..3ce63622 100644 --- a/src/NadekoBot/Modules/Administration/Commands/LogCommand.cs +++ b/src/NadekoBot/Modules/Administration/Commands/LogCommand.cs @@ -529,41 +529,41 @@ namespace NadekoBot.Modules.Administration await channel.SendMessageAsync($"`Logging will no longer ignore {channel.Name} ({channel.Id}) channel.`").ConfigureAwait(false); } - [LocalizedCommand, LocalizedRemarks, LocalizedSummary, LocalizedAlias] - [RequireContext(ContextType.Guild)] - [OwnerOnly] - public async Task LogAdd(IUserMessage msg, [Remainder] string eventName) - { - var channel = (ITextChannel)msg.Channel; - //eventName = eventName?.Replace(" ","").ToLowerInvariant(); + //[LocalizedCommand, LocalizedRemarks, LocalizedSummary, LocalizedAlias] + //[RequireContext(ContextType.Guild)] + //[OwnerOnly] + //public async Task LogAdd(IUserMessage msg, [Remainder] string eventName) + //{ + // var channel = (ITextChannel)msg.Channel; + // //eventName = eventName?.Replace(" ","").ToLowerInvariant(); - switch (eventName.ToLowerInvariant()) - { - case "messagereceived": - case "messageupdated": - case "messagedeleted": - case "userjoined": - case "userleft": - case "userbanned": - case "userunbanned": - case "channelcreated": - case "channeldestroyed": - case "channelupdated": - using (var uow = DbHandler.UnitOfWork()) - { - var logSetting = uow.GuildConfigs.For(channel.Guild.Id).LogSetting; - GuildLogSettings.AddOrUpdate(channel.Guild.Id, (id) => logSetting, (id, old) => logSetting); - var prop = logSetting.GetType().GetProperty(eventName); - prop.SetValue(logSetting, true); - await uow.CompleteAsync().ConfigureAwait(false); - } - await channel.SendMessageAsync($"`Now logging {eventName} event.`").ConfigureAwait(false); - break; - default: - await channel.SendMessageAsync($"`Event \"{eventName}\" not found.`").ConfigureAwait(false); - break; - } - } + // switch (eventName.ToLowerInvariant()) + // { + // case "messagereceived": + // case "messageupdated": + // case "messagedeleted": + // case "userjoined": + // case "userleft": + // case "userbanned": + // case "userunbanned": + // case "channelcreated": + // case "channeldestroyed": + // case "channelupdated": + // using (var uow = DbHandler.UnitOfWork()) + // { + // var logSetting = uow.GuildConfigs.For(channel.Guild.Id).LogSetting; + // GuildLogSettings.AddOrUpdate(channel.Guild.Id, (id) => logSetting, (id, old) => logSetting); + // var prop = logSetting.GetType().GetProperty(eventName); + // prop.SetValue(logSetting, true); + // await uow.CompleteAsync().ConfigureAwait(false); + // } + // await channel.SendMessageAsync($"`Now logging {eventName} event.`").ConfigureAwait(false); + // break; + // default: + // await channel.SendMessageAsync($"`Event \"{eventName}\" not found.`").ConfigureAwait(false); + // break; + // } + //} //[LocalizedCommand, LocalizedDescription, LocalizedSummary, LocalizedAlias] //[RequireContext(ContextType.Guild)] diff --git a/src/NadekoBot/Modules/Searches/Commands/UnitConversion.cs b/src/NadekoBot/Modules/Searches/Commands/UnitConversion.cs index e4f19cba..6c3f28b1 100644 --- a/src/NadekoBot/Modules/Searches/Commands/UnitConversion.cs +++ b/src/NadekoBot/Modules/Searches/Commands/UnitConversion.cs @@ -94,27 +94,6 @@ namespace NadekoBot.Modules.Searches } public List Units { get; set; } - - - [LocalizedCommand, LocalizedRemarks, LocalizedSummary, LocalizedAlias] - [RequireContext(ContextType.Guild)] - public async Task ConvertListE(IUserMessage msg) //extended and bugged list - { - var channel = msg.Channel as IGuildChannel; - - var sb = new StringBuilder("Units that can be used by the converter: \n"); - var res = Units.GroupBy(x => x.UnitType); - foreach (var group in res) - { - sb.AppendLine($"{group.Key}: ```xl"); - foreach (var el in group) - { - sb.Append($" [{string.Join(",", el.Triggers)}] "); - } - sb.AppendLine("```"); - } - await msg.ReplyLong(sb.ToString(), breakOn: new[] { "```xl", "\n" }); - } [LocalizedCommand, LocalizedRemarks, LocalizedSummary, LocalizedAlias] [RequireContext(ContextType.Guild)] public async Task ConvertList(IUserMessage msg) @@ -176,7 +155,6 @@ namespace NadekoBot.Modules.Searches } else { - //I just love currency if (originUnit.UnitType == "currency") { res = (value * targetUnit.Modifier) / originUnit.Modifier; diff --git a/src/NadekoBot/Resources/CommandStrings.Designer.cs b/src/NadekoBot/Resources/CommandStrings.Designer.cs index 13886cc4..2df71b44 100644 --- a/src/NadekoBot/Resources/CommandStrings.Designer.cs +++ b/src/NadekoBot/Resources/CommandStrings.Designer.cs @@ -141,7 +141,7 @@ namespace NadekoBot.Resources { } /// - /// Looks up a localized string similar to Adds a new quote with the specified name and message (no limit).. + /// Looks up a localized string similar to Adds a new quote with the specified name and message.. /// public static string addquote_desc { get { @@ -150,7 +150,7 @@ namespace NadekoBot.Resources { } /// - /// Looks up a localized string similar to `.. abc sayhi Hi`. + /// Looks up a localized string similar to `.. sayhi Hi`. /// public static string addquote_summary { get { @@ -1031,60 +1031,6 @@ namespace NadekoBot.Resources { } } - /// - /// Looks up a localized string similar to Checks if a certain user is streaming on the beam platform.. - /// - public static string checkbeam_desc { - get { - return ResourceManager.GetString("checkbeam_desc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to `~chbm SomeStreamer`. - /// - public static string checkbeam_summary { - get { - return ResourceManager.GetString("checkbeam_summary", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to checkbeam chbm. - /// - public static string checkbeam_text { - get { - return ResourceManager.GetString("checkbeam_text", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Checks if a certain user is streaming on the hitbox platform.. - /// - public static string checkhitbox_desc { - get { - return ResourceManager.GetString("checkhitbox_desc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to `~chhb SomeStreamer`. - /// - public static string checkhitbox_summary { - get { - return ResourceManager.GetString("checkhitbox_summary", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to checkhitbox chhb. - /// - public static string checkhitbox_text { - get { - return ResourceManager.GetString("checkhitbox_text", resourceCulture); - } - } - /// /// Looks up a localized string similar to Checks your userspecific permissions on this channel.. /// @@ -1113,29 +1059,29 @@ namespace NadekoBot.Resources { } /// - /// Looks up a localized string similar to Checks if a certain user is streaming on the twitch platform.. + /// Looks up a localized string similar to Checks if a user is online on a certain streaming platform.. /// - public static string checktwitch_desc { + public static string checkstream_desc { get { - return ResourceManager.GetString("checktwitch_desc", resourceCulture); + return ResourceManager.GetString("checkstream_desc", resourceCulture); } } /// - /// Looks up a localized string similar to `~chtw SomeStreamer`. + /// Looks up a localized string similar to `~cs twitch MyFavStreamer`. /// - public static string checktwitch_summary { + public static string checkstream_summary { get { - return ResourceManager.GetString("checktwitch_summary", resourceCulture); + return ResourceManager.GetString("checkstream_summary", resourceCulture); } } /// - /// Looks up a localized string similar to checktwitch chtw. + /// Looks up a localized string similar to checkstream cs. /// - public static string checktwitch_text { + public static string checkstream_text { get { - return ResourceManager.GetString("checktwitch_text", resourceCulture); + return ResourceManager.GetString("checkstream_text", resourceCulture); } } @@ -3840,7 +3786,7 @@ namespace NadekoBot.Resources { } /// - /// Looks up a localized string similar to Toggles logging in this channel. Logs every message sent/deleted/edited on the server. **Bot Owner Only!**. + /// Looks up a localized string similar to Logs server activity in this channel.. /// public static string logserver_desc { get { @@ -4443,7 +4389,7 @@ namespace NadekoBot.Resources { } /// - /// Looks up a localized string similar to `~osu top5 Name`. + /// Looks up a localized string similar to `~osu5 Name`. /// public static string osu5_summary { get { @@ -4470,7 +4416,7 @@ namespace NadekoBot.Resources { } /// - /// Looks up a localized string similar to `~osu b https://osu.ppy.sh/s/127712`. + /// Looks up a localized string similar to `~osub https://osu.ppy.sh/s/127712`. /// public static string osub_summary { get { @@ -6620,33 +6566,6 @@ namespace NadekoBot.Resources { } } - /// - /// Looks up a localized string similar to Starts a game of trivia. You can add nohint to prevent hints.First player to get to 10 points wins by default. You can specify a different number. 30 seconds per question.. - /// - public static string t_desc { - get { - return ResourceManager.GetString("t_desc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to `>t nohint` or `>t 5 nohint`. - /// - public static string t_summary { - get { - return ResourceManager.GetString("t_summary", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to trivia t. - /// - public static string t_text { - get { - return ResourceManager.GetString("t_text", resourceCulture); - } - } - /// /// Looks up a localized string similar to Takes a certain amount of flowers from someone. **Bot Owner Only!**. /// @@ -6809,6 +6728,33 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to Starts a game of trivia. You can add nohint to prevent hints.First player to get to 10 points wins by default. You can specify a different number. 30 seconds per question.. + /// + public static string trivia_desc { + get { + return ResourceManager.GetString("trivia_desc", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to `>t nohint` or `>t 5 nohint`. + /// + public static string trivia_summary { + get { + return ResourceManager.GetString("trivia_summary", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to trivia t. + /// + public static string trivia_text { + get { + return ResourceManager.GetString("trivia_text", resourceCulture); + } + } + /// /// Looks up a localized string similar to Notifies this channel when a certain user starts streaming.. /// diff --git a/src/NadekoBot/Resources/CommandStrings.resx b/src/NadekoBot/Resources/CommandStrings.resx index b6fc2550..3ab99e2d 100644 --- a/src/NadekoBot/Resources/CommandStrings.resx +++ b/src/NadekoBot/Resources/CommandStrings.resx @@ -238,7 +238,7 @@ logserver - Toggles logging in this channel. Logs every message sent/deleted/edited on the server. **Bot Owner Only!** + Logs server activity in this channel. `.logserver` @@ -1264,10 +1264,10 @@ . - Adds a new quote with the specified name and message (no limit). + Adds a new quote with the specified name and message. - `.. abc sayhi Hi` + `.. sayhi Hi` .. @@ -1467,13 +1467,13 @@ `$lb` - + trivia t - + Starts a game of trivia. You can add nohint to prevent hints.First player to get to 10 points wins by default. You can specify a different number. 30 seconds per question. - + `>t nohint` or `>t 5 nohint` @@ -1935,33 +1935,6 @@ `~beam SomeStreamer` - - checkhitbox chhb - - - Checks if a certain user is streaming on the hitbox platform. - - - `~chhb SomeStreamer` - - - checktwitch chtw - - - Checks if a certain user is streaming on the twitch platform. - - - `~chtw SomeStreamer` - - - checkbeam chbm - - - Checks if a certain user is streaming on the beam platform. - - - `~chbm SomeStreamer` - removestream rms @@ -2032,7 +2005,7 @@ Shows information about an osu beatmap. - `~osu b https://osu.ppy.sh/s/127712` + `~osub https://osu.ppy.sh/s/127712` osu5 @@ -2041,7 +2014,7 @@ Displays a user's top 5 plays. - `~osu top5 Name` + `~osu5 Name` pokemon poke @@ -2646,4 +2619,13 @@ removeperm rp + + Checks if a user is online on a certain streaming platform. + + + `~cs twitch MyFavStreamer` + + + checkstream cs + \ No newline at end of file diff --git a/src/NadekoBot/Services/CommandHandler.cs b/src/NadekoBot/Services/CommandHandler.cs index 979da273..6a9ac026 100644 --- a/src/NadekoBot/Services/CommandHandler.cs +++ b/src/NadekoBot/Services/CommandHandler.cs @@ -45,16 +45,6 @@ namespace NadekoBot.Services var guild = (msg.Channel as ITextChannel)?.Guild; - BlacklistItem blacklistedItem; - if ((blacklistedItem = Permissions.BlacklistCommands.BlacklistedItems.FirstOrDefault(bi => - (bi.Type == BlacklistItem.BlacklistType.Server && bi.ItemId == guild?.Id) || - (bi.Type == BlacklistItem.BlacklistType.Channel && bi.ItemId == msg.Channel.Id) || - (bi.Type == BlacklistItem.BlacklistType.User && bi.ItemId == usrMsg.Author.Id))) != null) - { - _log.Warn("Attempt was made to run a command by a blacklisted {0}, id: {1}", blacklistedItem.Type, blacklistedItem.ItemId); - return; - } - if (guild != null && guild.OwnerId != usrMsg.Author.Id) { if (Permissions.FilterCommands.InviteFilteringChannels.Contains(usrMsg.Channel.Id) || @@ -73,12 +63,11 @@ namespace NadekoBot.Services } } } - } - if (guild != null && guild.OwnerId != usrMsg.Author.Id) - { + + var filteredWords = Permissions.FilterCommands.FilteredWordsForChannel(usrMsg.Channel.Id, guild.Id).Concat(Permissions.FilterCommands.FilteredWordsForServer(guild.Id)); var wordsInMessage = usrMsg.Content.ToLowerInvariant().Split(' '); - if (filteredWords.Any(w=>wordsInMessage.Contains(w))) + if (filteredWords.Any(w => wordsInMessage.Contains(w))) { try { @@ -90,6 +79,15 @@ namespace NadekoBot.Services _log.Warn("I do not have permission to filter words in channel with id " + usrMsg.Channel.Id, ex); } } + + BlacklistItem blacklistedItem; + if ((blacklistedItem = Permissions.BlacklistCommands.BlacklistedItems.FirstOrDefault(bi => + (bi.Type == BlacklistItem.BlacklistType.Server && bi.ItemId == guild?.Id) || + (bi.Type == BlacklistItem.BlacklistType.Channel && bi.ItemId == msg.Channel.Id) || + (bi.Type == BlacklistItem.BlacklistType.User && bi.ItemId == usrMsg.Author.Id))) != null) + { + return; + } } try @@ -221,7 +219,7 @@ namespace NadekoBot.Services if (guild != null) { int index; - if (!rootPerm.AsEnumerable().CheckPermissions(message, cmd.Name, cmd.Module.Name, out index)) + if (!rootPerm.AsEnumerable().CheckPermissions(message, cmd.Text, cmd.Module.Name, out index)) { var returnMsg = $"Permission number #{index + 1} **{rootPerm.GetAt(index).GetCommand()}** is preventing this action."; return new Tuple(cmd, SearchResult.FromError(CommandError.Exception, returnMsg)); @@ -232,7 +230,7 @@ namespace NadekoBot.Services { if (!((IGuildUser)user).Roles.Any(r => r.Name.Trim().ToLowerInvariant() == permRole)) { - return new Tuple(cmd, SearchResult.FromError(CommandError.Exception, $"You need a **{permRole}** role in order to use permission commands.")); + return new Tuple(cmd, SearchResult.FromError(CommandError.Exception, $"You need the **{permRole}** role in order to use permission commands.")); } } } diff --git a/src/NadekoBot/Services/Database/Models/LogSetting.cs b/src/NadekoBot/Services/Database/Models/LogSetting.cs index a02cfcbc..1aeb1dfa 100644 --- a/src/NadekoBot/Services/Database/Models/LogSetting.cs +++ b/src/NadekoBot/Services/Database/Models/LogSetting.cs @@ -12,7 +12,6 @@ namespace NadekoBot.Services.Database.Models public ulong ChannelId { get; set; } public HashSet IgnoredChannels { get; set; } - public bool MessageReceived { get; set; } = true; public bool MessageUpdated { get; set; } = true; public bool MessageDeleted { get; set; } = true;