Skip to content

Commit

Permalink
Change type of ChannelFollowRequest.webhookChannelId from String to S…
Browse files Browse the repository at this point in the history
  • Loading branch information
lukellmann committed Aug 30, 2021
1 parent 9784b5a commit 6dfd861
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
11 changes: 5 additions & 6 deletions core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package dev.kord.core.behavior.channel

import dev.kord.common.annotation.KordPreview
import dev.kord.common.entity.ArchiveDuration
import dev.kord.common.entity.ChannelType
import dev.kord.common.entity.Permission
Expand Down Expand Up @@ -63,14 +62,14 @@ interface NewsChannelBehavior : ThreadParentChannelBehavior {
* @throws [RequestException] if something went wrong during the request.
*/
suspend fun follow(target: Snowflake) {
kord.rest.channel.followNewsChannel(id, ChannelFollowRequest(webhookChannelId = target.asString))
kord.rest.channel.followNewsChannel(id, ChannelFollowRequest(webhookChannelId = target))
}


suspend fun startPublicThread(
name: String,
archiveDuration: ArchiveDuration = ArchiveDuration.Day,
reason: String? = null
reason: String? = null,
): NewsChannelThread {
return unsafeStartThread(name, archiveDuration, ChannelType.PublicNewsThread, reason) as NewsChannelThread
}
Expand All @@ -79,7 +78,7 @@ interface NewsChannelBehavior : ThreadParentChannelBehavior {
messageId: Snowflake,
name: String,
archiveDuration: ArchiveDuration = ArchiveDuration.Day,
reason: String? = null
reason: String? = null,
): NewsChannelThread {
return unsafeStartPublicThreadWithMessage(messageId, name, archiveDuration, reason) as NewsChannelThread
}
Expand All @@ -101,7 +100,7 @@ fun NewsChannelBehavior(
guildId: Snowflake,
id: Snowflake,
kord: Kord,
strategy: EntitySupplyStrategy<*> = kord.resources.defaultStrategy
strategy: EntitySupplyStrategy<*> = kord.resources.defaultStrategy,
): NewsChannelBehavior = object : NewsChannelBehavior {
override val guildId: Snowflake = guildId
override val id: Snowflake = id
Expand Down Expand Up @@ -137,4 +136,4 @@ suspend inline fun NewsChannelBehavior.edit(builder: NewsChannelModifyBuilder.()
val data = ChannelData.from(response)

return Channel.from(data, kord) as NewsChannel
}
}
3 changes: 2 additions & 1 deletion rest/src/main/kotlin/json/request/ChannelFollowRequest.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package dev.kord.rest.json.request

import dev.kord.common.entity.Snowflake
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
class ChannelFollowRequest(
@SerialName("webhook_channel_id")
val webhookChannelId: String
val webhookChannelId: Snowflake,
)

0 comments on commit 6dfd861

Please sign in to comment.