mirror of
https://github.com/NoiTheCat/BirthdayBot.git
synced 2024-11-21 21:54:36 +00:00
Update command reporting format
This commit is contained in:
parent
f8b3f429bb
commit
b0c5ea4e3b
1 changed files with 11 additions and 8 deletions
|
@ -186,14 +186,17 @@ class ShardInstance : IDisposable {
|
|||
/// </summary>
|
||||
private async Task DiscordClient_SlashCommandExecuted(SocketSlashCommand arg) {
|
||||
SocketGuildChannel? rptChannel = arg.Channel as SocketGuildChannel;
|
||||
string rpt = "";
|
||||
if (rptChannel != null) rpt += rptChannel.Guild.Name + "!";
|
||||
rpt += arg.User;
|
||||
var rptId = rptChannel?.Guild.Id ?? arg.User.Id;
|
||||
var logLine = $"/{arg.CommandName} by {arg.User} in { (rptChannel != null ? "guild" : "DM. User") } ID {rptId}. Result: ";
|
||||
var logLine = $"/{arg.CommandName} at {rpt}; { (rptChannel != null ? "Guild" : "User") } ID {rptId}.";
|
||||
|
||||
// Specific reply for DM messages
|
||||
if (rptChannel == null) {
|
||||
// TODO do not hardcode message
|
||||
// TODO figure out appropriate message
|
||||
Log("Command", logLine + "Sending message.");
|
||||
Log("Command", logLine + " Sending default reply.");
|
||||
await arg.RespondAsync("don't dm me").ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
|
@ -213,7 +216,7 @@ class ShardInstance : IDisposable {
|
|||
}
|
||||
|
||||
var gconf = await GuildConfiguration.LoadAsync(rptChannel.Guild.Id, false);
|
||||
// Block check here
|
||||
// Blocklist/moderated check
|
||||
if (!gconf!.IsBotModerator((SocketGuildUser)arg.User)) // Except if moderator
|
||||
{
|
||||
if (await gconf.IsUserBlockedAsync(arg.User.Id)) {
|
||||
|
@ -226,9 +229,9 @@ class ShardInstance : IDisposable {
|
|||
// Execute the handler
|
||||
try {
|
||||
await handler(this, gconf, arg).ConfigureAwait(false);
|
||||
Log("Command", logLine + "Executed normally.");
|
||||
} catch (Exception ex) when (ex is not HttpException) {
|
||||
Log("Command", logLine + ex.ToString());
|
||||
Log("Command", logLine);
|
||||
} catch (Exception e) when (e is not HttpException) {
|
||||
Log("Command", $"{logLine} {e}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue