(<codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">commands.typed._TypedCommand.__init__()</span></code>). The only difference is that
<aclass="reference internal" href="../modules/commands.typed.html#commands.typed.TypedServerCommand" title="commands.typed.TypedServerCommand"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">commands.typed.TypedServerCommand</span></code></a> ignores the <codeclass="docutils literal notranslate"><spanclass="pre">permission</span></code> and
<codeclass="docutils literal notranslate"><spanclass="pre">fail_callback</span></code> arguments. Another thing to remember is which attributes of
the <aclass="reference internal" href="../modules/commands.typed.html#commands.typed.CommandInfo" title="commands.typed.CommandInfo"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">commands.typed.CommandInfo</span></code></a> instance are set in each of these
decorator types.</p>
<olclass="arabic simple">
<li><p><aclass="reference internal" href="../modules/commands.typed.html#commands.typed.TypedServerCommand" title="commands.typed.TypedServerCommand"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">commands.typed.TypedServerCommand</span></code></a> only sets the <codeclass="docutils literal notranslate"><spanclass="pre">command</span></code> attribute.</p></li>
<li><p><aclass="reference internal" href="../modules/commands.typed.html#commands.typed.TypedSayCommand" title="commands.typed.TypedSayCommand"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">commands.typed.TypedSayCommand</span></code></a> sets the attributes <codeclass="docutils literal notranslate"><spanclass="pre">command</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">index</span></code>.</p></li>
<li><p><aclass="reference internal" href="../modules/commands.typed.html#commands.typed.TypedClientCommand" title="commands.typed.TypedClientCommand"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">commands.typed.TypedClientCommand</span></code></a> sets all of the 3 attributes (<codeclass="docutils literal notranslate"><spanclass="pre">command</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">index</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">team_only</span></code>).</p></li>
</ol>
<sectionid="creating-optional-arguments">
<h3>Creating optional arguments<aclass="headerlink" href="#creating-optional-arguments" title="Link to this heading">¶</a></h3>
<p>You can create optional arguments by assigning a default value to an argument.</p>
<p>There is no limit on the number or depth of the sub-commands. That means you
can create an abitrary number of sub-commands and these sub-commands can have
sub-commands as well.</p>
<divclass="admonition seealso">
<pclass="admonition-title">See also</p>
<p>The <codeclass="docutils literal notranslate"><spanclass="pre">sp</span><spanclass="pre">auth</span></code> sub-command has a high sub-command depth.</p>
</div>
</section>
<sectionid="adding-value-validation">
<h3>Adding value validation<aclass="headerlink" href="#adding-value-validation" title="Link to this heading">¶</a></h3>
<p>As you might have noticed in the very first example, it’s quite easy to add
value validation to your command. All you need to do is adding a colon (:) and
a callable object behind your argument. When the command gets triggered, the
API will call the given object with the passed value. If any exception was
raised during this call, the validation is considered as a failure. Thus, an
error message is printed to the user. If the call has been finished
successfully, its return value will be passed to your callback.</p>
'a' is an invalid value for 'x:float'.
test 3
Got: 3.0
test 3.3
Got: 3.3
</pre></div>
</div>
<sectionid="using-custom-error-messages">
<h4>Using custom error messages<aclass="headerlink" href="#using-custom-error-messages" title="Link to this heading">¶</a></h4>
<p>If you are not happy with the automatic error message, you can simply raise
your own <aclass="reference internal" href="../modules/commands.typed.html#commands.typed.ValidationError" title="commands.typed.ValidationError"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">commands.typed.ValidationError</span></code></a> exception in your validator.</p>
<spanclass="k">raise</span><spanclass="n">ValidationError</span><spanclass="p">(</span><spanclass="s1">'"</span><spanclass="si">{}</span><spanclass="s1">" is not a floating value.'</span><spanclass="o">.</span><spanclass="n">format</span><spanclass="p">(</span><spanclass="n">value</span><spanclass="p">))</span>
<spanclass="nb">print</span><spanclass="p">(</span><spanclass="s1">'</span><spanclass="si">{player.name}</span><spanclass="s1"> in team </span><spanclass="si">{player.team}</span><spanclass="s1">. Dead?: </span><spanclass="si">{player.dead}</span><spanclass="s1">'</span><spanclass="o">.</span><spanclass="n">format</span><spanclass="p">(</span><spanclass="n">player</span><spanclass="o">=</span><spanclass="n">player</span><spanclass="p">))</span>
<p>In this case the player requires the permission <codeclass="docutils literal notranslate"><spanclass="pre">my_plugin.test</span></code> to execute
the command.</p>
<divclass="admonition note">
<pclass="admonition-title">Note</p>
<p>The permission is checked before arguments are validated.</p>
</div>
<p>You can also auto-generate the permission string by setting the second parameter to <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>.</p>
<p>You should only use this feature if it generates a permission string that
doesn’t conflict with our guideline on permission names. That means you
should only use it if you are using sub-commands. E.g. for the sub-command
<codeclass="docutils literal notranslate"><spanclass="pre">xy</span><spanclass="pre">kick</span></code> it would generate the permission string <codeclass="docutils literal notranslate"><spanclass="pre">xy.kick</span></code>.</p>
</div>
<p>You can also add a callback that gets called when an unauthorized player tries