just a bit better console output
This commit is contained in:
parent
7e79dd4163
commit
3388005edb
27
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
27
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
@ -7052,6 +7052,33 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to shardid.
|
||||
/// </summary>
|
||||
public static string shardid_cmd {
|
||||
get {
|
||||
return ResourceManager.GetString("shardid_cmd", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Shows which shard is a certain guild on, by guildid..
|
||||
/// </summary>
|
||||
public static string shardid_desc {
|
||||
get {
|
||||
return ResourceManager.GetString("shardid_desc", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to `{0}shardid 117523346618318850`.
|
||||
/// </summary>
|
||||
public static string shardid_usage {
|
||||
get {
|
||||
return ResourceManager.GetString("shardid_usage", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to shardstats.
|
||||
/// </summary>
|
||||
|
@ -3069,4 +3069,13 @@
|
||||
<data name="connectshard_usage" xml:space="preserve">
|
||||
<value>`{0}connectshard 2`</value>
|
||||
</data>
|
||||
<data name="shardid_cmd" xml:space="preserve">
|
||||
<value>shardid</value>
|
||||
</data>
|
||||
<data name="shardid_desc" xml:space="preserve">
|
||||
<value>Shows which shard is a certain guild on, by guildid.</value>
|
||||
</data>
|
||||
<data name="shardid_usage" xml:space="preserve">
|
||||
<value>`{0}shardid 117523346618318850`</value>
|
||||
</data>
|
||||
</root>
|
@ -105,9 +105,9 @@ namespace NadekoBot.Services
|
||||
BlacklistCommands.BlacklistedUsers.Contains(usrMsg.Author.Id);
|
||||
|
||||
const float oneThousandth = 1.0f / 1000;
|
||||
private Task LogSuccessfulExecution(SocketUserMessage usrMsg, ExecuteCommandResult exec, SocketTextChannel channel, int ticks)
|
||||
private Task LogSuccessfulExecution(SocketUserMessage usrMsg, ExecuteCommandResult exec, SocketTextChannel channel, int exec1, int exec2, int exec3, int total)
|
||||
{
|
||||
_log.Info("Command Executed after {4}s\n\t" +
|
||||
_log.Info("Command Executed after {4}/{5}/{6}/{7}s\n\t" +
|
||||
"User: {0}\n\t" +
|
||||
"Server: {1}\n\t" +
|
||||
"Channel: {2}\n\t" +
|
||||
@ -116,13 +116,17 @@ namespace NadekoBot.Services
|
||||
(channel == null ? "PRIVATE" : channel.Guild.Name + " [" + channel.Guild.Id + "]"), // {1}
|
||||
(channel == null ? "PRIVATE" : channel.Name + " [" + channel.Id + "]"), // {2}
|
||||
usrMsg.Content, // {3}
|
||||
ticks * oneThousandth);
|
||||
exec1 * oneThousandth, // {4}
|
||||
exec2 * oneThousandth, // {5}
|
||||
exec3 * oneThousandth, // {6}
|
||||
total * oneThousandth // {7}
|
||||
);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private void LogErroredExecution(SocketUserMessage usrMsg, ExecuteCommandResult exec, SocketTextChannel channel, int ticks)
|
||||
private void LogErroredExecution(SocketUserMessage usrMsg, ExecuteCommandResult exec, SocketTextChannel channel, int exec1, int exec2, int exec3, int total)
|
||||
{
|
||||
_log.Warn("Command Errored after {5}s\n\t" +
|
||||
_log.Warn("Command Errored after {5}/{6}/{7}/{8}s\n\t" +
|
||||
"User: {0}\n\t" +
|
||||
"Server: {1}\n\t" +
|
||||
"Channel: {2}\n\t" +
|
||||
@ -133,7 +137,10 @@ namespace NadekoBot.Services
|
||||
(channel == null ? "PRIVATE" : channel.Name + " [" + channel.Id + "]"), // {2}
|
||||
usrMsg.Content,// {3}
|
||||
exec.Result.ErrorReason, // {4}
|
||||
ticks * oneThousandth // {5}
|
||||
exec1 * oneThousandth, // {5}
|
||||
exec2 * oneThousandth, // {6}
|
||||
exec3 * oneThousandth, // {7}
|
||||
total * oneThousandth // {8}
|
||||
);
|
||||
}
|
||||
|
||||
@ -219,16 +226,22 @@ namespace NadekoBot.Services
|
||||
if (IsBlacklisted(guild, usrMsg))
|
||||
return;
|
||||
|
||||
var exec1 = Environment.TickCount - execTime;
|
||||
|
||||
var cleverBotRan = await Task.Run(() => TryRunCleverbot(usrMsg, guild)).ConfigureAwait(false);
|
||||
if (cleverBotRan)
|
||||
return;
|
||||
|
||||
var exec2 = Environment.TickCount - execTime;
|
||||
|
||||
// maybe this message is a custom reaction
|
||||
// todo log custom reaction executions. return struct with info
|
||||
var crExecuted = await Task.Run(() => CustomReactions.TryExecuteCustomReaction(usrMsg)).ConfigureAwait(false);
|
||||
if (crExecuted) //if it was, don't execute the command
|
||||
return;
|
||||
|
||||
var exec3 = Environment.TickCount - execTime;
|
||||
|
||||
string messageContent = usrMsg.Content;
|
||||
|
||||
// execute the command and measure the time it took
|
||||
@ -238,11 +251,11 @@ namespace NadekoBot.Services
|
||||
if (exec.Result.IsSuccess)
|
||||
{
|
||||
await CommandExecuted(usrMsg, exec.CommandInfo).ConfigureAwait(false);
|
||||
await LogSuccessfulExecution(usrMsg, exec, channel, execTime).ConfigureAwait(false);
|
||||
await LogSuccessfulExecution(usrMsg, exec, channel, exec1, exec2, exec3, execTime).ConfigureAwait(false);
|
||||
}
|
||||
else if (!exec.Result.IsSuccess && exec.Result.Error != CommandError.UnknownCommand)
|
||||
{
|
||||
LogErroredExecution(usrMsg, exec, channel, execTime);
|
||||
LogErroredExecution(usrMsg, exec, channel, exec1, exec2, exec3, execTime);
|
||||
if (guild != null && exec.CommandInfo != null && exec.Result.Error == CommandError.Exception)
|
||||
{
|
||||
if (exec.PermissionCache != null && exec.PermissionCache.Verbose)
|
||||
|
Loading…
Reference in New Issue
Block a user