Skip to content

Commit

Permalink
Use GuildMultiApplicationCommandBuilder in lambda types (small fix for
Browse files Browse the repository at this point in the history
  • Loading branch information
lukellmann committed May 16, 2022
1 parent 80b4b9c commit 9356d37
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion core/src/main/kotlin/Kord.kt
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ public class Kord(

public suspend inline fun createGuildApplicationCommands(
guildId: Snowflake,
builder: MultiApplicationCommandBuilder.() -> Unit,
builder: GuildMultiApplicationCommandBuilder.() -> Unit,
): Flow<GuildApplicationCommand> {
contract { callsInPlace(builder, InvocationKind.EXACTLY_ONCE) }

Expand Down
7 changes: 2 additions & 5 deletions core/src/main/kotlin/behavior/GuildBehavior.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ import dev.kord.rest.builder.auditlog.AuditLogGetRequestBuilder
import dev.kord.rest.builder.ban.BanCreateBuilder
import dev.kord.rest.builder.channel.*
import dev.kord.rest.builder.guild.*
import dev.kord.rest.builder.interaction.ChatInputCreateBuilder
import dev.kord.rest.builder.interaction.MessageCommandCreateBuilder
import dev.kord.rest.builder.interaction.MultiApplicationCommandBuilder
import dev.kord.rest.builder.interaction.UserCommandCreateBuilder
import dev.kord.rest.builder.interaction.*
import dev.kord.rest.builder.role.RoleCreateBuilder
import dev.kord.rest.builder.role.RolePositionsModifyBuilder
import dev.kord.rest.json.JsonErrorCode
Expand Down Expand Up @@ -656,7 +653,7 @@ public suspend inline fun GuildBehavior.createUserCommand(


public suspend inline fun GuildBehavior.createApplicationCommands(
builder: MultiApplicationCommandBuilder.() -> Unit
builder: GuildMultiApplicationCommandBuilder.() -> Unit
): Flow<GuildApplicationCommand> {
contract { callsInPlace(builder, InvocationKind.EXACTLY_ONCE) }
return kord.createGuildApplicationCommands(id, builder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,22 @@ public interface ApplicationCommandCreateBuilder : LocalizedNameCreateBuilder,
public val type: ApplicationCommandType

/**
* Disables the command for everyone by default.
* Disables the command for everyone except admins by default.
*
* **This does not ensure normal users cannot execute the command, any server owner can change this setting**
* **This does not ensure normal users cannot execute the command, any admin can change this setting.**
*/
public fun disableCommandInGuilds() {
defaultMemberPermissions = Permissions()
}
}

@KordDsl
public interface GlobalApplicationCommandCreateBuilder : ApplicationCommandCreateBuilder,
RequestBuilder<ApplicationCommandCreateRequest> {
public interface GlobalApplicationCommandCreateBuilder : ApplicationCommandCreateBuilder {
public var dmPermission: Boolean?
}

@KordDsl
public interface GlobalApplicationCommandModifyBuilder : ApplicationCommandModifyBuilder,
RequestBuilder<ApplicationCommandModifyRequest> {
public interface GlobalApplicationCommandModifyBuilder : ApplicationCommandModifyBuilder {
public var dmPermission: Boolean?
}

Expand Down
1 change: 1 addition & 0 deletions rest/src/main/kotlin/route/Route.kt
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,7 @@ public sealed class Route<T>(
DiscordGuildApplicationCommandPermissions.serializer()
)


/*
* Guild Scheduled Event:
* https://discord.com/developers/docs/resources/guild-scheduled-event
Expand Down

0 comments on commit 9356d37

Please sign in to comment.