diff --git a/src/Bot.hs b/src/Bot.hs index 87d8369..588ae63 100644 --- a/src/Bot.hs +++ b/src/Bot.hs @@ -78,7 +78,7 @@ builtinCommands = , mkBuiltinCommand ( "Delete quote from quote database" , $githubLinkLocationStr - , onlyForRoles "Only for mods" authorityRoles $ + , onlyForRoles "Only for mr strimmer :)" authorityRoles $ cmapR (readMaybe . T.unpack) $ replyOnNothing "Expected integer as an argument" deleteQuoteCommand)) , ( "quote" @@ -91,14 +91,14 @@ builtinCommands = ( "Update FFZ cache" , $githubLinkLocationStr , authorizeSender senderAuthority $ - replyOnNothing "Only for mods" $ + replyOnNothing "Only for mr strimmer :)" $ cmapR (const ()) updateFfzEmotesCommand)) , ( "updatebttv" , mkBuiltinCommand ( "Update BTTV cache" , $githubLinkLocationStr , authorizeSender senderAuthority $ - replyOnNothing "Only for mods" $ + replyOnNothing "Only for mr strimmer :)" $ cmapR (const ()) updateBttvEmotesCommand)) , ( "help" , mkBuiltinCommand @@ -108,7 +108,7 @@ builtinCommands = ( "Starts a poll. !poll option1; option2; ...; option3" , $githubLinkLocationStr , authorizeSender senderAuthority $ - replyOnNothing "Only for mods" $ + replyOnNothing "Only for mr strimmer :)" $ -- TODO(#362): !poll command does not parse negative numbers regexArgs "([0-9]+) (.*)" $ replyLeft $ @@ -141,7 +141,7 @@ builtinCommands = ( "Add periodic command" , $githubLinkLocationStr , authorizeSender senderAuthority $ - replyOnNothing "Only for mods" $ + replyOnNothing "Only for mr strimmer :)" $ regexArgs "([0-9]+) (.*)" $ replyLeft $ pairArgs $ @@ -161,7 +161,7 @@ builtinCommands = ( "Delete periodic command" , $githubLinkLocationStr , authorizeSender senderAuthority $ - replyOnNothing "Only for mods" removePeriodicCommand)) + replyOnNothing "Only for mr strimmer :)" removePeriodicCommand)) , ( "addtimer" , mkBuiltinCommand ( "Add Periodic Timer" @@ -190,13 +190,13 @@ builtinCommands = ( "Enable periodic timer" , $githubLinkLocationStr , authorizeSender senderAuthority $ - replyOnNothing "Only for mods" enablePeriodicTimerCommand)) + replyOnNothing "Only for mr strimmer :)" enablePeriodicTimerCommand)) , ( "periodicoff" , mkBuiltinCommand ( "Disable periodic timer" , $githubLinkLocationStr , authorizeSender senderAuthority $ - replyOnNothing "Only for mods" disablePeriodicTimerCommand)) + replyOnNothing "Only for mr strimmer :)" disablePeriodicTimerCommand)) , ( "periodicstat" , mkBuiltinCommand ( "Status of Periodic Timer" @@ -207,7 +207,7 @@ builtinCommands = ( "Add custom command" , $githubLinkLocationStr , authorizeSender senderAuthority $ - replyOnNothing "Only for mods" $ + replyOnNothing "Only for mr strimmer :)" $ regexArgs "([a-zA-Z0-9]+) ?(.*)" $ replyLeft $ pairArgs $ replyLeft $ addCustomCommand builtinCommands)) , ( "delcmd" @@ -215,13 +215,14 @@ builtinCommands = ( "Delete custom command" , $githubLinkLocationStr , authorizeSender senderAuthority $ - replyOnNothing "Only for mods" $ deleteCustomCommand builtinCommands)) + replyOnNothing "Only for mr strimmer :)" $ + deleteCustomCommand builtinCommands)) , ( "updcmd" , mkBuiltinCommand ( "Update custom command" , $githubLinkLocationStr , authorizeSender senderAuthority $ - replyOnNothing "Only for mods" $ + replyOnNothing "Only for mr strimmer :)" $ regexArgs "([a-zA-Z0-9]+) ?(.*)" $ replyLeft $ pairArgs $ replyLeft $ updateCustomCommand builtinCommands)) @@ -254,7 +255,7 @@ builtinCommands = ( "Add command alias" , $githubLinkLocationStr , authorizeSender senderAuthority $ - replyOnNothing "Only for mods" $ + replyOnNothing "Only for mr strimmer :)" $ regexArgs "([a-zA-Z0-9]+) ([a-zA-Z0-9]+)" $ replyLeft $ pairArgs $ replyLeft addAliasCommand)) , ( "delalias" @@ -262,19 +263,19 @@ builtinCommands = ( "Remove command alias" , $githubLinkLocationStr , authorizeSender senderAuthority $ - replyOnNothing "Only for mods" removeAliasCommand)) + replyOnNothing "Only for mr strimmer :)" removeAliasCommand)) , ( "addvar" , mkBuiltinCommand ( "Add variable" , $githubLinkLocationStr , authorizeSender senderAuthority $ - replyOnNothing "Only for mods" addVariable)) + replyOnNothing "Only for mr strimmer :)" addVariable)) , ( "updvar" , mkBuiltinCommand ( "Update variable" , $githubLinkLocationStr , authorizeSender senderAuthority $ - replyOnNothing "Only for mods" $ + replyOnNothing "Only for mr strimmer :)" $ regexArgs "([a-zA-Z0-9]+) ?(.*)" $ replyLeft $ pairArgs $ replyLeft updateVariable)) , ( "delvar" @@ -282,14 +283,14 @@ builtinCommands = ( "Delete variable" , $githubLinkLocationStr , authorizeSender senderAuthority $ - replyOnNothing "Only for mods" deleteVariable)) + replyOnNothing "Only for mr strimmer :)" deleteVariable)) , ( "nuke" , mkBuiltinCommand ( [qms|Looks at N previous messages and bans all of the users whose messages match provided regex|] , $githubLinkLocationStr , authorizeSender senderAuthority $ - replyOnNothing "Only for mods" $ + replyOnNothing "Only for mr strimmer :)" $ regexArgs "([0-9]+) (.*)" $ replyLeft $ pairArgs $ @@ -324,7 +325,7 @@ builtinCommands = ( "Makes the user trusted" , $githubLinkLocationStr , authorizeSender senderAuthority $ - replyOnNothing "Only for mods" $ + replyOnNothing "Only for mr strimmer :)" $ regexArgs "(.+)" $ replyLeft $ cmapR headMay $ replyOnNothing "Not enough arguments" trustCommand)) @@ -333,7 +334,7 @@ builtinCommands = ( "Untrusts the user" , $githubLinkLocationStr , authorizeSender senderAuthority $ - replyOnNothing "Only for mods" $ + replyOnNothing "Only for mr strimmer :)" $ regexArgs "(.+)" $ replyLeft $ cmapR headMay $ replyOnNothing "Not enough arguments" untrustCommand)) @@ -379,7 +380,8 @@ builtinCommands = ( "Start the raffle" , $githubLinkLocationStr , authorizeSender senderAuthority $ - replyOnNothing "Only for mods" $ cmapR (const 5) raffleCommand)) + replyOnNothing "Only for mr strimmer :)" $ + cmapR (const 5) raffleCommand)) , ( "join" , mkBuiltinCommand ("Join the raffle", $githubLinkLocationStr, joinCommand)) @@ -407,7 +409,7 @@ builtinCommands = , mkBuiltinCommand ( "Get the next video for Smart Stream" , $githubLinkLocationStr - , onlyForRoles "Only for mods" authorityRoles $ + , onlyForRoles "Only for mr strimmer :)" authorityRoles $ transR void nextVideoCommand)) , ( "video" , mkBuiltinCommand @@ -448,14 +450,14 @@ builtinCommands = , mkBuiltinCommand ( "Reloads Markov model file" , $githubLinkLocationStr - , onlyForRoles "Only for mods" authorityRoles $ + , onlyForRoles "Only for mr strimmer :)" authorityRoles $ liftR (const reloadMarkov) $ replyOnNothing "Nothing to reload" $ Reaction replyMessage)) , ( "config" , mkBuiltinCommand ( "Bot configuration command" , $githubLinkLocationStr - , onlyForRoles "Only for mods" authorityRoles $ + , onlyForRoles "Only for mr strimmer :)" authorityRoles $ subcommand [ ( "help" , subcommand diff --git a/src/Bot/Friday.hs b/src/Bot/Friday.hs index d63d200..a4f6b56 100644 --- a/src/Bot/Friday.hs +++ b/src/Bot/Friday.hs @@ -315,9 +315,12 @@ videoQueueCommand = subcommand [ ("", videoQueueLinkCommand) , ( "gist" - , onlyForRoles "Only for mods" authorityRoles setVideoQueueGistCommand) + , onlyForRoles + "Only for mr strimmer :)" + authorityRoles + setVideoQueueGistCommand) , ( "refresh" - , onlyForRoles "Only for mods" authorityRoles $ + , onlyForRoles "Only for mr strimmer :)" authorityRoles $ liftR (const currentFridayState) $ cmapR (updateFridayStateGistFresh False <$>) $ liftR updateEntityById $ diff --git a/src/Bot/Links.hs b/src/Bot/Links.hs index 017a9ec..c6f882f 100644 --- a/src/Bot/Links.hs +++ b/src/Bot/Links.hs @@ -13,7 +13,6 @@ module Bot.Links ) where import Bot.Replies -import Control.Applicative import Control.Monad import Control.Monad.Trans.Maybe import Data.Either @@ -56,12 +55,6 @@ findTrustedUser name = findTrustedSender :: Sender -> MaybeT Effect (Entity TrustedUser) findTrustedSender = findTrustedUser . senderName -autoTrustSender :: Sender -> MaybeT Effect (Entity TrustedUser) -autoTrustSender sender - | senderSubscriber sender || senderAuthority sender = - MaybeT $ fmap Just $ createEntity Proxy $ TrustedUser $ senderName sender - | otherwise = MaybeT $ return Nothing - textContainsLink :: T.Text -> Bool textContainsLink t = isRight $ do @@ -102,8 +95,7 @@ amitrustedCommand :: Reaction Message () amitrustedCommand = cmapR (const id) $ transR (reflect messageSender) $ - liftR - (\sender -> runMaybeT (findTrustedSender sender <|> autoTrustSender sender)) $ + liftR (runMaybeT . findTrustedSender) $ cmapR (maybe "no PepeHands" (const "yes Pog")) $ Reaction replyMessage istrustedCommand :: Reaction Message T.Text diff --git a/src/Bot/Replies.hs b/src/Bot/Replies.hs index 8122a15..cb3f17a 100644 --- a/src/Bot/Replies.hs +++ b/src/Bot/Replies.hs @@ -82,7 +82,7 @@ onlyForRoles reply roles reaction = (cmapR (const reply) $ Reaction replyMessage) onlyForMods :: Reaction Message a -> Reaction Message a -onlyForMods = onlyForRoles "Only for mods" authorityRoles +onlyForMods = onlyForRoles "Only for mr strimmer :)" authorityRoles nonEmptyRoles :: Reaction Message a -> Reaction Message a nonEmptyRoles reaction = diff --git a/src/Transport.hs b/src/Transport.hs index aaa94d6..bf9cd25 100644 --- a/src/Transport.hs +++ b/src/Transport.hs @@ -49,21 +49,8 @@ data Sender = Sender , senderRoles :: [Role] } -senderSubscriber :: Sender -> Bool -senderSubscriber = elem TwitchSub . senderRoles - -senderMod :: Sender -> Bool -senderMod = elem TwitchMod . senderRoles - -senderBroadcaster :: Sender -> Bool -senderBroadcaster = elem TwitchBroadcaster . senderRoles - -senderOwner :: Sender -> Bool -senderOwner = elem TwitchBotOwner . senderRoles - authorityRoles :: [Role] -authorityRoles = - [TwitchMod, TwitchBroadcaster, TwitchBotOwner, DiscordGuildOwner] +authorityRoles = [TwitchBroadcaster, TwitchBotOwner, DiscordGuildOwner] paidRoles :: [Role] paidRoles = [tsodingTwitchedDiscordRole, TwitchSub]