diff --git a/KfChatDotNetBot/Services/BotCommands.cs b/KfChatDotNetBot/Services/BotCommands.cs index 8ed1238..e202c83 100644 --- a/KfChatDotNetBot/Services/BotCommands.cs +++ b/KfChatDotNetBot/Services/BotCommands.cs @@ -47,14 +47,11 @@ internal class BotCommands return; } - if (!message.MessageRaw.StartsWith(CommandPrefix)) - { - return; - } - var messageTrimmed = message.MessageRaw.TrimStart(CommandPrefix); foreach (var command in Commands) { + var noPrefixCommand = HasAttribute(command); + if (!noPrefixCommand && !message.MessageRaw.StartsWith(CommandPrefix)) return; foreach (var regex in command.Patterns) { var match = regex.Match(messageTrimmed); @@ -252,4 +249,10 @@ internal class WagerCommand : Attribute; /// It'll also check whether the user is permanently banned before running the command. /// [AttributeUsage(AttributeTargets.Class)] -internal class KasinoCommand : Attribute; \ No newline at end of file +internal class KasinoCommand : Attribute; + +/// +/// Use this on commands where the Regex should be tested even if there's no command prefix +/// +[AttributeUsage(AttributeTargets.Class)] +internal class NoPrefixRequired : Attribute; \ No newline at end of file