Skip to content

Commit a6189cb

Browse files
committed
Remove hash sign from the channel name
1 parent c304dc2 commit a6189cb

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/Bot/Links.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ linkFilter reaction =
136136
(\case
137137
Message { messageContent = message
138138
, messageSender = sender@Sender { senderRoles = []
139-
, senderChannel = TwitchChannel channel
139+
, senderChannel = channel
140140
}
141141
}
142142
| textContainsLink message -> do
@@ -145,5 +145,5 @@ linkFilter reaction =
145145
sender
146146
[qms|Links are not allowed for untrusted users.
147147
Subscribe to gain the trust instantly:
148-
https://twitch.tv/{channel}/subscribe|]
148+
https://twitch.tv/{unChannel $ channelToName channel}/subscribe|]
149149
msg -> runReaction reaction msg)

src/Transport.hs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{-# LANGUAGE DeriveFunctor #-}
2-
2+
{-# LANGUAGE ViewPatterns #-}
3+
{-# LANGUAGE OverloadedStrings #-}
34
module Transport where
45

56
import Control.Concurrent.STM
@@ -72,11 +73,12 @@ senderAuthority sender = any (`elem` senderRoles sender) authorityRoles
7273

7374
channelToName :: Channel -> ChannelName
7475
channelToName (DiscordChannel x) = ChannelName $ T.pack $ show x
75-
channelToName (TwitchChannel x) = ChannelName x
76+
channelToName (TwitchChannel (T.uncons -> Just ('#', x))) = ChannelName x
77+
channelToName (TwitchChannel _) = ChannelName ""
7678

7779
newtype ChannelName = ChannelName
7880
{ unChannel :: T.Text
79-
}
81+
} deriving Eq
8082

8183
data InEvent
8284
= Started

0 commit comments

Comments
 (0)