mirror of
https://github.com/Sanae6/SmoOnlineServer.git
synced 2024-11-21 18:55:17 +00:00
added log message that prints the channel the command came from and the channel commands are accepted from
This commit is contained in:
parent
b6e634ada4
commit
82e94334c9
1 changed files with 2 additions and 1 deletions
|
@ -96,6 +96,7 @@ public class DiscordBot {
|
|||
Reconnecting = false;
|
||||
string mentionPrefix = $"{DiscordClient.CurrentUser.Mention} ";
|
||||
DiscordClient.MessageCreated += async (_, args) => {
|
||||
Logger.Info($"Message recieved on channel \"{args.Channel.Id}\", accepting commands from channel \"{Config.LogChannel ?? "(Any Channel)"}\", do channels match: {args.Channel.Id.ToString() == Config.LogChannel}");
|
||||
if (args.Author.IsCurrent) return; //dont respond to commands from ourselves (prevent "sql-injection" esq attacks)
|
||||
//prevent commands via dm and non-public channels
|
||||
if (Config.LogChannel == null) {
|
||||
|
@ -105,7 +106,7 @@ public class DiscordBot {
|
|||
}
|
||||
if (args.Channel is DiscordDmChannel) {
|
||||
#if LOG_BAD_REQ
|
||||
Logger.Warn("A command was sent to the bot in a non-public channel. This will not be processed. (Send commands in the specified LogChannel in settings.json or only in public channels)");
|
||||
Logger.Warn("A command was sent to the bot in a direct message channel. This will not be processed. (Send commands in the specified LogChannel in settings.json or only in public channels)");
|
||||
#endif
|
||||
#if SEND_RESP_TO_BAD_REQ
|
||||
await args.Message.RespondAsync("This channel is not valid for running commands. (Your command was not processed).");
|
||||
|
|
Loading…
Reference in a new issue