Blocks Reference

Blocks Reference

Every WHEN, ONLY IF and DO block in Cubevate, and every blank you can use in your text. Use the search box to find a block by name.

How to read this page

Every event is built from three kinds of blocks. WHEN wakes the bot up, ONLY IF checks something, and DO makes the bot act. Each table below lists the blocks by the group they belong to in Cubevate.

WHEN blocks

There are 37 WHEN blocks. An event has exactly one.

🤖 The bot

BlockWhat it does
The bot wakes upHappens when your bot turns on (once for every server it is in).
Every so oftenRepeats again and again, like an alarm clock.
Every day at a timeHappens once a day at the time you choose (the time of the computer running the bot).
My own mini-programA named set of blocks that other blocks can start. Great when you use the same steps in many places.
The bot joins a new serverHappens when someone adds your bot to a server.
A feed has a new itemFollows an RSS or Atom feed and wakes up for every new item. Fill in the feed address, how often to check (not faster than every 5 minutes) and whether to also post the latest few items the first time. You can also pick a list box: every address in it is followed too. Blanks: {feed.title}, {item.title}, {item.link}, {item.summary}, {item.image}, {item.author} and {item.date}.
A Twitch streamer goes liveChecks Twitch every few minutes and wakes up when a streamer starts a live stream. Type one or more Twitch names (or pick a list box that holds them), how often to check and whether to announce streamers who are already live when the bot starts. Needs a free Client ID and Client Secret from dev.twitch.tv in my-secrets.txt. Blanks: {stream.name}, {stream.title}, {stream.game}, {stream.viewers}, {stream.url}, {stream.thumbnail}, {stream.avatar} and {stream.started}.
The bot leaves a serverHappens when your bot is removed from a server (kicked, banned or the server was deleted). The bot can not write there any more, so use this for notes and memory boxes. The server name is {server}.

💬 Chat messages

BlockWhat it does
Someone sends a messageHappens every time someone writes in a channel. (Tip: add an “Only if” block to look for words.)
Someone types a !commandThe old-school way: someone types something like !hello in a channel. (Slash commands are the modern way.)
Someone edits a messageHappens when a message is changed after it was sent.
A message is deletedHappens when a message is removed. The words may be missing if the message was old.
Someone adds an emoji to a messageHappens when someone clicks an emoji under a message.
Someone removes their emojiHappens when someone un-clicks an emoji.
A message is pinnedHappens when someone pins a message. {user} is who pinned it, and {message}, {message.link} and {author.avatar} are about the pinned message.

🎛️ Commands & buttons

BlockWhat it does
Someone uses a /commandPeople type / and pick your command from a list. The easy and modern way to talk to a bot.
Someone clicks a buttonHappens when someone clicks a button you put under a message. Use the same ID you gave the button.
Someone picks from a choice listHappens when someone chooses something from a drop-down list you sent. Use {menu} to see what they picked.
Someone sends a formHappens when someone fills in a pop-up form you showed them. Use {form.ID} to read the answers.
Someone right-clicks a personAdds an item to the menu you get when you right-click a person (Apps). The person clicked on is {target}.
Someone right-clicks a messageAdds an item to the menu you get when you right-click a message (Apps).

👥 People

BlockWhat it does
Someone joins the serverHappens when a new person joins. Perfect for a welcome message!
Someone leaves the serverHappens when a person leaves (or is kicked).
Someone gets bannedHappens when a person is banned.
Someone gets un-bannedHappens when a ban is removed.
Someone gets a roleHappens when a person is given a role. The role is {role}.
Someone loses a roleHappens when a role is taken away from a person.
Someone changes their nicknameUse {old} and {new} for the old and new name.
Someone boosts the serverHappens when a person starts boosting your server.
Someone changes their online statusOnline, away, busy or offline. Needs the “Presence” switch on the Discord page.
Someone is put in time-outHappens when a person is put in time-out, or when a time-out is taken away early. {user} is the person. {new} says when the time-out ends and {old} is how many minutes are left.

🔊 Voice chat

BlockWhat it does
Someone joins a voice channelThe voice channel is {channel}.
Someone leaves a voice channelHappens when a person disconnects from voice. The voice channel they left is {channel}.
Someone moves to another voice channelHappens when a person jumps from one voice channel to another.

🏠 Server changes

BlockWhat it does
A channel is madeThe new channel is {channel}.
A channel is deletedIts old name is {old}.
A role is madeThe new role is {role}.
A role is deletedThe old role name is {role.name}.
An emoji is added to the serverThe new emoji is {emoji}.
An invite link is madeThe link is {invite}.
A thread is startedHappens when a new thread (a little side-chat) is made.
A server event is plannedThe event name is {old}.
A forum post is createdHappens when somebody starts a new post in a Forum channel. {user} is the person who posted and {channel.name} is the post title. You can limit it to one forum.
An invite link is deletedHappens when an invite link is removed. The link was {invite}.
A server event starts or endsHappens when a planned server event begins (or is over). The event name is {old} and {new} is its link.
A channel is changedHappens when a channel gets a new name or a new topic. {channel} is the channel, {old} is what it was and {new} is what it is now. Changes your own bot made a moment ago are skipped, so it can not go in circles.
A thread is changedHappens when a thread or forum post is renamed, closed, reopened, locked or unlocked. {thread} is the thread, {old} is the old name and {new} the new one.
A role is changedHappens when a role gets a new name, colour or powers. {role} is the role, {old} is the old name and {new} the new one.
The server is changedHappens when the server gets a new name or a new picture. {old} is the old name and {new} the new one.
AutoMod catches somethingHappens when Discord’s own AutoMod blocks or flags a message. {user} is the person, {automod.rule} is the rule, {automod.word} is what it caught and {automod.text} is what they wrote. The bot needs the Manage Server permission to hear about it.

ONLY IF blocks

There are 49 ONLY IF blocks. An event can have as many as you like. All of them must be true. Right-click a block to flip it into “if NOT”.

👤 About a person

BlockWhat it does
Has a roleChecks if a person has a certain role.
Is a botChecks if the person is a bot (not a human).
Is allowed to…Checks if a person has a power, like deleting messages.
Is the server ownerChecks if the person owns the server.
Is boosting the serverChecks if the person boosts the server.
Is one exact personChecks if it is a very specific person (by their ID number).
Account ageHow old their Discord account is. Great against fake accounts!
Time in the serverHow long they have been in your server.
Is in a voice channelChecks if a person is talking in voice chat.
Is in time-outChecks if the person is currently in time-out.
Has their own profile pictureChecks if the person picked a profile picture. The plain default picture is common for fake or throw-away accounts.

💬 About the message

BlockWhat it does
Has certain wordsChecks if the message has any of the words you list.
Starts withChecks how the message begins.
Ends withChecks how the message ends.
Is exactlyThe whole message is exactly this.
Has a web linkChecks if the message has a link (http…).
Has a Discord inviteChecks for discord.gg invite links.
Has a file or pictureChecks if a picture or file was attached.
Has a picture, video or soundChecks what kind of file or link is in the message. Perfect for picture-only or video-only channels. Note: Discord treats GIFs as videos, so a GIF is not a picture here.
Is a commandChecks if the message is a bot command: starts with a command sign like ! . ? $ or is the answer to a /command. Perfect for commands-only channels.
Pings someoneChecks if the message pings (@) someone.
Pings many peopleCounts the pings. Good against spam.
Length of the messageHow many letters the message has.
SHOUTING (lots of capitals)Checks if most letters are CAPITAL. Ignores short messages.
Too many emojiCounts the emoji in the message.
Repeating letters (spam)Catches things like “aaaaaaaaaaaa” or “lollollollol”.
Is a replyChecks if the message answers another message.
Matches a pattern (advanced)For experts: a “regular expression” pattern.
Has a stickerChecks if the message has a Discord sticker in it.
Is a reply to this botChecks if the message is a reply to something this bot wrote. Great for bots that chat back.

📍 About the place

BlockWhat it does
Is in a channelChecks which channel it happened in.
Is in a categoryChecks if the channel is inside a category (a folder of channels).
Voice channel is emptyChecks that nobody is inside a voice channel. Perfect for removing temporary channels.
Channel is age-restrictedChecks if the channel is marked 18+.
Is inside a threadChecks if it happened in a thread.
Channel typeChecks what kind of channel it happened in: a text channel, voice chat, announcement channel, thread or stage.
Number of people in the serverCompares how many people the server has.
Is inside a forum postChecks if it happened inside a post of a Forum channel (not a normal thread).
Forum post has a tagChecks if the forum post it happened in has a certain tag, like “Solved” or “Open”.

🧠 Memory & numbers

BlockWhat it does
Compare two thingsCompare any two values. You can use {blanks} like {memory.coins} or {option.amount}.
Check a memory boxLooks inside one of your memory boxes.
A list box containsChecks if a list box has a certain item.

🎲 Luck, time & waiting

BlockWhat it does
Random chanceLike rolling a dice. 50% means “half of the time”.
Time of dayOnly between two times (of the computer running the bot).
Day of the weekOnly on certain days.
Slow down (cooldown)Makes people wait between uses so they can’t spam. The first time it works, then they must wait.

🔁 Repeat & otherwise

BlockWhat it does
OtherwiseRuns when the block just above did NOT happen. (Only inside a “sub-event”.)
Do it many timesRepeats everything inside this block. Use {loop} for the counting number (1, 2, 3…).
Do it for each personRepeats for every person (or everyone with a role). Use {each} to mention the current person.
A note for meJust a sticky note between your conditions. It does nothing when the bot runs — it helps you remember what is going on.
My own code says yesAdvanced: write a few lines of code that give back true (yes) or false (no).
Do it for each item in a listRepeats everything inside for every item of a list box, or of a list you type with commas. Use {loop.item} for the current item and {loop} for its position (1, 2, 3…).
Do it for each letterRepeats everything inside for every letter of a text (great for word games). Use {loop.item} for the current letter and {loop} for its position (1, 2, 3…).

DO blocks

There are 65 DO blocks. They run from top to bottom.

💬 Send & manage messages

BlockWhat it does
Send a messageWrites a message. Add buttons if you want!
Send a fancy box (embed)A pretty message box with a title, colour and pictures.
Show a list of all my /commandsPosts a neat help list of every /command your bot has. It is built automatically: add a new command and it shows up in the list by itself.
Send a choice listA drop-down list people can pick from. Make a “Someone picks from a choice list” block to react.
Send a private message (DM)Writes to one person privately. It is skipped if they turned private messages off.
Change a fancy box I sentRewrites a fancy box (embed) that already exists — like a pet card or a game that updates itself. Leave the message empty to change the one that was clicked.
Change the message I just sentEdits the last message this block sent.
Delete a messageRemoves a message. Empty = the message that started this.
Clear many messagesDeletes the newest messages in a channel (not older than 14 days).
Add an emoji under a messageSticks an emoji reaction to a message.
Remove all emoji from a messageCleans all reactions off a message.
Pin a messagePins a message to the top of the channel.
Publish an announcementIn an announcement channel, this publishes the message to every server that follows the channel.
Copy a message to another channelSends a copy of a message to another channel: who wrote it, what it said, any picture and a link back to the original. Perfect for reports and highlights.
Un-pin a messageRemoves a pin.
Start a pollPeople vote with clicks.
Show a pop-up formPops up a little form with questions. Must be the FIRST thing in a /command or button block. When they send it, the “Someone sends a form” block wakes up.
Switch buttons off or onGreys out buttons under a message so they can not be clicked any more (or wakes them up again). Leave the IDs empty for all the buttons.

👥 People

BlockWhat it does
Give a roleGives a role to a person. (My own role must be ABOVE this role in the list.)
Take a role awayRemoves a role from a person.
Flip a role on/offGives the role if they don’t have it, takes it if they do. Great for role buttons! ({temp.toggled} says added or removed.)
Kick someoneSends a person out of the server. They can come back with a new invite.
Ban someoneRemoves a person and stops them from coming back.
Un-ban someoneLets a banned person return. Needs their ID number.
Put someone in time-outThey can’t write or talk for a while.
End a time-outLets them talk again.
Change a nicknameChanges how a person’s name looks in this server. Leave it empty to reset.
Move to another voice channelMoves a person who is in voice chat.
Kick out of voice chatDisconnects a person from voice.
Mute / un-mute in voiceMutes a person in voice chat (for everybody).

#️⃣ Channels

BlockWhat it does
Close a threadHides (archives) the thread this happened in, and can lock it too. Good for finished help requests.
Make a channelCreates a new channel. Use {newchannel} afterwards to mention it.
Limit people in a voice channelSets the most people that can be in a voice channel. 0 means no limit.
Delete a channelRemoves a channel for good.
Rename a channelGives a channel a new name.
Change a channel’s descriptionChanges the little text at the top of a channel.
Set slow modePeople must wait between messages. 0 turns it off.
Lock a channelNobody (in the role) can write there any more.
Unlock a channelLets people write there again.
Change who can do what in a channelAllow or block one power in one channel for a role or person.
Start a threadMakes a little side-chat. Use {thread} to mention it.
Make an invite linkMakes a link to join the server. Use {invite} to show it.
Start a forum postMakes a new post in a Forum channel, with a title, a first message and (optionally) tags. Use {thread} to mention it afterwards.
Change this thread or forum postRenames, locks, unlocks, closes, reopens, pins, unpins or deletes the thread (or forum post) this happened in.
Change forum post tagsAdds, removes or replaces the tags of the forum post this happened in. Great for “Open” / “Solved” systems.
Add someone to this threadAdds a person to the thread or forum post this happened in, so they get notified.

🏷️ Roles & server

BlockWhat it does
Make a roleCreates a role. Use {newrole} afterwards to mention it.
Delete a roleRemoves a role for good.
Change a roleRenames a role or changes its colour.
Rename the serverGives the server a new name.
Change the bot’s statusThe little text under the bot’s name, like “Playing a game”.
Add an emoji to the serverMakes a new server emoji from a picture on the web.

🧠 Memory boxes

BlockWhat it does
Put something in a memory boxReplaces what is in a box. You can do math: {memory.coins} + 5
Add to a number boxMakes a number box bigger.
Take away from a number boxMakes a number box smaller.
Add to a list boxAdds one item to the end of a list.
Remove from a list boxTakes an item out of a list.
Reset a memory boxPuts the box back to its starting value.
Show a top list (leaderboard)Shows who has the most in a “one for each person” number box.
Look inside or sort a list boxReads the first or last item, finds a position, counts, sorts, mixes or tidies a list box. Answers go on a sticky note you read with {temp.NAME}.
Find someone’s place in a top listLooks up the rank of a person in a “one for each person” number box (1 = the most). Read it with {temp.NAME}; {temp.NAME_of} says how many people are on the list.

🧰 Waiting, stopping & extras

BlockWhat it does
Wait a bitPauses this block for a while before the next step.
Stop hereEnds this block right now. Nothing below it happens.
Run a mini-programStarts one of your “My own mini-program” blocks.
Pick a random numberLike rolling a dice. The answer is saved on a sticky note: read it with {temp.NAME}.
Pick one thing at randomGives you one item from a list you type, separated by commas. Saved on a sticky note: read it with {temp.NAME}.
Pick one from a list boxTakes a random item out of one of your list boxes (like giveaway entrants). Read it with {temp.NAME}; {temp.NAME_count} says how many were in the list.
Remember something for a momentA sticky note that is thrown away when the block ends. Read it with {temp.NAME}.
Get something from the internetAsks a website for information. Read the answer with {web}. (Advanced)
Write a note in the bot’s windowPrints a line in the black window where your bot runs. Good for testing.
A note for meJust a sticky note between your actions. It does nothing when the bot runs — it helps you remember what is going on.
Run my own codeAdvanced: write your own JavaScript. You get ctx (what happened), client (the bot), memory, fill and sleep.
Change or measure a textMakes a sticky note out of a text: CAPITALS, small letters, how long it is, replace a word, take one letter, hide letters and more. Read the answer with {temp.NAME}.
If an action fails, keep goingNormally, when one action fails (a missing role, closed private messages…), the rest of the event is skipped. Put this block first and the actions after it carry on. {temp.error} then holds the last problem in plain words.
Run a mini-program laterStarts one of your “My own mini-program” blocks after some time: minutes, hours or even days. Unlike “Wait a bit”, this is written down in the bot’s memory, so it still happens after the bot restarts.

Note: Some blocks need a power (permission) in Discord, like Manage Roles or Kick Members. Cubevate tells you which ones your bot needs on the Finish & host page, in step 3 (“Why does my bot need these powers?”).

Blanks you can put in any text

A blank is a word in curly brackets. When your bot runs, it is replaced with the real thing. In any text box press Add info ({ }) to pick one.

The person

BlankWhat it becomes
{user}Pings the person
{user.name}Their name (no ping)
{user.id}Their ID number
{user.avatar}Link to their picture
{user.joined}The day they joined the server
{user.created}The day their account was made
{user.roles}How many roles they have
{user.rolelist}Their roles (clickable)
{author}Writer of the message (for emoji events)
{target}The person you right-clicked

The server & the place

BlankWhat it becomes
{server}Server name
{server.members}How many people are in the server
{server.humans}How many humans (no bots)
{server.bots}How many bots
{server.channels}How many channels
{server.textchannels}How many text channels
{server.voicechannels}How many voice channels
{server.categories}How many categories
{server.roles}How many roles
{server.emojis}How many emojis
{server.boosts}How many boosts
{server.created}The day the server was made
{commands}A list of all my /commands
{channel}The channel (clickable)
{channel.name}Name of the channel
{role}The role involved
{role.name}Name of that role

The message

BlankWhat it becomes
{message}The words that were written
{message.link}Link to the message
{message.image}First picture attached to the message
{author.avatar}Picture of the message writer
{reaction.count}How many times this emoji was used (emoji events)
{emoji}The emoji used
{arg.1}1st word after a !command
{args}Everything after a !command

Answers from people

BlankWhat it becomes
{menu}What was picked in a choice list
{button}ID of the clicked button

Dates, luck & other things

BlankWhat it becomes
{random:1-100}A random number
{pick:red|blue|green}Picks one at random
{date}Today’s date
{today.md}Today as month/day, like 3/14
{today.month}This month (1-12)
{today.day}Today’s day number
{time}The time now
{now}The time now as a number (seconds), for math
{timestamp}A date Discord shows in each person’s own time zone
{timestamp.relative}“5 minutes ago” style
{loop}Counting number inside a repeat
{each}Current person in a “for each person”
{web}Answer from the internet
{newchannel}The channel just made
{newrole}The role just made
{invite}The invite link just made
{old}The old value (edits, nicknames)
{new}The new value
{memory.coins}What is inside your memory box named coins (use your own box name)

Tip: Blanks only work where they make sense. {reaction.count} works in emoji events, {arg.1} in !command events, and {menu} after a choice list.