discord-haskell 1.19.0 → 1.20.0
raw patch · 6 files changed
+49/−18 lines, 6 filesdep ~aesondep ~containersdep ~timePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aeson, containers, time
API changes (from Hackage documentation)
- Discord.Internal.Types: [auditLogEntryReasons] :: AuditLogEntry -> Maybe String
- Discord.Internal.Types.AuditLog: [auditLogEntryReasons] :: AuditLogEntry -> Maybe String
- Discord.Types: [auditLogEntryReasons] :: AuditLogEntry -> Maybe String
+ Discord.Internal.Rest.Channel: maxChannelMessagesRequestNumber :: Int
+ Discord.Internal.Types: [auditLogEntryReason] :: AuditLogEntry -> Maybe String
+ Discord.Internal.Types.AuditLog: [auditLogEntryReason] :: AuditLogEntry -> Maybe String
+ Discord.Internal.Types.Events: ReactionRemoveAllInfo :: ChannelId -> MessageId -> Maybe GuildId -> ReactionRemoveAllInfo
+ Discord.Internal.Types.Events: [reactionRemoveAllChannelId] :: ReactionRemoveAllInfo -> ChannelId
+ Discord.Internal.Types.Events: [reactionRemoveAllGuildId] :: ReactionRemoveAllInfo -> Maybe GuildId
+ Discord.Internal.Types.Events: [reactionRemoveAllMessageId] :: ReactionRemoveAllInfo -> MessageId
+ Discord.Internal.Types.Events: data ReactionRemoveAllInfo
+ Discord.Internal.Types.Events: instance Data.Aeson.Types.FromJSON.FromJSON Discord.Internal.Types.Events.ReactionRemoveAllInfo
+ Discord.Internal.Types.Events: instance GHC.Classes.Eq Discord.Internal.Types.Events.ReactionRemoveAllInfo
+ Discord.Internal.Types.Events: instance GHC.Classes.Ord Discord.Internal.Types.Events.ReactionRemoveAllInfo
+ Discord.Internal.Types.Events: instance GHC.Read.Read Discord.Internal.Types.Events.ReactionRemoveAllInfo
+ Discord.Internal.Types.Events: instance GHC.Show.Show Discord.Internal.Types.Events.ReactionRemoveAllInfo
+ Discord.Types: ReactionRemoveAllInfo :: ChannelId -> MessageId -> Maybe GuildId -> ReactionRemoveAllInfo
+ Discord.Types: [auditLogEntryReason] :: AuditLogEntry -> Maybe String
+ Discord.Types: [reactionRemoveAllChannelId] :: ReactionRemoveAllInfo -> ChannelId
+ Discord.Types: [reactionRemoveAllGuildId] :: ReactionRemoveAllInfo -> Maybe GuildId
+ Discord.Types: [reactionRemoveAllMessageId] :: ReactionRemoveAllInfo -> MessageId
+ Discord.Types: data ReactionRemoveAllInfo
- Discord.Internal.Types.Events: GuildAuditLogEntryCreate :: AuditLogEntry -> Event
+ Discord.Internal.Types.Events: GuildAuditLogEntryCreate :: GuildId -> AuditLogEntry -> Event
- Discord.Internal.Types.Events: InternalGuildAuditLogEntryCreate :: AuditLogEntry -> EventInternalParse
+ Discord.Internal.Types.Events: InternalGuildAuditLogEntryCreate :: GuildId -> AuditLogEntry -> EventInternalParse
- Discord.Internal.Types.Events: InternalMessageReactionRemoveAll :: ChannelId -> MessageId -> EventInternalParse
+ Discord.Internal.Types.Events: InternalMessageReactionRemoveAll :: ReactionRemoveAllInfo -> EventInternalParse
- Discord.Internal.Types.Events: MessageReactionRemoveAll :: ChannelId -> MessageId -> Event
+ Discord.Internal.Types.Events: MessageReactionRemoveAll :: ReactionRemoveAllInfo -> Event
- Discord.Types: GuildAuditLogEntryCreate :: AuditLogEntry -> Event
+ Discord.Types: GuildAuditLogEntryCreate :: GuildId -> AuditLogEntry -> Event
- Discord.Types: MessageReactionRemoveAll :: ChannelId -> MessageId -> Event
+ Discord.Types: MessageReactionRemoveAll :: ReactionRemoveAllInfo -> Event
Files
- changelog.md +11/−0
- discord-haskell.cabal +4/−4
- src/Discord/Internal/Rest/Channel.hs +9/−1
- src/Discord/Internal/Types.hs +2/−2
- src/Discord/Internal/Types/AuditLog.hs +2/−2
- src/Discord/Internal/Types/Events.hs +21/−9
changelog.md view
@@ -4,6 +4,17 @@ The Discord API constantly changes. This library issues updates when we implement new features added to the API or remove outdated functionalities. In order to interact with the Discord API safely and predictably, please update the library whenever there is a new version released. +## 1.20.0++- [isaacthekind](https://github.com/discord-haskell/discord-haskell/pull/264) [**Breaking**] Fix `ReactionRemoveInfo` swapping its guild and channel IDs+- [isaacthekind](https://github.com/discord-haskell/discord-haskell/pull/265) [**Breaking**] Add `GuildAuditLogEntryCreate.guild_id` field+- [isaacthekind](https://github.com/discord-haskell/discord-haskell/pull/266) [**Breaking**] Add `MessageReactionRemoveAll.guild_id` field+- [yutotakano](https://github.com/discord-haskell/discord-haskell/pull/260) [**Breaking**] Rename `AuditLogEntry.auditLogEntryReasons` to `auditLogEntryReason`+- [L0neGamer](https://github.com/discord-haskell/discord-haskell/pull/253) Remove trailing zeros in dependency list+- [stanekondrej](https://github.com/discord-haskell/discord-haskell/pull/257) Add `maxChannelMessagesRequestNumber` (= 100)+- [dajiaohuang](https://github.com/discord-haskell/discord-haskell/pull/258) Fix documentation links and guidance from Discord+- [yutotakano](https://github.com/discord-haskell/discord-haskell/pull/263) Bump dependency upper bounds to allow `containers 0.8`, `time 1.16`, and `aeson 2.3`+ ## 1.19.0 - [ShapeOfMatter](https://github.com/discord-haskell/discord-haskell/pull/231) Fix broken parsing of channel IDs in STAGE_INSTANCE and VOICE scheduled events
discord-haskell.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.0 name: discord-haskell-version: 1.19.0+version: 1.20.0 description: Functions and data types to write discord bots. Official discord docs <https://discord.com/developers/docs/reference>. .@@ -182,11 +182,11 @@ -- 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.*, == 9.6.*, == 9.8.*, == 9.10.*, == 9.12.*, == 9.14.* base == 4.14.* || == 4.15.* || == 4.16.* || == 4.17.* || == 4.18.* || == 4.19.* || == 4.20.* || == 4.21.* || == 4.22.*,- aeson >= 2.0 && < 2.3,+ aeson >= 2.0 && < 2.4, async >=2.2 && <2.3, bytestring >=0.10 && <0.13, base64-bytestring >=1.1 && <1.3,- containers >=0.6 && <0.8,+ containers >=0.6 && <0.9, data-default >=0.7 && <0.9, emojis >=0.1.3 && <0.2, hashable >= 1.4.0.0 && <1.6,@@ -196,7 +196,7 @@ req >=3.9 && <3.14, safe-exceptions >=0.1 && <0.2, text >=1.2 && <3,- time >=1.9 && <1.15,+ time >=1.9 && <1.17, websockets >=0.12 && <0.14, network >=3 && <3.3, wuss >=1.1 && <3,
src/Discord/Internal/Rest/Channel.hs view
@@ -19,6 +19,8 @@ , StartThreadForumMediaOpts(..) , StartThreadForumMediaMessage(..) , ListThreads(..)++ , maxChannelMessagesRequestNumber ) where @@ -46,7 +48,7 @@ ModifyChannel :: ChannelId -> ModifyChannelOpts -> ChannelRequest Channel -- | Deletes a channel if its id doesn't equal to the id of guild. DeleteChannel :: ChannelId -> ChannelRequest Channel- -- | Gets a messages from a channel with limit of 100 per request.+ -- | Gets messages from a channel with a limit of `maxChannelMessagesRequestNumber` per request. GetChannelMessages :: ChannelId -> (Int, MessageTiming) -> ChannelRequest [Message] -- | Gets a message in a channel by its id. GetChannelMessage :: (ChannelId, MessageId) -> ChannelRequest Message@@ -126,6 +128,12 @@ -- threads, thread members, and whether there are more to collect. -- Requires both the READ_MESSAGE_HISTORY and MANAGE_THREADS permissions. ListJoinedPrivateArchivedThreads :: ChannelId -> (Maybe UTCTime, Maybe Integer) -> ChannelRequest ListThreads++-- | The maximum number of messages you can get in a request for all of the+-- messages in a channel. See the @limit@ query parameter at+-- <https://docs.discord.com/developers/resources/message#get-channel-messages>.+maxChannelMessagesRequestNumber :: Int+maxChannelMessagesRequestNumber = 100 -- | Options for `CreateMessageDetailed` requests.
src/Discord/Internal/Types.hs view
@@ -73,11 +73,11 @@ InternalMessageCreate a -> MessageCreate a InternalMessageUpdate a b -> MessageUpdate a b InternalMessageDelete a b -> MessageDelete a b- InternalGuildAuditLogEntryCreate a -> GuildAuditLogEntryCreate a+ InternalGuildAuditLogEntryCreate a b -> GuildAuditLogEntryCreate a b InternalMessageDeleteBulk a b -> MessageDeleteBulk a b InternalMessageReactionAdd a -> MessageReactionAdd a InternalMessageReactionRemove a -> MessageReactionRemove a- InternalMessageReactionRemoveAll a b -> MessageReactionRemoveAll a b+ InternalMessageReactionRemoveAll a -> MessageReactionRemoveAll a InternalMessageReactionRemoveEmoji a -> MessageReactionRemoveEmoji a InternalPresenceUpdate a -> PresenceUpdate a InternalTypingStart a -> TypingStart a
src/Discord/Internal/Types/AuditLog.hs view
@@ -59,7 +59,7 @@ , auditLogEntryTargetId :: Maybe Snowflake , auditLogEntryChanges :: Maybe [AuditLogChange] , auditLogEntryOptions :: Maybe AuditLogEntryOptions - , auditLogEntryReasons :: Maybe String + , auditLogEntryReason :: Maybe String } deriving ( Eq, Show, Read ) instance FromJSON AuditLogEntry where @@ -70,7 +70,7 @@ <*> o .:? "target_id" <*> o .:? "changes" <*> o .:? "options" - <*> o .:? "reasons" + <*> o .:? "reason" newtype AuditLogEvent = MkAuditLogEvent Int deriving ( Eq, Show, Read )
src/Discord/Internal/Types/Events.hs view
@@ -69,7 +69,7 @@ -- | guild became unavailable, or user left/was removed from a guild | GuildDelete GuildUnavailable -- | new entry to the audit log was added- | GuildAuditLogEntryCreate AuditLogEntry+ | GuildAuditLogEntryCreate GuildId AuditLogEntry -- | user was banned from a guild | GuildBanAdd GuildId User -- | user was unbanned from a guild@@ -105,7 +105,7 @@ -- | user removed a reaction from a message | MessageReactionRemove ReactionInfo -- | all reactions were explicitly removed from a message- | MessageReactionRemoveAll ChannelId MessageId+ | MessageReactionRemoveAll ReactionRemoveAllInfo -- | all reactions for a given emoji were explicitly removed from a message | MessageReactionRemoveEmoji ReactionRemoveInfo -- | user was updated@@ -145,7 +145,7 @@ | InternalGuildCreate Guild GuildCreateData | InternalGuildUpdate Guild | InternalGuildDelete GuildUnavailable- | InternalGuildAuditLogEntryCreate AuditLogEntry+ | InternalGuildAuditLogEntryCreate GuildId AuditLogEntry | InternalGuildBanAdd GuildId User | InternalGuildBanRemove GuildId User | InternalGuildEmojiUpdate GuildId [Emoji]@@ -163,7 +163,7 @@ | InternalMessageDeleteBulk ChannelId [MessageId] | InternalMessageReactionAdd ReactionInfo | InternalMessageReactionRemove ReactionInfo- | InternalMessageReactionRemoveAll ChannelId MessageId+ | InternalMessageReactionRemoveAll ReactionRemoveAllInfo | InternalMessageReactionRemoveEmoji ReactionRemoveInfo | InternalPresenceUpdate PresenceInfo | InternalTypingStart TypingInfo@@ -234,6 +234,19 @@ <*> o .: "message_id" <*> o .: "emoji" +-- | Structure containing information about all reactions that have been removed from a message+data ReactionRemoveAllInfo = ReactionRemoveAllInfo+ { reactionRemoveAllChannelId :: ChannelId -- ^ Channel in which the message is+ , reactionRemoveAllMessageId :: MessageId -- ^ The message the reactions were removed from+ , reactionRemoveAllGuildId :: Maybe GuildId -- ^ Guild in which the message is (if any)+ } deriving (Show, Read, Eq, Ord)++instance FromJSON ReactionRemoveAllInfo where+ parseJSON = withObject "ReactionRemoveAllInfo" $ \o ->+ ReactionRemoveAllInfo <$> o .: "channel_id"+ <*> o .: "message_id"+ <*> o .:? "guild_id"+ -- | Structure containing information about a reaction that has been removed data ReactionRemoveInfo = ReactionRemoveInfo { reactionRemoveChannelId :: ChannelId@@ -244,8 +257,8 @@ instance FromJSON ReactionRemoveInfo where parseJSON = withObject "ReactionRemoveInfo" $ \o ->- ReactionRemoveInfo <$> o .: "guild_id"- <*> o .: "channel_id"+ ReactionRemoveInfo <$> o .: "channel_id"+ <*> o .: "guild_id" <*> o .: "message_id" <*> o .: "emoji" @@ -357,7 +370,7 @@ "GUILD_CREATE" -> parseGuildCreate o "GUILD_UPDATE" -> InternalGuildUpdate <$> reparse o "GUILD_DELETE" -> InternalGuildDelete <$> reparse o- "GUILD_AUDIT_LOG_ENTRY_CREATE" -> InternalGuildAuditLogEntryCreate <$> reparse o+ "GUILD_AUDIT_LOG_ENTRY_CREATE" -> InternalGuildAuditLogEntryCreate <$> o .: "guild_id" <*> reparse o "GUILD_BAN_ADD" -> InternalGuildBanAdd <$> o .: "guild_id" <*> o .: "user" "GUILD_BAN_REMOVE" -> InternalGuildBanRemove <$> o .: "guild_id" <*> o .: "user" "GUILD_EMOJI_UPDATE" -> InternalGuildEmojiUpdate <$> o .: "guild_id" <*> o .: "emojis"@@ -378,8 +391,7 @@ "MESSAGE_DELETE_BULK" -> InternalMessageDeleteBulk <$> o .: "channel_id" <*> o .: "ids" "MESSAGE_REACTION_ADD" -> InternalMessageReactionAdd <$> reparse o "MESSAGE_REACTION_REMOVE" -> InternalMessageReactionRemove <$> reparse o- "MESSAGE_REACTION_REMOVE_ALL" -> InternalMessageReactionRemoveAll <$> o .: "channel_id"- <*> o .: "message_id"+ "MESSAGE_REACTION_REMOVE_ALL" -> InternalMessageReactionRemoveAll <$> reparse o "MESSAGE_REACTION_REMOVE_EMOJI" -> InternalMessageReactionRemoveEmoji <$> reparse o "PRESENCE_UPDATE" -> InternalPresenceUpdate <$> reparse o "TYPING_START" -> InternalTypingStart <$> reparse o