summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaura <the-ceo-of-antifa@protonmail.com>2023-01-25 22:56:20 +0100
committerLaura <the-ceo-of-antifa@protonmail.com>2023-01-25 22:56:20 +0100
commit115d223922eb50a371743ea2f384323278888f9c (patch)
tree1f4f3a88c25b58533e7841eacda25fa9cc6289e5
parent468b3c649325de247d502afecd6d50f61d92d261 (diff)
downloadmiaowe-115d223922eb50a371743ea2f384323278888f9c.tar.gz
miaowe-115d223922eb50a371743ea2f384323278888f9c.zip
Don't allow commands from PM to spam channel
-rw-r--r--miaowe.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/miaowe.hs b/miaowe.hs
index f03d4f2..f046198 100644
--- a/miaowe.hs
+++ b/miaowe.hs
@@ -257,10 +257,15 @@ processCommand channel command | length (words command) < 5 = sendToChannel chan
a command."
| otherwise = doCommand channel command
+commandChannel :: String -> String
+commandChannel command = (words command)!!2
+
mainLoop :: IrcChannel -> IO ()
mainLoop channel = waitForCommand
>>= \line ->
- processCommand channel line
+ (if commandChannel line == channel
+ then processCommand channel line
+ else return ())
>> mainLoop channel