-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
306d50a
commit 6239590
Showing
19 changed files
with
193 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@buape/carbon": patch | ||
--- | ||
|
||
fix: component registering |
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
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { | ||
ApplicationCommandType, | ||
Command, | ||
type CommandInteraction | ||
} from "@buape/carbon" | ||
|
||
export default class MessageCommand extends Command { | ||
name = "Message Command" | ||
description = "Message command test" | ||
defer = true | ||
type = ApplicationCommandType.Message | ||
|
||
async run(interaction: CommandInteraction) { | ||
interaction.reply({ content: "Message command" }) | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { | ||
Command, | ||
type CommandInteraction, | ||
Modal, | ||
type ModalInteraction, | ||
Row, | ||
TextInput, | ||
TextInputStyle | ||
} from "@buape/carbon" | ||
|
||
export default class ModalCommand extends Command { | ||
name = "modal" | ||
description = "Modal test" | ||
|
||
modals = [TestModal] | ||
|
||
async run(interaction: CommandInteraction) { | ||
await interaction.showModal(new TestModal()) | ||
} | ||
} | ||
|
||
class TestModal extends Modal { | ||
title = "Test Modal" | ||
customId = "test-modal" | ||
|
||
components = [ | ||
new Row([new TextInputHi()]), | ||
new Row([new TextInputName()]), | ||
new Row([new TextInputAge()]), | ||
new Row([new TextInputColor()]), | ||
new Row([new TextInputHeight()]) | ||
] | ||
|
||
run(interaction: ModalInteraction) { | ||
return interaction.reply({ | ||
content: `Hi ${interaction.fields.getText("name")}, you are ${interaction.fields.getText("age")} years old, and your favorite color is ${interaction.fields.getText("color")}. You are ${interaction.fields.getText("height") || "not"} tall.` | ||
}) | ||
} | ||
} | ||
|
||
class TextInputHi extends TextInput { | ||
label = "Hi, how are you?" | ||
customId = "hi" | ||
style = TextInputStyle.Paragraph | ||
} | ||
|
||
class TextInputColor extends TextInput { | ||
label = "What is your favorite color?" | ||
customId = "color" | ||
} | ||
|
||
class TextInputAge extends TextInput { | ||
label = "How old are you?" | ||
customId = "age" | ||
} | ||
|
||
class TextInputName extends TextInput { | ||
label = "What is your name?" | ||
customId = "name" | ||
} | ||
|
||
class TextInputHeight extends TextInput { | ||
label = "How tall are you?" | ||
customId = "height" | ||
required = false | ||
} |
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
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
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
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