Skip to content

Advanced Command Tricks

Quotes

Koishi would regard the content in quotes (whatever full-width or half-width) as a single parameter. This would be useful in many cases, for example:

  • Passing parameters with spaces, otherwise spaces would be treated as delimiters between parameters.
  • Passing parameters that start with -, otherwise they would be treated as options.
  • Passing an empty string as the parameter, otherwise it would be treated as true.
  • Passing numbers as string, otherwise they would be treated as number type.

Interpolation

You could use $() to inject the results from other commands into your current command:

A
Alice
echo foo$(echo bar)
Koishi
foobar

By default, text in single quotes would not be escaped. So it can be used when you don't want the parameter to be escaped:

A
Alice
echo 'foo$(echo bar)'
Koishi
foo$(echo bar)

Lastly, there is another interpolation approach in the koishi-plugin-eval plugin.

Fuzzy Matching

In the daily use, it is not surprise that you make typos. In this case, Koishi would show hints based on similar commands:

A
Alice
ecko hello
Koishi
您要找的是不是“echo”?Send a period to apply the suggestion.
A
Alice
.
Koishi
hello

You could also change the value of minSimilarity in the global configuration to adjust the threshold of the fuzzy matching. Very convenient, isn't it?