Default commands
These work the moment the chatbot is on. Each one can be given aliases, restricted to a role or switched off in Commands.
| Command | What it does | Role |
|---|---|---|
| !points | A viewer's point balance | Everyone |
| !level | Current level | Everyone |
| !xp | XP progress to the next level | Everyone |
| !top | Leaderboard of top viewers | Everyone |
| !watchtime | Total time watched | Everyone |
| !followage | How long they have followed | Everyone |
| !followers | Channel follower count | Everyone |
| !uptime | How long the stream has been live | Everyone |
| !commands | Lists the commands they can run | Everyone |
| !addcom | Adds a custom command | Moderator |
| !editcom | Edits a custom command | Moderator |
| !delcom | Deletes a custom command | Moderator |
| !activecom | Turns a command on or off | Moderator |
| !usecom | Sets when a command works | Moderator |
| !rolecom | Sets which role can run it | Moderator |
Custom commands
Add commands from the panel, or straight from chat with !addcom.
everyone, subscriber, vip, og, moderator, owner
always, live, offline
You can set a global and a per-user cooldown for each command; the command will not run again until it expires.
Variables
The one placeholder you can use in a command response is {sender}. For persistent data there are three kinds of variables, all reachable from the Advanced Editor too.
{sender}Who ran the commandA single value (text) for the whole channel.
A numeric value; ideal for increment/decrement (e.g. death counter).
A per-viewer value (stored per user).
Advanced editor
When a template isn't enough, write JavaScript. Return a string and the bot posts it; return nothing and it stays quiet.
- You must define a
Mainfunction and return a value — that value becomes the command output. Maincan be async; useawaitwithnpoqandfetchcalls.- Keep scripts short and fast; the response length is limited.
fetchsupports only http/https URLs and returns text (string).
npoq — Global variables
npoq.getGlobalVar(name) | Promise<string | null> | Reads a global variable. |
npoq.setGlobalVar(name, value) | Promise<void> | Writes a global variable. |
npoq.deleteGlobalVar(name) | Promise<void> | Deletes a global variable. |
npoq — Counters
npoq.getCounter(name) | Promise<number | null> | Reads a counter value. |
npoq.setCounter(name, value) | Promise<void> | Sets a numeric counter value. |
npoq.deleteCounter(name) | Promise<void> | Deletes a counter. |
npoq — Viewer variables
npoq.getViewerVar(name, viewer) | Promise<string | null> | Reads a viewer's value. |
npoq.setViewerVar(name, viewer, value) | Promise<void> | Writes a viewer's value. |
npoq.deleteViewerVar(name, viewer) | Promise<void> | Deletes a viewer's value. |
npoq.clearViewerVar(name) | Promise<void> | Clears the variable for all viewers. |
sender — The command user
sender.username | string | Username of the viewer who ran the command. |
sender.slug | string | Viewer's channel slug. |
Built-ins
fetch(url, options?) | Promise<string> | HTTP/HTTPS request; returns the response as text. |
console.log(...args) | void | Logs to the editor test panel. |
Math, JSON, Date, Object, Array … | — | Standard JavaScript built-ins are available. |
<script>
const Main = async () => {
const wins = (await npoq.getCounter('wins')) || 0
await npoq.setCounter('wins', wins + 1)
return `${sender.username} → ${wins + 1} 🏆`
}
</script><script>
const Main = () => {
const roll = Math.floor(Math.random() * 6) + 1
return `${sender.username} 🎲 ${roll}`
}
</script><script>
const Main = async () => {
const res = await fetch('https://official-joke-api.appspot.com/random_joke')
const joke = JSON.parse(res)
return `${joke.setup} — ${joke.punchline}`
}
</script>