-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow users to use #channel syntax for channel-id parameters
- Loading branch information
Showing
5 changed files
with
51 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 6 additions & 5 deletions
11
...n/de/darkatra/vrising/discord/commands/parameters/PlayerActivityFeedChannelIdParameter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
package de.darkatra.vrising.discord.commands.parameters | ||
|
||
import de.darkatra.vrising.discord.getChannelIdFromStringParameter | ||
import dev.kord.core.entity.interaction.ChatInputCommandInteraction | ||
import dev.kord.rest.builder.interaction.GlobalChatInputCreateBuilder | ||
import dev.kord.rest.builder.interaction.channel | ||
import dev.kord.rest.builder.interaction.string | ||
|
||
object PlayerActivityFeedChannelIdParameter { | ||
const val NAME = "player-activity-feed-channel" | ||
const val NAME = "player-activity-feed-channel-id" | ||
} | ||
|
||
fun GlobalChatInputCreateBuilder.addPlayerActivityFeedChannelIdParameter(required: Boolean = true) { | ||
channel( | ||
string( | ||
name = PlayerActivityFeedChannelIdParameter.NAME, | ||
description = "The channel to post the player activity feed in." | ||
description = "The id of the channel to post the player activity feed in." | ||
) { | ||
this.required = required | ||
} | ||
} | ||
|
||
fun ChatInputCommandInteraction.getPlayerActivityFeedChannelIdParameter(): String? { | ||
return command.channels[PlayerActivityFeedChannelIdParameter.NAME]?.id?.toString() | ||
return command.getChannelIdFromStringParameter(PlayerActivityFeedChannelIdParameter.NAME) | ||
} |
11 changes: 6 additions & 5 deletions
11
...n/kotlin/de/darkatra/vrising/discord/commands/parameters/PvpKillFeedChannelIdParameter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
package de.darkatra.vrising.discord.commands.parameters | ||
|
||
import de.darkatra.vrising.discord.getChannelIdFromStringParameter | ||
import dev.kord.core.entity.interaction.ChatInputCommandInteraction | ||
import dev.kord.rest.builder.interaction.GlobalChatInputCreateBuilder | ||
import dev.kord.rest.builder.interaction.channel | ||
import dev.kord.rest.builder.interaction.string | ||
|
||
object PvpKillFeedChannelIdParameter { | ||
const val NAME = "pvp-kill-feed-channel" | ||
const val NAME = "pvp-kill-feed-channel-id" | ||
} | ||
|
||
fun GlobalChatInputCreateBuilder.addPvpKillFeedChannelIdParameter(required: Boolean = true) { | ||
channel( | ||
string( | ||
name = PvpKillFeedChannelIdParameter.NAME, | ||
description = "The channel to post the pvp kill feed in." | ||
description = "The id of the channel to post the pvp kill feed in." | ||
) { | ||
this.required = required | ||
} | ||
} | ||
|
||
fun ChatInputCommandInteraction.getPvpKillFeedChannelIdParameter(): String? { | ||
return command.channels[PvpKillFeedChannelIdParameter.NAME]?.id?.toString() | ||
return command.getChannelIdFromStringParameter(PvpKillFeedChannelIdParameter.NAME) | ||
} |