aboutsummaryrefslogtreecommitdiff
path: root/src/framework/configuration.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/framework/configuration.rs')
-rw-r--r--src/framework/configuration.rs68
1 files changed, 34 insertions, 34 deletions
diff --git a/src/framework/configuration.rs b/src/framework/configuration.rs
index c104e1e..0561f87 100644
--- a/src/framework/configuration.rs
+++ b/src/framework/configuration.rs
@@ -29,37 +29,35 @@ use ::model::{GuildId, UserId};
/// [`Framework`]: struct.Framework.html
pub struct Configuration {
#[doc(hidden)]
- pub depth: usize,
- #[doc(hidden)]
- pub on_mention: Option<Vec<String>>,
+ pub allow_dm: bool,
#[doc(hidden)]
pub allow_whitespace: bool,
#[doc(hidden)]
- pub prefixes: Vec<String>,
+ pub blocked_guilds: HashSet<GuildId>,
+ #[doc(hidden)]
+ pub blocked_users: HashSet<UserId>,
+ #[doc(hidden)]
+ pub depth: usize,
+ #[doc(hidden)]
+ pub disabled_commands: HashSet<String>,
#[doc(hidden)]
pub dynamic_prefix: Option<Box<PrefixCheck>>,
#[doc(hidden)]
pub ignore_bots: bool,
#[doc(hidden)]
- pub blocked_users: HashSet<UserId>,
+ pub ignore_webhooks: bool,
#[doc(hidden)]
- pub blocked_guilds: HashSet<GuildId>,
+ pub on_mention: Option<Vec<String>>,
#[doc(hidden)]
pub owners: HashSet<UserId>,
#[doc(hidden)]
- pub disabled_commands: HashSet<String>,
- #[doc(hidden)]
- pub allow_dm: bool,
- #[doc(hidden)]
- pub ignore_webhooks: bool,
+ pub prefixes: Vec<String>,
}
impl Configuration {
- /// Whether the bot should respond to other bots.
- ///
- /// For example, if this is set to false, then the bot will respond to any other bots including itself.
- pub fn ignore_bots(mut self, ignore_bots: bool) -> Self {
- self.ignore_bots = ignore_bots;
+ /// If set to false, bot will ignore any private messages.
+ pub fn allow_dm(mut self, allow_dm: bool) -> Self {
+ self.allow_dm = allow_dm;
self
}
@@ -94,17 +92,9 @@ impl Configuration {
self
}
- /// If set to false, bot will ignore any private messages.
- pub fn allow_dm(mut self, allow_dm: bool) -> Self {
- self.allow_dm = allow_dm;
-
- self
- }
-
- /// If set to true, bot will ignore all commands called by webhooks.
- /// True by default.
- pub fn ignore_webhooks(mut self, ignore_webhooks: bool) -> Self {
- self.ignore_webhooks = ignore_webhooks;
+ /// HashSet of guild Ids where commands will be ignored.
+ pub fn blocked_guilds(mut self, guilds: HashSet<GuildId>) -> Self {
+ self.blocked_guilds = guilds;
self
}
@@ -117,13 +107,6 @@ impl Configuration {
self
}
- /// HashSet of guild Ids where commands will be ignored.
- pub fn blocked_guilds(mut self, guilds: HashSet<GuildId>) -> Self {
- self.blocked_guilds = guilds;
-
- self
- }
-
/// The default depth of the message to check for commands. Defaults to 5.
/// This determines how "far" into a message to check for a valid command.
///
@@ -176,6 +159,23 @@ impl Configuration {
self
}
+ /// Whether the bot should respond to other bots.
+ ///
+ /// For example, if this is set to false, then the bot will respond to any other bots including itself.
+ pub fn ignore_bots(mut self, ignore_bots: bool) -> Self {
+ self.ignore_bots = ignore_bots;
+
+ self
+ }
+
+ /// If set to true, bot will ignore all commands called by webhooks.
+ /// True by default.
+ pub fn ignore_webhooks(mut self, ignore_webhooks: bool) -> Self {
+ self.ignore_webhooks = ignore_webhooks;
+
+ self
+ }
+
/// Whether or not to respond to commands initiated with a mention. Note
/// that this can be used in conjunction with [`prefix`].
///