discord-haskell 1.15.5 → 1.15.6
raw patch · 4 files changed
+44/−18 lines, 4 filesdep +emojisdep −emojidep ~MonadRandomdep ~aesondep ~basePVP ok
version bump matches the API change (PVP)
Dependencies added: emojis
Dependencies removed: emoji
Dependency ranges changed: MonadRandom, aeson, base, bytestring, http-api-data, mtl, time
API changes (from Hackage documentation)
Files
- changelog.md +10/−0
- discord-haskell.cabal +11/−10
- src/Discord.hs +2/−1
- src/Discord/Internal/Rest/Channel.hs +21/−7
changelog.md view
@@ -8,6 +8,16 @@ - +## 1.15.6++- [penelopeysm](https://github.com/discord-haskell/discord-haskell/pull/176) GHC 9.6 dependencies++- [penelopeysm](https://github.com/discord-haskell/discord-haskell/pull/179) and [penelopeysm](https://github.com/discord-haskell/discord-haskell/pull/181) Improving emoji support++- [penelopeysm](https://github.com/discord-haskell/discord-haskell/pull/182) Fix StartThreadNoMessage endpoint++- [yutotakano](https://github.com/discord-haskell/discord-haskell/pull/183) Slim down stack matrix build+ ## 1.15.5 - [Gregory1234](https://github.com/discord-haskell/discord-haskell/pull/173) Adding `global_name` field to the User object
discord-haskell.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.0 name: discord-haskell-version: 1.15.5+version: 1.15.6 description: Functions and data types to write discord bots. Official discord docs <https://discord.com/developers/docs/reference>. .@@ -19,6 +19,7 @@ tested-with: GHC == 8.10.7 , GHC == 9.2 , GHC == 9.4+ , GHC == 9.6 extra-doc-files: README.md , changelog.md @@ -158,27 +159,27 @@ , Discord.Internal.Types.ScheduledEvents build-depends: -- https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history- -- below also sets the GHC version effectively. set to == 8.10.*, == 9.0.*., == 9.2.*, == 9.4.*- base == 4.14.* || == 4.15.* || == 4.16.* || == 4.17.*,- aeson >= 1.5 && < 1.6 || >= 2.0 && < 2.2,+ -- below also sets the GHC version effectively. set to == 8.10.*, == 9.0.*., == 9.2.*, == 9.4.*, == 9.6.*+ base == 4.14.* || == 4.15.* || == 4.16.* || == 4.17.* || == 4.18.*,+ aeson >= 1.5 && < 1.6 || >= 2.0 && < 2.3, async >=2.2 && <2.3,- bytestring >=0.10 && <0.12,+ bytestring >=0.10 && <0.13, base64-bytestring >=1.1 && <1.3, containers >=0.6 && <0.7, data-default >=0.7 && <0.8,- emoji ==0.1.*,+ emojis >=0.1.3 && <0.2, http-client >=0.6 && <0.8, iso8601-time >=0.1 && <0.2,- MonadRandom >=0.5 && <0.6,+ MonadRandom >=0.5 && <0.7, req >=3.9 && <3.14, safe-exceptions >=0.1 && <0.2, text >=1.2 && <3,- time >=1.9 && <1.12,+ time >=1.9 && <1.13, websockets >=0.12 && <0.13, network >=3.0.0.0 && <3.2.0.0, wuss >=1.1 && <3,- mtl >=2.2 && <2.3,+ mtl >=2.2 && <2.4, unliftio >=0.2 && <0.3, scientific >=0.3 && <0.4,- http-api-data >=0.4 && <0.6,+ http-api-data >=0.4 && <0.7, unordered-containers >=0.2.10.0 && <0.3
src/Discord.hs view
@@ -26,7 +26,8 @@ import Prelude hiding (log) import Control.Exception (Exception)-import Control.Monad.Reader (ReaderT, runReaderT, void, ask, liftIO, forever, asks)+import Control.Monad (void, forever)+import Control.Monad.Reader (ReaderT, runReaderT, ask, liftIO, asks) import Data.Aeson (FromJSON) import Data.Default (Default, def) import Data.IORef (writeIORef)
src/Discord/Internal/Rest/Channel.hs view
@@ -22,7 +22,7 @@ import Data.Aeson import Data.Default (Default, def)-import Data.Emoji (unicodeByName)+import Text.Emoji (emojiFromAlias) import qualified Data.Text as T import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as BL@@ -401,11 +401,25 @@ cleanupEmoji :: T.Text -> T.Text cleanupEmoji emoji = let noAngles = T.replace "<" "" (T.replace ">" "" emoji)- byName = T.pack <$> unicodeByName (T.unpack (T.replace ":" "" emoji))- in case (byName, T.stripPrefix ":" noAngles) of- (Just e, _) -> e- (_, Just a) -> "custom:" <> a- (_, Nothing) -> noAngles+ noColons = T.replace ":" "" emoji+ toneModifier s = case s of+ "tone1" -> Just "\x1f3fb"+ "tone2" -> Just "\x1f3fc"+ "tone3" -> Just "\x1f3fd"+ "tone4" -> Just "\x1f3fe"+ "tone5" -> Just "\x1f3ff"+ _ -> Nothing+ byName = case emojiFromAlias noColons of+ Just e -> Just e+ Nothing ->+ let (prefix, tone) = T.breakOnEnd "_" noColons+ in case ((fst <$> T.unsnoc prefix) >>= emojiFromAlias, toneModifier tone) of+ (Just p, Just t) -> Just (p <> t)+ _ -> Nothing+ in case (byName, T.stripPrefix ":" noAngles) of+ (Just e, _) -> e+ (_, Just a) -> "custom:" <> a+ (_, Nothing) -> noAngles channels :: R.Url 'R.Https channels = baseUrl /: "channels"@@ -566,7 +580,7 @@ mempty (StartThreadNoMessage chan sto) ->- Post (channels /~ chan /: "messages" /: "threads")+ Post (channels /~ chan /: "threads") (pure $ R.ReqBodyJson $ toJSON sto) mempty