discord-haskell 1.1.3 → 1.2.0
raw patch · 7 files changed
+43/−16 lines, 7 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Discord.Internal.Types.Guild: [roleID] :: Role -> RoleId
- Discord.Internal.Types.Guild: [voiceRegionDepreciated] :: VoiceRegion -> Bool
+ Discord.Internal.Types.Channel: Nonce :: Text -> Nonce
+ Discord.Internal.Types.Channel: instance Data.Aeson.Types.FromJSON.FromJSON Discord.Internal.Types.Channel.Nonce
+ Discord.Internal.Types.Channel: instance GHC.Classes.Eq Discord.Internal.Types.Channel.Nonce
+ Discord.Internal.Types.Channel: instance GHC.Classes.Ord Discord.Internal.Types.Channel.Nonce
+ Discord.Internal.Types.Channel: instance GHC.Show.Show Discord.Internal.Types.Channel.Nonce
+ Discord.Internal.Types.Channel: newtype Nonce
+ Discord.Internal.Types.Guild: [roleId] :: Role -> RoleId
+ Discord.Internal.Types.Guild: [voiceRegionDeprecated] :: VoiceRegion -> Bool
- Discord.Internal.Rest.Guild: ModifyGuildRoleOpts :: Maybe Text -> Maybe Integer -> Maybe Integer -> Bool -> Bool -> ModifyGuildRoleOpts
+ Discord.Internal.Rest.Guild: ModifyGuildRoleOpts :: Maybe Text -> Maybe Integer -> Maybe Integer -> Maybe Bool -> Maybe Bool -> ModifyGuildRoleOpts
- Discord.Internal.Rest.Guild: [modifyGuildRoleOptsMentionable] :: ModifyGuildRoleOpts -> Bool
+ Discord.Internal.Rest.Guild: [modifyGuildRoleOptsMentionable] :: ModifyGuildRoleOpts -> Maybe Bool
- Discord.Internal.Rest.Guild: [modifyGuildRoleOptsSeparateSidebar] :: ModifyGuildRoleOpts -> Bool
+ Discord.Internal.Rest.Guild: [modifyGuildRoleOptsSeparateSidebar] :: ModifyGuildRoleOpts -> Maybe Bool
- Discord.Internal.Types.Channel: Message :: MessageId -> ChannelId -> User -> Text -> UTCTime -> Maybe UTCTime -> Bool -> Bool -> [User] -> [RoleId] -> [Attachment] -> [Embed] -> Maybe Snowflake -> Bool -> Maybe GuildId -> Message
+ Discord.Internal.Types.Channel: Message :: MessageId -> ChannelId -> User -> Text -> UTCTime -> Maybe UTCTime -> Bool -> Bool -> [User] -> [RoleId] -> [Attachment] -> [Embed] -> Maybe Nonce -> Bool -> Maybe GuildId -> Message
- Discord.Internal.Types.Channel: [messageNonce] :: Message -> Maybe Snowflake
+ Discord.Internal.Types.Channel: [messageNonce] :: Message -> Maybe Nonce
Files
- README.md +7/−1
- changelog.md +11/−0
- discord-haskell.cabal +3/−3
- src/Discord/Internal/Rest/Guild.hs +9/−8
- src/Discord/Internal/Rest/Prelude.hs +1/−1
- src/Discord/Internal/Types/Channel.hs +10/−1
- src/Discord/Internal/Types/Guild.hs +2/−2
README.md view
@@ -44,7 +44,7 @@ ```yaml extra-deps:-- discord-haskell-1.0.0+- discord-haskell-1.1.3 - emoji-0.1.0.2 ``` @@ -81,6 +81,12 @@ See [examples/ping-pong.hs](https://github.com/aquarial/discord-haskell/blob/master/examples/ping-pong.hs) for a `CreateReaction` request in use. +### Limitations++The following features are not implemented:++- Voice & Audio+- Authenticating with a user token ### Debugging
changelog.md view
@@ -4,6 +4,17 @@ ## master ++## 1.2.0++[MDeltaX](https://github.com/aquarial/discord-haskell/pull/27) Fixed typo: depreciated --> deprecated++[MDeltaX](https://github.com/aquarial/discord-haskell/pull/29) More consistency: RoleID --> RoleId++[MDeltaX](https://github.com/aquarial/discord-haskell/pull/29) Fix ModifyGuildRole: Post --> Patch && optional args++[Hippu](https://github.com/aquarial/discord-haskell/pull/31) Won't crash on integer-nonces in ChannelMessage-events (usually strings)+ ## 1.1.3 Minor improvements to rate-limiting like using newer `X-RateLimit-Reset-After` header
discord-haskell.cabal view
@@ -1,12 +1,12 @@ cabal-version: 2.0 name: discord-haskell -- library version is also noted at src/Discord/Rest/Prelude.hs-version: 1.1.3+version: 1.2.0 description: Functions and data types to write discord bots. Official discord docs <https://discordapp.com/developers/docs/reference>. .- See the project wiki for quickstart notes- <https://github.com/aquarial/discord-haskell/wiki>+ See the project readme for quickstart notes+ <https://github.com/aquarial/discord-haskell#discord-haskell-> synopsis: Write bots for Discord in Haskell homepage: https://github.com/aquarial/discord-haskell bug-reports: https://github.com/aquarial/discord-haskell/issues
src/Discord/Internal/Rest/Guild.hs view
@@ -182,11 +182,11 @@ ("reason", toJSON <$> createGuildBanOptsReason )]] data ModifyGuildRoleOpts = ModifyGuildRoleOpts- { modifyGuildRoleOptsName :: Maybe T.Text- , modifyGuildRoleOptsPermissions :: Maybe Integer- , modifyGuildRoleOptsColor :: Maybe Integer- , modifyGuildRoleOptsSeparateSidebar :: Bool- , modifyGuildRoleOptsMentionable :: Bool+ { modifyGuildRoleOptsName :: Maybe T.Text+ , modifyGuildRoleOptsPermissions :: Maybe Integer+ , modifyGuildRoleOptsColor :: Maybe Integer+ , modifyGuildRoleOptsSeparateSidebar :: Maybe Bool+ , modifyGuildRoleOptsMentionable :: Maybe Bool } deriving (Show, Eq, Ord) instance ToJSON ModifyGuildRoleOpts where@@ -194,8 +194,8 @@ [("name", toJSON <$> modifyGuildRoleOptsName ), ("permissions", toJSON <$> modifyGuildRoleOptsPermissions ), ("color", toJSON <$> modifyGuildRoleOptsColor ),- ("hoist", toJSON <$> Just modifyGuildRoleOptsSeparateSidebar ),- ("mentionable", toJSON <$> Just modifyGuildRoleOptsMentionable )]]+ ("hoist", toJSON <$> modifyGuildRoleOptsSeparateSidebar ),+ ("mentionable", toJSON <$> modifyGuildRoleOptsMentionable )]] data AddGuildMemberOpts = AddGuildMemberOpts { addGuildMemberOptsAccessToken :: T.Text@@ -421,7 +421,7 @@ in Patch (guilds // guild /: "roles") (R.ReqBodyJson body) mempty (ModifyGuildRole guild role patch) ->- Post (guilds // guild /: "roles" // role) (pure (R.ReqBodyJson patch)) mempty+ Patch (guilds // guild /: "roles" // role) (R.ReqBodyJson patch) mempty (DeleteGuildRole guild role) -> Delete (guilds // guild /: "roles" // role) mempty@@ -463,3 +463,4 @@ (GetGuildVanityURL guild) -> Get (guilds // guild /: "vanity-url") mempty+
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.1.3)"+ agent = "DiscordBot (https://github.com/aquarial/discord-haskell, 1.2.0)" -- Append to an URL infixl 5 //
src/Discord/Internal/Types/Channel.hs view
@@ -4,6 +4,7 @@ -- | Data structures pertaining to Discord Channels module Discord.Internal.Types.Channel where +import Control.Applicative (empty) import Data.Aeson import Data.Aeson.Types (Parser) import Data.Default (Default, def)@@ -251,7 +252,7 @@ -- the message , messageAttachments :: [Attachment] -- ^ Any attached files , messageEmbeds :: [Embed] -- ^ Any embedded content- , messageNonce :: Maybe Snowflake -- ^ Used for validating if a message+ , messageNonce :: Maybe Nonce -- ^ Used for validating if a message -- was sent , messagePinned :: Bool -- ^ Whether this message is pinned , messageGuild :: Maybe GuildId -- ^ The guild the message went to@@ -453,3 +454,11 @@ T.Text Bool deriving (Show, Eq, Ord)++newtype Nonce = Nonce T.Text+ deriving (Show, Eq, Ord)++instance FromJSON Nonce where+ parseJSON (String nonce) = pure $ Nonce nonce+ parseJSON (Number nonce) = pure . Nonce . T.pack . show $ nonce+ parseJSON _ = empty
src/Discord/Internal/Types/Guild.hs view
@@ -143,7 +143,7 @@ -- (guild) and channel context. data Role = Role {- roleID :: RoleId -- ^ The role id+ roleId :: RoleId -- ^ The role id , roleName :: T.Text -- ^ The role name , roleColor :: Integer -- ^ Integer representation of color code , roleHoist :: Bool -- ^ If the role is pinned in the user listing@@ -170,7 +170,7 @@ , voiceRegionName :: T.Text -- ^ Name of the region , voiceRegionVip :: Bool -- ^ True if this is a VIP only server , voiceRegionOptimal :: Bool -- ^ True for the closest server to a client- , voiceRegionDepreciated :: Bool -- ^ Whether this is a deprecated region+ , voiceRegionDeprecated :: Bool -- ^ Whether this is a deprecated region , voiceRegionCustom :: Bool -- ^ Whether this is a custom region } deriving (Show, Eq, Ord)