0
0
Fork 0
mirror of https://github.com/Sanae6/SmoOnlineServer.git synced 2024-11-22 03:05:16 +00:00

You can no longer dm a bot for a command (has been tested)

This commit is contained in:
TheUbMunster 2022-08-22 16:01:58 -06:00 committed by Sanae
parent 9c01f30c5e
commit 08d1020770

View file

@ -91,6 +91,17 @@ public class DiscordBot {
string mentionPrefix = $"{DiscordClient.CurrentUser.Mention} "; string mentionPrefix = $"{DiscordClient.CurrentUser.Mention} ";
DiscordClient.MessageCreated += async (_, args) => { DiscordClient.MessageCreated += async (_, args) => {
if (args.Author.IsCurrent) return; if (args.Author.IsCurrent) return;
//prevent commands via dm
if (Config.LogChannel == null) {
Logger.Warn("The discord bot cannot process commands because the LogChannel in settings isn't set");
return;
}
ulong chId = ulong.Parse(Config.LogChannel);
if (args.Channel.Id != chId) {
Logger.Warn("A command was sent to the bot in a channel other than the specified log channel (probably attempt to run command via dm)");
return;
}
//run command
try { try {
DiscordMessage msg = args.Message; DiscordMessage msg = args.Message;
string? resp = null; string? resp = null;