<i id='CMhG1'><tr id='CMhG1'><dt id='CMhG1'><q id='CMhG1'><span id='CMhG1'><b id='CMhG1'><form id='CMhG1'><ins id='CMhG1'></ins><ul id='CMhG1'></ul><sub id='CMhG1'></sub></form><legend id='CMhG1'></legend><bdo id='CMhG1'><pre id='CMhG1'><center id='CMhG1'></center></pre></bdo></b><th id='CMhG1'></th></span></q></dt></tr></i><div id='CMhG1'><tfoot id='CMhG1'></tfoot><dl id='CMhG1'><fieldset id='CMhG1'></fieldset></dl></div>
    <tfoot id='CMhG1'></tfoot>

          <bdo id='CMhG1'></bdo><ul id='CMhG1'></ul>
        <legend id='CMhG1'><style id='CMhG1'><dir id='CMhG1'><q id='CMhG1'></q></dir></style></legend>

      1. <small id='CMhG1'></small><noframes id='CMhG1'>

        如何让不和谐机器人输出用户输入的所有内容,

        时间:2023-09-09

        <small id='pL81i'></small><noframes id='pL81i'>

            <tbody id='pL81i'></tbody>
            <tfoot id='pL81i'></tfoot>
          1. <i id='pL81i'><tr id='pL81i'><dt id='pL81i'><q id='pL81i'><span id='pL81i'><b id='pL81i'><form id='pL81i'><ins id='pL81i'></ins><ul id='pL81i'></ul><sub id='pL81i'></sub></form><legend id='pL81i'></legend><bdo id='pL81i'><pre id='pL81i'><center id='pL81i'></center></pre></bdo></b><th id='pL81i'></th></span></q></dt></tr></i><div id='pL81i'><tfoot id='pL81i'></tfoot><dl id='pL81i'><fieldset id='pL81i'></fieldset></dl></div>
              • <bdo id='pL81i'></bdo><ul id='pL81i'></ul>
                <legend id='pL81i'><style id='pL81i'><dir id='pL81i'><q id='pL81i'></q></dir></style></legend>

                • 本文介绍了如何让不和谐机器人输出用户输入的所有内容,而不仅仅是第一个输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试让机器人重复用户输入的内容,重复用户指定的次数.
                  我遇到的问题是,如果用户输入:!repeat 5 xy,机器人只会重复 x 5 次,而不是 xy 5 次.

                  I'm trying to get a bot that will repeat what a user inputs, as many times as the user specifies.
                  The issue I'm running into is that if the user types: !repeat 5 x y, the bot will only repeat x 5 times, and not x y 5 times.

                  这是我要运行的代码:

                  @bot.command()
                  async def repeat(times: int, content="Repeating..."):
                      for i in range(times):
                          if times > 10:
                              await bot.say("Cannot spam more than 10 messages at a time.")
                              return
                          else:
                              await bot.say(content)
                  

                  推荐答案

                  您可以使用 仅关键字参数语法 并执行类似

                  You can use the keyword-only argument syntax and do something like

                  @bot.command()
                  async def repeat(times: int, *,content="Repeating..."):
                    for i in range(times):
                      if times > 10:
                        await bot.say("Cannot spam more than 10 messages at a time.")
                        return
                      else:
                        await bot.say(content)
                  

                  这篇关于如何让不和谐机器人输出用户输入的所有内容,而不仅仅是第一个输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                • <legend id='5ESf9'><style id='5ESf9'><dir id='5ESf9'><q id='5ESf9'></q></dir></style></legend>
                    <bdo id='5ESf9'></bdo><ul id='5ESf9'></ul>
                    <i id='5ESf9'><tr id='5ESf9'><dt id='5ESf9'><q id='5ESf9'><span id='5ESf9'><b id='5ESf9'><form id='5ESf9'><ins id='5ESf9'></ins><ul id='5ESf9'></ul><sub id='5ESf9'></sub></form><legend id='5ESf9'></legend><bdo id='5ESf9'><pre id='5ESf9'><center id='5ESf9'></center></pre></bdo></b><th id='5ESf9'></th></span></q></dt></tr></i><div id='5ESf9'><tfoot id='5ESf9'></tfoot><dl id='5ESf9'><fieldset id='5ESf9'></fieldset></dl></div>
                      <tbody id='5ESf9'></tbody>

                      <small id='5ESf9'></small><noframes id='5ESf9'>

                          <tfoot id='5ESf9'></tfoot>