Ich möchte meinem DiscordBot beibringen, wie mit einem Input umzugehen ist, nachdem der Befehl geschrieben wurde.C# Discord Bot - Benutzereingabe über einen Befehlsparameter
schaffe ich den Befehl so:
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
});
}
Ich benutze diese Methode zu kurz meinen Code der nächsten Methode:
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));
}
Und das ist die Methode meiner CommandList Füllung
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");
}
Mein Problem ist, dass ich nicht weiß, wie man den Parameter der Methodefüllt. Was müsste ich dort passieren? Etwas mit e.User
..?
Tatsächlich hat sich die gesamte API geändert. – TheOnlyMrCat