Merge branch '1.0' of github.com:Kwoth/NadekoBot into 0.9-to-1.0-migration
This commit is contained in:
commit
6ff8fec2c5
@ -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)]
|
||||
|
@ -94,27 +94,6 @@ namespace NadekoBot.Modules.Searches
|
||||
}
|
||||
|
||||
public List<ConvertUnit> 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;
|
||||
|
136
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
136
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
@ -141,7 +141,7 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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..
|
||||
/// </summary>
|
||||
public static string addquote_desc {
|
||||
get {
|
||||
@ -150,7 +150,7 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to `.. abc sayhi Hi`.
|
||||
/// Looks up a localized string similar to `.. sayhi Hi`.
|
||||
/// </summary>
|
||||
public static string addquote_summary {
|
||||
get {
|
||||
@ -1031,60 +1031,6 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Checks if a certain user is streaming on the beam platform..
|
||||
/// </summary>
|
||||
public static string checkbeam_desc {
|
||||
get {
|
||||
return ResourceManager.GetString("checkbeam_desc", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to `~chbm SomeStreamer`.
|
||||
/// </summary>
|
||||
public static string checkbeam_summary {
|
||||
get {
|
||||
return ResourceManager.GetString("checkbeam_summary", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to checkbeam chbm.
|
||||
/// </summary>
|
||||
public static string checkbeam_text {
|
||||
get {
|
||||
return ResourceManager.GetString("checkbeam_text", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Checks if a certain user is streaming on the hitbox platform..
|
||||
/// </summary>
|
||||
public static string checkhitbox_desc {
|
||||
get {
|
||||
return ResourceManager.GetString("checkhitbox_desc", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to `~chhb SomeStreamer`.
|
||||
/// </summary>
|
||||
public static string checkhitbox_summary {
|
||||
get {
|
||||
return ResourceManager.GetString("checkhitbox_summary", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to checkhitbox chhb.
|
||||
/// </summary>
|
||||
public static string checkhitbox_text {
|
||||
get {
|
||||
return ResourceManager.GetString("checkhitbox_text", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Checks your userspecific permissions on this channel..
|
||||
/// </summary>
|
||||
@ -1113,29 +1059,29 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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..
|
||||
/// </summary>
|
||||
public static string checktwitch_desc {
|
||||
public static string checkstream_desc {
|
||||
get {
|
||||
return ResourceManager.GetString("checktwitch_desc", resourceCulture);
|
||||
return ResourceManager.GetString("checkstream_desc", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to `~chtw SomeStreamer`.
|
||||
/// Looks up a localized string similar to `~cs twitch MyFavStreamer`.
|
||||
/// </summary>
|
||||
public static string checktwitch_summary {
|
||||
public static string checkstream_summary {
|
||||
get {
|
||||
return ResourceManager.GetString("checktwitch_summary", resourceCulture);
|
||||
return ResourceManager.GetString("checkstream_summary", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to checktwitch chtw.
|
||||
/// Looks up a localized string similar to checkstream cs.
|
||||
/// </summary>
|
||||
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 {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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..
|
||||
/// </summary>
|
||||
public static string logserver_desc {
|
||||
get {
|
||||
@ -4470,7 +4416,7 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to `~osu top5 Name`.
|
||||
/// Looks up a localized string similar to `~osu5 Name`.
|
||||
/// </summary>
|
||||
public static string osu5_summary {
|
||||
get {
|
||||
@ -4497,7 +4443,7 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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`.
|
||||
/// </summary>
|
||||
public static string osub_summary {
|
||||
get {
|
||||
@ -6647,33 +6593,6 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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..
|
||||
/// </summary>
|
||||
public static string t_desc {
|
||||
get {
|
||||
return ResourceManager.GetString("t_desc", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to `>t nohint` or `>t 5 nohint`.
|
||||
/// </summary>
|
||||
public static string t_summary {
|
||||
get {
|
||||
return ResourceManager.GetString("t_summary", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to trivia t.
|
||||
/// </summary>
|
||||
public static string t_text {
|
||||
get {
|
||||
return ResourceManager.GetString("t_text", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Takes a certain amount of flowers from someone. **Bot Owner Only!**.
|
||||
/// </summary>
|
||||
@ -6836,6 +6755,33 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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..
|
||||
/// </summary>
|
||||
public static string trivia_desc {
|
||||
get {
|
||||
return ResourceManager.GetString("trivia_desc", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to `>t nohint` or `>t 5 nohint`.
|
||||
/// </summary>
|
||||
public static string trivia_summary {
|
||||
get {
|
||||
return ResourceManager.GetString("trivia_summary", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to trivia t.
|
||||
/// </summary>
|
||||
public static string trivia_text {
|
||||
get {
|
||||
return ResourceManager.GetString("trivia_text", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Notifies this channel when a certain user starts streaming..
|
||||
/// </summary>
|
||||
|
@ -238,7 +238,7 @@
|
||||
<value>logserver</value>
|
||||
</data>
|
||||
<data name="logserver_desc" xml:space="preserve">
|
||||
<value>Toggles logging in this channel. Logs every message sent/deleted/edited on the server. **Bot Owner Only!**</value>
|
||||
<value>Logs server activity in this channel.</value>
|
||||
</data>
|
||||
<data name="logserver_summary" xml:space="preserve">
|
||||
<value>`.logserver`</value>
|
||||
@ -1264,10 +1264,10 @@
|
||||
<value>.</value>
|
||||
</data>
|
||||
<data name="addquote_desc" xml:space="preserve">
|
||||
<value>Adds a new quote with the specified name and message (no limit).</value>
|
||||
<value>Adds a new quote with the specified name and message.</value>
|
||||
</data>
|
||||
<data name="addquote_summary" xml:space="preserve">
|
||||
<value>`.. abc sayhi Hi`</value>
|
||||
<value>`.. sayhi Hi`</value>
|
||||
</data>
|
||||
<data name="showquote_text" xml:space="preserve">
|
||||
<value>..</value>
|
||||
@ -1467,13 +1467,13 @@
|
||||
<data name="leaderboard_summary" xml:space="preserve">
|
||||
<value>`$lb`</value>
|
||||
</data>
|
||||
<data name="t_text" xml:space="preserve">
|
||||
<data name="trivia_text" xml:space="preserve">
|
||||
<value>trivia t</value>
|
||||
</data>
|
||||
<data name="t_desc" xml:space="preserve">
|
||||
<data name="trivia_desc" xml:space="preserve">
|
||||
<value>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.</value>
|
||||
</data>
|
||||
<data name="t_summary" xml:space="preserve">
|
||||
<data name="trivia_summary" xml:space="preserve">
|
||||
<value>`>t nohint` or `>t 5 nohint`</value>
|
||||
</data>
|
||||
<data name="tl_text" xml:space="preserve">
|
||||
@ -1935,33 +1935,6 @@
|
||||
<data name="beam_summary" xml:space="preserve">
|
||||
<value>`~beam SomeStreamer`</value>
|
||||
</data>
|
||||
<data name="checkhitbox_text" xml:space="preserve">
|
||||
<value>checkhitbox chhb</value>
|
||||
</data>
|
||||
<data name="checkhitbox_desc" xml:space="preserve">
|
||||
<value>Checks if a certain user is streaming on the hitbox platform.</value>
|
||||
</data>
|
||||
<data name="checkhitbox_summary" xml:space="preserve">
|
||||
<value>`~chhb SomeStreamer`</value>
|
||||
</data>
|
||||
<data name="checktwitch_text" xml:space="preserve">
|
||||
<value>checktwitch chtw</value>
|
||||
</data>
|
||||
<data name="checktwitch_desc" xml:space="preserve">
|
||||
<value>Checks if a certain user is streaming on the twitch platform.</value>
|
||||
</data>
|
||||
<data name="checktwitch_summary" xml:space="preserve">
|
||||
<value>`~chtw SomeStreamer`</value>
|
||||
</data>
|
||||
<data name="checkbeam_text" xml:space="preserve">
|
||||
<value>checkbeam chbm</value>
|
||||
</data>
|
||||
<data name="checkbeam_desc" xml:space="preserve">
|
||||
<value>Checks if a certain user is streaming on the beam platform.</value>
|
||||
</data>
|
||||
<data name="checkbeam_summary" xml:space="preserve">
|
||||
<value>`~chbm SomeStreamer`</value>
|
||||
</data>
|
||||
<data name="removestream_text" xml:space="preserve">
|
||||
<value>removestream rms</value>
|
||||
</data>
|
||||
@ -2032,7 +2005,7 @@
|
||||
<value>Shows information about an osu beatmap.</value>
|
||||
</data>
|
||||
<data name="osub_summary" xml:space="preserve">
|
||||
<value>`~osu b https://osu.ppy.sh/s/127712`</value>
|
||||
<value>`~osub https://osu.ppy.sh/s/127712`</value>
|
||||
</data>
|
||||
<data name="osu5_text" xml:space="preserve">
|
||||
<value>osu5</value>
|
||||
@ -2041,7 +2014,7 @@
|
||||
<value>Displays a user's top 5 plays.</value>
|
||||
</data>
|
||||
<data name="osu5_summary" xml:space="preserve">
|
||||
<value>`~osu top5 Name`</value>
|
||||
<value>`~osu5 Name`</value>
|
||||
</data>
|
||||
<data name="pokemon_text" xml:space="preserve">
|
||||
<value>pokemon poke</value>
|
||||
@ -2655,4 +2628,13 @@
|
||||
<data name="migratedata_text" xml:space="preserve">
|
||||
<value>migratedata</value>
|
||||
</data>
|
||||
<data name="checkstream_desc" xml:space="preserve">
|
||||
<value>Checks if a user is online on a certain streaming platform.</value>
|
||||
</data>
|
||||
<data name="checkstream_summary" xml:space="preserve">
|
||||
<value>`~cs twitch MyFavStreamer`</value>
|
||||
</data>
|
||||
<data name="checkstream_text" xml:space="preserve">
|
||||
<value>checkstream cs</value>
|
||||
</data>
|
||||
</root>
|
@ -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<Command, IResult>(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<Command, IResult>(cmd, SearchResult.FromError(CommandError.Exception, $"You need a **{permRole}** role in order to use permission commands."));
|
||||
return new Tuple<Command, IResult>(cmd, SearchResult.FromError(CommandError.Exception, $"You need the **{permRole}** role in order to use permission commands."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ namespace NadekoBot.Services.Database.Models
|
||||
public ulong ChannelId { get; set; }
|
||||
public HashSet<IgnoredLogChannel> IgnoredChannels { get; set; }
|
||||
|
||||
public bool MessageReceived { get; set; } = true;
|
||||
public bool MessageUpdated { get; set; } = true;
|
||||
public bool MessageDeleted { get; set; } = true;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user