输入文字的参数太少-C#Discord Bot

时间:2018-09-07 13:34:22

标签: c# discord

我对所有这些都还很陌生,所以请原谅这一事实,这可能是这里大多数人面临的重大打击。我正在尝试让Discord机器人播放音频。它会加入频道,但是每当我使用play命令时,在不和谐聊天中都会说“输入文本的参数太少”。正如我说的那样,我是新手,所以不知道从哪里开始。这是我对play命令的要求;

[Command("play", RunMode = RunMode.Async)]
public async Task PlayCmd([Remainder] string song)
{

    await _service.SendAudioAsync(Context.Guild, Context.Channel, song);
}
}

那只是我的基本播放命令,还没有添加任何额外的内容。另外,如何获取它以播放特定文件?我不确定将文件路径添加到命令的位置或方式。

1 个答案:

答案 0 :(得分:0)

根据您提供的代码,我假设您需要在命令中提供歌曲名称作为参数。函数<img id="top" src="top.png" alt=""> <div id="form_container"> <h1><a>MEDICAL HISTORY QUESTIONNAIRE</a></h1> <form id="form_25714" class="appnitro" method="post" action=""> <div class="form_description"> <h2>MEDICAL HISTORY QUESTIONNAIRE</h2> <p></p> </div> <ul> <li id="li_1"> <label class="description" for="element_1">Visit in the presence of </label> <span> <input id="element_1_1" name="element_1" class="element radio" type="radio" value="1" /> <label class="choice" for="element_1_1">parents</label> <input id="element_1_2" name="element_1" class="element radio" type="radio" value="2" /> <label class="choice" for="element_1_2">mother</label> <input id="element_1_3" name="element_1" class="element radio" type="radio" value="3" /> <label class="choice" for="element_1_3">father</label> <input id="element_1_4" name="element_1" class="element radio" type="radio" value="4" /> <label class="choice" for="element_1_4">grandmother</label> <input id="element_1_5" name="element_1" class="element radio" type="radio" value="5" /> <label class="choice" for="element_1_5">grandfather</label> <input id="element_1_6" name="element_1" class="element radio" type="radio" value="6" /> <label class="choice" for="element_1_6">grandparents</label> </span> </li> <li id="li_2"> <label class="description" for="element_2">Chronic diesases </label> <div> <input id="element_2" name="element_2" class="element text medium" type="text" maxlength="255" value="" /> </div> </li> <li id="li_3"> <label class="description" for="element_3">Allergies </label> <div> <input id="element_3" name="element_3" class="element text medium" type="text" maxlength="255" value="" /> </div> </li> <li id="li_4"> <label class="description" for="element_4">Medical history </label> <div> <textarea id="element_4" name="element_4" class="element textarea medium"></textarea> </div> </li> <li id="li_5"> <label class="description" for="element_5">Meningism </label> <span> <input id="element_5_1" name="element_5" class="element radio" type="radio" value="1" /> <label class="choice" for="element_5_1">negative</label> <input id="element_5_2" name="element_5" class="element radio" type="radio" value="2" /> <label class="choice" for="element_5_2">positive</label> </span> </li> <li id="li_7"> <label class="description" for="element_7">Skin </label> <span> <input id="element_7_1" name="element_7" class="element radio" type="radio" value="1" /> <label class="choice" for="element_7_1">Normal, without purpura</label> <input id="element_7_2" name="element_7" class="element radio" type="radio" value="2" /> <label class="choice" for="element_7_2"><input id="element_7_2" name="element_7_2" class="element text medium" type="text" maxlength="800" value=""/> </label> </span> </li> <li id="li_6"> <label class="description" for="element_6">Temperature </label> <div> <input id="element_6" name="element_6" class="element text medium" type="text" maxlength="255" value="" /> </div> </li> <li class="buttons"> <input type="hidden" name="form_id" value="25714" /> <input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" /> </li> </ul> </form> </div>确实将PlayCmd作为参数。 尝试使用不符合以下语法的逗号:

  

string command

。例如:parameter