aboutsummaryrefslogtreecommitdiff
path: root/src/framework
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-10-18 12:06:09 -0700
committerZeyla Hellyer <[email protected]>2017-10-18 12:06:09 -0700
commit65e3279ce7b3c4807e8b1310551e9493d3868b94 (patch)
tree1a0cea555659bd7f77e37a1b00d51c3ad102d546 /src/framework
parentSlightly improve performance of builders (diff)
downloadserenity-65e3279ce7b3c4807e8b1310551e9493d3868b94.tar.xz
serenity-65e3279ce7b3c4807e8b1310551e9493d3868b94.zip
Change CreateEmbed::field{,s} to not take builders
Change the `field` and `fields` methods on `builder::CreateEmbed` to not accept a `CreateEmbedField` builder. The embed field builder realistically only had (and most likely, only will) have one optional argument, so the parameters may as well be on `CreateEmbed::field`.
Diffstat (limited to 'src/framework')
-rw-r--r--src/framework/standard/help_commands.rs27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/framework/standard/help_commands.rs b/src/framework/standard/help_commands.rs
index ce90e74..ce3e406 100644
--- a/src/framework/standard/help_commands.rs
+++ b/src/framework/standard/help_commands.rs
@@ -51,7 +51,7 @@ fn remove_aliases(cmds: &HashMap<String, CommandOrAlias>) -> HashMap<&String, &I
result
}
-/// Checks whether a user is member of required roles
+/// Checks whether a user is member of required roles
/// and given the required permissions.
pub fn has_all_requirements(cmd: &Command, msg: &Message) -> bool {
if let Some(guild) = msg.guild() {
@@ -116,7 +116,7 @@ pub fn with_embeds(_: &mut Context,
}
else {
break;
- }
+ }
},
CommandOrAlias::Alias(ref name) => {
let actual_command = group.commands.get(name).unwrap();
@@ -157,26 +157,25 @@ pub fn with_embeds(_: &mut Context,
}
if let Some(ref usage) = command.usage {
- embed = embed.field(|f| {
- f.name("Usage")
- .value(&format!("`{} {}`", command_name, usage))
- });
+ let value = format!("`{} {}`", command_name, usage);
+
+ embed = embed.field("Usage", value, true);
}
if let Some(ref example) = command.example {
- embed = embed.field(|f| {
- f.name("Sample usage")
- .value(&format!("`{} {}`", command_name, example))
- });
+ let value = format!("`{} {}`", command_name, example);
+
+ embed = embed.field("Sample usage", value, true);
}
if group_name != "Ungrouped" {
- embed = embed.field(|f| f.name("Group").value(&group_name));
+ embed = embed.field("Group", group_name, true);
}
if !command.aliases.is_empty() {
let aliases = command.aliases.join(", ");
- embed = embed.field(|f| f.name("Aliases").value(&aliases));
+
+ embed = embed.field("Aliases", aliases, true);
}
let available = if command.dm_only {
@@ -187,7 +186,7 @@ pub fn with_embeds(_: &mut Context,
"In DM and guilds"
};
- embed = embed.field(|f| f.name("Available").value(available));
+ embed = embed.field("Available", available, true);
embed
})
@@ -240,7 +239,7 @@ pub fn with_embeds(_: &mut Context,
}
if has_commands {
- e = e.field(|f| f.name(group_name).value(&desc));
+ e = e.field(&group_name[..], &desc[..], true);
}
}
e