aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorIllia <[email protected]>2016-12-10 22:25:55 +0200
committerzeyla <[email protected]>2016-12-10 12:25:55 -0800
commite44838f4339b90817b5eba5df16230b02487f0cc (patch)
tree8513ab3d9d3f9c8826f85630524cca1e4a7e188d /src/utils
parentFix no-cache+method conditional compiles (diff)
downloadserenity-e44838f4339b90817b5eba5df16230b02487f0cc.tar.xz
serenity-e44838f4339b90817b5eba5df16230b02487f0cc.zip
More config for CreateCommand, add various methods
Adds multiple configurations to the command builder, and adds methods to various structs. Context::get_current_user is a shortcut to retrieve the current user from the cache. Message::get_member retrieves the member object of the message, if sent in a guild. Message::is_private checks if the message was sent in a Group or PrivateChannel. User::member retrieves the user's member object in a guild by Id; Adds 6 configurations to the command builder: - dm_only: whether the command can only be used in direct messages; - guild_only: whether the command can only be used in guilds; - help_available: whether the command should be displayed in the help list; - max_args: specify the maximum number of arguments a command must be given; - min_args: specify the minimum number of arguments a command must be given; - required_permissions: the permissions a member must have to be able to use the command;
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/macros.rs48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/utils/macros.rs b/src/utils/macros.rs
index 2ba37e0..2f2ebdf 100644
--- a/src/utils/macros.rs
+++ b/src/utils/macros.rs
@@ -44,7 +44,7 @@ macro_rules! status {
}
// Enable/disable check for cache
-#[cfg(feature = "cache")]
+#[cfg(feature="cache")]
macro_rules! feature_cache {
($enabled:block else $disabled:block) => {
{
@@ -53,7 +53,7 @@ macro_rules! feature_cache {
}
}
-#[cfg(not(feature = "cache"))]
+#[cfg(not(feature="cache"))]
macro_rules! feature_cache {
($enabled:block else $disabled:block) => {
{
@@ -62,7 +62,7 @@ macro_rules! feature_cache {
}
}
-#[cfg(feature = "cache")]
+#[cfg(feature="cache")]
macro_rules! feature_cache_enabled {
($enabled:block) => {
{
@@ -71,17 +71,17 @@ macro_rules! feature_cache_enabled {
}
}
-#[cfg(not(feature = "cache"))]
+#[cfg(not(feature="cache"))]
macro_rules! feature_cache_enabled {
($enabled:block) => {{}}
}
-#[cfg(feature = "cache")]
+#[cfg(feature="cache")]
macro_rules! feature_cache_disabled {
($disabled:block) => {{}}
}
-#[cfg(not(feature = "cache"))]
+#[cfg(not(feature="cache"))]
macro_rules! feature_cache_disabled {
($disabled:block) => {
{
@@ -91,7 +91,7 @@ macro_rules! feature_cache_disabled {
}
// Enable/disable check for framework
-#[cfg(feature = "framework")]
+#[cfg(feature="framework")]
macro_rules! feature_framework {
($enabled:block else $disabled:block) => {
{
@@ -100,7 +100,7 @@ macro_rules! feature_framework {
}
}
-#[cfg(not(feature = "framework"))]
+#[cfg(not(feature="framework"))]
macro_rules! feature_framework {
($enabled:block else $disabled:block) => {
{
@@ -109,7 +109,7 @@ macro_rules! feature_framework {
}
}
-#[cfg(feature = "framework")]
+#[cfg(feature="framework")]
macro_rules! feature_framework_enabled {
($enabled:block) => {
{
@@ -118,17 +118,17 @@ macro_rules! feature_framework_enabled {
}
}
-#[cfg(not(feature = "framework"))]
+#[cfg(not(feature="framework"))]
macro_rules! feature_framework_enabled {
($enabled:block) => {{}}
}
-#[cfg(feature = "framework")]
+#[cfg(feature="framework")]
macro_rules! feature_framework_disabled {
($disabled:block) => {{}}
}
-#[cfg(not(feature = "framework"))]
+#[cfg(not(feature="framework"))]
macro_rules! feature_framework_disabled {
($disabled:block) => {
{
@@ -138,7 +138,7 @@ macro_rules! feature_framework_disabled {
}
// Enable/disable check for methods
-#[cfg(feature = "methods")]
+#[cfg(feature="methods")]
macro_rules! feature_methods {
($enabled:block else $disabled:block) => {
{
@@ -147,7 +147,7 @@ macro_rules! feature_methods {
}
}
-#[cfg(not(feature = "methods"))]
+#[cfg(not(feature="methods"))]
macro_rules! feature_methods {
($enabled:block else $disabled:block) => {
{
@@ -156,7 +156,7 @@ macro_rules! feature_methods {
}
}
-#[cfg(feature = "methods")]
+#[cfg(feature="methods")]
macro_rules! feature_methods_enabled {
($enabled:block) => {
{
@@ -165,17 +165,17 @@ macro_rules! feature_methods_enabled {
}
}
-#[cfg(not(feature = "methods"))]
+#[cfg(not(feature="methods"))]
macro_rules! feature_methods_enabled {
($enabled:block) => {{}}
}
-#[cfg(feature = "methods")]
+#[cfg(feature="methods")]
macro_rules! feature_methods_disabled {
($disabled:block) => {{}}
}
-#[cfg(not(feature = "methods"))]
+#[cfg(not(feature="methods"))]
macro_rules! feature_methods_disabled {
($disabled:block) => {
{
@@ -185,7 +185,7 @@ macro_rules! feature_methods_disabled {
}
// Enable/disable check for voice
-#[cfg(feature = "voice")]
+#[cfg(feature="voice")]
macro_rules! feature_voice {
($enabled:block else $disabled:block) => {
{
@@ -194,7 +194,7 @@ macro_rules! feature_voice {
}
}
-#[cfg(not(feature = "voice"))]
+#[cfg(not(feature="voice"))]
macro_rules! feature_voice {
($enabled:block else $disabled:block) => {
{
@@ -203,7 +203,7 @@ macro_rules! feature_voice {
}
}
-#[cfg(feature = "voice")]
+#[cfg(feature="voice")]
macro_rules! feature_voice_enabled {
($enabled:block) => {
{
@@ -212,17 +212,17 @@ macro_rules! feature_voice_enabled {
}
}
-#[cfg(not(feature = "voice"))]
+#[cfg(not(feature="voice"))]
macro_rules! feature_voice_enabled {
($enabled:block) => {{}}
}
-#[cfg(feature = "voice")]
+#[cfg(feature="voice")]
macro_rules! feature_voice_disabled {
($disabled:block) => {{}}
}
-#[cfg(not(feature = "voice"))]
+#[cfg(not(feature="voice"))]
macro_rules! feature_voice_disabled {
($disabled:block) => {
{