Fix logging; change status message

This commit is contained in:
Noi 2022-03-19 11:57:40 -07:00
parent 12c421ef17
commit 9f49e73540
3 changed files with 6 additions and 13 deletions

View file

@ -89,7 +89,7 @@ internal class CommandsSlash : CommandsCommon {
private async Task DiscordClient_SlashCommandExecuted(SocketSlashCommand arg) {
SocketGuildChannel? rptChannel = arg.Channel as SocketGuildChannel;
var rptId = rptChannel?.Guild.Id ?? arg.User.Id;
Program.Log("Command executed", $"/{arg.CommandName} by {arg.User} { (rptChannel != null ? "in guild" : "with ID") } {rptId}");
Program.Log("Command executed", $"/{arg.CommandName} by {arg.User} in { (rptChannel != null ? "guild" : "DM. User") } ID {rptId}");
CommandResponder responder = arg.Data.Name switch {
"help" => CmdHelp,
@ -109,14 +109,7 @@ internal class CommandsSlash : CommandsCommon {
}
private async Task UnknownCommandHandler(SocketSlashCommand arg) {
string place;
// Unknown command - set up a report
if (arg.Channel is SocketGuildChannel gch) {
place = $"Guild {gch.Guild.Id}";
} else {
place = "Global command";
}
Program.Log("Command invoked", $"/{arg.Data.Name} is an unknown command! Executed at: {place}");
Program.Log("Command invoked", $"/{arg.Data.Name} is an unknown command!");
await arg.RespondAsync("Oops, that command isn't supposed to be there... Please try something else.",
ephemeral: true).ConfigureAwait(false);
}

View file

@ -148,7 +148,7 @@ internal class WorldTime : IDisposable {
return Task.CompletedTask;
}
private Task DiscordClient_ShardReady(DiscordSocketClient arg) => arg.SetGameAsync(CommandsText.CommandPrefix + "help");
private Task DiscordClient_ShardReady(DiscordSocketClient arg) => arg.SetGameAsync("/help");
/// <summary>
/// Non-specific handler for incoming events.

View file

@ -5,15 +5,15 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>2.1.0</Version>
<Version>2.1.1</Version>
<Authors>NoiTheCat</Authors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.8.0" />
<PackageReference Include="Discord.Net" Version="3.2.0" />
<PackageReference Include="Discord.Net" Version="3.4.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NodaTime" Version="3.0.9" />
<PackageReference Include="NodaTime" Version="3.0.10" />
<PackageReference Include="Npgsql" Version="6.0.3" />
</ItemGroup>