mirror of
https://github.com/Sanae6/SmoOnlineServer.git
synced 2024-11-21 18:55:17 +00:00
You can no longer dm a bot for a command (has been tested)
This commit is contained in:
parent
9c01f30c5e
commit
08d1020770
1 changed files with 11 additions and 0 deletions
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue