QoL changes

This commit is contained in:
Kwoth 2016-12-08 17:30:29 +01:00
parent 5324cc2229
commit 9c989804e8
3 changed files with 6 additions and 6 deletions

View File

@ -40,11 +40,11 @@ namespace NadekoBot.Modules.Administration
} }
} }
private async void DelMsgOnCmd_Handler(object sender, CommandExecutedEventArgs e) private async Task DelMsgOnCmd_Handler(IUserMessage msg, Command cmd)
{ {
try try
{ {
var channel = e.Message.Channel as ITextChannel; var channel = msg.Channel as ITextChannel;
if (channel == null) if (channel == null)
return; return;
@ -56,7 +56,7 @@ namespace NadekoBot.Modules.Administration
} }
if (shouldDelete) if (shouldDelete)
await e.Message.DeleteAsync().ConfigureAwait(false); await msg.DeleteAsync().ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -39,7 +39,7 @@ namespace NadekoBot.Services
private List<IDMChannel> ownerChannels { get; set; } private List<IDMChannel> ownerChannels { get; set; }
public event EventHandler<CommandExecutedEventArgs> CommandExecuted = delegate { }; public event Func<IUserMessage,Command, Task> CommandExecuted = delegate { return Task.CompletedTask; };
public CommandHandler(ShardedDiscordClient client, CommandService commandService) public CommandHandler(ShardedDiscordClient client, CommandService commandService)
{ {
@ -154,7 +154,7 @@ namespace NadekoBot.Services
var channel = (usrMsg.Channel as ITextChannel); var channel = (usrMsg.Channel as ITextChannel);
if (result.IsSuccess) if (result.IsSuccess)
{ {
CommandExecuted(this, new CommandExecutedEventArgs(usrMsg, command)); await CommandExecuted(usrMsg, command);
_log.Info("Command Executed after {4}s\n\t" + _log.Info("Command Executed after {4}s\n\t" +
"User: {0}\n\t" + "User: {0}\n\t" +
"Server: {1}\n\t" + "Server: {1}\n\t" +

View File

@ -38,7 +38,7 @@ namespace NadekoBot.Services.Impl
Reset(); Reset();
this.client.MessageReceived += _ => Task.FromResult(MessageCounter++); this.client.MessageReceived += _ => Task.FromResult(MessageCounter++);
cmdHandler.CommandExecuted += (_, e) => CommandsRan++; cmdHandler.CommandExecuted += (_, e) => Task.FromResult(CommandsRan++);
this.client.Disconnected += _ => Reset(); this.client.Disconnected += _ => Reset();