performance improvements?
This commit is contained in:
parent
a0e23b4c2c
commit
dfbabea8b9
@ -38,7 +38,9 @@ namespace NadekoBot.Modules.Administration
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task DelMsgOnCmd_Handler(SocketUserMessage msg, CommandInfo cmd)
|
private static Task DelMsgOnCmd_Handler(SocketUserMessage msg, CommandInfo cmd)
|
||||||
|
{
|
||||||
|
var _ = Task.Run(async () =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -52,6 +54,8 @@ namespace NadekoBot.Modules.Administration
|
|||||||
{
|
{
|
||||||
_log.Warn(ex, "Delmsgoncmd errored...");
|
_log.Warn(ex, "Delmsgoncmd errored...");
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
@ -105,9 +105,8 @@ namespace NadekoBot.Services
|
|||||||
BlacklistCommands.BlacklistedUsers.Contains(usrMsg.Author.Id);
|
BlacklistCommands.BlacklistedUsers.Contains(usrMsg.Author.Id);
|
||||||
|
|
||||||
const float oneThousandth = 1.0f / 1000;
|
const float oneThousandth = 1.0f / 1000;
|
||||||
private async Task LogSuccessfulExecution(SocketUserMessage usrMsg, ExecuteCommandResult exec, SocketTextChannel channel, int ticks)
|
private Task LogSuccessfulExecution(SocketUserMessage usrMsg, ExecuteCommandResult exec, SocketTextChannel channel, int ticks)
|
||||||
{
|
{
|
||||||
await CommandExecuted(usrMsg, exec.CommandInfo).ConfigureAwait(false);
|
|
||||||
_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" +
|
||||||
@ -118,6 +117,7 @@ namespace NadekoBot.Services
|
|||||||
(channel == null ? "PRIVATE" : channel.Name + " [" + channel.Id + "]"), // {2}
|
(channel == null ? "PRIVATE" : channel.Name + " [" + channel.Id + "]"), // {2}
|
||||||
usrMsg.Content, // {3}
|
usrMsg.Content, // {3}
|
||||||
ticks * oneThousandth);
|
ticks * oneThousandth);
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LogErroredExecution(SocketUserMessage usrMsg, ExecuteCommandResult exec, SocketTextChannel channel, int ticks)
|
private void LogErroredExecution(SocketUserMessage usrMsg, ExecuteCommandResult exec, SocketTextChannel channel, int ticks)
|
||||||
@ -184,7 +184,9 @@ namespace NadekoBot.Services
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task MessageReceivedHandler(SocketMessage msg)
|
private Task MessageReceivedHandler(SocketMessage msg)
|
||||||
|
{
|
||||||
|
var _ = Task.Run(async () =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -235,6 +237,7 @@ namespace NadekoBot.Services
|
|||||||
|
|
||||||
if (exec.Result.IsSuccess)
|
if (exec.Result.IsSuccess)
|
||||||
{
|
{
|
||||||
|
await CommandExecuted(usrMsg, exec.CommandInfo).ConfigureAwait(false);
|
||||||
await LogSuccessfulExecution(usrMsg, exec, channel, execTime).ConfigureAwait(false);
|
await LogSuccessfulExecution(usrMsg, exec, channel, execTime).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else if (!exec.Result.IsSuccess && exec.Result.Error != CommandError.UnknownCommand)
|
else if (!exec.Result.IsSuccess && exec.Result.Error != CommandError.UnknownCommand)
|
||||||
@ -271,6 +274,8 @@ namespace NadekoBot.Services
|
|||||||
_log.Warn(ex.InnerException);
|
_log.Warn(ex.InnerException);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<ExecuteCommandResult> ExecuteCommandAsync(CommandContext context, int argPos, IDependencyMap dependencyMap = null, MultiMatchHandling multiMatchHandling = MultiMatchHandling.Exception)
|
public Task<ExecuteCommandResult> ExecuteCommandAsync(CommandContext context, int argPos, IDependencyMap dependencyMap = null, MultiMatchHandling multiMatchHandling = MultiMatchHandling.Exception)
|
||||||
|
Loading…
Reference in New Issue
Block a user