packages feed

discord-haskell 1.5.2 → 1.6.0

raw patch · 4 files changed

+71/−3 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Discord.Internal.Types.Channel: ChannelNews :: ChannelId -> GuildId -> Text -> Integer -> [Overwrite] -> Bool -> Text -> Maybe MessageId -> Channel
+ Discord.Internal.Types.Channel: ChannelStorePage :: ChannelId -> GuildId -> Text -> Integer -> Bool -> [Overwrite] -> Channel
+ Discord.Internal.Types.Channel: [channelNSFW] :: Channel -> Bool
+ Discord.Internal.Types.Channel: [channelUserRateLimit] :: Channel -> Integer
- Discord.Internal.Types.Channel: ChannelText :: ChannelId -> GuildId -> Text -> Integer -> [Overwrite] -> Text -> Maybe MessageId -> Channel
+ Discord.Internal.Types.Channel: ChannelText :: ChannelId -> GuildId -> Text -> Integer -> [Overwrite] -> Integer -> Bool -> Text -> Maybe MessageId -> Channel
- Discord.Internal.Types.Channel: ChannelVoice :: ChannelId -> GuildId -> Text -> Integer -> [Overwrite] -> Integer -> Integer -> Channel
+ Discord.Internal.Types.Channel: ChannelVoice :: ChannelId -> GuildId -> Text -> Integer -> [Overwrite] -> Bool -> Integer -> Integer -> Channel

Files

changelog.md view
@@ -4,7 +4,12 @@  ## master -## 1.5.2+## 1.6.0+++Add News Channel and StorePage Channel. Fix crash `Unknown channel type:5`++Add NSFW and UserRateLimit  ## 1.5.1 
discord-haskell.cabal view
@@ -1,7 +1,7 @@ cabal-version:       2.0 name:                discord-haskell -- library version is also noted at src/Discord/Rest/Prelude.hs-version:             1.5.2+version:             1.6.0 description:         Functions and data types to write discord bots.                      Official discord docs <https://discordapp.com/developers/docs/reference>.                      .
src/Discord/Internal/Rest/Prelude.hs view
@@ -25,7 +25,7 @@   where   -- | https://discordapp.com/developers/docs/reference#user-agent   -- Second place where the library version is noted-  agent = "DiscordBot (https://github.com/aquarial/discord-haskell, 1.5.2)"+  agent = "DiscordBot (https://github.com/aquarial/discord-haskell, 1.6.0)"  -- Append to an URL infixl 5 //
src/Discord/Internal/Types/Channel.hs view
@@ -26,10 +26,30 @@       , channelName        :: T.Text      -- ^ The name of the guild (2 - 1000 characters).       , channelPosition    :: Integer     -- ^ The storing position of the channel.       , channelPermissions :: [Overwrite] -- ^ An array of permission 'Overwrite's+      , channelUserRateLimit :: Integer   -- ^ Seconds before a user can speak again+      , channelNSFW        :: Bool        -- ^ Is not-safe-for-work       , channelTopic       :: T.Text      -- ^ The topic of the channel. (0 - 1024 chars).       , channelLastMessage :: Maybe MessageId   -- ^ The id of the last message sent in the                                                 --   channel       }+  | ChannelNews+      { channelId          :: ChannelId+      , channelGuild       :: GuildId+      , channelName        :: T.Text+      , channelPosition    :: Integer+      , channelPermissions :: [Overwrite]+      , channelNSFW        :: Bool+      , channelTopic       :: T.Text+      , channelLastMessage :: Maybe MessageId+      }+  | ChannelStorePage+      { channelId          :: ChannelId+      , channelGuild       :: GuildId+      , channelName        :: T.Text+      , channelPosition    :: Integer+      , channelNSFW        :: Bool+      , channelPermissions :: [Overwrite]+      }   -- | A voice channel in a guild.   | ChannelVoice       { channelId          :: ChannelId@@ -37,6 +57,7 @@       , channelName        :: T.Text       , channelPosition    :: Integer       , channelPermissions :: [Overwrite]+      , channelNSFW        :: Bool       , channelBitRate     :: Integer     -- ^ The bitrate (in bits) of the channel.       , channelUserLimit   :: Integer     -- ^ The user limit of the voice channel.       }@@ -67,6 +88,8 @@                      <*> o .:  "name"                      <*> o .:  "position"                      <*> o .:  "permission_overwrites"+                     <*> o .:  "rate_limit_per_user"+                     <*> o .:? "nsfw" .!= False                      <*> o .:? "topic" .!= ""                      <*> o .:? "last_message_id"       1 ->@@ -79,6 +102,7 @@                      <*> o .:  "name"                      <*> o .:  "position"                      <*> o .:  "permission_overwrites"+                     <*> o .:? "nsfw" .!= False                      <*> o .:  "bitrate"                      <*> o .:  "user_limit"       3 ->@@ -88,6 +112,22 @@       4 ->         ChannelGuildCategory <$> o .: "id"                              <*> o .:? "guild_id" .!= 0+      5 ->+        ChannelNews <$> o .:  "id"+                    <*> o .:? "guild_id" .!= 0+                    <*> o .:  "name"+                    <*> o .:  "position"+                    <*> o .:  "permission_overwrites"+                    <*> o .:? "nsfw" .!= False+                    <*> o .:? "topic" .!= ""+                    <*> o .:? "last_message_id"+      6 ->+        ChannelStorePage <$> o .:  "id"+                         <*> o .:? "guild_id" .!= 0+                         <*> o .:  "name"+                         <*> o .:  "position"+                         <*> o .:? "nsfw" .!= False+                         <*> o .:  "permission_overwrites"       _ -> fail ("Unknown channel type:" <> show type')  instance ToJSON Channel where@@ -96,10 +136,30 @@               , ("guild_id", toJSON <$> pure channelGuild)               , ("name",  toJSON <$> pure channelName)               , ("position",   toJSON <$> pure channelPosition)+              , ("rate_limit_per_user", toJSON <$> pure channelUserRateLimit)+              , ("nsfw", toJSON <$> pure channelNSFW)               , ("permission_overwrites",   toJSON <$> pure channelPermissions)               , ("topic",   toJSON <$> pure channelTopic)               , ("last_message_id",  toJSON <$> channelLastMessage)               ] ]+  toJSON ChannelNews{..} = object [(name,value) | (name, Just value) <-+              [ ("id",     toJSON <$> pure channelId)+              , ("guild_id", toJSON <$> pure channelGuild)+              , ("name",  toJSON <$> pure channelName)+              , ("position",   toJSON <$> pure channelPosition)+              , ("permission_overwrites",   toJSON <$> pure channelPermissions)+              , ("nsfw", toJSON <$> pure channelNSFW)+              , ("topic",   toJSON <$> pure channelTopic)+              , ("last_message_id",  toJSON <$> channelLastMessage)+              ] ]+  toJSON ChannelStorePage{..} = object [(name,value) | (name, Just value) <-+              [ ("id",     toJSON <$> pure channelId)+              , ("guild_id", toJSON <$> pure channelGuild)+              , ("name",  toJSON <$> pure channelName)+              , ("nsfw", toJSON <$> pure channelNSFW)+              , ("position",   toJSON <$> pure channelPosition)+              , ("permission_overwrites",   toJSON <$> pure channelPermissions)+              ] ]   toJSON ChannelDirectMessage{..} = object [(name,value) | (name, Just value) <-               [ ("id",     toJSON <$> pure channelId)               , ("recipients",   toJSON <$> pure channelRecipients)@@ -110,6 +170,7 @@               , ("guild_id", toJSON <$> pure channelGuild)               , ("name",  toJSON <$> pure channelName)               , ("position",   toJSON <$> pure channelPosition)+              , ("nsfw", toJSON <$> pure channelNSFW)               , ("permission_overwrites",   toJSON <$> pure channelPermissions)               , ("bitrate",   toJSON <$> pure channelBitRate)               , ("user_limit",  toJSON <$> pure channelUserLimit)@@ -130,6 +191,8 @@         ChannelGuildCategory{..} -> True         ChannelText{..} -> True         ChannelVoice{..}  -> True+        ChannelNews{..}  -> True+        ChannelStorePage{..}  -> True         _ -> False  -- | Permission overwrites for a channel.