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.
- Loading branch information
Showing
1,298 changed files
with
165,918 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="List of all items in this crate"><title>List of all items in this crate</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="command_attr" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.0-nightly (ee612c45f 2024-11-19)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc mod sys"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../command_attr/index.html">command_<wbr>attr</a><span class="version">0.5.3</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h3><a href="#attributes">Crate Items</a></h3><ul class="block"><li><a href="#attributes" title="Attribute Macros">Attribute Macros</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><h1>List of all items</h1><h3 id="attributes">Attribute Macros</h3><ul class="all-items"><li><a href="attr.check.html">check</a></li><li><a href="attr.command.html">command</a></li><li><a href="attr.group.html">group</a></li><li><a href="attr.help.html">help</a></li><li><a href="attr.hook.html">hook</a></li></ul></section></div></main></body></html> |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A macro for marking a function as a condition checker to groups and commands."><title>check in command_attr - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="command_attr" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.0-nightly (ee612c45f 2024-11-19)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc attr"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../command_attr/index.html">command_<wbr>attr</a><span class="version">0.5.3</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">check</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#options" title="Options">Options</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate command_<wbr>attr</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="index.html">command_attr</a></span><h1>Attribute Macro <span class="attr">check</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/command_attr/lib.rs.html#747-815">Source</a> </span></div><pre class="rust item-decl"><code>#[check]</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A macro for marking a function as a condition checker to groups and commands.</p> | ||
<h3 id="options"><a class="doc-anchor" href="#options">§</a>Options</h3><div><table><thead><tr><th>Syntax</th><th>Description</th><th>Argument explanation</th></tr></thead><tbody> | ||
<tr><td><code>#[name(s)]</code> <br /> <code>#[name = s]</code></td><td>How the check should be listed in help.</td><td><code>s</code> is a string. If this option isn’t provided, the value is assumed to be <code>"<fn>"</code>.</td></tr> | ||
<tr><td><code>#[display_in_help]</code> <br /> <code>#[display_in_help(b)]</code></td><td>If the check should be listed in help. Has no effect on <code>check_in_help</code>.</td><td><code>b</code> is a boolean. If no boolean is provided, the value is assumed to be <code>true</code>.</td></tr> | ||
<tr><td><code>#[check_in_help]</code> <br /> <code>#[check_in_help(b)]</code></td><td>If the check should be evaluated in help.</td><td><code>b</code> is a boolean. If no boolean is provided, the value is assumed to be <code>true</code>.</td></tr> | ||
</tbody></table> | ||
</div></div></details></section></div></main></body></html> |
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="The heart of the attribute-based framework."><title>command in command_attr - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="command_attr" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.0-nightly (ee612c45f 2024-11-19)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc attr"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../command_attr/index.html">command_<wbr>attr</a><span class="version">0.5.3</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">command</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#options" title="Options">Options</a></li><li><a href="#notes" title="Notes">Notes</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate command_<wbr>attr</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="index.html">command_attr</a></span><h1>Attribute Macro <span class="attr">command</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/command_attr/lib.rs.html#96-234">Source</a> </span></div><pre class="rust item-decl"><code>#[command]</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The heart of the attribute-based framework.</p> | ||
<p>This is a function attribute macro. Using this on other Rust constructs won’t work.</p> | ||
<h3 id="options"><a class="doc-anchor" href="#options">§</a>Options</h3> | ||
<p>To alter how the framework will interpret the command, you can provide options as attributes | ||
following this <code>#[command]</code> macro.</p> | ||
<p>Each option has its own kind of data to stock and manipulate with. They’re given to the option | ||
either with the <code>#[option(...)]</code> or <code>#[option = ...]</code> syntaxes. If an option doesn’t require | ||
for any data to be supplied, then it’s simply an empty <code>#[option]</code>.</p> | ||
<p>If the input to the option is malformed, the macro will give you can error, describing the | ||
correct method for passing data, and what it should be.</p> | ||
<p>The list of available options, is, as follows:</p> | ||
<div><table><thead><tr><th>Syntax</th><th>Description</th><th>Argument explanation</th></tr></thead><tbody> | ||
<tr><td><code>#[checks(identifiers)]</code></td><td>Preconditions that must met before the command’s execution.</td><td><code>identifiers</code> is a comma separated list of identifiers referencing functions marked by the <code>#[check]</code> macro</td></tr> | ||
<tr><td><code>#[aliases(names)]</code></td><td>Alternative names to refer to this command.</td><td><code>names</code> is a comma separated list of desired aliases.</td></tr> | ||
<tr><td><code>#[description(desc)]</code> <br /> <code>#[description = desc]</code></td><td>The command’s description or summary.</td><td><code>desc</code> is a string describing the command.</td></tr> | ||
<tr><td><code>#[usage(use)]</code> <br /> <code>#[usage = use]</code></td><td>The command’s intended usage.</td><td><code>use</code> is a string stating the schema for the command’s usage.</td></tr> | ||
<tr><td><code>#[example(ex)]</code> <br /> <code>#[example = ex]</code></td><td>An example of the command’s usage. May be called multiple times to add many examples at once.</td><td><code>ex</code> is a string</td></tr> | ||
<tr><td><code>#[delimiters(delims)]</code></td><td>Argument delimiters specific to this command. Overrides the global list of delimiters in the framework.</td><td><code>delims</code> is a comma separated list of strings</td></tr> | ||
<tr><td><code>#[min_args(min)]</code> <br /> <code>#[max_args(max)]</code> <br /> <code>#[num_args(min_and_max)]</code></td><td>The expected length of arguments that the command must receive in order to function correctly.</td><td><code>min</code>, <code>max</code> and <code>min_and_max</code> are 16-bit, unsigned integers.</td></tr> | ||
<tr><td><code>#[required_permissions(perms)]</code></td><td>Set of permissions the user must possess. <br /> In order for this attribute to work, “Presence Intent” and “Server Member Intent” options in bot application must be enabled and all intent flags must be enabled during client creation.</td><td><code>perms</code> is a comma separated list of permission names.<br /> These can be found at <a href="https://discord.com/developers/docs/topics/permissions">Discord’s official documentation</a>.</td></tr> | ||
<tr><td><code>#[allowed_roles(roles)]</code></td><td>Set of roles the user must possess.</td><td><code>roles</code> is a comma separated list of role names.</td></tr> | ||
<tr><td><code>#[help_available]</code> <br /> <code>#[help_available(b)]</code></td><td>If the command should be displayed in the help message.</td><td><code>b</code> is a boolean. If no boolean is provided, the value is assumed to be <code>true</code>.</td></tr> | ||
<tr><td><code>#[only_in(ctx)]</code></td><td>Which environment the command can be executed in.</td><td><code>ctx</code> is a string with the accepted values <code>guild</code>/<code>guilds</code> and <code>dm</code>/<code>dms</code> (Direct Message).</td></tr> | ||
<tr><td><code>#[bucket(name)]</code> <br /> <code>#[bucket = name]</code></td><td>What bucket will impact this command.</td><td><code>name</code> is a string containing the bucket’s name.<br /> Refer to <a href="https://docs.rs/serenity/*/serenity/framework/standard/struct.StandardFramework.html#method.bucket">the bucket example in the standard framework</a> for its usage.</td></tr> | ||
<tr><td><code>#[owners_only]</code> <br /> <code>#[owners_only(b)]</code></td><td>If this command is exclusive to owners.</td><td><code>b</code> is a boolean. If no boolean is provided, the value is assumed to be <code>true</code>.</td></tr> | ||
<tr><td><code>#[owner_privilege]</code> <br /> <code>#[owner_privilege(b)]</code></td><td>If owners can bypass certain options.</td><td><code>b</code> is a boolean. If no boolean is provided, the value is assumed to be <code>true</code>.</td></tr> | ||
<tr><td><code>#[sub_commands(commands)]</code></td><td>The sub or children commands of this command. They are executed in the form: <code>this-command sub-command</code>.</td><td><code>commands</code> is a comma separated list of identifiers referencing functions marked by the <code>#[command]</code> macro.</td></tr> | ||
</tbody></table> | ||
</div> | ||
<p>Documentation comments (<code>///</code>) applied onto the function are interpreted as sugar for the | ||
<code>#[description]</code> option. When more than one application of the option is performed, the text is | ||
delimited by newlines. This mimics the behaviour of regular doc-comments, which are sugar for | ||
the <code>#[doc = "..."]</code> attribute. If you wish to join lines together, however, you have to end | ||
the previous lines with <code>\$</code>.</p> | ||
<h2 id="notes"><a class="doc-anchor" href="#notes">§</a>Notes</h2> | ||
<p>The name of the command is parsed from the applied function, or may be specified inside the | ||
<code>#[command]</code> attribute, a lá <code>#[command("foobar")]</code>.</p> | ||
<p>This macro attribute generates static instances of <code>Command</code> and <code>CommandOptions</code>, conserving | ||
the provided options.</p> | ||
<p>The names of the instances are all uppercased names of the command name. For example, with a | ||
name of “foo”:</p> | ||
|
||
<div class="example-wrap ignore"><a href="#" class="tooltip" title="This example is not tested">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="kw">pub static </span>FOO_COMMAND_OPTIONS: CommandOptions = CommandOptions { ... }; | ||
<span class="kw">pub static </span>FOO_COMMAND: Command = Command { options: FOO_COMMAND_OPTIONS, ... };</code></pre></div> | ||
</div></details></section></div></main></body></html> |
Oops, something went wrong.