mirror of
https://github.com/NoiTheCat/WorldTime.git
synced 2024-11-21 22:34:36 +00:00
Fix logging; change status message
This commit is contained in:
parent
12c421ef17
commit
9f49e73540
3 changed files with 6 additions and 13 deletions
|
@ -89,7 +89,7 @@ internal class CommandsSlash : CommandsCommon {
|
||||||
private async Task DiscordClient_SlashCommandExecuted(SocketSlashCommand arg) {
|
private async Task DiscordClient_SlashCommandExecuted(SocketSlashCommand arg) {
|
||||||
SocketGuildChannel? rptChannel = arg.Channel as SocketGuildChannel;
|
SocketGuildChannel? rptChannel = arg.Channel as SocketGuildChannel;
|
||||||
var rptId = rptChannel?.Guild.Id ?? arg.User.Id;
|
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 {
|
CommandResponder responder = arg.Data.Name switch {
|
||||||
"help" => CmdHelp,
|
"help" => CmdHelp,
|
||||||
|
@ -109,14 +109,7 @@ internal class CommandsSlash : CommandsCommon {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task UnknownCommandHandler(SocketSlashCommand arg) {
|
private async Task UnknownCommandHandler(SocketSlashCommand arg) {
|
||||||
string place;
|
Program.Log("Command invoked", $"/{arg.Data.Name} is an unknown command!");
|
||||||
// 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}");
|
|
||||||
await arg.RespondAsync("Oops, that command isn't supposed to be there... Please try something else.",
|
await arg.RespondAsync("Oops, that command isn't supposed to be there... Please try something else.",
|
||||||
ephemeral: true).ConfigureAwait(false);
|
ephemeral: true).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,7 +148,7 @@ internal class WorldTime : IDisposable {
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Task DiscordClient_ShardReady(DiscordSocketClient arg) => arg.SetGameAsync(CommandsText.CommandPrefix + "help");
|
private Task DiscordClient_ShardReady(DiscordSocketClient arg) => arg.SetGameAsync("/help");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Non-specific handler for incoming events.
|
/// Non-specific handler for incoming events.
|
||||||
|
|
|
@ -5,15 +5,15 @@
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<Version>2.1.0</Version>
|
<Version>2.1.1</Version>
|
||||||
<Authors>NoiTheCat</Authors>
|
<Authors>NoiTheCat</Authors>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CommandLineParser" Version="2.8.0" />
|
<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="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" />
|
<PackageReference Include="Npgsql" Version="6.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue