Translate

- Bug fix for searching for text-to-translate
- If empty string provided, send error message
This commit is contained in:
Tristan B. Velloza Kildaire 2023-06-18 13:00:09 +02:00
parent 291e85dcf2
commit 85b6c65ccb
1 changed files with 8 additions and 2 deletions

View File

@ -35,12 +35,18 @@ public final class Translate : Mod
// TODO: Implement custom language (to) support
string[] splits = split(strip(messageBody), " ");
long textIdx = indexOf(messageBody, " ")+1;
long textIdx = indexOf(messageBody, " ");
if(textIdx > -1)
{
string textToTranslate = messageBody[textIdx..$];
string textToTranslate = strip(messageBody[textIdx+1..$]);
if(textToTranslate.length == 0)
{
getBot().channelMessage("No text to translate", channel);
return;
}
try
{