-
Notifications
You must be signed in to change notification settings - Fork 4
Usage
Tags in motiful are a feature seperate from commands -- they don't use the command prefix, nor do they have a specific "command name" that tells motiful to use them -- all it listens to is the format in which things are written.
They are saved in a file called tags.js
within the src/data
folder and to update the loaded tags, motiful needs to be restarted.
To trigger a tag, just place it in your message alongside your other content enclosed by brackets, e.g. My name is [name]!
. This will result in motiful trying to find a tag called name
, replacing the tag call with the output this tag results in.
Assuming you have a tag called name
, with value 'robflop'
, the result of the above would be:
My name is robflop!
.
If a tag cannot be found (e.g. you do not have a tag called name
), motiful will simply ignore this and leave the text as-is, because you don't always want to use a tag when you use brackets. This is to avoid complications when trying to type text unrelated to the tags system.
In addition to this, it is possible to use on-the-fly evaluation using the eval
keyword as tag name. To evaluate using this, provide the tag in a fashion such as this:
My name is [eval: message.client.user.username]!
.
Motiful will then evaluate the code behind the keyword, resulting in a text of My name is robflop
, if we assume that your username is robflop
.
If you write more complex tag functions to for example fetch a guild and get any of its properties, you can pass parameters to your function in the same way as you would pass it to eval, each parameter being comma seperated.
For example let's take the above eval and turn it into a tag with parameter:
Your tag function would look like this:
(message, name) => `My name is ${name}!`
and would be used like this: [name: robflop]
, resulting in the same as the above eval.
Important notices:
A tag function always passes the message as first param like above. In usage you don't need to pass it (this is done automatically), but in the tag's code you do. See how it's done in the above example tag, that is how you need to do it too.
Only one tag is possible per message. This is due to internal workings of scanning the message for tags with complex inputs such as arrays, objects etc.
Also, the tags system is generally only meant for simple-ish functions, not a fully fleshed eval command or an entire standalone command. Keep this in mind when writing tags.
You will likely encounter errors if you go too deep into nesting aswell.
- emoteName: The name you wish to save the emote under.
- url: The link to the file you wish to save as emote -- if saving an attachment, url does not need to be provided.
- channelName: The name of the channel on twitch, e.g. robflop98 OR name of the extension.
- Supported extensions: ffz and bttv standing for FrankerFacez and BetterTwitchTV respectively.
- Subscriber emotes disabled until further notice. [26-07-2017]
- emoteName: The name of the emote itself. It is case-sensitive.
- quoteName: The name you wish to save the quote under.
- user: A mention, start of the username, or ID of the user that wrote the message you wish to quote.
- snippet: A part of the message you wish to quote.
- quoteName: The name you wish to save the quote under.
- messageID: ID of the message to save as quote.
- input: The text you wish to turn a e s t h e t i c.
- input: The text you wish to ascii-fy.
- emoteName: The name of the emote you wish to delete.
- emoteName: The name of the emote you wish to remove from your favorites.
- quoteName: The name of the quote you wish to delete.
Description: Post a twitch (global or subscriber), FrankerFaceZ, BetterTwitchTV or custom emote into chat.
- channelName: The name of the channel on twitch, e.g. robflop98 OR name of the extension.
- Supported extensions:
ffz
andbttv
standing for FrankerFacez and BetterTwitchTV respectively. - If posting a global, favorite or custom emote, this value is replaced by emoteName.
- Subscriber emotes disabled until further notice. [26-07-2017]
- Supported extensions:
- emoteName: The name of the emote itself. It is case-sensitive.
- If posting a global or favorite emote, this value is replaced by emoteSize.
- If posting a custom emote, this value does not exist.
- emoteSize: The size of the emote you wish to select. Options are
small
,medium
andbig
.- This value defaults to
small
if no input is provided. - If posting a global emote, this value replaces emoteName.
- If posting a custom emote, this value does not exist.
- This value defaults to
- asyncFlag: If you provide
async
as the value of this argument, the following code will be executed asynchronically and you will be able to use await/async syntax.- If yo do not provide
async
as the value for this argument, it will simply be regarded as part of thecode
argument and will be appended.
- If yo do not provide
- code: The code you wish to evaluate.
- None
- input: The text you wish to spell out in indicator emotes.
- None
- None
- None
- None
- None
- amount: The amount of your own messages you wish to purge.
- message: The ID of the message you want to quote.
- response: An optional response to attach to the quote.
- response: An optional response to attach to the quote.
- For clarity: The message selection happens by reacting to it, so no snippet, user or other arguments need to be given.
- You must react using the 💬 (speech_balloon) emoji for the command to progress.
- user: A mention, start of the username, or ID of the user that wrote the message you wish to quote.
- input: Both the snippet of the message you wish to quote and optionally a response to attach to the quote, the former and the latter seperated by a vertical line ('|').
- command: The name of the command you wish to reload.
- quoteName: The name of the saved quote to send.
- input: The text you wish to set your
Playing ...
status to. Leaving this empty will clear your status.
- action: The action you wish to take, either
shutdown
orrestart
.
- input: Both the parts you wish to replace, and what you wish to replace them with. Former and latter are seperated by a vertical bar (
|
), individual words or phrases in the former or latter are seperated by semicolons (;
).
- targetCommand: The command you to disable or enable.