Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 25 additions & 23 deletions src/Bot.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -108,7 +108,7 @@ builtinCommands =
( "Starts a poll. !poll <duration:secs> 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 $
Expand Down Expand Up @@ -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 $
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -207,21 +207,22 @@ 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"
, mkBuiltinCommand
( "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))
Expand Down Expand Up @@ -254,42 +255,42 @@ 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"
, mkBuiltinCommand
( "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"
, mkBuiltinCommand
( "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 $
Expand Down Expand Up @@ -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))
Expand All @@ -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))
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions src/Bot/Friday.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 $
Expand Down
10 changes: 1 addition & 9 deletions src/Bot/Links.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Bot/Replies.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
15 changes: 1 addition & 14 deletions src/Transport.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down