@@ -63,8 +63,8 @@ import Transport
6363
6464type Bot = InEvent -> Effect ()
6565
66- builtinCommands :: ChannelName -> CommandTable
67- builtinCommands channel =
66+ builtinCommands :: CommandTable
67+ builtinCommands =
6868 M. fromList
6969 [ ( " russify"
7070 , mkBuiltinCommand
@@ -114,7 +114,7 @@ builtinCommands channel =
114114 , mkBuiltinCommand
115115 ( " Send help"
116116 , $ githubLinkLocationStr
117- , helpCommand $ builtinCommands channel ))
117+ , helpCommand builtinCommands))
118118 , ( " poll"
119119 , mkBuiltinCommand
120120 ( " Starts a poll. !poll <duration:secs> option1; option2; ...; option3"
@@ -227,14 +227,14 @@ builtinCommands channel =
227227 replyOnNothing " Only for mods" $
228228 regexArgs " ([a-zA-Z0-9]+) ?(.*)" $
229229 replyLeft $
230- pairArgs $ replyLeft $ addCustomCommand $ builtinCommands channel ))
230+ pairArgs $ replyLeft $ addCustomCommand builtinCommands))
231231 , ( " delcmd"
232232 , mkBuiltinCommand
233233 ( " Delete custom command"
234234 , $ githubLinkLocationStr
235235 , authorizeSender senderAuthority $
236236 replyOnNothing " Only for mods" $
237- deleteCustomCommand $ builtinCommands channel ))
237+ deleteCustomCommand builtinCommands))
238238 , ( " updcmd"
239239 , mkBuiltinCommand
240240 ( " Update custom command"
@@ -243,7 +243,7 @@ builtinCommands channel =
243243 replyOnNothing " Only for mods" $
244244 regexArgs " ([a-zA-Z0-9]+) ?(.*)" $
245245 replyLeft $
246- pairArgs $ replyLeft $ updateCustomCommand $ builtinCommands channel ))
246+ pairArgs $ replyLeft $ updateCustomCommand builtinCommands))
247247 -- TODO(#337): use help instead of !showcmd
248248 , ( " showcmd"
249249 , mkBuiltinCommand
@@ -253,7 +253,7 @@ builtinCommands channel =
253253 replyLeft $
254254 cmapR headMay $
255255 replyOnNothing " Not enough arguments" $
256- showCustomCommand $ builtinCommands channel ))
256+ showCustomCommand builtinCommands))
257257 , ( " timescmd"
258258 , mkBuiltinCommand
259259 ( " Show amount of times the custom commands was invoked"
@@ -262,7 +262,7 @@ builtinCommands channel =
262262 replyLeft $
263263 cmapR headMay $
264264 replyOnNothing " Not enough arguments" $
265- timesCustomCommand $ builtinCommands channel ))
265+ timesCustomCommand builtinCommands))
266266 , ( " song"
267267 , mkBuiltinCommand
268268 ( " Print currently playing song"
@@ -407,9 +407,7 @@ builtinCommands channel =
407407 ( " Suggest video for the friday stream"
408408 , $ githubLinkLocationStr
409409 , nonEmptyRoles
410- [qms |You have to be trusted to use this command.
411- Subscribe to gain the trust instantly:
412- https://twitch.tv/{channel'}/subscribe|]
410+
413411 fridayCommand))
414412 , ( " videoq"
415413 , mkBuiltinCommand
@@ -511,14 +509,8 @@ builtinCommands channel =
511509 , mkBuiltinCommand
512510 ( " Asciify Twitch, BTTV or FFZ emote"
513511 , $ githubLinkLocationStr
514- , nonEmptyRoles
515- [qms |You have to be trusted to use this command.
516- Subscribe to gain the trust instantly:
517- https://twitch.tv/{channel'}/subscribe|]
518- asciifyReaction))
512+ , nonEmptyRoles asciifyReaction))
519513 ]
520- where
521- channel' = unChannel channel
522514
523515nextStreamCommand :: Reaction Message a
524516nextStreamCommand =
@@ -636,18 +628,18 @@ mention =
636628 else Nothing <$ msg) $
637629 ignoreNothing markov
638630
639- bot :: ChannelName -> Bot
640- bot channel Started = do
631+ bot :: Bot
632+ bot Started = do
641633 startRefreshFridayGistTimer
642- startRefreshHelpGistTimer $ builtinCommands channel
634+ startRefreshHelpGistTimer builtinCommands
643635-- TODO(#656): Restarted Twitch transport thread can duplicate timers
644- bot _ (Joined channel@ (TwitchChannel _)) = do
636+ bot (Joined channel@ (TwitchChannel _)) = do
645637 startPeriodicCommands channel dispatchCommand
646638 periodicEffect (60 * 1000 ) (Just channel) (announceRunningPoll channel)
647639-- TODO(#550): Periodic commands don't work in Discord channels
648- bot _ (Joined channel@ (DiscordChannel _)) =
640+ bot (Joined channel@ (DiscordChannel _)) =
649641 periodicEffect (60 * 1000 ) (Just channel) (announceRunningPoll channel)
650- bot _ (InMsg msg) =
642+ bot (InMsg msg) =
651643 runReaction
652644 (dupLiftExtractR internalMessageRoles $
653645 copyPastaFilter $ linkFilter messageReaction)
@@ -714,12 +706,12 @@ dispatchCommand message = do
714706 dispatchCustomCommand message
715707
716708dispatchBuiltinCommand :: Message (Command T. Text ) -> Effect ()
717- dispatchBuiltinCommand message@ Message { messageSender = sender
709+ dispatchBuiltinCommand message@ Message { messageSender = _
718710 , messageContent = Command { commandName = name
719711 , commandArgs = args
720712 }
721713 } =
722714 maybe
723715 (return () )
724716 (\ bc -> runReaction (bcReaction bc) $ fmap (const args) message)
725- (M. lookup name $ builtinCommands $ channelToName $ senderChannel sender )
717+ (M. lookup name builtinCommands)
0 commit comments