forked from serenity-rs/serenity
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Overhaul usage of the builder pattern (serenity-rs#2024)
- Loading branch information
1 parent
994da26
commit dd4e669
Showing
75 changed files
with
4,203 additions
and
4,266 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
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 |
---|---|---|
@@ -1,28 +1,26 @@ | ||
use serenity::builder; | ||
use serenity::builder::{CreateApplicationCommand, CreateApplicationCommandOption}; | ||
use serenity::model::prelude::command::CommandOptionType; | ||
|
||
pub fn register( | ||
command: &mut builder::CreateApplicationCommand, | ||
) -> &mut builder::CreateApplicationCommand { | ||
command | ||
pub fn register() -> CreateApplicationCommand { | ||
CreateApplicationCommand::default() | ||
.name("numberinput") | ||
.description("Test command for number input") | ||
.create_option(|option| { | ||
option | ||
.add_option( | ||
CreateApplicationCommandOption::default() | ||
.name("int") | ||
.description("An integer from 5 to 10") | ||
.kind(CommandOptionType::Integer) | ||
.min_int_value(5) | ||
.max_int_value(10) | ||
.required(true) | ||
}) | ||
.create_option(|option| { | ||
option | ||
.required(true), | ||
) | ||
.add_option( | ||
CreateApplicationCommandOption::default() | ||
.name("number") | ||
.description("A float from -3.3 to 234.5") | ||
.kind(CommandOptionType::Number) | ||
.min_number_value(-3.3) | ||
.max_number_value(234.5) | ||
.required(true) | ||
}) | ||
.required(true), | ||
) | ||
} |
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
4 changes: 2 additions & 2 deletions
4
examples/e14_slash_commands/src/commands/wonderful_command.rs
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,5 +1,5 @@ | ||
use serenity::builder::CreateApplicationCommand; | ||
|
||
pub fn register(command: &mut CreateApplicationCommand) -> &mut CreateApplicationCommand { | ||
command.name("wonderful_command").description("An amazing command") | ||
pub fn register() -> CreateApplicationCommand { | ||
CreateApplicationCommand::default().name("wonderful_command").description("An amazing 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
Oops, something went wrong.