Skip to content

Commit ae22eb2

Browse files
committed
ShouldIgnoreBot
1 parent 2a3925d commit ae22eb2

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

DiscordBot.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ public void InitAndRun(string[] args)
282282
}
283283
ReactionsHandler.CheckReactables();
284284
BotMonitor.LoopsSilent = 0;
285-
if (message.Author.IsBot || message.Author.IsWebhook)
285+
if (message.Author.IsWebhook || (message.Author.IsBot && ClientConfig.ShouldIgnoreBot(message)))
286286
{
287287
return Task.CompletedTask;
288288
}

DiscordBotConfig.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ public class DiscordBotConfig
1414
/// <summary>An alternate handler for unknown commands (eg special info output) (if any).</summary>
1515
public Action<string, CommandData> UnknownCommandHandler = null;
1616

17-
/// <summary>
18-
/// A method that will return a bool indicating whether the client should respond to commands in the message given in the parameter (usually based on the channel details).
19-
/// </summary>
17+
/// <summary>A method that will return a bool indicating whether the client should respond to commands in the message given in the parameter (usually based on the channel details).</summary>
2018
public Func<IUserMessage, bool> ShouldPayAttentionToMessage = null;
2119

2220
/// <summary>A method to run to initialize the bot.</summary>
@@ -48,5 +46,8 @@ public class DiscordBotConfig
4846

4947
/// <summary>Whether DM'd slash commands are ever allowed.</summary>
5048
public bool AllowSlashCommandsInDM = false;
49+
50+
/// <summary>A method that will return true if a bot message should be ignored, or false if it should be parsed. Note that webhooks are always ignored.</summary>
51+
public Func<IMessage, bool> ShouldIgnoreBot = (_) => true;
5152
}
5253
}

0 commit comments

Comments
 (0)