File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -2700,7 +2700,8 @@ extension DiscordClient {
27002700
27012701 /// https://discord.com/developers/docs/resources/user#leave-guild
27022702 @inlinable
2703- public func leaveGuild( id: GuildSnowflake ) async throws -> DiscordHTTPResponse {
2703+ public func leaveGuild( id: GuildSnowflake ) async throws -> DiscordHTTPResponse
2704+ {
27042705 let endpoint = APIEndpoint . leaveGuild ( guildId: id)
27052706 return try await self . send ( request: . init( to: endpoint) )
27062707 }
@@ -2713,8 +2714,16 @@ extension DiscordClient {
27132714 ) async throws -> DiscordClientResponse < DiscordChannel > {
27142715 let endpoint = APIEndpoint . createDm
27152716 return try await self . send (
2716- request: . init( to: endpoint) ,
2717- payload: payload
2717+ request: . init(
2718+ to: endpoint,
2719+ headers: [
2720+ " X-Context-Properties " :
2721+ SuperProperties . GenerateContextPropertiesHeader (
2722+ context: . createDM
2723+ )
2724+ ]
2725+ ) ,
2726+ payload: payload,
27182727 )
27192728 }
27202729
Original file line number Diff line number Diff line change @@ -141,13 +141,15 @@ public enum SuperProperties {
141141
142142 public enum ContextPropertyContext {
143143 case createMessage
144+ case createDM
144145 }
145146 public static func GenerateContextPropertiesHeader(
146147 context: ContextPropertyContext
147148 ) -> String {
148149 let dict : [ String : Any ] =
149150 switch context {
150151 case . createMessage: [ " location " : " chat_input " ]
152+ case . createDM: [ : ]
151153 }
152154 let data = try ! JSONSerialization . data ( withJSONObject: dict, options: [ ] )
153155 return data. base64EncodedString ( )
You can’t perform that action at this time.
0 commit comments