Skip to content

Commit

Permalink
Rename username to name in webhook things
Browse files Browse the repository at this point in the history
Ref: #71
  • Loading branch information
simmsb committed Jul 11, 2024
1 parent 130fbd7 commit 5cfffaa
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions calamity/Calamity/HTTP/Webhook.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import Network.Mime
import Optics

data CreateWebhookData = CreateWebhookData
{ username :: Maybe Text
{ name :: Maybe Text
, avatar :: Maybe Text
-- ^ The avatar field should be in discord's image data format: https://discord.com/developers/docs/reference#image-data
}
Expand All @@ -35,15 +35,15 @@ data CreateWebhookData = CreateWebhookData

instance CalamityToJSON' CreateWebhookData where
toPairs CreateWebhookData {..} =
[ "username" .?= username
[ "name" .?= name
, "avatar" .?= avatar
]

instance Default CreateWebhookData where
def = CreateWebhookData Nothing Nothing

data ModifyWebhookData = ModifyWebhookData
{ username :: Maybe Text
{ name :: Maybe Text
, avatar :: Maybe Text
-- ^ The avatar field should be in discord's image data format: https://discord.com/developers/docs/reference#image-data
, channelID :: Maybe (Snowflake Channel)
Expand All @@ -53,7 +53,7 @@ data ModifyWebhookData = ModifyWebhookData

instance CalamityToJSON' ModifyWebhookData where
toPairs ModifyWebhookData {..} =
[ "username" .?= username
[ "name" .?= name
, "avatar" .?= avatar
, "channel_id" .?= channelID
]
Expand All @@ -66,7 +66,7 @@ data ExecuteWebhookOptions = ExecuteWebhookOptions
, content :: Maybe Text
, attachments :: [CreateMessageAttachment]
, embeds :: Maybe [Embed]
, username :: Maybe Text
, name :: Maybe Text
, avatarUrl :: Maybe Text
, allowedMentions :: Maybe AllowedMentions
, tts :: Maybe Bool
Expand Down Expand Up @@ -95,7 +95,7 @@ instance CalamityToJSON' CreateMessageAttachmentJson where
data ExecuteWebhookJson = ExecuteWebhookJson
{ content :: Maybe Text
, embeds :: Maybe [Embed]
, username :: Maybe Text
, name :: Maybe Text
, avatarUrl :: Maybe Text
, tts :: Maybe Bool
, attachments :: [CreateMessageAttachmentJson]
Expand Down Expand Up @@ -207,7 +207,7 @@ instance Request (WebhookRequest a) where
jsonBody =
ExecuteWebhookJson
{ content = wh ^. #content
, username = wh ^. #username
, name = wh ^. #name
, avatarUrl = wh ^. #avatarUrl
, tts = wh ^. #tts
, embeds = wh ^. #embeds
Expand Down

0 comments on commit 5cfffaa

Please sign in to comment.