From 8c27b8c3fb66986bbfed2bc5c2f59de1aff9d143 Mon Sep 17 00:00:00 2001 From: Madpeter <57852827+Madpeterz@users.noreply.github.com> Date: Wed, 8 Jun 2022 02:59:54 +0100 Subject: [PATCH] add support to not require signing checks --- SecondBotEvents/Services/Commands.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/SecondBotEvents/Services/Commands.cs b/SecondBotEvents/Services/Commands.cs index 9a70d44..b182971 100644 --- a/SecondBotEvents/Services/Commands.cs +++ b/SecondBotEvents/Services/Commands.cs @@ -212,7 +212,10 @@ namespace SecondBotEvents.Services public KeyValuePair RunCommand(SignedCommand C) { - + if(acceptNewCommands == false) + { + return new KeyValuePair(false, "Not accepting commands"); + } try { string lowerName = C.command.ToLower(); @@ -324,13 +327,18 @@ namespace SecondBotEvents.Services } Vaildate(requireTimewindow, windowSize, secret); } - public SignedCommand(string setCommand, string setSigningCode, string[] setArgs, int setUnixtime, string setReplyTarget, bool requireTimewindow, int windowSize, string secret) + public SignedCommand(string setCommand, string setSigningCode, string[] setArgs, int setUnixtime, string setReplyTarget, bool requireTimewindow, int windowSize, string secret, bool requireSigning = true) { command = setCommand; signingCode = setSigningCode; args = setArgs; unixtimeOfCommand = setUnixtime; replyTarget = setReplyTarget; + if (requireSigning == false) + { + accepted = true; // just accept the command + return; + } Vaildate(requireTimewindow, windowSize, secret); }