You can not select more than 25 topics
Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- using Discord;
- using Discord.WebSocket;
-
- public class LoggingService
- {
- public LoggingService(DiscordSocketClient client, CommandService command)
- {
- client.Log += LogAsync;
- command.Log += LogAsync;
- }
- private Task LogAsync(LogMessage message)
- {
- if (message.Exception is CommandException cmdException)
- {
- Console.WriteLine($"[Command/{message.Severity}] {cmdException.Command.Aliases.First()}"
- + $" failed to execute in {cmdException.Context.Channel}.");
- Console.WriteLine(cmdException);
- }
- else
- Console.WriteLine($"[General/{message.Severity}] {message}");
-
- return Task.CompletedTask;
- }
- }
|