v3.459 Custom Code & TTS Actions
Random Stuff
- Login page has hopefully gotten clearer.
- Running the scale command now interrupts a scaling sequence.
- Fixed reward toggling by main profiles, the logic was faulty.
- A ton of new text tags, see full list here.
New Features
Custom Code Action
This action can contain and execute any arbitrary code you want. It's basically a way to extend the widget without creating new classes or adding more files, just plug your code into this action and go.
[Keys.COMMAND_EXAMPLE]: {
actions: {
custom: {
tag: 'Tag',
description: 'A short description',
call: async (user) => { // The async is needed if you use `await` in the code.
const modules = ModulesSingleton.getInstance() // Get access to all modules.
modules.tts.enqueueSpeakSentence(
await Utils.replaceTagsInText('%userTag just did a custom thing!', user)
)
console.log(`${user.name} just triggered a custom action!`)
}
}
}
}
TTS Action
This was a huge amount of work, but now pretty much ALL features of the TTS system are callable as actions. Meaning you can make rewards for what was commands before, like setting nick, or commands for what was a reward before, like setting voice. All existing TTS commands that were previously hard-coded, are now in the templates.
[Keys.COMMAND_EXAMPLE]: {
actions: {
tts: { function: ETTSFunction.SetUserVoice } // For all commands, check the enum `ETTSFunction`.
inputOverride: 'kr' // This is optional, and can be used if you don't want the user input to decide what happens. This would set someone's voice to Korean.
}
}
Config Changes
Removed References
TTS References
Things removed from Config.controller.speechReferences
.
COMMAND_TTS_ON
COMMAND_TTS_OFF
COMMAND_TTS_MUTE
COMMAND_TTS_UNMUTE
COMMAND_TTS_NICK
COMMAND_DICTIONARY
Chat References
Things removed from Config.controller.chatReferences
.
COMMAND_DICTIONARY
COMMAND_TTS_NICK
Rename
In Config.google.cleanTextConfig
removeParantheses
was spell-corrected toremoveParentheses
Template Changes
Removed Rewards
REWARD_TTSSETVOICE
REWARD_TTSSWITCHVOICEGENDER
Removed Commands
COMMAND_DICTIONARY
Updated Commands
COMMAND_TTS_ON
COMMAND_TTS_OFF
COMMAND_TTS_SILENCE
COMMAND_TTS_DIE
COMMAND_TTS_NICK
COMMAND_TTS_MUTE
COMMAND_TTS_UNMUTE
Added Commands
COMMAND_TTS_GETNICK
COMMAND_TTS_CLEARNICK
COMMAND_TTS_GETVOICE
COMMAND_TTS_GENDER
COMMAND_DICTIONARY_SET
COMMAND_DICTIONARY_GET
COMMAND_DICTIONARY_CLEAR
Added Event (Command & Reward)
EVENT_TTSSETVOICE
Key Changes
Things that has changed in _data/!keys.ts
.
Removed Keys
COMMAND_DICTIONARY
REWARD_TTSSETVOICE
REWARD_TTSSWITCHVOICEGENDER
Updated Keys
COMMAND_TTS_DIE
COMMAND_TTS_NICK
Added Keys
EVENT_TTSSETVOICE
COMMAND_TTS_GETNICK
COMMAND_TTS_CLEARNICK
COMMAND_TTS_GETVOICE
COMMAND_TTS_GENDER
COMMAND_DICTIONARY_SET
COMMAND_DICTIONARY_GET
COMMAND_DICTIONARY_CLEAR