Skip to main content

Overview

The Petto Code Generator is a website that writes Petto Code for you. You pick what the command does with forms, try it in a channel that looks and works like Discord, and copy the command into your server. Open it at codegen.petto.sbs. It is free and needs no login.
Nothing leaves the page. The generator never touches your server. Your commands only reach Discord when you paste the install command yourself.

How it works

1

Build it

Open the Builder. Start from one of the 21 recipes, from an official template, or from an empty command. Fill only the parts you need: the name, how it starts, the answer, buttons, a form, reactions, requirements and extras. Variables like {user} or {server} work anywhere. The code is written and checked while you go.
2

Try it

The Try it tab is a test channel that runs the command with the real engine of Petto. Type the command, press its buttons, choose in its menus, fill its forms and react. You see what it would print and what it would do: roles given or taken, DMs, deleted messages, the stored data and a log of every use. You can switch between two test people to try what someone else sees.
3

Install it

The Install tab gives the !customcommand code command ready to paste in your server, and the !customcommand trigger command when it starts with its own prefix or words. It also gives a share code (pc1.) for !customcommand import.
liam pastes !customcommand code verify with the code in a block and Petto answers that verify was created

In Discord: the install command pasted in a server; Petto checks the code and saves it.

liam pastes !customcommand import with the pc1. share code and the name verify, and Petto answers that verify was imported

In Discord: the same command installed from its share code.

Want to change something by hand? Edit as code opens the command in the code editor, with colors, line numbers, a check on every key (with the line and the column of a mistake) and every function and piece of data ready to insert.

What it can build

Text and embeds

An answer in the channel, in a DM or in another channel, as text or an embed with fields, colors, images and the author.

Buttons and menus

Buttons and a dropdown menu that answer, give or take a role, or open a form. They can be locked to the person who used the command.

Forms

A pop-up form (modal) with text fields, menus of choices, radio buttons, checkboxes, pickers of members, roles and channels, files to upload and texts that inform. The answers go into a message, for example to a staff channel.

Reactions

Something that happens when people react: a role, a DM, an answer in the channel or a change to the message. A reaction can be only for the person who used the command.

Roles

Give, take or toggle a role from a command, a button, a menu option or a reaction.

Counters and random answers

A counter that goes up on every use or click, and an answer picked at random from a list.

Cooldowns and requirements

How often a command can be used, and which roles or channels it needs.

Coins and rankings

Stored data for each member: a daily reward, a balance and a leaderboard of the server.

Triggers

Start with the prefix of Petto, with a prefix of its own (?hello), or with a message that starts with, is exactly or contains some words.

Recipes and templates

21 recipes (verification, role menu, reaction role, suggestions, reports, daily coins, leaderboard, requests by reaction and more) and every official template of the bot.

Change a message, only who asked, and closing it

These make request cards and other messages that change over time possible without writing code.
  • Some parts of the embed: when a button, a menu option or a reaction changes the message, it can keep the embed as it is (with everything the command wrote in it) and change only the parts you fill: a new title, description, footer or color. A part you leave empty stays.
  • Only who used the command: for each button and each reaction. Anyone else pressing the button is told This is not for you; anyone else’s reaction is taken away, with an optional DM like Only who asked can confirm it. A reaction knows who used the command because Petto remembers it with the message (.Message.CommandUserID in Petto Code).
  • Close the message by its footer: when the footer of the embed says a word, like Delivered, its buttons, menus and reactions stop answering. A reaction is taken away, and a click gets an optional answer like This one is already closed.

Recipe: Requests by reaction

The Requests by reaction recipe puts the three together. !req a cake sends a card with the request and deletes the message of the command:
  • 🦋 is for anyone and sets the footer to Claimed by {name}.
  • 🎀 is only for who asked and sets the footer to Delivered. Anyone else’s 🎀 is taken away.
  • Once the footer says Delivered, the card is closed and stops answering.
Open it in Templates, change the texts and the emojis, try it in the test channel as two people, and install it.
The request card of chu for a cake for the server birthday, with the butterfly and bow reactions to claim it and confirm the delivery

In Discord: the Requests by reaction recipe installed and used with !req, run by Petto's engine.

Share codes, both ways

A share code starts with pc1. and holds a whole command.
  • Out: the Install tab gives the share code of your command. Anyone can use it in their server with !customcommand import <share code> [name].
  • In: paste a share code in the Import tab to read its code and check it before you use it. Then open it in the editor to change it. The whole line works too, with !customcommand import in front.
A code from !customcommand export in Discord works in the generator, and a code from the generator works in Discord.

My commands

My commands keeps the commands you save in your browser. You can export them as a JSON file and import them again on another device. Nothing is saved on a server. The website is in English, Spanish and Portuguese, with a light and a dark theme. The default texts of the commands follow the language you pick.

Same engine as the bot

The generator runs the same Petto Code engine as Petto, with the same checks, functions and limits (10,000 characters, 10,000 steps, 250 ms of running time, 25 reads and writes of stored data per use). What works in the generator works in your server.What it cannot test is what depends on Discord: the permissions of Petto in the channel, a role above Petto’s role or with moderation permissions, or someone with closed DMs. Petto checks those when the command runs. See Limits and safety.
The full documentation of the language is at code.petto.sbs, with a page about the generator at code.petto.sbs/generator. See Petto Code for the commands and Custom commands for plain text and embed commands.