aboutsummaryrefslogtreecommitdiff
path: root/src/ext/framework
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2017-01-23 12:16:06 -0800
committerAustin Hellyer <[email protected]>2017-01-23 12:16:06 -0800
commit651c618f17cb92d3ea9bbd1d5f5c92a015ff64e0 (patch)
treedcf452e8fe73411af331678a769cb769a32dd12e /src/ext/framework
parentFix no-framework compilation (diff)
downloadserenity-651c618f17cb92d3ea9bbd1d5f5c92a015ff64e0.tar.xz
serenity-651c618f17cb92d3ea9bbd1d5f5c92a015ff64e0.zip
Switch to a mostly-fully OOP approach
The context is now strictly in relation to the context of the current channel related to the event, if any. See Context::say for a list of events that the context can be used for.
Diffstat (limited to 'src/ext/framework')
-rw-r--r--src/ext/framework/help_commands.rs21
-rw-r--r--src/ext/framework/mod.rs2
2 files changed, 11 insertions, 12 deletions
diff --git a/src/ext/framework/help_commands.rs b/src/ext/framework/help_commands.rs
index 87b69a0..863f3fd 100644
--- a/src/ext/framework/help_commands.rs
+++ b/src/ext/framework/help_commands.rs
@@ -7,8 +7,8 @@ use ::client::Context;
use ::model::Message;
use ::utils::Colour;
-fn error_embed(ctx: &mut Context, message: &Message, input: &str) {
- let _ = ctx.send_message(message.channel_id, |m| m
+fn error_embed(ctx: &mut Context, input: &str) {
+ let _ = ctx.send_message(|m| m
.embed(|e| e
.colour(Colour::dark_red())
.description(input)));
@@ -27,7 +27,7 @@ fn remove_aliases(cmds: &HashMap<String, CommandOrAlias>) -> HashMap<&String, &I
}
pub fn with_embeds(ctx: &mut Context,
- message: &Message,
+ _: &Message,
groups: HashMap<String, Arc<CommandGroup>>,
args: Vec<String>) -> Result<(), String> {
if !args.is_empty() {
@@ -49,7 +49,7 @@ pub fn with_embeds(ctx: &mut Context,
found = Some((command_name, cmd));
},
CommandOrAlias::Alias(ref name) => {
- error_embed(ctx, message, &format!("Did you mean \"{}\"?", name));
+ error_embed(ctx, &format!("Did you mean \"{}\"?", name));
return Ok(());
}
}
@@ -58,12 +58,12 @@ pub fn with_embeds(ctx: &mut Context,
if let Some((command_name, command)) = found {
if !command.help_available {
- error_embed(ctx, message, "**Error**: No help available.");
+ error_embed(ctx, "**Error**: No help available.");
return Ok(());
}
- let _ = ctx.send_message(message.channel_id, |m| {
+ let _ = ctx.send_message(|m| {
m.embed(|e| {
let mut embed = e.colour(Colour::rosewater())
.title(command_name);
@@ -110,13 +110,13 @@ pub fn with_embeds(ctx: &mut Context,
}
let error_msg = format!("**Error**: Command `{}` not found.", name);
- error_embed(ctx, message, &error_msg);
+ error_embed(ctx, &error_msg);
return Ok(());
}
- let _ = ctx.send_message(message.channel_id, |m| {
- m.embed(|mut e| {
+ let _ = ctx.send_message(|m| m
+ .embed(|mut e| {
e = e.colour(Colour::rosewater())
.description("To get help with an individual command, pass its \
name as an argument to this command.");
@@ -146,8 +146,7 @@ pub fn with_embeds(ctx: &mut Context,
}
e
- })
- });
+ }));
Ok(())
}
diff --git a/src/ext/framework/mod.rs b/src/ext/framework/mod.rs
index ccb81f1..988d3a3 100644
--- a/src/ext/framework/mod.rs
+++ b/src/ext/framework/mod.rs
@@ -360,7 +360,7 @@ impl Framework {
return;
}
- #[cfg(all(feature="cache", feature="methods"))]
+ #[cfg(feature="cache")]
{
if !self.configuration.allow_dm && message.is_private() {
if let Some(ref message) = self.configuration.no_dm_message {