Skip to content

Releases

Petto v0.7.12

Choose a tag to compare

@github-actions github-actions released this 25 Nov 02:35
Immutable release. Only release title and notes can be modified.
a2dcd02

Added

  • /purchase (and !purchase): where to buy Premium for a server, a plan for yourself or a pack of ceramos. Why: the maintainer wanted a command that gives the purchase links. What: a Components V2 card with three link buttons (Premium for a server, Plans for you, Ceramos) that open the pages of the website, where the person signs in with Discord, accepts the terms and goes on to the payment; the bot does not create the checkout itself, so the terms window is never skipped. Written in TypeScript (commands/utility/purchase.ts), in English, Spanish and Portuguese, registered in each server (second set).
  • Custom commands: choose where each one works. Why: the maintainer wanted a custom command to be limited to some channels or roles, like the commands of other bots. What: a custom command keeps lists of allowed and blocked channels and roles (blocked wins), an NSFW switch (it answers only in an age-restricted channel) and a Restricted switch (a member who is not a moderator is answered in another channel); a command that is not allowed stays silent. The old lists of the commands written in code are read as the same lists (utils/commandScope.js).
  • A badge can show any frame it has. Why: the maintainer wanted to choose between the normal, the golden and the divine frame of each badge. What: user_badges.shown_frame saves the choice (only among the frames the person has unlocked), /profile and the shop draw it, and the best frame is never lost.
  • A second instance of the bot (Docker, a VPS, shards), with the dashboard, the jobs and the other databases. Why: the maintainer wanted to run Petto in another place for shards, while Discloud keeps the databases and does not accept outside connections, and asked that the dashboard reach those servers, that the jobs work for them, that the Vault and the other databases and Redis not be a limit, and that the trips to the database cost less. What: Dockerfile, .dockerignore, docker-compose.worker.yml and docs/SECOND_INSTANCE.md. PETTO_ROLE=worker makes an instance a worker (utils/instanceRole.ts): its own shards (DISCORD_SHARDS, DISCORD_SHARD_COUNT), no public web, no slash command registration, no schema, and the jobs for its own servers except the ones that work on the whole bot (PETTO_WORKER_JOBS: guild by default, essential, all). SQL bridge (db/sqlBridge.ts): the primary serves POST /api/bridge/db when PETTO_BRIDGE_SECRET (32 characters or more) is set; signed with HMAC-SHA256, old or repeated requests refused, 2 MB, 24 at once, 8 transactions of 30 s; a lost answer asked again does not run twice; dates, bytes and database error codes travel intact. It reaches the main database, the Vault, the code database and the second one (db/bridgeTargets.js: the worker asks which exist, so it needs no database URL); queries of the same moment share one trip (PETTO_BRIDGE_BATCH_MS) and plain SELECTs are remembered for PETTO_BRIDGE_CACHE_MS (3 s, forgotten after any write or dashboard message). Link (utils/instanceLink.ts, utils/linkRuntime.ts): the worker keeps a WebSocket open to the primary (it goes out from the worker, no open port needed); every route with a :guildId of the primary looks at the shard of the server and sends the request through the link when a connected worker holds it (503 shard_unavailable when nobody does), and the worker answers with its own copy of the routes on 127.0.0.1; the Redis messages petto:* travel both ways, so the worker needs no Redis. Jobs of a split instance only see their own servers: the query builder adds the shard condition to a job's read of a table with guild_id, a raw SELECT drops other shards' rows, and claimDue of the code schedule names the shards (db/postgres.js; the global jobs see everything). !perf shows the trips, their time, shared trips, answers from memory, the link and the workers. PETTO_READ_DATABASE_URL is a hook for a read-only copy used by the statistics. New dependency ws. Checked in scripts/check-sql-bridge.js and scripts/check-instance-link.js (a real WebSocket on localhost); the image was not built (no Docker daemon in the sandbox), and nothing was tried against the real Discloud databases, a real VPS or real shards. Not covered: public pages that find the server by a token, jobs that find their servers without a guild_id in the rows, and servers whose shard nobody holds.
  • Quarantine and fallbacks: a part that keeps failing rests, and a rate limit is waited for once. Why: the maintainer asked that, if the bot fails, that part is put apart so it does not break the rest of the code, with a fallback for rate limits. What: utils/quarantine.ts (typed, plain functions) puts apart an event listener, an interval job or a call to an outside service that failed at least 8 times in a minute and in at least half of its runs; it rests 1 minute (twice as long after every failed trial, up to 15 minutes) and then ONE trial run decides if it comes back (half open). The commands, moderation, tickets, verification and the jobs that must always run are never put apart (the lists of loadGuard). The team is told once when a part rests (logger.error) and once, only in the console, when it is back. handlers/eventHandler.js and utils/perf.js (trackIntervals) use it for every listener and job at once; !perf quarantine lists what rests and the summary shows it. utils/fallback.ts: withFallback waits what a rate limit (429) asks (never more than 5 s) and tries once more, then gives the fallback; a rate limit is not counted as a failure of the part; a part that rests answers the fallback at once without being called. The detector of pictures uses it (a 429 is waited for, an outage rests, and every case ends as "not checked"). Checked in scripts/check-quarantine.js (clock moved by hand, listeners, a real interval job and the detector with a fake service).
  • Streaks: choose what counts as a message. Why: the maintainer asked for the rest of the streak settings (minimum length, cooldown, filters by channel or role, and reactions as messages). What: in Streaks > Activity a server can set a minimum number of characters, one counted message every so many seconds for each person, only (or everywhere but) some channels or roles (a thread or channel also counts through its category), and a reaction that counts as a message (the length is not asked of a reaction). All of it is off by default and the streaks keep reading activity_members. When a rule is turned on the server gets a start day (counting_since): from that day the messages come from the new table streak_days (a number for each person and day, never what was said; kept 13 months, deleted with the server or when a person asks not to be counted) and the days before keep what they had; the voice time always comes from activity_members. New columns in streak_config (min_length, cooldown_seconds, channel_mode, channel_ids, role_mode, role_ids, reactions_count, counting_since); new events messageCreateStreakCount and messageReactionAddStreakCount; the rules are kept a minute in memory, so a change takes up to a minute to be noticed. Checked against a real PostgreSQL 16 (the whole schema.sql applies, and the days a streak reads, the batches and the deletes were tried there); not against real Discord. Checks in scripts/check-streak-counting.js (the database part runs with PETTO_TEST_DATABASE_URL).
  • Limits bonus of the plans: more reminders waiting at once. Why: the plans promised +25 %, +50 % and +100 % on their limits. What: the 25 reminders a person can have waiting become 31 with Bronze, 37 with Silver and 50 with Gold (the answer when the limit is reached tells the real number); a plan that ended or cannot be read gives 25. Embeds and replies are limits of the server, not of a person, so they do not change with a personal plan; the Plans pages now say "reminders" instead of "embeds, replies, reminders". Checks in scripts/check-limits-bonus.js.
  • Own badges with a plan (Bronze 1, Silver 2, Gold 4). Why: the maintainer asked for the own badges of the plans. What: a person makes a badge with a name (2 to 24 letters or numbers) and a picture (PNG, JPEG or WebP, cut to a square of 256 x 256; a GIF is not accepted); it goes through the same policy, block and detector as the own pictures and waits for the team in the page "Own pictures" of the staff; when it is approved it becomes a badge of the editor with the id own-<person>-<slot> that is off sale, so only its maker has it and can put it in the showcase; a new one for the same slot waits while the approved one stays; the person can remove theirs, and the team can take one down (with a block if it says so). If the plan ends, what they have stays but nothing new can be made. New table user_own_badges; new routes own-badge-state, own-badge-submit, own-badge-remove, admin/own-badges, admin/own-badge-review and admin/own-badge-file; the badges of this kind are left out of the editor of the team. The waiting animated pictures are now served as PNG (not WebP) to the staff page. Not verified: no real Discord, database or OpenAI. Checks in scripts/check-own-badges.js.
  • Own picture for the rank card: an animated one with the Gold plan, a detector for every picture, and a contact email. Why: the maintainer asked for the animated background of the Gold plan, the image detector and the contact email of the Terms. What: with Gold a GIF is the background of the rank card and it moves (each frame is cut to the banner and kept as an APNG of at most 3 MB and 30 frames; the card goes out as an APNG and, if it would be too big for a message, loses half of its frames until it fits or goes out still); with Silver a GIF is only its first picture; when the plan ends the card shows the first picture. Every own picture goes through the OpenAI moderation endpoint (`...
Read more

Petto v0.7.11

Choose a tag to compare

@github-actions github-actions released this 12 Nov 18:49
Immutable release. Only release title and notes can be modified.
10eb16e

Security

  • The bot is no longer open source: its code is private now. Why: someone tried to add malicious code to the bot through a pull request, code that would have let the data of the database be taken out and sent to another network (the bot has direct access to the database and to the internet). It never reached the bot: every change is reviewed line by line before it is merged, and that pull request was rejected; no data was leaked. To close the door to this kind of attempt, the repository stopped being public. It may be open source again in the future; the maintainer and the team are evaluating it. What: the website and the wiki no longer say the bot is open source (the FAQ, the news post /code, the links to GitHub and the changelog explain it). Impact: nothing changes for a server (the same security, privacy and terms); the LICENSE and the governance files of the repository are not changed by this release.

Added

  • /levels manage sync can sync more than the roles: type is roles, voice-roles, levels, messages or all. Why: /levels manage sync-roles only gave the reward roles that members had already earned; after changing the curve or the maximum level the saved levels stayed old, the roles of the voice levels had no way of their own, and the counters of messages could not be fixed. What: the command is now /levels manage sync (also !level manage sync) with an optional type (default roles, so it does what it did): roles and voice-roles give the reward roles of the levels of the messages and of the voice; levels calculates the level of the messages and of the voice again from the XP with the curve and the maximum level of today (up or down, database only, nobody is announced); messages raises the counter of messages of each member to what the activity statistics say, when it says more (not when the server has statistics off or without members); all does everything, levels first so the roles follow them. It only gives roles, never takes one away. The old !levels manage sync-roles and the published short word !lmsr still work and mean roles. The logic is utils/levelSync.ts (TypeScript, compiled over its .js), with two new functions in db/levelUsers.js (listForSync, raiseMessagesFromStats). The limit of members looked at for roles went from 2000 to 10000 (the old answer said to run it again for the rest, which could never reach them: it started from the same member every time). Texts in English, Spanish and Portuguese (leveling.sync.* changed, leveling.sync.done and leveling.sync.roles.* removed). Impact: no table or column; the command in the / menu changes name and gets an option (Discord can take a while to show it).
  • Activity leaderboards: choose which cards a board has, and they update about every 5 minutes. Why: a server did not always want the month, the week and the day (only the month, or the week and the day), and an update once an hour was too slow to be a live board. What: /activityboard set <chat|voice> <channel> [periods] takes periods (all, monthly, weekly, daily, monthly-weekly, monthly-daily, weekly-daily); left out, a new board has all three and an existing one keeps the ones it has, and status shows them. Taking a card away deletes its message; adding one posts them all again in order. The cards are looked at about every 5 minutes (the job looks every minute and a board is due 270 seconds after its last time) instead of every 55 minutes, without more load: a card is edited only when what it says changed (and anyway about once an hour, which is how a deleted message is found), a round stops after 45 seconds and waits only after a board that wrote at Discord, only the chosen periods are read from activity_members, and the load guard also pauses the job when the bot is degraded (activityLeaderboardJob in SHED_IN_DEGRADED_JOBS), not only when it is critical. The footer of the cards says Updates every 5 minutes!. Impact: new column activity_leaderboards.periods text[] not null default '{monthly,weekly,daily}', created at start with if not exists, so the boards that exist keep all three cards and, being due at the next look because their text changed, are edited at the first rounds after the deploy; a board that cannot be written is now tried again in about 5 minutes (it was an hour) and logs a warning each time for an unexpected error. The dashboard and the wiki are updated in their own pull requests.
  • /variables and !variables (alias !vars): where to find every option of every command. Why: the options that are written after a command (--color, --duration 7d, --joined_after 30d) were only known by who wrote them, and the list of variables of messages was only in !embed vars. What: any option of any command can be written as --name value (the prefix always read them, but nothing said so), and !variables explains it: !variables <command> lists the options of a command or of one of its parts (!variables quote, !variables role all), from its own builder and in the language of the server, with which ones are required and the values they take; !variables <option> says where an option is used (!variables duration: 39 commands); !variables flags lists the options that are only written in the text and are not in the / menu (--color, --light, --bold of !quote; --reply, --delete, --ping, --previous, --strict, --not_strict, --mode, --embed_template of !autoresponder; --private and --message of !pagination; the nine of !counter create; the bare --preview of !role and !joinrole); !variables messages says where the variables of messages are. Team-only commands are not listed. It is a slash command of its own too (asked by the maintainer), so slash commands go from 90 to 91 of 100: 9 slots are free instead of 10, and the check that kept 10 free (scripts/check-slash-structure.js) now keeps 9 (scripts/check-umbrellas-3.js and the counts of five other checks are updated). From a slash command, it calls itself back with /variables and shows the examples of options with !, since --name value is only written with a prefix. The list of text-only flags is one typed list (src/utils/commandFlags.ts) and scripts/check-variables.js fails when a --flag appears in the code or in the texts that is neither an option of a command nor in that list, so a new one cannot be forgotten (it found --goal of !counter create, which was not written anywhere). Written in TypeScript (src/commands/info/variables.ts, src/utils/commandFlags.ts, compiled over their .js with npm run build:ts). Not verified: only tested with Discord replaced; no real server ran !variables, and the wiki page (Variables) has the same information.
  • Activity leaderboards: a role for the most active member of the week. Why: servers wanted the most active member to be seen in the member list, not only on the cards. What: /activityboard role-set <chat|voice> <role> (also !activityboard role-set) chooses a role for the chat and another for the voice; when each week ends (Monday, GMT-5, Colombia) the number 1 of that week gets it and the one who had it loses it. role-remove stops it and takes the role from who has it, and role-status shows each role, who has it and what is wrong. It uses the same counts as the cards, so it skips bots, who asked not to be counted (!stats privacy) and who left, a quiet week leaves the role with nobody, and a server with statistics off cannot use it. Petto needs Manage Roles and the role has to be below its highest role (not @everyone, not a bot or booster role); a role it cannot give keeps the reason and is tried again in an hour. When a role is set, last week's number 1 gets it within about 5 minutes. They are subcommands of /activityboard, so no slash slot is used. New table activity_top_roles (created at start). Written in TypeScript (src/utils/activityTopRole.ts, src/db/activityTopRoles.ts). Not verified: only tested with Discord replaced; no real server got the role, so the first week change in a real server was not seen. Check in scripts/check-activity-top-role.js.
  • /rank and /leaderboard are slash commands of their own. Why: to see your level you had to write /levels rank, and the ranking was /levels leaderboard, longer than it needed to be. What: /rank [user] shows the level card and /leaderboard [page] shows the XP ranking (it was the command top, now called leaderboard; !top, !lb and !ranking still work, and the rules a server saved for top (disabled, restricted, permission levels) still apply to it through legacyRuleNames). /levels rank and /levels leaderboard are not in the / menu any more (no command twice, prefixOnlySubcommands of /levels, new option of defineUmbrella), but they keep working with the prefix, with their words: !levels rank, !levels leaderboard and the short !lra and !ll, which were published. The two take 2 slots: 90 slash commands, 10 free (the check keeps at least 10). Not verified: only tested with Discord replaced; the new commands were not registered in a real server, and Discord can take a while to show them. Checks in scripts/check-umbrellas-2.js, check-umbrellas-3.js, check-slash-structure.js and check-member-access.js.
  • Activity leaderboards: the most active members of the chat and of the voice channels, in a channel, edited every hour. Why: servers want a live "who talks the most" board (daily, weekly and monthly) without asking for it by hand. What: /activityboard set <chat|voice> <channel> (also !activityboard, !actlb) posts three cards in the channel: the month, the week and the day, each with the most active member on its own line (a heart), the next nine numbered with the pink numbers, the count (messages, or voice minutes), when the ...
Read more

Petto v0.7.10

Choose a tag to compare

@github-actions github-actions released this 05 Nov 17:18
Immutable release. Only release title and notes can be modified.
ff91f50

Added

  • /ban and /mute take an optional time; /tempban and /tempmute are not slash commands any more. Why: a ban or a mute that ends was a command of its own, so there were two commands for one action. What: /ban user duration reason and /mute user duration reason (the time is optional: without it the ban is permanent and the mute lasts until it is lifted; with it they are the same temporary ban and mute as before, same cases, DMs, logs and expiry). /tempban and /tempmute are removed from the slash menu. With the prefix nothing is removed: !tempban, !tempmute, !tban, !tmute, !timeout keep working, and !ban @member 7d spam and !mute @member 3d also take the time, or none for a permanent one. The option delete_message_days of /ban moved after the reason so the order is user, time, reason. Not verified: only tested with Discord replaced; the old slash commands stay in Discord's menu until the next deploy of commands. Checks in scripts/check-mod-command.js, scripts/check-slash-commands.js and scripts/check-slash-structure.js.

  • A vote for the bot on top.gg or omniplex.gg gives +10% XP for 12 hours, in every server, and omniplex votes are now received. Why: voting for Petto had no reward other than a role in one server, so there was little reason to vote, and the votes from omniplex.gg (where Petto is listed too) were not received at all. Now a member who voted on either list earns +10% XP from messages and from voice for 12 hours in every server that has the boost on. Both lists share one timer for each member: the boost ends at the latest expiry of their votes (top.gg sends expires_at; an omniplex vote lasts 12 hours), so voting on both never gives +20%, and the weight of a top.gg vote does not change the time. The boost is applied in the one place that awards message and voice XP (applyXpRules), once, with the XP event and rounded together with it: it multiplies on top of the base, role and channel multipliers (the multiplier_cap does not limit it), and it comes before the daily limit daily_xp_cap, which counts the boosted amount; the daily and streak bonus is not boosted. A server can turn it off for free with /levels settings rules setting:vote_boost value:off (!level rules vote_boost off; the new column level_config.vote_boost_enabled, default on, idempotent in schema.sql, listed in rules and status, and written by the dashboard like the other settings); with it off the server gets exactly the old numbers and its rank card shows no boost. A message costs no query: utils/voteBoost.ts keeps a cache by user id (50,000 entries at most, oldest out first; a boost until it ends, "no boost" for 10 minutes; a failed read for 30 seconds), a miss is one query on the new index bot_votes (user_id, voted_at desc) (votes of the last 2 days), and both webhooks put a new vote in the cache at once. The new route POST /webhooks/omniplex (own rate limit of 120 a minute; env OMNIPLEX_WEBHOOK_SECRET; the web server now starts when either webhook secret is set) checks X-Webhook-Signature: sha256=<hex> (HMAC SHA-256 of the raw body, constant-time compare, 401 otherwise), ignores but answers 200 to tests, downvotes, automatic votes and any other event, makes the vote id <voter id>:<created_at> because the payload has none (a delivery sent again is one vote), and then does what the top.gg route does: stores the vote (source: "omniplex"), gives the voter role and posts the thanks, which now name the list and the boost (utils/omniplexVotes.js, utils/voteLists.js). The rank shows the boost as a line of plain text above the card or the embed, never inside the picture: ⭐ +10% XP from your vote, ends <relative time> while the boost lasts; with no boost, and when the server has it on, Vote boost: vote now for +10% XP for 12 hours: and the vote links of both lists, each a masked link with the address between < and > ([top.gg](<url>)) so it shows a short name and Discord shows no preview box; nothing when the server turned the boost off. The new variable {level_vote_boost} (empty without a boost; the dashboard preview shows a sample) is for the cards and embeds of a server, and !votes show also gives the vote links of both lists and says the lists share one timer; all in English, Spanish and Portuguese. New env vars: OMNIPLEX_WEBHOOK_SECRET, and OMNIPLEX_VOTE_URL (optional). Not verified: the shape of the omniplex payload (NEW_VOTE, creator.id, metadata.created_at in seconds, metadata.test, data.downvote, data.auto) and its signature header come from the omniplex documentation and were tested only with payloads built from it, never with a real delivery or the real secret; the default omniplex vote link https://omniplex.gg/bots/<bot id> is a guess (set OMNIPLEX_VOTE_URL to the right page); omniplex's own vote cooldown is unknown, so the thanks no longer say "every 12 hours"; and the cache lives in one process, so a second process would learn of a new vote within 10 minutes. New check: scripts/check-vote-boost.js; docs/REFERENCE.md says exactly this.

  • Role triggers: an action for a member who is given a role or finishes Discord's onboarding while holding it. Why: a server that hands a role to members it does not trust (a "quarantine", "suspicious" or "unverified" role from another bot or the onboarding) had to watch for it by hand. /protect roletrigger add role:<role> action:<warn|mute|jail|kick|ban|remove_role> [duration] [reason] [on], remove role:<role> and list (Administrator only, also !roletrigger) keep up to 25 rules per server, one for each role, in the new table role_triggers (idempotent in schema.sql; the rules sit in a 30-second per-server cache that every write forgets). on is role_added (default: the role was just given), onboarding (the member just finished onboarding and holds the role) or either. The action runs through the same helpers as a manual one, with Petto as the moderator, the case source roletrigger and the reason Role trigger: <role name>: warn is addWarn plus the warn escalation, kick and ban create their case after Discord confirms, ban with a duration is a temporary ban (lifted by the existing expiry job), mute is a timeout when it has a duration (up to 28 days) and the mute role when it has none, jail is jailMember, and remove_role takes the role away (no case: it is not a sanction). Never acted on: bots, Petto, the server owner, members with Administrator or Manage Server, members of a permission group with a level, and members whose top role is not below Petto's. Each grant is handled once in 5 minutes (a repeated event or a role that flaps does nothing more), and a circuit breaker stops the rules of a server for 10 minutes when more than 5 actions fire in 60 seconds, with one warning in the automod log. A member update that gives no role and finishes no onboarding costs no query. The old copy of the member is needed to see a role given or the onboarding flag turning on, so an update for a member that was not cached is ignored. New check: scripts/check-role-triggers.js.

  • Role triggers: the safety stop is configurable, bigger servers get a higher default, and nothing it skips is forgotten. Why: a spam raid is when the rules are needed, and with the fixed limit of 5 actions a minute (then 10 minutes of pause) the sixth raider was already let through and so was everyone after. Now /protect roletrigger limit [amount] [reset] (!roletrigger limit 30) sets how many actions a minute a server allows (1 to 500; with no number it shows the current one, reset:true goes back), saved in the new table role_trigger_settings (the dashboard page of the role triggers writes the same row). With no choice the default grows with the server: 5 below 1,000 members, 10 from 1,000, 20 from 5,000 and 40 from 25,000. Over the limit the rest do not stop: they wait in a line (up to the limit times 10 members, first in, first out) and are handled at the pace of the limit, each one looked at again first (still in the server, still holding the role, the rule still there, not someone who is never touched), so removing the rule or taking the role away stops the line. The warning in the automod log is a card (Components V2, no color) with a short heading and short lines: the limit, how many can wait, what happens if the line fills up, how to stop it and how to raise the limit. Only when the line is full the rules pause for 10 minutes, and then, or when a member waited more than 10 minutes, a second message lists whom Petto did not look at (up to 50 mentions and how many in all), so the staff can check them by hand. The limit and the line are typed code in the new utils/roleTriggerBreaker.ts, compiled over its .js like the other TypeScript files.

  • Role triggers load the members of the servers that have rules, so a role given to a member Petto had not seen is no longer lost. Why: discord.js emits guildMemberUpdate only for a member that is in the cache; for one that is not it caches the member and emits guildMemberAvailable with no old copy, so the first role grant of any member that was in the server before Petto started was never seen (large servers do not send their member list at start). Members who join while Petto is online were already covered. Now utils/roleTriggerWarm.js runs guild.members.fetch() (gateway request-members) for each server that has at least one rule: 30 seconds after the start, one server every 20 seconds, when roletrigger add saves a rule and on guildCreate for a server that already has rules. It does nothing when the cache already holds 95% of memberCount, above 25,000 members in a server (100,000 loaded in total, to protect a 1 GB host), and while the load guard is degraded or critical (tried again after 5 minutes, at most 6 times). In the last two cases roletrigger list and add add one li...

Read more

Petto v0.7.9-3

Choose a tag to compare

@github-actions github-actions released this 02 Nov 02:33
Immutable release. Only release title and notes can be modified.
32f09b9

A patch of 0.7.9, shown as 0.7.9~3.

Added

  • Every direct message from Petto says who it is from and has three small buttons to report it to the Petto team. Join messages, sanctions (ban, kick, mute, warn, jail, softban, tempban and the ones from automod, escalation, anti-scam and the honeypot), form results, appeals, tickets and transcripts, giveaway notices, verification, level-ups, suggestions, report updates, setup messages, backup notices and the answers of custom commands and embed buttons start with a small grey line, From <server> (From Petto when no server is behind it; the name is clipped to 60 characters and cannot ping or link), and end with one row of three icon buttons in Petto's emojis: info (an "i"), delete (a bin) and report (a warning). Info answers with a private message that only you see (it goes away with Discord's own dismiss, nothing is written in the chat) with only the facts about the server: its icon, name, ID, creation date and number of members (a message from Petto itself says so in one line, and a server Petto left shows its ID and that Petto is not in it any more); it does not say why you got the message or how to turn it off. Delete removes that message from the chat. Report opens a form ("Report DM to Petto Staff": a notice, a bold paragraph saying it does NOT go to the server's moderators, a list of reasons with a new one for unwanted or abusive DMs, details of 20 to 1000 characters and a switch to delete the DM afterwards), in English, Spanish and Brazilian Portuguese. A report goes to the Petto team only, as a card in the channel PETTO_DM_REPORTS_CHANNEL_ID (the reported text with links made safe, the server's name and ID, why it was sent, who reported, the reason, and a Mark handled button for the team); with no channel set the report waits in the new dm_reports table and a warning is logged. Each person can send 3 reports an hour and one for each message. Every answer of the buttons is an answer to the button itself, private to the person (the report receipt, the refusals, the "already reported" and "could not delete" notes included), and each one acknowledges Discord at once, so the red "petto didn't respond in time" no longer appears; delete acknowledges and removes the message without saying anything. The buttons only work in the person's own chat with Petto and only on messages of Petto (inside a server they refuse), the server in the button is only used to read public data, and a message that is already at a limit (5 rows, 2000 characters, 40 components, 4000 characters of text) keeps itself and drops the line or the buttons. One place does it (utils/dmOrigin.js, sendDm), and User#send / GuildMember#send carry the same step so a new message cannot forget it; replies to what someone typed in the chat, and the report receipts, have no line. No new commands and no new settings.

  • ask: an AI that answers questions, with a daily limit for each member (/ai ask, /ai usage, !ask, in BETA). !ask <question>, petto ask <question>, @Petto ask <question>, the prefix of the server and !ai ask <question> answer as a reply to the message (a short, casual text that pings nobody, with a small line that says it is an AI and can be wrong, and how many questions are left today for a free member); /ai ask question: (up to 800 characters) answers in public while it thinks; /ai usage (also !ai usage, !askusage) says how many questions the member has left and when they come back. A reply to one of its answers, written by the member who asked it, is the next question with no command word (it reads up to 4 messages of the reply chain as context). It is in BETA and uses the same AI service as the ticket assistant; without its key it says it is not available and counts nothing. Limits (environment variables): free members ASK_FREE_DAILY=10 questions per UTC day, Premium (the account), the owner and PETTO_DEVELOPER_IDS unlimited; a cooldown between questions (ASK_COOLDOWN_FREE_SECONDS=15, ASK_COOLDOWN_PREMIUM_SECONDS=5); a cap per server (ASK_GUILD_PER_HOUR=60) and for the whole bot (ASK_GLOBAL_PER_MINUTE=25) that answers "I am busy" and counts nothing; ASK_ENABLED=false switches it off without a deploy. The count is one atomic statement on the new table ask_usage (a number per member and day; where ask_usage.used < limit), a question that gets no answer gives its use back, and if the database is down the question is refused. Questions and answers are never stored or logged. The server rules apply to the slash command, the prefix and the follow-up: !disablecommand ask (also by channel), !restrictcommand ask and permission levels; askusage for the count and ai for both; a server that already has an alias or a custom command called ask keeps it. ai is an everyday word, so petto ai ... is chat (petto ask ... and !ai ... work). In en, es and pt-BR; see "Ask" in docs/REFERENCE.md.

  • Prefix commands move to slash commands, grouped in umbrellas (Petto registers 67 commands: 64 slash commands and 3 menus, with 36 slash slots free; it was 31). Discord will take the prefix away one day, so everything public that was prefix-only moves now, into slash commands that only have subcommands, each one a group that makes sense and no loose command left: every old word, alias, route and short alias keeps working as it was, and each umbrella also works with the prefix (!game 8ball ..., !search yt ..., !staff mban ..., !config prefix set; an umbrella alone lists its subcommands). Each subcommand runs the code of the command it wraps with the same options, so the answers, the logs and the checks of the old command are the same; the descriptions are in English, Spanish and Portuguese (the ones of the old commands), and every subcommand has a short alias (!sma, !g8...). Permissions: Discord checks the permissions of a whole command and never of one subcommand, so an umbrella is open to everybody (a server can limit it in Settings > Integrations) and each subcommand asks, when it runs and for the slash command and the prefix alike, for the permission of the command it wraps (a member with only Kick Members cannot /mod ban) or for the role chosen with !moderation, and answers with the same private message as the old command; what the wrapped command checks by itself (the permission of the bot, the role hierarchy, the confirmation of the mass commands) still happens after, and an umbrella hands over the autocomplete of the command it wraps to who may use it. A rule of a server (!disablecommand, !restrictcommand, a permission level) on a wrapped command also stops its subcommand, a rule on the umbrella stops all of it, and an umbrella has one cooldown. !help mod ban says which permission each one needs. me, bot, auto, config, message, community, protect, greet and special are everyday words, so a word prefix such as petto never starts them (petto me ayudas and petto bot is down are chat): !me, /me, !bot and /bot do. Run node deploy-commands.js after deploying.

  • /mod: the everyday moderation commands in one slash command. /mod ban, kick, mute, tempmute, unmute, warn, softban, tempban, unban, hardban, note, case, history, jail, unjail, nickname, stripstaff, purge, lockdown, unlockdown, clearinvites, pauseinvites, lock, unlock and slowmode (25 subcommands, the most Discord allows) are the old commands with their options: each one runs the code of the command it wraps (/mod ban is /ban user, /mod tempban is /tempban, /mod lock is /channel lock), so the cases, the logs, the messages to the member and the hierarchy are the same. What a subcommand leaves out (/ban users, /mute remove, /case edit...) stays in the old command, and /ban, /kick, /warn and /channel are still slash commands. With the prefix: !mod ban @x spam, !mod k @x, !mod purge bots 50, and short aliases (!mb, !mk...). The umbrella also copies options of type number, mentionable and file, and the limits and choices of an option (the days of /mod ban are 0 to 7). In English, Spanish and Portuguese.

  • /server and /user. A tidier / list: type /server or /user and find what Petto already has. /server (16): info (!serverinfo), roles, channels, emojis, boosters, channel (!channelinfo), role (!roleinfo), emoji (!emojiinfo), invite (!inviteinfo), inrole, summary, steal (it asks for Manage Guild Expressions when it runs, slash and prefix), bots (!bots) and three new ones, icon, banner and splash, which show the picture of the server with links in every size Discord serves (128 to 4096) and in PNG, JPG, WEBP and GIF when it moves. /user (8): info (!userinfo), avatar, banner, cosmetics (!usercosmetics), permissions, id (!snowflake), first-message (!firstmessage) and activity. Each subcommand has the options of the command it wraps. With the prefix, !server info, !server icon, !user avatar @member, and !server or !user alone are the info, as !server always was (it was a word of !serverinfo, which keeps !si). New words !servericon, !serverbanner and !serversplash; the rules have the keys servericon, serverbanner and serversplash, and server or user turn off the whole umbrella. /serverinfo, /userinfo, /avatar, /unban, /purge and /timeout are no longer registered, because their umbrella subcommand has the same options and the same permission: use /server info, /user info, /user avatar, /mod unban, /mod purge and /mod tempmute; the prefix forms (!serverinfo, !si, !avatar, !unban, !purge, !timeout...) are unchanged, and a rule saved for the old name (including timeout for /mod tempmute) still applies. The error that names Manage Guild E...

Read more

Petto v0.7.9-2

Choose a tag to compare

@github-actions github-actions released this 30 Oct 20:20
Immutable release. Only release title and notes can be modified.
6484eb1

A patch of 0.7.9, shown as 0.7.9~2.

Added

  • /act: every interaction command in one slash command. The 36 interaction commands (hug, pat, slap...) were 36 slash commands. They are now the subcommands of one command, /act, in five groups: love, play, fight, feel and react (in Spanish /accion, in Portuguese /acao, with the names and descriptions translated). So they take 1 of the 100 slash commands Discord allows instead of 36, and Petto registers 31 commands (with /messagelinks), down from 65. With the prefix nothing changes: !hug @member, !hf, !lol and every other word still work and run the same code, !help hug finds them, and !disablecommand hug and !restrictcommand hug apply to that action only, with the prefix and with /act, while !disablecommand act turns off every action.
  • 43 new interaction commands. baka, bored, celebrate, cheers, clap, confused, cool, drool, evillaugh, facepalm, handshake, headbang, love, lurk, mad, nervous, nod, nuzzle, nyah, peck, peek, pinch, pout, scared, shout, shrug, shy, sigh, sip, sleep, slowclap, smack, sneeze, sorry, stare, surprised, sweat, think, thumbsup, tired, woah, yawn and yay. Each one has its gif, its response button and its counter ("Ana has received 3 cheers"), in English, Spanish and Portuguese, like the ones that were there before.
  • !uwu (also !uwuify) turns a text, or the message you reply to, into uwu speak: Hello, really lovely! becomes Hewwo, weawwy wuvwy! nya~. Mentions, links, code, custom emojis, timestamps and Markdown are left as they were, nobody is pinged, a long text is cut under Discord's limit, and the same text always gives the same result. In Spanish and Portuguese only a final r and n before a vowel are softened, so the text stays readable.
  • Four small games: !coinflip, !wouldyourather, !neverhaveiever and !truthordare. !wouldyourather posts a question (or your own two options, !wyr pizza, tacos) that is voted with two reactions; !neverhaveiever posts a statement to answer with a check or a cross; !truthordare [truth|dare] gives a truth or a dare. They are prefix commands, in English, Spanish and Portuguese.
  • Message link embeds, off by default (/messagelinks, !messagelinks). When a server turns it on, a Discord message link of the same server (discord.com, discordapp.com, ptb. and canary.) gets a reply with an embed of that message: the author, the text (cut at the limit of an embed), the first picture as the image, the other files by name with links, the pictures of the message's own embeds, a note for each sticker, a "replying to" line, the channel and the time in the footer, and a Jump to message link button. It only shows what the member who posted the link can already see: that member and Petto both need View Channel and Read Message History in the linked channel or thread (a private thread only for those in it or who manage threads), the link must be of the same server, an NSFW channel is never shown in a channel that is not NSFW, and an ignored channel is never read. Links inside code, spoilers or <...>, links from bots, system or ephemeral messages and deleted messages are left alone, and a message with the link of itself too. At most 3 links per message and one answer every 3 seconds in each channel; there is no other limit and none depends on a plan. The reply pings nobody (allowedMentions with nothing to parse), is a reply that does not fail if the message is gone, and the member's message is never deleted. Without Embed Links it does nothing and says so once in the log. !messagelinks (also !msglinks, !linkembed, !mlinks; Manage Server) has on, off, status, ignore #channel and unignore #channel, and the same is the slash command /messagelinks (31 commands are now registered with Discord). The setting is in the new table message_link_settings (off by default, with the ignored channels); the switch is read from a small bounded memory (5000 servers, 5 minutes, forgotten on petto:invalidate when the dashboard saves) before a message is parsed, so a server with it off costs no database query. The Community settings page of the dashboard has the switch and the ignored channels.
  • Snipe: reactions, clear and more words. /snipe has two new subcommands, reactions (the last reaction taken off a message of the channel: the emoji, who removed it and a link to the message) and clear (forgets what is saved for the channel: all, deleted, edited or reactions). !editsnipe and !esnipe are !snipe edited, !reactionsnipe and !rsnipe are !snipe reactions, !clearsnipe and !csnipe are !snipe clear, and !snipe 3 shows the third from last deleted message. Every part still needs Manage Messages. Everything is in memory only and small: 10 entries per channel and kind, the 200 channels used most recently, 1500 remembered messages, nothing older than 24 hours, and only what is shown is stored (the text cut at 1000 characters, up to 8 files, the number of embeds, the avatar hash), never the message itself.
  • Short prefix aliases for most commands with subcommands. !is is !image sepia, !iro is !image rotate (!ir is !inrole), !tko is !ticket open, !tma is !timer add... about 770 words (the table is src/utils/short-aliases.json, made by npm run gen:short-aliases from the real command list, committed, and only ever added to, so a word never changes meaning). The rule is the initial of the command (or its short name: tk, gw, xp) plus the initial of the subcommand, and more letters of the subcommand when that word is taken; nothing is taken from an existing command, alias or route, and a subcommand with no short free word has none. They are prefix only (no slash commands), and each is the normal route of the real command, so its permissions and the !disablecommand and !restrictcommand rules apply. A word the server chose (an alias or a custom command) wins over a short alias, and a short alias no longer blocks the name of a new server alias or custom command. An everyday word in English, Spanish or Portuguese (is, if, si, um...: src/utils/commonWords.js) works with a symbol prefix (!is) but never after a word prefix, so petto is the best is chat. The wiki and the Commands page list the words from the same table.
  • Ticket forms: choices, checkboxes, member pickers, pictures and files. Besides short and long answers, a question of a ticket form can be a dropdown menu (one or several choices, up to 25), radio buttons (2 to 10), a group of checkboxes (up to 10), one checkbox (it can be required: it has to be ticked), a file upload (pictures only, or any file, 1 to 5 files), a member, role or channel picker (up to 25) and a text that only informs (Markdown works, shown above or between the questions). Every question can have a description under its label, a form still holds up to 5 parts and at least one that members answer, and a form that only has text questions is stored, shown and answered exactly as before: the new kinds are only keys in the fields column of ticket_forms, so no column changed. The questions are built and read with the same code as the forms of Petto Code (src/utils/modalParts.js, now shared by both). /ticket form create and edit (the buttons) get Add choices, Add file upload, Add picker and Add text, and the fields: text takes the new types (select|topic|Topic||required|Bug,Billing, file|proof|Screenshot||required|images,3). A form saved by the dashboard is never trusted: what Discord would refuse is cut down or left out when the window is shown.
  • Ticket answers show each kind of answer, and the pictures and files last. The card in the new ticket shows text as before, choices as a list, a checkbox as ✅ or ❌, members, roles and channels as mentions that notify nobody (no @everyone, role or member is pinged by an answer), and every picture as a media gallery. Discord's links to what is uploaded in a form can stop working, so Petto downloads each file (the safe download of Petto: public addresses only, a time limit, 8 MB for each file, never more than the server takes) and uploads it again into the ticket channel, where it stays as long as the ticket does and the transcript keeps it; other files are file cards with their name and size. If a file cannot be copied (too big, a failed download, or more than 10 files in a ticket) the card keeps its link, name and size and says it may stop working. A question that takes pictures only checks the type Discord gives and the first bytes of the file, and refuses anything else with a private message in the form, before any ticket opens. File names are shown with their Markdown, links and mentions escaped, and long answers are cut to 1000 characters and split into more cards when Discord's 4000 characters of text, 40 components, 10 files or the upload limit of a message would be passed.
  • Verification panel: an optional picture. The panel (the message with the buttons to verify) could only show the small icon of the server. verification_config.panel_image_url (a new column, an https link) puts a picture at the top of the panel as a media gallery; with none, or a link that is not https, the panel is exactly what it was, and a panel that stands is edited in place when it is posted again. The DMs of the verification can already have pictures through a saved embed (!verify template).
  • Silent mentions: a ! right before a mention shows it without notifying. In any message Petto sends (plain text and Components V2 text: text displays, sections and containers), !@everyone, !@here, !@Moderators, !@"Role with spaces", !<@&id>, !<@id> and the output of a variable (!{user.mention}, !{role.mention}) sh...
Read more

Petto v0.7.9-1

Choose a tag to compare

@github-actions github-actions released this 29 Oct 14:42
Immutable release. Only release title and notes can be modified.
c629467

A patch of 0.7.9, shown as 0.7.9~1.

Added

  • Timers at a time of day, and new !timer subcommands. A timer can post every day or every week at a time, in a time zone (!timer add #news daily 18:00 America/Bogota Hello, weekly monday 09:30 UTC). Each server numbers its own timers 1, 2, 3 (the commands and the dashboard use that number). New: !timer run 1 sends a timer now without moving its schedule; !timer edit 1 daily 07:00 America/Bogota (or !timer edit 1 2h) changes when it posts; !timer message 1 <text> (none takes the text off when it has a saved embed); !timer channel 1 #channel; !timer pause 1 and !timer resume 1. The dashboard shows the number, a "Send now" button and a "Paused" switch.

Changed

  • Feeds of pictures: every word counts. flor rosa anime only gives drawings of pink flowers: every word has to be in the tags, the title or the description of a picture (a color can also be the color filter of the place it comes from), and a word such as anime only asks the places of anime pictures, so no photo, mountain or pink car comes in. Spanish and Portuguese words are turned into the English tags the places use.
  • Feeds of pictures: a word with more than one meaning is asked about. !feed add pictures 30m rosa asks whether you mean the flower, the color or the mountain (Monte Rosa) with a button for each, and the feed is saved with what you pick; the other words also say it (flor rosa is a pink flower, rosa roja a red rose). The same happens for naranja, lima, violeta, llama, vela, mono, sierra, jaguar, mouse and a few more. The dashboard gets the same choices.
  • Feeds of pictures say what they search. The feed and each picture show it ("Searching: pink · flower · anime style · Wallhaven") instead of the title the picture had on its site.
  • !send reads the channel however it is written: a mention, an ID, a link, #name or the name of the channel (also without the emojis around it), at the start or at the end of the message. Its help shows send [channel] [message].

Fixed

  • !send sent the message to the channel where it was typed when the channel came after the text (the order its help showed) or was written by name. A channel that does not exist is now told, never replaced, and a thread asks for Send Messages in Threads.
  • An RSS feed pointing to a web page (such as the changelog of the site, which has no feed) was saved as an empty feed and never posted. Adding one now looks for the feed the page announces or where sites usually keep it (/rss.xml, /feed...), and says when there is none. A feed that cannot be read several times in a row shows why in !feed list.
  • Pictures of the picture feeds no longer show as broken: each one is checked before it is posted (a real picture that loads, not a page or a format Discord does not show), the next one is used when it fails, and the pictures from Pixabay, Google and Openverse are sent as a file so they do not break later. Openverse gave no picture at all, and now does.
  • The join DM (!dmonjoin) no longer has buttons with actions, which only work in a server; its link buttons stay.
  • A Petto Code form whose menu or checkboxes start with more choices selected than its max is told as a mistake instead of being refused by Discord.
  • A timer with a Components V2 saved embed never posted. Its text (even a lone .) was sent as content next to the V2 design, Discord refused the whole message, the error was swallowed and the timer moved on to the next day. A V2 design never gets content now: the timer's text goes in as the first text of the design when it says something (a lone . or , is left out). A send that fails is logged with the timer and Discord's answer, kept in the timer (!timer view, !timer list and the dashboard show it) and cleared by the next send that works.
  • A saved embed sent from the dashboard (the embed builder's "Send") lost its buttons that give a role or show a saved embed; they are sent now, in a classic embed and in a V2 design, and a coloured button of a V2 design that only shows something is kept too.

Petto v0.7.9

Choose a tag to compare

@github-actions github-actions released this 29 Oct 01:30
Immutable release. Only release title and notes can be modified.
83f1bef

Added

  • Buttons with actions in Components V2 designs. A button of a V2 design (in a row of buttons or as the button of a section) can have the same actions as in an embed code: give, take or toggle a role, or show a saved embed (privately, in the channel or in the DMs). It has a color (blurple, green, grey or red) and keeps what it does in its id, so nothing is stored. A button whose role does not exist, or a design sent where there is no server, leaves it out.
  • Petto Code: forms with every part Discord has. Besides ctext, a form (cmodal) can hold cmenu (a menu of choices, with the ones selected from the start), cusers, croles, cmentions and cchannels (pickers of members, roles, both, or channels of the kinds you say: text, voice, announcement, category, stage, forum, media, thread), cfile (up to 10 files to upload), cradio (radio buttons), cchecks (a group of checkboxes), ccheck (one checkbox) and cdisplay (a text that only informs, with Markdown). Every part has a label and a description, and min, max and required where they make sense. A form holds up to 5 parts and at least one that people fill in. What a form gives back is in .Fields (a text, a list of values or of ids, true or false, or a list of files: .Fields.proof is [{ID Name URL Size Type Description}]), the new .FieldText (the same, ready to print: ids as mentions, lists joined, ✅ or ❌) and the new .Files (every file of the form in one list). The parts are under their label (the new way of Discord, so ctext too).
  • Feeds: pictures are searched in many places, so anime roses gives anime roses. 15m anime roses takes the words, up to four now, and searches Wallhaven (its anime category, safe only) and Safebooru when a word asks for anime (anime, manga, waifu, chibi, ghibli, otaku, vtuber). The rest is searched by meaning, not by the tags of whoever uploaded them: Google Images (GOOGLE_CSE_KEY and GOOGLE_CSE_CX, a Programmable Search Engine with images on), Pixabay (PIXABAY_API_KEY), Pexels (PEXELS_API_KEY) and Unsplash (UNSPLASH_ACCESS_KEY) when the bot has their keys, then Openverse (no key, no adult content) and the public tags of Flickr as before. Everything is asked for safe pictures only, a place that fails or has nothing is skipped, and the notice says where the picture is from. rosas is roses.
  • !send, buttons that do things in embed codes, and an embed code as the message of !welcome, !leave, !boost and !dmonjoin. !send [#channel] <message> sends a message as Petto: text with line breaks, links, role mentions (a role that is not mentionable only pings if you have Mention Everyone), the pictures, videos or files attached to the command (up to 10), an embed code, and it is a reply when the command replies to a message. It needs Manage Messages in that channel. In an embed code, {button: green && Get the role && role:@Members} is a button that gives or takes a role: role: toggles, addrole: and removerole: only do one; {button: blurple && Rules && embed:rules:dm} answers with a saved embed, privately by default (embed:name:ephemeral), in the channel (:public) or in the DMs (:dm); a button can do several things (up to 4 actions), and its color is blurple, green, grey or red. What a button does is kept in its id, so nothing is stored, and a role is only given when it is below the highest role of Petto. Who sends a code with !send needs Manage Roles and a role above the ones in the buttons. The setup commands now read the code whole: !welcome setup #general {embed}$v{description: Hi {user.mention}}$v{button: green && Rules && embed:rules} saves the code as the message (/welcome setup with the message option too) and tells how many embeds and buttons it has and what was not understood. The names other bots use for boosts and levels work too ({boost.count}, {boost.level}, {boost.required}, {level.new_rank}, {level.user_xp}, {guild.members}...).
  • Music: a longer bar, and the time of each change between songs told in parts. The progress bar uses the five pieces of the music set (filled cells up to a pill with a knob, then dark cells to a rounded end), has twelve pieces (it had five) and is alone in its own text of the card, so Discord shows its emojis big like the bar of Flamey. The log line of each song start now says how long was spent choosing its recording and how long the node took to play it (started N ms after the change began (choosing the recording A ms, the node B ms)), to tell which part is slow.
  • Music: autoplay, and a list of songs while /music play is typed. /music autoplay (or !autoplay, or its button on the card, off by default) adds songs like the last one when the queue is about to run out: they come from Last.fm (track.getSimilar, and the top songs of similar artists when that gives little), which follows the genre, the language and the artist; what was heard in the session is not repeated, five songs are added each time, they are looked for while the last song still plays (so there is no gap), and a repeat on turns it off. It needs the Last.fm key of the bot (LASTFM_API_KEY, the same one !lastfm uses). While /music play or playnext is typed, Discord shows up to 10 matching songs as "Title - Artist" (found in the same places as a search, kept 1 minute, only for the team while it is tested) and the one chosen plays exactly that recording. The card has 10 buttons (autoplay is the new one).
  • Music: /music search (a menu of results), a bar that moves, and faster changes between songs. /music search creep (or !music search, !music find) shows the best five results (no covers, remixes or repeats) in a menu with the artist, length and where each one is from; the person who searched picks one and it is added like play does (a menu lasts 5 minutes and is used once). The progress bar of the card is made of the three pieces of the music set (a pill that moves along a track). The recordings of the next three songs are chosen while one plays (it was one), a song asked for while it is being prepared is not asked twice, and the log says how long each change took to start (started N ms after the change began), the number to look at when a change is slow.
  • Music: the new look, 50% of volume, Deezer for the team, and a freeze goes on from where it was. The card, its buttons and the status of the voice channel use the emojis of the Petto music server (pe_s_*): the title has the music note, the line of time and volume has its own icons, the next song has the play icon, and when Discord does not take the custom emojis the card is sent again with plain ones. A session starts at 50% of volume (it was 100), which is also the lowest (the card has no button to lower the volume, and /music volume goes from 50 to 150). A song that freezes (Lavalink says it is stuck) now plays again from where it was before the next recording is tried; a second freeze within a minute goes to the next recording. With MUSIC_DEEZER=true songs are also searched on Deezer, its studio recording goes first and its links are played (Pettolava needs its Deezer variables; see its README).
  • Music: playlists without Spotify keys, a faster start, and no dead cards. A Spotify song, album or playlist that Lavalink cannot read (it needs keys) is now read from the public page of the link (title, artist and length of up to 50-100 songs of a playlist; the recording is still searched when each song is about to play). The voice channel is joined while the song is searched instead of after, and the song starts without waiting for the answer to be sent. When Lavalink restarts it comes back without its players: the card now says "the music server restarted" and the server is forgotten (before, the bot thought a song was still playing and play said "added to the queue (place 1)" forever); and a song whose end never arrives (no word from the player for 25 seconds, past the end of the song) is moved on from by itself, so the next song of a list plays. The buttons of the card have a name next to their icon (Back, Pause, Stop, Skip, Repeat, Queue, Vol −, Vol +, Shuffle, Leave) and the pause button says Play while paused.
  • !steal and !jumbo find the emojis of a card. Replying to a message made of the new cards (Components V2, like the ones of other bots or of Petto) found nothing, because only the text, the embeds and the reactions were read. Now the text of the card, the emoji of its buttons and of the options of its menus are read too (the ones of the buttons are how most of those cards show their emojis).
  • Music: the node is really reconnected when Lavalink restarts. The times given to Shoukaku are in seconds and were written in milliseconds: after a restart of Lavalink the bot waited 83 minutes before trying again (so the music said "the server does not answer" until the bot restarted) and a request to a node that was down could hang for hours. It now tries every 5 seconds for 5 minutes (Lavalink takes up to two minutes to start) and gives up on a request after 15 seconds. A check keeps the values in seconds.
  • Music: it comes back when Lavalink restarts, and it does not depend on YouTube. Shoukaku drops the node for good when its reconnect tries run out (Lavalink takes about a minute and a half to start), so after a restart of the node the music said "the server does not answer" until the bot restarted: the node is now put back in the pool every 20 seconds while it is missing. The second recording to try is now from another service than the first (SoundCloud after YouTube), and when YouTube asks for a login ("This video requires login") or blocks the node, the recordings of other services go first for 10 minutes. The log (and #errores-logs) now says what Lavalink said about a track that could not load, not only `loadFaile...
Read more

Petto v0.7.8

Choose a tag to compare

@github-actions github-actions released this 23 Oct 23:31
Immutable release. Only release title and notes can be modified.
9dc3d05

Added

  • Delete the previous message: repeating timers and autoresponders. A repeating timer can delete the message it sent the time before, so the channel only ever has the latest one (timer add ... delete_previous:true, or timer previous <id> <enabled> for one that exists). An autoresponder can delete its own previous reply in the channel before sending the new one (autoresponder add|edit ... delete_previous:true, or --previous with the prefix). Both are off by default, need Manage Messages in the channel, and ignore a message that is already gone. A timer remembers its last message in the new auto_messages.last_message_id column; an autoresponder remembers it in memory, so after a restart its first reply deletes nothing. The interval of a timer takes seconds, minutes, hours, days, weeks, months and years (10m, 2h, 1d, 2w, 1mo, 1y, or together like 3d 4h), never less than 10 minutes. A timer can also send a saved embed (also a Components V2 design), with its text above it or without text: timer add ... embed_template:name, or timer embed <id> <name|none> for one that exists; if the embed is gone the timer sends its text. New columns: auto_messages.delete_previous, auto_messages.last_message_id, auto_messages.embed_template, auto_responders.delete_previous.

  • Clownboard, and boards with more than one emoji. A third reaction board next to the starboard and the monkeyboard: clownboard (aliases cwb, clown) reposts what gets enough 🤡 in its own channel, with its own color, ignored lists and saved embed (variables {clown.…}). Every board can now count more than one emoji (emoji ⭐ 🍌 <:wow:123>, up to five, the first is the main one): whoever reacts with several counts once, and any of them can bring the message to the board. New tables clownboards and clownboard_entries, and a column extra_emojis on the three boards (schema.sql).

  • Media channels: imgonly and urlonly. A channel where only pictures and videos (imgonly add #channel, with options for audio, other files and text next to the picture) or only links (urlonly add #channel youtube x instagram, or any) can be posted. What does not fit is deleted and the person gets a notice that deletes itself (once every few seconds per person). Sites: YouTube, X, Instagram, TikTok, Pinterest, Spotify, Twitch, Kick, SoundCloud, Reddit, Facebook, GitHub, GIFs and Discord; a look-alike address is not the site. One channel can have both rules. Members with Manage Messages and the roles the server chose are never touched; a thread follows its channel. Aliases gallery, imageonly, linkonly; !mediaonlyconfig shows the settings. New table media_only_channels in schema.sql; the dashboard page comes with the web.

  • AI assistant for tickets: calmer replies and a place for more instructions. Replies now have one emoji only (in the header), no emoji on the button or the hand-over notice, and the line under them says that it is an AI and can make mistakes (it no longer talks about staff taking over). The assistant does not use emojis unless the owner asks for them. New field How it should answer (up to 2500 characters: length, format, wording, example replies), kept in ticket_ai_settings.reply_style (new column in schema.sql, added with alter table ... add column if not exists), sent to the model as its own data section that never overrides the fixed rules.

  • AI assistant for tickets: it can read Discord messages and knows the channels. The owner can paste links of up to 10 messages of the server (its rules, for example) in the dashboard; the bot reads them live (a message is read again after five minutes at most, so editing it changes what the assistant knows) and gives their text, embeds and cards to the assistant as data. The assistant also gets the channels the ticket user can see, with their topics (it can be turned off), so it can answer "where is...?" by mentioning the channel. A reply can mention only those channels or the ones the owner wrote in a text; any other channel mention is turned into plain text. New columns ticket_ai_settings.message_links and channel_guide in schema.sql. Needs the bot to see and read the channels of the linked messages.

  • AI assistant for tickets: replies are cards, with a button to talk to a person. The answers of the assistant are Components V2 messages in the same layout as other AI bots: a small header with the bot's own emoji ("Reply to ", linked to the profile), a line, the answer next to the picture of the bot, a line saying it is an AI and a Talk to a person button (only the person who opened the ticket can press it; it tells the team and pings the ticket type's roles, once). When the assistant hands over, the notice replaces the button. The model is told which ticket type was opened (its name and description). When a ticket opens in a ticket type where the assistant is on, it sends a first message, with no model call, in the language chosen for the assistant (the language of the server when it follows the ticket user's); that message is not counted as a reply. Its own earlier replies are read back from the messages, so it keeps its memory after a restart; the first replies, written with the robot emoji, are still recognized.

  • AI assistant for tickets (beta).- AI assistant for tickets (beta). A server can switch on an assistant that answers the person who opened a ticket, from the instructions, knowledge and hand-over list its owner wrote in the dashboard (Tickets → AI assistant, beta, only for the team and for servers staff enabled). It uses Groq (GROQ_API_KEY, and optionally GROQ_MODEL; without a key nothing happens). It answers only the opener, in the ticket types chosen, and stops when a staff member writes or claims the ticket, when its reply limit is reached, when the message matches a hand-over keyword or the model asks for it, or when a token or card number is written (that message is deleted and never sent to the model). Hand-over says the team was told and pings the ticket type's ping roles. Every reply ends with a line saying it is an AI, never mentions anyone, and is counted in ticket_ai_usage. A model failure says nothing in the ticket. The prompt, its fixed safety rules and its caps are the same module the dashboard's test chat uses (src/utils/ticketAiPrompt.js). Needs the new tables ticket_ai_settings and ticket_ai_usage and the function ticket_ai_count_reply in schema.sql.

  • Live tickets on the dashboard. New bot routes for the dashboard's Tickets → Live tickets (src/web/ticketLiveRoutes.js): POST /api/dashboard/guild/:id/tickets/live/list (the open tickets with their type, opener, claimer, age, time of the last message and whether the member waits for the staff), …/messages (the last 50 messages of one ticket: names, avatars, attachments as links, embeds and Components V2 cards in short, plus the members added) and the staff actions …/reply, …/claim, …/unclaim, …/add, …/remove and …/close, which use the same ticket actions as the buttons (claim and unclaim post their cards, close makes the transcript and the logs). A reply is sent as Petto (with the server's ticket look), its first line -# <staff name> · from the dashboard so the member and the transcript show who answered, and it pings nobody (allowedMentions: { parse: [] }); it counts as a staff message for inactivity and the staff count. Access: Manage Server, or a role with the new Tickets section of Dashboard access (view for the reads, edit for the actions; rules saved with Community still open it). Such a member only sees the tickets whose channel they can see, and every action needs the ticket's staff (a support role of its type or Manage Server, and the claimer in exclusive mode), as in Discord. Limits per member: 150 reads and 30 actions a minute, 5 replies in 10 seconds, replies up to 1800 characters. Reads stay short: one database read, Discord's cache, at most one fetch of 50 messages per ticket (shared and reused until a new message arrives) and a few lookups within 650 ms; a close answers within a second and goes on. While someone looks at the live tickets of a server, the bot follows its ticket channels in memory and sends a signal on Redis (petto:tk, at most one every 1.5 s per server) when a message arrives or a ticket opens, is claimed or closes; the website passes it to the open page, which reads the list at once. Servers nobody watches cost nothing. Deploy the bot before the website.

  • Ticket transcripts look like Discord and show Petto as it looks in the server. Petto's messages in a transcript use its nickname and its per-server avatar (the Premium bot profile), not the global ones; messages sent with a custom sender look (webhook) keep the name and avatar they were sent with; members show their server avatar and role color. The page has a header with the server icon and banner, the ticket number and status, who opened, claimed and closed it, the category, open and close times and how long it was open, the reason, the message and attachment count and the participants. Messages are grouped like Discord, replies and "used /command" lines are drawn, Components V2 cards (thumbnails, buttons with emojis, small text) render, there is a light theme (follows the system, with a toggle) and times are shown in the reader's time zone. The look is taken when the transcript is made; transcripts saved before are served as they were.

  • A deleted ticket channel closes its ticket. When the channel of an open ticket is deleted, the ticket is closed ("the ticket channel was deleted", closed by whoever deleted it when the audit log says), logged like a close, and the member can open a new one. A check on start and every 30 minutes closes open tickets whose channel no longer exists, only when Discord answers "Unknown Channel" for a server that is available (never on an outage or...

Read more

Petto v0.7.7

Choose a tag to compare

@github-actions github-actions released this 19 Oct 01:07
Immutable release. Only release title and notes can be modified.
6fdd356

Added

  • The everyday commands also work as slash commands. Not everyone uses the prefix, so 21 commands are now in Discord's / menu too, with the same answers as their prefix form (which keeps working): /help, /ping, /botinfo, /serverinfo, /userinfo, /avatar, /rank, /top, /remind, /afk, /suggest, /poll, /warn, /kick, /ban, /unban, /timeout, /purge, /channel (lock, unlock, slowmode...), /giveaway and /ticket. Their descriptions are in English, Spanish and Portuguese, the moderation ones are only shown to members with the permission they need, and none is offered in DMs. Petto now registers 64 commands (61 slash commands and 3 context menus); they are sent to Discord on the next start, and can take a moment to show (reloading Discord helps). Configuration and the rest of the commands stay prefix only.

  • /embed is a slash command too. create (opens the same editor, or saves a code), preview, send (with a channel option for text, announcement and voice channels and threads), list, delete, vars, edit title|description|color|author|footer|thumbnail|image|timestamp and field add|remove, the same as !embed, which keeps working. The saved embed is chosen from a list of the server's embeds while it is typed. Only shown to members with Manage Server, never in DMs, described in English, Spanish and Portuguese. Petto now registers 65 commands (62 slash commands and 3 context menus).

  • /help shows both ways of using a command. As a slash command the menu is private. The main page says how many commands also work with /, each category names the ones that do, a command's card shows its slash form next to the prefix syntax, and buttons open the dashboard (petto.sbs/dash), the docs (wiki.petto.sbs) and the support server.

  • Each form dresses its own web page. The page of a form (petto.sbs/form#…) now looks like the server's, the same way as the appeal site: the color of the form is the accent of the page (buttons, links, numbers), with an optional banner on top (an https link to a .png, .jpg, .gif or .webp picture, checked like the images of questions), a background (Petto's, a solid tint of the color or a gradient of it), and the icon and name of the server in the header (each can be hidden). The tab shows the icon of the server and "form · server" as its title, and the head of the form shows before the member logs in too. Set it with !form set <form> banner <link>|none, background default|solid|gradient, server-icon on|off and server-name on|off, or in the dashboard's new Web page section of the form editor, with a live preview. !form info shows the look and a link to share with a preview, petto.sbs/f/<id>: Discord and other apps show the title, the description and the banner (or the server icon) of the form, and a browser goes on to the page. A new bot route (look) gives the website only how a form looks, without a member. Needs schema.sql (four new columns on forms; existing forms keep the default look).

  • New counter types: role_online (the members of a role who are online, idle or busy: !counter create staffonline @Staff), tag_users (members wearing this server's tag), vanity_users (members a Vanity rule matches now, from the Vanity rules' records) and messages_today (messages of the day, from the activity stats, the day of Colombia like the other stats). The two read from the database are read at most once a minute per server, and only for servers that count them.

  • A better Counters page. Drag the counters (or use the arrows) to change their order, and Petto moves the channels in Discord to match: counters swap the places they hold inside their category, so nothing leaves its category or jumps past channels that are not counters. Click a counter's name to edit it in place with a live preview (Enter saves). Each counter says when it was last updated and when it updates next, and shows small problems the bot sees (no presences for an online count, a server too big to read every member, Discord asking to wait). A small line shows the members of the last 30 days: the counter job now saves the member count of every server once a day (one row per server and day, kept 90 days). Needs the new guild_member_days table and the position column of server_counters in schema.sql.

  • Counters in a category's name or a text channel's topic. !counter create <type> --kind category|topic|voice|text|stage (the dashboard has the same): category shows the value as a category's name, topic keeps a text channel's name and shows the value in its topic (up to 1,024 characters; a new one is a locked #server-stats channel, or --channel #general --kind topic uses one you have). Topic edits share the channel's budget of two edits every 10 minutes and the line of renames, like names. !counter edit #channel kind topic|name switches a text channel between the two. Needs the new target column of server_counters in schema.sql.

  • Counter milestone announcements (!counter announce). A message in a channel when the server reaches the goal of a goal counter, and if you want every N members (!counter announce every 100). The text takes {count} (members now), {goal} (the number reached) and {server}, or a saved embed with {counter.count}, {counter.goal} and {counter.server}. The last number announced is saved before the message goes out, so the same number is never announced twice: not after a restart, not when members leave and join again around it, and a raid of joins announces only the highest number passed. Turning it on starts from the members of that moment, without announcing what was already passed. !counter announce #channel [message], message, embed <name>|off, every <N>|off, goals on|off, on, off, test; the dashboard's Counters page has the same, with a preview. Needs the new counter_announce_config table in schema.sql.

  • Counter packs. !counter setup <pack> (also !counter preset <pack>) adds a ready category: basic (members, humans, bots), boosts (boosts, boosters, level), online (online, online now, in voice), goal [number] (a goal, by default the next round number above the members) and clock [time zone] (time and date). What the server already counts is skipped and the plan's limit is respected. The dashboard's Counters page has the same packs in a gallery, with the names they will show.

  • Restore only part of a backup. The dashboard's restore can bring back only some parts: roles, channels (with categories and permissions), server settings, emojis, stickers or AutoMod rules. Replace mode only deletes inside the parts chosen, so "only the channels" never deletes a role. The preview also says what the backup holds (roles, categories, channels, permission overwrites, emojis, stickers and AutoMod rules).

  • Live counters, rebuilt (!counter, prefix only). Channels whose name shows a live number, like the best counter bots:

    • More types: members, humans, bots, pending, online (any status) and online / idle / do not disturb (with the Presence intent Petto already has), members in voice, boosts, boosters, boost level, roles, channels, text / voice / announcement / stage channels, categories, emojis, stickers, the members of a role, a member goal (🎯 Goal: 480/500, with {goal}, {left}, {percent}; a set goal or the next round number), a clock and a date in any time zone, and countdowns to a timestamp. !counter types lists them with their value now.
    • Names you write: any text with {count} (and {role}, {tz}...), and a number format: plain 1234, grouped 1,234 (1.234 in Spanish and Portuguese) or compact 1.2k. New counters get a ready name in the server's language (👥 Members: 1,234). Old counters keep their names.
    • Setup: !counter setup makes a "📊 Server stats" category with members, humans and bots. !counter create <type> [name] [category] makes a locked voice channel (everyone sees it, nobody can join), or --channel #existing turns a channel you have into a counter; --format, --kind voice|text|category|stage, --role @Role, --goal 500, --timezone Europe/Madrid. !counter list shows what each one displays and any problem, !counter edit #channel <setting> <value>, !counter delete #channel [keep], !counter refresh. !counter add members voice still works.
    • Updates that respect Discord: a channel can be renamed twice every 10 minutes, and Petto never asks for more. A member joining or leaving, a boost, a new channel or role updates the counter at once when the budget allows; otherwise one rename is planned for the moment it is allowed again, with the value of that moment (everything in between is merged). Nothing is renamed when the name would not change. The renames are saved, so a restart keeps the budget; a rate limit from Discord pauses that channel.
    • Problems are said once: a deleted counter channel turns its counter off (shown in the list and the dashboard) instead of disappearing, and a missing Manage Channels permission is reported once to the server's notices and shown on the counter until it is fixed.
    • Free servers have 6 counters, Premium 25. Needs a few new columns of server_counters in schema.sql (applied on start). The dashboard has a new Counters page with live previews.
  • Forms can be filled on the website. Each form has a page at petto.sbs/f/<id>: the member logs in with Discord and sees the title, the description and every question (choices as buttons and checkboxes), checked the same way as in Discord. The answers go through the same pipeline as a Discord submission (requirements, review card, roles, DM, log, limits and retention), and the card says it was sent on the web. On by default; !form set <form> web off keeps a form in Discord only. !form panel ... --web yes adds a "Fil...

Read more

Petto v0.7.6

Choose a tag to compare

@github-actions github-actions released this 15 Oct 02:59
Immutable release. Only release title and notes can be modified.
20b4e3f

Added

  • Appeals. Each server gets an appeal page at petto.sbs/appeal/<server id or your name>. A member signs in with Discord, sees the punishments they have there (Petto cases, and the native bans and timeouts of Discord, cut to what the server allows: types, details and how old a warn can be), opens a form and sends an appeal; the staff gets it in a channel with Accept, Reject and Reply buttons (optionally in a thread and with a role ping), and the member follows it on the page and by DM, with a conversation in both ways. Everything starts off. Run schema.sql (tables appeal_config, appeal_forms, appeal_submissions, appeal_messages, appeal_blocks, appeal_name_claims, appeal_name_reservations and appeal_images, and columns slug, invite_url and invite_note) and deploy the bot and the website together.
    • Accepting lifts the ban, the timeout and the active Petto sanctions (a hardban is never lifted), and can make a single-use invite that lasts 7 days. The invite that was made is shown on the appeal card, in the log and in the dashboard, or the reason there is none (Petto needs Create Invite in a text channel). Rejecting can block a new appeal for a day, a week, a month or for good.
    • Forms are built in the dashboard with sections and questions (short and long text, choices, checkboxes, numbers and more), each with who can open it (by punishment type), its own messages and an icon from a set of real icons. The first form and the default messages are written in the language chosen for the page.
    • A link name of your own, petto.sbs/appeal/amor, next to the one with the server id (which keeps working). 3 to 32 letters, numbers or dashes; names that are only numbers, reserved words (site pages, Discord, Petto, Valorant and other brands, staff words) and offensive words in English, Spanish and Portuguese are blocked, also with numbers or symbols for letters; the Petto team can take the reserved ones. If another server holds the name, the server can send a request (why, a link to see the server, an optional proof) that the team answers in 1 to 72 hours from the new page /dash/appeal-names; until then the page uses the server id link. A name that a server changes away from stays reserved for it for 30 days and its old link redirects. Names of servers that left Petto, that have appeals off and untouched for 30 days, or on with no appeal and no change for 90 days, are freed by the cleanup job.
    • Brand and link preview: name, tagline, accent color, banner, icon, and what Discord shows when the link is pasted (title, description, picture and side color), with a live preview. The pictures can be uploaded from the device (PNG, JPG, WEBP or GIF, up to 5 MB) or taken from a link; the allowed links are direct https:// links of a public site, and a link that cannot be used is reported instead of dropped.
    • !appeals shows the link and how many appeals wait. The default sanction DM (ban, mute, warn and kick) points to the page when the server has appeals on and allows that type.
    • New environment variable, optional: APPEAL_CLAIMS_WEBHOOK_URL (website) posts a message in a Discord channel when a request for a name arrives.
  • Moderation. Anti scam (the MrBeast scam by behavior, wording and new accounts, with actions, a DM, alert buttons and takedown), !lockdown (closes channels, pauses invites and raises verification while a raid lasts, with automatic end), anti-nuke with limits, whitelists, a log and restore for each protection, and AutoMod templates (Discord rules and Petto filters) with strikes and exceptions by channel. Sanctions can be lifted from the dashboard, cases can be searched, with proof and stats, and active sanctions have their own page.
  • Tickets. Panels with a color, a picture, a footer and the text of the dropdown (and !ticket panel edit), a limit of open tickets for the whole server, staff hours with a note outside them, a reminder for tickets nobody claims, !ticket stats, the channel topic with the number, type and opener, quick replies (!quickreply), automatic deletion of closed channels, and transcripts: a transcript channel and delivery as a link, a file or both.
  • Suggestions (!suggest, by writing in the channel or from a button with a form; votes, a thread for each, answers from the staff or the dashboard, who voted), Counting (a channel to count one number after the other, with saves, a record, roles and a leaderboard) and Confessions (anonymous, with a panel, a check by the staff, anonymous replies, blocks and a log channel).
  • Image cards go in any message with {imgcard:name} and inside Components V2 designs, with 24 new fonts (40 in total). The embed code generator has a Components V2 mode, and !embed create <name> code: p2.… reads it.
  • VoiceMaster can copy the category permissions, with access roles, a privacy mode for new rooms and owner permissions (all off by default).
  • Verification can be set up from the dashboard in one press, with a New picture button, and the buttons of the picture turn off once the member is verified.
  • The website has a Brand page (/brand, /es/brand, /pt-br/brand) with the mascot in its versions, colors, fonts, descriptions and a download kit.

Changed

  • The reposts of the starboard and the monkeyboard look like a message with its author, date and an Original Message button.
  • !ping is a Components V2 card with the latency of the guild and the API; !userinfo takes its accent from the dominant color of the avatar and shows the server banner.
  • New messages (partners, verification, birthdays, suggestions) are Components V2 cards without color by default, in warm colors when a status needs one.
  • Rollouts show only the variants that changed, with Treatment and Control names; variant 0 is the control and is never read.
  • Dashboard: Fraunces for titles and Plus Jakarta Sans for text, softer colors and smaller text, one color picker everywhere with a No color choice and bigger, easier-to-drag controls, a smaller save bar, a Modules page with a setup guide, and a real status page.

Fixed

  • Answers fall back to a normal message when quoting is not allowed (no Read Message History), and a missing permission is told in plain words and kept out of the error channel.
  • !prefix set ? works like !prefix ?; !nuke with the prefix no longer fails when its channel is gone, and a missing argument is told with the usage.
  • A new appeal could fail to reach the staff channel (Discord error 50035: a Components V2 message cannot have content); the role pings are now inside the card.
  • Opening a dashboard page with a color no longer shows "You have unsaved changes".