Я хочу научить мой DiscordBot, как работать с вводом после написания команды.C# Discord Bot - получить Userinput по параметру команды
Я создаю командный таким образом:
private void CreateCommand(string commandName, string parameterName, ParameterType parameterType , string commandValue) // Register this command by the name and the answer value
{
commands.CreateCommand(commandName).Parameter(parameterName, parameterType).Do(async (e) =>
{
await e.Channel.SendMessage(commandValue); // Bots answer
});
}
Я использую этот метод, чтобы короткий мой код следующего метода:
private void Add(string commandName, string commandValue, string commandDescription) // Add a simple command to the List
{
singleCommandList.Add(new Tuple<string, string, string>(commandName, commandValue, commandDescription));
}
private void Add(string commandName, string parameterName, ParameterType parameterType, string commandValue, string commandDescription) // Add commands with Parameters to the List
{
parameterCommandList.Add(new Tuple<string, string, ParameterType, string, string>(commandName, parameterName, parameterType, commandValue, commandDescription));
}
И это метод заполнения моего CommandList
private void FillCommandList() // Add all the commands to the List
{
Add("test", "success", "test"); // simple Command
Add("search", "onlineSearch", ParameterType.Multiple, Search("text to look for"), "Google it");
}
Моя проблема в том, что я не знаю, как заполнить параметр метода Search()
. Что я должен пройти там? Что-то с e.User
..?
Собственно, весь API изменился. – TheOnlyMrCat