Merge branch '1.0' of github.com:Kwoth/NadekoBot into 0.9-to-1.0-migration

This commit is contained in:
Nitix
2016-10-05 02:03:09 +02:00
6 changed files with 106 additions and 203 deletions

View File

@@ -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)]

View File

@@ -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;