mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
Added additional message logging
This commit is contained in:
parent
8ba86651c2
commit
3567e02129
4 changed files with 38 additions and 5 deletions
|
|
@ -19,6 +19,7 @@
|
|||
<u style="font-size: .9em;">CHANGE</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>Added additional message logging when log level set to debug.</li>
|
||||
<li>pt-BR Translation file updated.</li>
|
||||
<li>ru-RU Translation file updated.</li>
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,30 @@
|
|||
<title>Conan Server Manager Version Feed</title>
|
||||
<subtitle>This is the Conan Server Manager beta version feed.</subtitle>
|
||||
<link href="http://servermanagers.freeforums.net/" />
|
||||
<updated>2021-12-16T00:00:00Z</updated>
|
||||
<updated>2021-12-17T00:00:00Z</updated>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:A189668E-DA03-471A-9C5A-7FF2A7264F9C</id>
|
||||
<title>1.1.58 (1.1.58.6)</title>
|
||||
<summary>1.1.58.6</summary>
|
||||
<link href="" />
|
||||
<updated>2021-12-17T00:00:00Z</updated>
|
||||
<content type="xhtml">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
|
||||
<p>
|
||||
<u style="font-size: .9em;">CHANGE</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>Added additional message logging when log level set to debug.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</content>
|
||||
<author>
|
||||
<name>bletch</name>
|
||||
<email>bletch1971@hotmail.com</email>
|
||||
</author>
|
||||
</entry>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:A189668E-DA03-471A-9C5A-7FF2A7264F9C</id>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using Discord;
|
||||
using Discord.Addons.Interactive;
|
||||
using Discord.Addons.Interactive;
|
||||
using Discord.Commands;
|
||||
using Discord.Net.Providers.WS4Net;
|
||||
using Discord.WebSocket;
|
||||
|
|
@ -48,6 +47,7 @@ namespace ServerManagerTool.DiscordBot
|
|||
{
|
||||
{ "DiscordSettings:Token", discordToken },
|
||||
{ "DiscordSettings:Prefix", commandPrefix },
|
||||
{ "DiscordSettings:LogLevel", logLevel.ToString() },
|
||||
{ "ServerManager:DataDirectory", dataDirectory },
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
using Discord.Commands;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using ServerManagerTool.DiscordBot.Enums;
|
||||
using ServerManagerTool.DiscordBot.Models;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
|
@ -12,14 +14,16 @@ namespace ServerManagerTool.DiscordBot.Services
|
|||
{
|
||||
private readonly DiscordSocketClient _discord;
|
||||
private readonly CommandService _commands;
|
||||
private readonly LoggingService _logger;
|
||||
private readonly IConfigurationRoot _config;
|
||||
private readonly IServiceProvider _provider;
|
||||
private readonly DiscordBotWhitelistConfig _botWhitelist;
|
||||
|
||||
public CommandHandlerService(DiscordSocketClient discord, CommandService commands, IConfigurationRoot config, IServiceProvider provider, DiscordBotWhitelistConfig botWhitelist)
|
||||
public CommandHandlerService(DiscordSocketClient discord, CommandService commands, LoggingService logger, IConfigurationRoot config, IServiceProvider provider, DiscordBotWhitelistConfig botWhitelist)
|
||||
{
|
||||
_discord = discord;
|
||||
_commands = commands;
|
||||
_logger = logger;
|
||||
_config = config;
|
||||
_provider = provider;
|
||||
_botWhitelist = botWhitelist ?? new DiscordBotWhitelistConfig();
|
||||
|
|
@ -28,6 +32,11 @@ namespace ServerManagerTool.DiscordBot.Services
|
|||
|
||||
private async Task OnMessageReceivedAsync(SocketMessage s)
|
||||
{
|
||||
if (LogLevel.Debug.ToString().Equals(_config["DiscordSettings:LogLevel"]))
|
||||
{
|
||||
await _logger?.OnLogAsync(new LogMessage(LogSeverity.Debug, MessageSource.System.ToString(), $"Intercepted the following message from {s.Author.Username} ({s.Author.Id}) - {s.Content}"));
|
||||
}
|
||||
|
||||
// Ensure the message is from a user/bot
|
||||
if (!(s is SocketUserMessage msg))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue