Docs
Build a Fluxer bot with blocks
This guide takes you from nothing to a bot that answers in your community. No coding needed, and every step says exactly where to click. Start at the top, or jump to the part you need.
How it works
You snap blocks together in your browser. Scratch For Fluxer turns the blocks into a Python file called main.py, and that file is your bot. Run it here with one button, or download it and run it anywhere.
- BlocksYou build in the editor.
- main.pyPython written for you.
- RunOn our runner, or on your own machine.
- Your botOnline in your community.
What you need
- A Fluxer account with a verified email address (Fluxer asks for this before you can create a bot).
- A community on Fluxer where you are allowed to add bots, such as one you created.
- About ten minutes.
Words you will see
- Bot
- A helper account that lives in your community and answers when something happens, such as someone typing a command.
- Application
- What Fluxer calls the page where a bot is set up. One application holds one bot.
- Token
- The bot's password. Whoever has it can control your bot, so keep it secret.
- Community
- A place on Fluxer with channels and members. fluxer.py calls it a guild, so you may see that word in code.
- Command
- A message that starts with the bot's prefix and a name, like
!ping. - Prefix
- The character at the start of every command. It is
!unless you change it. - Event
- Something that happens: the bot comes online, a message arrives, someone joins.
- Block
- One puzzle piece. Blocks snap together into scripts.
- Console
- The panel where your running bot writes what it is doing, including errors.
- Runner
- The server that keeps your bots running when you press Run.
Step 1
Create your bot on Fluxer
First the bot has to exist on Fluxer. This part happens on Fluxer's own website, not here. Fluxer may rename or move a button from time to time. If a label below doesn't match what you see, look for the closest one.
-
Open Fluxer and log in
Go to web.fluxer.app. Make sure your email address is verified, because Fluxer only lets verified accounts create bots.
-
Open User Settings, then Applications
Look for the settings (cog) icon near your name. Applications is one of the pages inside it.
-
Create an application
Choose a name. This will be the name people see for your bot, so pick one you like. You can change it later.
-
Add a bot to the application
On the application's page, add a bot. An application can have one bot.
-
Copy the bot's token
Press Regenerate next to the bot token and copy the new token. Fluxer may ask for your password first, and for a code from your authenticator app if you use one.
What a token looks like
A token has two parts joined by a dot. The first part is your application's ID, which is safe to share. The second part is the secret.
That token is made up. Never paste a real one in a chat, a screenshot or a public file. If you ever do, press Regenerate on Fluxer at once.
-
Invite the bot to your community
Your bot has to be a member of the community before it can answer. Open this address in your browser, after swapping
YOUR_APPLICATION_IDfor the first part of your token (the numbers before the dot):https://fluxer.app/oauth2/authorize?client_id=YOUR_APPLICATION_ID&scope=bot&permissions=68608Pick your community when Fluxer asks, then confirm. You need the Manage Community permission there (it may be called Manage Guild). The number
68608asks for the basics: see channels, send messages and read message history. If your bot will kick, ban, time out or give roles, ask for those permissions too, and see Roles and moderation.
Step 2
Add your bot token
Now bring the bot into Scratch For Fluxer. You log in with Fluxer, paste the token, and the editor opens.
-
Log in with Fluxer
Press Log in with Fluxer at the top right of any page. Fluxer asks you to allow the login. We only get your name and avatar. We never see your password, your email or your messages.
The login page. -
Press Add a bot
You land on My bots. It is empty the first time. Press Add a bot.
My bots, before you have added anything. -
Paste the token and check it
Paste the token into the box (1). The eye button next to it shows or hides what you typed. Then press Check token (2). We ask Fluxer if the token is real and belongs to you.
Paste the token, then press Check token. -
Name it and save
If the token is good, you see your bot's name and avatar. Type the name you want to see in Scratch For Fluxer (1). It is only used here and you can change it later. Press Save bot (2) and the editor opens.
Fluxer confirmed the token. Give the bot a name and save.
You can add up to 10 bots to one account.
Step 3
A tour of the editor
The editor has three parts: the blocks on the left, the Python they write on the right, and the console at the bottom right. Everything is saved for you as you go. Look for Saved at the top.
- 1Block families. Press one to open its blocks. There are eleven, each with its own colour. See Blocks.
- 2Workspace. Drag blocks here and snap them together. Drag a block to the bin (or press Delete) to remove it. The sparkle button tidies everything up, and the arrows undo and redo.
- 3Run, Restart, Stop. Start your bot, restart it with your latest blocks, or stop it. See Run your bot.
- 4Get code. Download
main.pyor a folder with everything. See Download main.py. - 5Python, Files and Problems. Python shows the code your blocks write, live. Files holds the pictures and data you uploaded. Problems lists anything that needs fixing before the bot can run.
- 6Console. What your bot says while it runs, including warnings and errors.
Two blocks are already there and can't be deleted: create the bot with command prefix at the top, and log in with the saved bot token at the bottom. They create your bot and connect it to Fluxer. You only ever need to change the prefix.
Step 4
Your first bot
A new bot already knows two things. When it comes online it writes Bot is online! to the console, and when someone types !ping it answers Pong!. Let's teach it a second command, !hello, that greets people by name.
-
Read the blocks that are already there
Each yellow block starts a script. when the command ping is used runs when someone types the prefix and
ping, and the purple block under it, reply with Pong!, answers. Click the white box that says Pong! and type something else to change the answer.when the commandpingis used -
Add a new command
Open Events and drag when the command … is used into an empty spot. Click its white box and type
hello. People will now type!hello. -
Add a reply under it
Open Messages, drag reply with and drop it just under the yellow block. When the shapes line up it clicks into place.
Pressing a family opens its blocks. Drag the one you want out. -
Greet people by name
Open Operators and drag join into the white box of reply with. Type
Hello,(with a space after the comma) in the first box. Then open Message info and drag author name into the second box.when the commandhellois usedIn the editor the join and author name blocks sit inside the white box, like round pieces in a hole.
-
Check the Python
Look at the Python tab. Your two blocks became a few lines of real code. This is the file your bot runs, and reading it is a great way to learn.
The Python tab updates as you build.
Step 5
Run your bot
Make sure you invited the bot to your community (see step 1). Then:
-
Press Run
The status next to Console says Starting and then Running (1). Your bot shows as online in your community. In the console you see Bot is online! (3).
A running bot. The console shows what it is doing. -
Try it in Fluxer
Open a channel the bot can see and type
!ping. The bot answers Pong!. Type!helloif you built the second command. -
Change something? Press Restart
A running bot keeps the blocks it started with. After you change the blocks, press Restart to stop it and start it again with the new ones.
-
Press Stop when you are done
The bot goes offline (2).
What the console shows
The console is for you, not for chat. It shows the lines your write to the console blocks print, plus what the bot itself reports: that it connected, and any warnings and errors. Replies in Fluxer don't appear in it. Use the All, Warnings, Errors buttons to filter and the bin to clear it.
How long does it stay online?
- There is no time limit. A bot keeps running until you press Stop.
- You can run a couple of bots at the same time. If the runner is full, it says so. Try again in a little while.
- If the runner restarts, running bots stop and don't come back by themselves. The editor says The runner no longer has this run. Press Run again.
Step 6
Download main.py
Your bot is not stuck on this site. The code your blocks write is yours to keep.
-
Open Get code
It is the button at the top right of the editor.
-
Pick what you want
Python file (1) downloads
main.pyon its own. Folder with your files (2) downloads a.zipwith everything the bot needs to run.
The Get code menu.
Save and load your blocks
The same menu has two more items under Blocks. Save your blocks downloads a small .json file with all your blocks (not the Python), which is a good backup and the way to share a bot with a friend. Load blocks from a file… replaces the blocks in this bot with the ones in such a file. Fluxer's pictures and data files are not inside it: if a block uses a file, add that file in the Files tab with the same name.
What is in the zip
main.pyThe bot.requirements.txtWhat to install first (pip install -r requirements.txt).README.txtShort instructions for running it.assets/The pictures and data files your blocks use, if any.
This is what main.py looks like
This is the code of a new bot. Yours will have more lines once you add blocks.
import os
import fluxer
bot = fluxer.Bot(
command_prefix="!",
intents=fluxer.Intents.default(),
)
@bot.event
async def on_ready():
print("Bot is online!")
@bot.command()
async def ping(ctx):
await ctx.reply("Pong!")
bot.run(os.environ["FLUXER_TOKEN"])Read the last line: bot.run(os.environ["FLUXER_TOKEN"]). The file doesn't contain your token. It reads it from something called an environment variable named FLUXER_TOKEN, so you can share or upload main.py without leaking the token. You set that variable when you run the bot. The next section shows how.
Step 7 (optional)
Run main.py yourself
Running it yourself means you decide when it starts and stops, and it can stay online as long as the machine does. You need a computer that has Python.
On your computer
-
Install Python
Get Python 3.10 or newer from python.org/downloads. On Windows, tick Add python.exe to PATH in the installer.
-
Put the files in a folder
Unzip the folder you downloaded, or make a new folder and put
main.pyin it. -
Open a terminal in that folder
On Windows, open the folder, click the address bar, type
cmdand press Enter. On macOS, right-click the folder and choose New Terminal at Folder. On Linux, open a terminal andcdinto it. -
Install what the bot needs
pip install -r requirements.txtIf you only have
main.py, runpip install "fluxer.py>=0.4.2,<0.5"instead. On macOS and Linux, usepip3ifpipisn't found. -
Give it the token and start it
Replace
paste your token herewith your bot's token, then run the line for your system:Windows (PowerShell)
$env:FLUXER_TOKEN="paste your token here"; python main.pyWindows (Command Prompt)
set FLUXER_TOKEN=paste your token here python main.pymacOS and Linux
FLUXER_TOKEN="paste your token here" python3 main.pyYou should see the lines you set up, such as Bot is online!. Try
!pingin Fluxer. To stop the bot, press Ctrl + C.
Keep it online all the time
A bot is only online while main.py is running. Close the terminal or switch off the computer, and it goes offline. To keep it up day and night, run it on a machine that is always on, such as a small server (a VPS), a home server or a spare computer. Pick the way you like best:
With Docker
Put a file called Dockerfile next to main.py and requirements.txt:
FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python", "main.py"]Build it once, then start it so that it comes back after a restart:
docker build -t my-fluxer-bot .
docker run -d --name my-fluxer-bot --restart unless-stopped -e FLUXER_TOKEN="paste your token here" my-fluxer-botSee what the bot says with docker logs -f my-fluxer-bot. Many hosting panels that run containers have a box for environment variables. Add FLUXER_TOKEN there.
As a service on Linux (systemd)
Store the token in a private file, so it isn't in the service file:
echo 'FLUXER_TOKEN=paste your token here' > ~/mybot/.env
chmod 600 ~/mybot/.envThen create /etc/systemd/system/mybot.service:
[Unit]
Description=My Fluxer bot
After=network-online.target
[Service]
WorkingDirectory=/home/you/mybot
EnvironmentFile=/home/you/mybot/.env
ExecStart=/usr/bin/python3 main.py
Restart=always
User=you
[Install]
WantedBy=multi-user.targetStart it, and make it start with the machine:
sudo systemctl enable --now mybot
sudo journalctl -u mybot -fOn a hosting service that runs Python
Most services that run Python programs (or containers) work the same way:
- Upload
main.pyandrequirements.txt. - Set the start command to
python main.py. - Add an environment variable called
FLUXER_TOKENwith your token as its value. - Start it, and read its logs to see Bot is online!.
Choose a service that keeps the program running all the time. Some free plans put programs to sleep, which would take your bot offline.
Reference
Blocks
There are 124 blocks in 11 families. A family is a group of blocks that do a similar job, and it has its own colour so you can find your way around.
How blocks fit together
Hat and stack blocks
Yellow event blocks have a curved top: they start a script. Other blocks have a notch on top and a bump underneath, so they stack under each other and run from top to bottom.
Round blocks and white boxes
A white box is a place for a value: type text into it, or drop a round block on top. Round blocks hold information (like author name) or do a calculation.
Dropdowns
A dark pill with a small arrow is a dropdown. Click it and pick an option, such as a status.
Finding a block by typing
You don't have to remember which family a block lives in. There are two search boxes in the editor:
- The search box at the top of the workspace (next to undo and redo) looks through every block. Type a word such as role or embed, press Enter or click a result, and the block appears in the middle of your workspace, ready to drag. Press / or Ctrl+K to jump into it, the arrow keys to move through the results and Esc to leave.
- The search box inside each family narrows the list you opened. Open Messages, type reaction, and only the blocks about reactions stay. Clear the box, or close the family, to see them all again.
Both look at the words on the block and at its description, so typing several words (like ban member) finds blocks that have all of them.
Every block below is shown as it looks in the editor.
Cards (embeds)
A card (Fluxer calls it an embed) is a message with a title, some text and a coloured edge. Use reply with embed or send embed from the Messages family. The block has a Card options button: press it to open a small window where you set everything about the card, and watch it change in a preview as you go.
- Title and Text. Type them here, or plug another block (like author name) into the block's own sockets. If a block is plugged in, the window tells you.
- Colour of the edge: pick one of nine, or press the small coloured square to open the colour picker (next to the picture below), or type a code like
#ff8800. - Link on the title: people who click the title go to that address. It must start with
https://. - Big picture (under the text) and small picture (the thumbnail, top right): use a web address, or one of the pictures you uploaded on the Files tab. Uploaded pictures work in reply with embed and send embed, not in the webhook block.
- Author (small name above the title, with an optional picture) and footer (small text at the bottom, with an optional picture).
- Show the time adds the time the message was sent.
Press Reset in the window to go back to a plain card. Cards you made before this window existed keep their colour.
The emoji picker
Under the card's Text there is an Emoji button. Press it to open a small picker with a search box:
- Your communities' emoji come first. The editor asks Fluxer which communities your bot is in and lists their custom emoji, one group per community. A community with no custom emoji is left out. If the list can't be loaded, the ordinary emoji still work.
- Ordinary emoji come in groups (faces, hearts, animals, food and more). Type a word such as fire or heart in the search box to find one.
- Pressing an emoji writes it into the text where your cursor is. A community emoji is written like
<:party:123456789>, which is how Fluxer reads it, so leave that as it is. The bot can only use a community emoji from a community it is in.
The picker is only in the card's Text. Anywhere else you can still type or paste an emoji yourself.
The colour picker
Press the coloured square under Colour of the edge. A picker opens that works the same in every browser:
- The big square is the shade. Click or drag in it: left is pale, right is strong, up is bright, down is dark. With the keyboard, use the arrow keys (hold Shift for bigger steps).
- The rainbow slider chooses the basic colour (red, green, blue and everything between).
- R, G, B and Hex are the same colour as numbers (0 to 255) and as a code. Type in any of them and the others follow.
- Pick from screen lets you click any colour you can see on your screen. It shows up only in browsers that have an eyedropper, like Chrome and Edge.
- The small circles at the bottom are the colours you used lately. Press one to use it again.
Codenames: put a value inside your text
Say you want a message like “Coins Balance: 500”, where 500 is whatever is in your Coins variable. Normally you would need a join block with three pieces. With a codename you just write it in the text:
Coins Balance: $varCoins
A codename is a $ followed by a short word. When your bot runs, the codename is replaced by the real value. It works in every text box (the ones inside reply, send, write to the console, the title and text of a card, and so on). The Author and Footer in the Card options window understand them too.
Try it: make a variable called Coins, put set Coins to 500 in a command, then reply with the text You have $varCoins coins. Type $ codenames by hand, or use the Insert a codename… menu in the Card options window.
Your variables and lists
Write var, list or count and then the name of your variable or list. Capital letters, spaces and _ don't matter, so $varCoinsBalance finds a variable called Coins Balance.
$varCoinsis the value of the variable Coins.$listShopis every item of the list Shop, with commas between them.$countShopis how many items the list Shop has.$argUseris the word a person wrote for the argument user of the command you are in. See Commands: arguments and locks.
Values from the message, the member and the bot
These are the same as the blocks with the same words (author ID, message ID ...), so they work in the same places. If you use one where it can't work, for example $messageID in a “member joins” event, the editor tells you.
The message
| Write | You get | Works in |
|---|---|---|
$authorName | Name of the person who wrote the message | message and command events |
$authorMention | A mention of that person (they get pinged) | message and command events |
$authorID | ID of that person | message and command events |
$messageText | What the message says | message and command events |
$messageID | ID of the message | message and command events |
$channelID | ID of the channel it was written in | message and command events |
$mentionedID | ID of the first person mentioned in it | message and command events |
The command
| Write | You get | Works in |
|---|---|---|
$commandText | Everything written after the command | command events |
Community
| Write | You get | Works in |
|---|---|---|
$communityID | ID of the community (server) | message, member, community events |
$communityName | Name of the community the bot just joined | community events |
Members and reactions
| Write | You get | Works in |
|---|---|---|
$memberName | Name of the member who joined | member join and leave events |
$memberMention | A mention of that member | member join and leave events |
$memberID | ID of that member | member join and leave events |
$reactorID | ID of the person who reacted | reaction events |
Things the bot made
| Write | You get | Works in |
|---|---|---|
$newChannelID | ID of the channel the bot just made | anywhere |
$newRoleID | ID of the role the bot just made | anywhere |
$newThreadID | ID of the thread or post the bot just made | anywhere |
The bot
| Write | You get | Works in |
|---|---|---|
$botName | The bot's name | anywhere |
$botPing | Bot ping in milliseconds | anywhere |
$botUptime | How long the bot has been running, as words | anywhere |
$botUptimeSeconds | How long the bot has been running, in seconds | anywhere |
$communityCount | How many communities the bot is in | anywhere |
Good to know
- Letters right after a codename? Use curly brackets:
${authorID}abc. This also lets you use a name with spaces:${var Coins Balance}. - Want a real dollar sign? Most of the time just type it:
It costs $5stays as it is. If a word follows the$, write two:$$authorIDshows exactly$authorID. - Misspelled a codename? It stays as you typed it and the editor shows a warning, so a typo is easy to spot.
- Blocks still work. A codename is only a shortcut. If you plug a block into a socket, it keeps working exactly as before.
Commands: arguments and locks
The yellow when the command … is used block has two extra settings. They are what you need for commands like !say or !kick @someone spamming.
Arguments: the words after the command
In the box next to arguments, write a name for each word you want people to type after the command, separated by spaces. For a kick command write user reason. Now !kick @Sam spamming a lot gives you two values: $argUser is @Sam and $argReason is spamming a lot.
- Use them anywhere you can type text. Write
$argand then the name (capital letters don't matter):$argUser. Or drop the round argument block from Message info into a socket and type the name. - The last argument takes everything that is left. A command with one argument,
message, makes a perfect!say: reply with$argMessage. - Missing arguments are explained. If someone types
!kickand nothing else, the bot answers Usage: !kick <user> [reason] and stops, so your blocks never run on empty values. - Optional arguments end with a question mark:
user reason?means the reason can be left out (then$argReasonis empty). - People and roles. A moderation block accepts an argument that holds an ID or a mention, so kick the person
$argUserworks with!kick @Sam. - A command can have up to 8 arguments. Names use letters and digits, and start with a letter.
Who can use it: lock a command to a permission
Open the who can use it menu on the command block and pick a permission, such as people who can kick members. Only people who have that permission in your community can run the command. Everyone else gets “You don't have permission to use this command.”, and none of your blocks run. Administrators and the owner of the community can always use a locked command.
- The editor's warning “Anyone who can type this could use it on other people” goes away when the command is locked, because now only the right people can.
- The lock checks the person who typed the command. Your bot still needs its own permission for what it does (for example Kick Members).
- You can still use author has the role … when you want to check one particular role instead of a permission.
Try it: make a command say with the argument message, lock it to people who can manage messages, and put reply with $argMessage under it. Then !say hello everyone repeats what you wrote, but only for your moderators.
Schedules and time zones
Most blocks wait for something to happen. Two yellow blocks make the bot act by itself, on the clock, with no message needed.
- when the clock reaches 09:00 every day runs at a time of day. Type the time with a 24-hour clock (
09:00,21:30), pick the days (every day, weekdays, weekends, or one day), and pick the time zone the time is in. A bot in Cairo that should say good morning at 9 uses Cairo (Egypt), and the time zone's summer-time changes are handled for you. - every 30 minutes runs again and again. The wait is at least 1 minute and at most 7 days. The first run happens after the first wait.
- The round current time in … block gives the time, date, day of the week, hour or minute in a time zone. Use it in a message, or with if to do something only at certain hours.
A scheduled script has no message under it, so it can't reply. Use send … to channel and paste the channel's ID (see Where do I get an ID?). A bot can have up to 10 schedule blocks, and each runs as long as the bot runs. If one run has a problem, the console says so and the schedule keeps going.
Try it: use when the clock reaches 09:00 every day with your time zone, and snap send Good morning! It is $botName time to channel your channel's ID under it.
Sharing a bot with other people
You can let friends help build your bot without ever giving them your bot's token. Open a bot and press Share.
- Make an invite link. Choose when it stops working, how many people can use it, and what they may do: edit blocks, manage files, start and stop the bot, see the console and export. Looking at the blocks is always allowed.
- The link is shown only once, when you make it. Copy it then and send it. We keep only a scrambled copy, so we can't show it again.
- A bot can have up to 5 helpers and 10 active links. You can cancel a link, change what each person may do, or remove someone at any time. Helpers can leave by themselves.
- Helpers never see the token. Without the start and stop permission they can't run the bot at all.
Try it: press Share, make a link that works for 1 person and 1 day with only edit blocks ticked, and send it to a friend. Their bot list will show it under Shared with me.
Channels, roles, threads and forums
Until now your bot could talk. With the Channels and roles and Threads and forums families it can also build: make channels and roles, start threads, and publish posts. Each block is listed with the others below. This part explains how to use them well.
Before you start: permissions
- For channels and tags the bot needs the Manage Channels permission. For roles it needs Manage Roles, and its own role must be above any role it makes or deletes.
- For threads it needs permission to create threads. For forum posts it needs to be allowed to send messages in that channel.
- If something is missing, the bot doesn't crash. It writes one clear line in the console, like “Channel not made. Check that the bot has the Manage Channels permission”.
Where do I get an ID?
In Fluxer, turn on developer mode in your settings, then right-click a channel, role or message and choose Copy ID. A block that has just made something also gives you its ID, so you rarely need to copy one by hand:
- ID of the channel I just made (or
$newChannelIDinside a text) - ID of the role I just made (or
$newRoleID) - ID of the thread or post I just made (or
$newThreadID)
Channels
The create a … channel block has a menu with six kinds:
| Kind | What it is | The extra box |
|---|---|---|
| text | A normal channel for messages | The topic (a short description) |
| voice | A channel to talk in | Not used |
| announcement | A channel for news that other communities can follow | The topic |
| forum | A channel where every conversation is a post with a title | The topic, shown at the top of the forum |
| media | Like a forum, made for pictures and videos | The topic |
| link | A button in the channel list that opens a web page | The web address. It is required and must start with https:// |
Leave inside the category with ID empty to put the channel at the top, or paste the ID of a category to put it there. Channel names are written in lower case with dashes, so My News becomes my-news.
Try it: a ticket channel. A command !ticket that runs create a text channel named ticket-$authorName, then send Hi $authorMention, tell us how we can help! to channel $newChannelID.
Roles
create a role named … makes a role with a colour (the same colours as cards, or none), and two yes/no choices: shown apart from others (people with this role are listed in their own group) and anyone can mention it. The new role has no special permissions. Give it to someone with the block you already know, give the role … to the person …, using ID of the role I just made.
Threads
A thread is a small side conversation under a channel. start a public/private thread named … starts one in a text or announcement channel (leave the channel empty to use the channel where the command was written). A public thread can be seen by everyone who sees the channel. A private thread only by the people in it: to bring someone in, mention them in a message inside the thread.
- start a thread named … from this message attaches the thread to the message that started the command. A message can have only one thread.
- send … in the thread with ID writes inside it. A thread's ID works like a channel's ID, so the send … to channel block works too.
- close / reopen / lock / unlock the thread. Closing hides it from the list but anyone can reopen it by writing. Locking lets only moderators write.
Try it: !help starts a public thread named Help for $authorName and writes Tell us what happened, $authorMention in it with the thread ID.
Forum and media posts
In a forum or media channel every conversation is a post. post in the forum or media channel … publishes one with a title and a first message. There are three versions of the block:
- The plain one: title, text and tags.
- … and the picture: pick a picture you uploaded on the Files tab. The post opens with your text and the picture follows it right away.
- … and the picture at: a web address (
https://…). The picture is shown inside the first message.
Tags are the little labels a forum has (like Help or Bug). Write the names of the tags you want, separated by commas, in the and tags box: Help, Bug. Capital letters don't matter, a post can have up to five, and the tags must already exist. A name that doesn't exist is skipped, and the console says which. To see what a channel has, use the tags of the forum or media channel block (it gives a list). To change the tags, use add the tag … and remove the tag ….
Events 10 blocks
Every script starts with an event: something happens in Fluxer and your blocks run.
An event is something that happens in Fluxer: your bot comes online, someone sends a message, someone joins your community. Every script of blocks starts with a yellow event block, and the blocks snapped under it run each time that event happens. Blocks that aren't under an event never run.
Try it: Use when the command ping is used and snap reply with Pong! under it. Now typing !ping in Fluxer makes your bot answer. Commands can also take arguments and be locked to a permission, and two blocks run on the clock (see Commands and Schedules).
-
when the bot is ready
Runs once, when your bot has connected to Fluxer.
-
when a message is received
Runs for every message people send. Messages from bots, including yours, are ignored so your bot can't answer itself forever.
-
when the commandpingis usedwho can use itarguments
Runs when a message starts with your prefix and this name, for example !ping. “Who can use it” locks the command to people with a permission (others are told they can't). “Arguments” names the words people write after the command, like: user reason. Use them as $argUser and $argReason, or with the “argument” block. The last argument takes the rest of the message. Add ? to make one optional (reason?).
-
when the clock reaches09:00in the time zone
Runs by itself at a time of day, in the time zone you choose (24-hour clock, like 09:00 or 21:30). There is no message here, so use “send … to channel” with a channel ID to talk.
-
every30
Runs again and again, after this much time (at least 1 minute, at most 7 days). The first run is after the first wait. There is no message here, so use “send … to channel” with a channel ID to talk.
-
when someone joins a community
Runs when a person joins a community your bot is in (called a guild in fluxer.py).
-
when someone leaves a community
Runs when a person leaves a community your bot is in.
-
when the bot joins a community
Runs when your bot is added to a community (for example, someone uses its invite link). Use “community name” and “community ID” inside it.
-
when someone adds the reaction✅to message
Runs when a person reacts. Paste the message's ID (leave it empty for any message) and type the emoji (leave it empty for any emoji). Reactions from your own bot are ignored.
-
when someone removes the reaction✅from message
Runs when a person takes their reaction back. Use the same message ID and emoji as the block that gave the role, then take the role away here.
Bot 9 blocks
Control the bot itself: its status, its custom status and what it writes to the console.
These blocks are about the bot itself rather than a message: the little status dot next to its name, the text under its name, and what it writes to the console (the panel under the Python code in the editor).
Try it: Put write Bot is online! to the console under when the bot is ready. When you press Run, that line appears in the console.
-
set status to
Changes the dot next to your bot's name: online, idle, do not disturb or invisible.
-
set custom status toLearning blockswith emoji
Shows a short text, and an emoji if you want one, next to your bot's name. For the emoji, type or paste any normal emoji, or paste a community emoji written like <:name:123456789>. Leave both empty to clear it.
-
writeBot is online!to the console
Writes a line to the console. Handy to see what your bot is doing.
-
writeSomething happenedto the console as
Writes a line to the console as an info, a warning or an error, so you can filter for it.
-
the bot's name
Your bot's own username.
-
bot ping (ms)
How many milliseconds Fluxer takes to answer your bot. It is measured each time the block runs.
-
bot uptime (seconds)
How many seconds your bot has been running since it started.
-
bot uptime
How long your bot has been running, written like 1d 2h 3m 4s.
-
number of communities
How many communities your bot is in right now.
Messages 28 blocks
Talk back: reply to a message, send to a channel, or post an embed.
These blocks make your bot do something: reply, send to a channel, post an embed (a message with a title and a coloured edge), react with an emoji, send a private message, delete a message, or manage roles and members. Most of them only make sense inside an event that has a message or a person, and the editor tells you if one is in the wrong place.
Try it: Snap reply with embed under a command to answer with a coloured card instead of plain text, then press its Card options button to change the colour, add a picture, a link and more.
-
Replies to the message that started this script. Fluxer shows it as a reply.
Use it in: message and command events
-
Sends a new message in the channel where the message was written.
Use it in: message and command events
-
Sends a message to any channel your bot can see. Paste the channel's ID.
-
Sends a card (an embed) to this channel. Press “Card options” to change its colour, add a link, a picture, a small picture (thumbnail), an author, a footer or the time.
Use it in: message and command events
-
Replies with a card (an embed). Press “Card options” to change its colour, add a link, a picture, a small picture (thumbnail), an author, a footer or the time.
Use it in: message and command events
-
Adds an emoji reaction to the message. Type or paste any emoji.
Use it in: message and command events
-
Deletes the message. Your bot needs permission to manage messages.
Use it in: message and command events
-
Opens a private chat with the person who wrote the message and sends this text.
Use it in: message and command events
-
Sends a private message to the person who just joined or left.
Use it in: member join and leave events
-
Gives the person who just joined a role. Paste the role's ID. Your bot needs the Manage Roles permission, and its own role must be above the role it gives.
Use it in: member join and leave events
-
Gives a role to a person. Paste the role's ID and the person's ID (or a mention). Your bot needs the Manage Roles permission, and its own role must be above the role it gives.
Use it in: message, command, member and reaction events
-
Removes a role from a person. Paste the role's ID and the person's ID (or a mention). Your bot needs the Manage Roles permission, and its own role must be above that role.
Use it in: message, command, member and reaction events
-
Gives the role to whoever added the reaction. Paste the role's ID. Your bot needs the Manage Roles permission, and its own role must be above the role it gives.
Use it in: reaction events
-
Removes the role from whoever took their reaction back. Paste the same role ID that the adding script gives.
Use it in: reaction events
-
Stops a person from talking for some minutes (1 to 40320, which is 28 days). Paste their ID or mention them. Needs the Moderate Members permission and a role above theirs.
Use it in: message, command, member and reaction events
-
Ends a mute early. Needs the Moderate Members permission.
Use it in: message, command, member and reaction events
-
Sets a person's nickname in this community (at most 32 letters). Leave the nickname empty to remove it. Paste their ID or mention them. Needs the Manage Nicknames permission and a role above theirs.
Use it in: message, command, member and reaction events
-
Removes a person from the community. They can join again with an invite. Needs the Kick Members permission and a role above theirs.
Use it in: message, command, member and reaction events
-
Removes a person and stops them from joining again until you unban them. Needs the Ban Members permission and a role above theirs.
Use it in: message, command, member and reaction events
-
Lets a banned person join again. Paste their ID. Needs the Ban Members permission.
Use it in: message, command, member and reaction events
-
Sends a message to this channel and keeps its ID in a variable, so you can edit or delete that message later.
Use it in: message and command events
-
Sends a message to a channel and keeps its ID in a variable, so you can edit or delete that message later.
-
Changes the text of one of your bot's own messages (a bot can't edit other people's messages). Paste the message ID and the channel ID, or use the variable you saved the ID in.
-
Deletes a message by its ID. Deleting other people's messages needs the Manage Messages permission.
-
Shows “the bot is typing…” in this channel for a few seconds. Use it before a wait to make replies feel natural.
Use it in: message and command events
-
Shows “the bot is typing…” in a channel for a few seconds. Paste the channel's ID.
-
Posts a message through a webhook. Paste the webhook URL from the channel settings. Leave the name empty to use the webhook's own. Keep the URL private: anyone who has it can post.
-
Posts a card (an embed) through a webhook. Press “Card options” for the colour, a link, pictures (web addresses only), an author, a footer or the time. Paste the webhook URL from the channel settings. Leave the name empty to use the webhook's own. Keep the URL private.
Message info 18 blocks
Read what was said, who said it and where.
Round blocks that hold information about the message that just arrived: what it says, who wrote it, which channel it is in. They don't do anything on their own. Drop them into the white sockets of other blocks.
Try it: Drop author name into the second socket of a join block to say Hello, Sam.
-
ID of the person who reacted
The ID of the person who added or removed the reaction.
Use it in: reaction events
-
ID of the first person mentioned
The ID of the first person mentioned in the message (like !kick @someone), or empty if nobody was.
Use it in: message and command events
-
author has the role
True if the person who wrote the message has this role. Paste the role's ID. Use it so only staff can run moderation commands.
Use it in: message and command events
-
message text
What the message says, exactly as it was written (a command message includes the prefix).
Use it in: message and command events
-
currentin
The time, date or day of the week right now in a time zone. Hours and minutes use a 24-hour clock. Use “number from” to do maths with the hour or the minute.
-
argumentuser
One of the arguments you named on the command block (the same as writing $arg and its name, like $argUser). Type the argument's name exactly as you wrote it there. It also fits number sockets, like the minutes of a mute.
Use it in: command events
-
text after the command
Everything written after the command. For !say hello it is: hello
Use it in: command events
-
author name
The display name of the person who wrote the message.
Use it in: message and command events
-
author mention
Text that mentions the author, so they get a notification.
Use it in: message and command events
-
author ID
The author's ID. IDs are long numbers, so they are kept as text.
Use it in: message and command events
-
channel ID
The ID of the channel the message was written in.
Use it in: message and command events
-
message ID
The ID of the message.
Use it in: message and command events
-
community ID
The ID of the community. It is empty in private messages.
Use it in: message, member, community events
-
community name
The name of the community the bot just joined. Works inside “when the bot joins a community”.
Use it in: community events
-
author is a bot
True if the message was written by a bot.
Use it in: message and command events
-
member name
The display name of the person who joined or left.
Use it in: member join and leave events
-
member mention
Text that mentions the member, so they get a notification.
Use it in: member join and leave events
-
member ID
The member's ID. IDs are long numbers, so they are kept as text.
Use it in: member join and leave events
Channels and roles 6 blocks
Build your community: make and delete channels (text, voice, announcement, forum, media, link) and roles.
These blocks build your community: make a channel (text, voice, announcement, forum, media or link) or a role, and delete them again. They change your community for real, so use them inside an “if” that checks the person has a staff role. The bot needs the Manage Channels or Manage Roles permission, and for roles its own role must be above the roles it makes or deletes.
Try it: Make a command !ticket that makes a text channel called ticket-$authorName, then writes “Welcome!” in it with send … to channel and the ID of the channel I just made.
-
create achannel namednew-channelwith topic (or the web address, for a link channel)inside the category with ID
Makes a new channel. Fill in the topic for a text, voice, announcement, forum or media channel, or the web address (https://…) for a link channel. Leave the category empty to put it at the top. Needs the Manage Channels permission.
Use it in: message, command, member and reaction events
-
delete the channel (or thread) with ID
Deletes a channel for good, with everything in it. There is no undo. Paste the ID, or use the ID of the channel you just made. Needs the Manage Channels permission.
Use it in: message, command, member and reaction events
-
create a role namedMemberwith colourshown apart from others:anyone can mention it:
Makes a new role (it starts with no special permissions). Needs the Manage Roles permission.
Use it in: message, command, member and reaction events
-
delete the role with ID
Deletes a role, so everyone loses it. Needs the Manage Roles permission, and the role must be below the bot's own role.
Use it in: message, command, member and reaction events
-
ID of the channel I just made
The ID of the last channel this bot made. Use it to delete it later or to send something in it.
-
ID of the role I just made
The ID of the last role this bot made. Use it with “give the role … to the person …”.
Threads and forums 11 blocks
Start threads, write inside them, and publish posts (with a picture and tags) in forum and media channels.
A thread is a small side conversation under a channel. Start one (public, or private for a few people), write inside it, and close or lock it later. In a forum or media channel every conversation is a post, so these blocks can publish a post with a title, text, an optional picture and tags, and add or remove the channel's tags.
Try it: Make a command !help that starts a public thread called Help for $authorName and writes “Tell us what happened” inside it.
-
start athread namedChatin the channel with ID (empty = this channel)
Starts a thread in a text or announcement channel. A public thread can be seen by everyone who sees the channel; a private one only by the people in it. Needs permission to create threads.
Use it in: message, reaction events
-
start a thread namedDiscussionfrom this message
Starts a public thread attached to the message that triggered the script.
Use it in: message and command events
-
sendHello!in the thread with ID
Writes a message inside a thread. Use the ID of the thread you just made. To bring a person into a private thread, mention them in the message.
-
the thread with ID
Closes (archives) or reopens a thread, or locks it so only moderators can write in it.
-
ID of the thread or post I just made
The ID of the last thread or forum post this bot made. A thread's ID works like a channel's ID.
-
post in the forum or media channelwith titleHelloand textFirst post!and tags (names, separated by commas)
Publishes a post in a forum or media channel. Tags must already exist in that channel; write their names like Help, Bug. A wrong name is skipped and shown in the console.
-
post in the forum or media channelwith titleHelloand textFirst post!and the pictureand tags (names, separated by commas)
Publishes a post with a picture you uploaded on the Files tab. The post opens with your text, and the picture is added to it right after. Tags must already exist in the channel.
-
post in the forum or media channelwith titleHelloand textFirst post!and the picture athttps://and tags (names, separated by commas)
Publishes a post with a picture from a web address (https://…). The picture is shown inside the first message. Tags must already exist in the channel.
-
add the tagHelpto the forum or media channel
Adds a new tag people can pick when they post (up to 20 per channel). Needs the Manage Channels permission.
Use it in: message, command, member and reaction events
-
remove the tagHelpfrom the forum or media channel
Removes a tag from the channel by its name. Needs the Manage Channels permission.
Use it in: message, command, member and reaction events
-
tags of the forum or media channel
A list with the names of the tags the channel has. Use it to check that a tag exists, or to show them.
Control 7 blocks
Decide and repeat: if / else, loops and waiting.
Control blocks decide what happens and how often. If runs its blocks only when something is true, repeat runs them several times, and wait pauses for a number of seconds.
Try it: Put reply with inside an if block whose condition checks the author's name.
-
if…then
Runs the blocks inside only when the condition is true.
-
if…thenelse
Runs the first stack when the condition is true, otherwise the second.
-
repeat10times
Runs the blocks inside again and again, this many times.
-
repeat until…
Keeps running the blocks inside until the condition becomes true.
-
forever
Runs the blocks inside again and again. Put a wait inside so it doesn't spin too fast.
-
wait1seconds
Pauses this script. Your bot keeps answering other things while it waits.
-
stop this script
Ends this script here. Other scripts keep running.
Operators 14 blocks
Join text, compare values and do maths.
Operators work with values: join two pieces of text, compare two things (is this equal to that?), and do maths. Like Message info blocks they are round, so they go into sockets.
Try it: Use join to combine Hello, with a name, or pick random to answer with a different number each time.
-
True or false.
-
joinHello world
Sticks two pieces of text together. Numbers and other values are turned into text.
-
00
Adds, subtracts, multiplies or divides two numbers. ÷ always gives a decimal (10 ÷ 2 is 5.0). mod gives the remainder.
-
Compares two values. Text is compared exactly: Hello and hello are different.
-
……
True when both (and) or either (or) of the two conditions are true.
-
not…
Flips true to false and false to true.
-
pick random1to10
A whole number between the two numbers, both included.
-
hello worldcontainsworld
True if the first text has the second inside it. Capital letters don't matter.
-
length ofhello
How many characters the text has.
-
ofhello
Changes capital letters, or trims spaces from both ends.
-
word1ofhello world
The Nth word of some text. It is empty if there is no such word.
-
replaceawithoinbanana
Swaps every copy of the first text for the second.
-
number from5
Turns text like 12 into a number. If it isn't a number you get 0.
-
0
Rounds a number to a whole number (a half goes to the nearest even number, so 2.5 becomes 2 and 3.5 becomes 4), rounds it down or up, or removes its minus sign.
Variables 3 blocks
Give a value a name, then use it or change it later.
A variable is a labelled box that remembers a value. Create one with the Make a variable button in the editor, give it a value with set, and change it later with change by. A variable lives as long as your bot runs: when the bot stops, it forgets.
Try it: Make a variable called count, change count by 1 inside a command, then reply with it to count how often the command is used.
-
setto0
Gives a variable a new value.
-
changeby1
Adds a number to a variable. Use a negative number to subtract.
-
The current value of a variable.
Lists 12 blocks
Keep many values together and loop over them.
A list keeps several values together in order, like a shopping list: add to it, remove from it, take the first or a random item, or repeat something for every item.
Try it: Make a list of jokes, then reply with random item of jokes.
-
addappleto
Puts a new item at the end of the list.
-
delete item1of
Removes one item from the list. Counting starts at 1.
-
delete all of
Empties the list.
-
setto…
Replaces the whole list with another list, for example the words of some text.
-
item1of
One item of the list. Counting starts at 1. It is empty if there is no such item.
-
length of
How many items the list has.
-
containsapple
True if the list has this item.
-
random item of
A random item from the list. It is empty if the list is empty.
-
join items ofwith,
Turns the list into one piece of text, with this between the items.
-
splita,b,cby,
Cuts text into a list at every separator. An empty separator cuts at spaces.
-
The list itself, to use in a loop or to copy.
-
for eachin…
Runs the blocks inside once for every item. The variable holds the current item.
JSON and assets 6 blocks
Use the files you uploaded: read a JSON file, or send an image.
These blocks use files you uploaded on the Files tab. Read a value out of a JSON file (a small data file, good for quotes, answers or settings), or send an image or text file as an attachment.
Try it: Upload a picture on the Files tab, then use reply with image and pick it from the dropdown.
-
load JSON fileinto
Reads a JSON file you uploaded and keeps what is inside in a variable.
-
gettitlefrom
Digs into JSON data. Use dots to go deeper, like users.0.name. Missing keys give empty text.
-
text of file
All the text inside a text or JSON file you uploaded.
-
reply with image
Replies with a picture you uploaded.
Use it in: message and command events
-
send imageto this channel
Sends a picture you uploaded to the channel where the message was written.
Use it in: message and command events
-
reply with file
Replies with a file you uploaded, as an attachment.
Use it in: message and command events
No block matches that. Try a shorter word.
More
Files and images
Open the Files tab to give your bot pictures, text and data. Press Add files or drop them onto the editor.
- Accepted: PNG, JPG, GIF, WebP, JSON, TXT, MD or CSV.
- Up to 40 files per bot, 2 MB each and 8 MB in total.
- After you upload a file, its name appears in the dropdown of blocks that use files, such as reply with image and the JSON blocks. The Files tab shows which files your blocks use.
- Files come with you in the
.zip, inside theassetsfolder.
Manage your bots
Open My bots to see all your bots. Open blocks (1) takes you to the editor. The three dots (2) open a menu:
- Rename changes the name you see here. The bot's name on Fluxer stays the same.
- Replace token is for when you pressed Regenerate on Fluxer. The old token stops working at that moment, so paste the new one here and the bot works again.
- Remove bot deletes it from Scratch For Fluxer with its blocks, files and saved token. Your bot on Fluxer is not touched.
- Delete my data at the bottom of the page removes your account and everything in it. It stops your running bots first.
Help
Troubleshooting
Something not working? Find what you see below.
Check token says the token isn't valid
- Copy the whole token, including the number, the dot and everything after it. No spaces at the start or the end.
- If you pressed Regenerate since you copied it, the old token is dead. Copy the newest one.
- If you aren't sure, press Regenerate on Fluxer again and paste the fresh token.
It says the bot doesn't belong to my account
You can only add a bot that your Fluxer account owns. Log in here with the same Fluxer account that created the application. Check the name at the top right of the page.
The bot is running but doesn't answer in Fluxer
- Did you invite it? The bot has to be a member of the community. See the invite link in step 1.
- Can it see the channel? The bot needs to see the channel and be allowed to send messages in it. Check the channel's permissions.
- Typed it right? Start with the prefix. If the prefix is
!and the block saysping, people type!ping. Don't type the prefix inside the block's box. - Did you press Restart? A running bot doesn't pick up new blocks until you do.
- Look at the console. Errors show up there in red.
The Run button doesn't work, or says that running bots isn't switched on
The runner, the server that keeps bots online, isn't reachable right now. Try again in a few minutes. In the meantime you can download main.py and run it yourself, which doesn't need the runner at all.
My bot went offline by itself
- If the runner was restarted, every running bot stops. The editor says The runner no longer has this run. Press Run.
- If you replaced or regenerated the token, the old one stops working at once. Replace it on My bots.
- For a bot that must never go offline, run it yourself.
Roles, nickname, kick, ban and timeout blocks don't work
- The bot needs the matching permission in your community: Manage Roles to give or take roles, Manage Nicknames to change a nickname, Kick Members, Ban Members, or the timeout permission.
- A bot can only manage roles that are lower than its own highest role. In the community's role settings, drag the bot's role above the ones it should give.
- A bot can't act on the owner of the community, or on someone whose highest role is above its own.
- The blocks print Moderation failed in the console, with the reason, instead of crashing. Read that line.
- Think about who can type the command. A command that bans people is dangerous if anyone can use it. Add an if block that checks for a staff role first.
Blocks won't snap together
- Yellow event blocks have no notch on top, so nothing can go above them. Other blocks go under them.
- Round blocks go into white boxes, not under other blocks.
- Move the block until a preview of where it will click appears, then let go.
- Dropped one in the wrong place? Undo with Ctrl + Z.
The Python file won't download
Open the Problems tab (or the yellow pill at the top). Fix each item and the download works again.
The login says "Your login session expired or didn't match"
Your browser blocked the cookie that logging in needs, or you opened the site at a different address than the one you started on. Allow cookies for this site, open it at scratch.fluxer.my, and log in again.
My token was leaked
Don't panic. Press Regenerate next to the bot token on Fluxer. The leaked token stops working at once. Then paste the new token with Replace token on My bots, and update it wherever else you run the bot.
python isn't recognised, or pip isn't found
Python isn't installed, or isn't on your PATH. Reinstall it from python.org and tick Add python.exe to PATH. On Windows you can also try py main.py and py -m pip install -r requirements.txt. On macOS and Linux use python3 and pip3.
KeyError: 'FLUXER_TOKEN'
You started main.py without setting the token first. Set FLUXER_TOKEN in the same terminal window, right before starting the bot, as shown in Run main.py yourself. A new terminal window forgets it.
Questions
Do I need to know how to code?
No. Blocks do the coding for you. And if you want to learn, the Python tab shows the real code that each block writes.
Is my token safe?
It is encrypted before it is stored, it is never sent back to your browser, and no block can read it. When your bot runs, it is sent over HTTPS to the runner and kept in memory only. The privacy page lists everything we keep.
Can I use the same bot on more than one community?
Yes. Invite it to each community with the invite link. One bot runs one set of blocks everywhere it has been invited.
Will my variables and lists be remembered?
Only while the bot runs. When it stops or restarts, they start from their first value again. For anything that must survive a restart, keep it in a JSON file you read with the JSON blocks.
Can I make a block that isn't in the list?
Not yet. The blocks are fixed on purpose, which is what lets us check that every bot is safe to run. If you wish a block existed, tell us in the community server.
Where do I ask for help?
Join the community server on Fluxer and ask there. Say what you were doing and what you saw, and add a screenshot with the token hidden.