Skip to content

CommandSystem

Splamy edited this page Feb 1, 2017 · 13 revisions

The CommandSystem

Existing commands

All in all, the bot is fully operable only via chat (and actually only via chat).
Commands are invoked with !command.
Some commands have restrictions, like they can only be used in a private chat, only in public chat, or need admin rights.

  • add: Adds a new song to the queue.
  • clear: Removes all songs from the current playlist.
  • eval: Executes a given command or string
  • help: Shows all commands or detailed help about a specific command.
  • history: Shows recently played songs.
  • if: - no description yet -
  • kickme: Guess what?
  • link: Gets a link to the origin of the current song.
  • loop: Gets or sets whether or not to loop the entire playlist.
  • next: Plays the next song in the playlist.
  • parse: Displays the AST of the requested command.
  • pause: Well, pauses the song. Undo with !play
  • play: Automatically tries to decide whether the link is a special resource (like youtube) or a direct resource (like ./hello.mp3) and starts it
  • pm: Requests a private session with the ServerBot so you can invoke private commands.
  • previous: Plays the previous song in the playlist.
  • print: Lets you format multiple parameter to one.
  • quit: Closes the TS3AudioBot application.
  • quiz: Enable to hide the songnames and let your friends guess the title.
  • random: Gets whether or not to play playlists in random order.
  • repeat: Gets or sets whether or not to loop a single song.
  • rng: Gets a random number.
  • seek: Jumps to a timemark within the current song.
  • song: Tells you the name of the current song.
  • stop: Stops the current song.
  • subscribe: Lets you hear the music independent from the channel you are in.
  • take: Take a substring from a string
  • test: Only for debugging purposes
  • unsubscribe: Only lets you hear the music in active channels again.
  • volume: Sets the volume level of the music.

Basic commands

A Command

Every command is build up by the following scheme

!<commandname> <parameter1> <parameter2> ...

Command matching

The string matcher can still find the correct command for you even if you misspell it. This way

!historyy lastt 10
!his la 10
// or even
!higsndtor latuht 10

for example should all match to

!history last 10

This works by picking the command with the most matching characters. So the last example would match on hi_s__tor lat___ with 6 and 3 characters. Therefore the best match is history and last. But !ahistory last 10 will not match since the algorithm is greedy. The word history with no 'a' will be filtered out inbefore.

Escaping

Since spaces seperate parameters you have to quote a string if it has to contain spaces, like this:

!history rename 123 "New Song Name"

Note that a single quote (without closing quote) will not be interpreted as a control sequence but instead as a normal text character.

!bot name Funky"Name

Will rename the bot to Funky"Name

On the other hand of you want quotes in an already quoted string you can escape them with a backslash.

!bot name "Funky\" \"Name"

Will rename the bot to Funky" "Name

Command Chaining