Piecewise Blog

Build chat bots with blocks.

Hi everyone! November has been a very busy month for me – I've been working on several new, big-ish features and tons of bug-fixes and usability improvements!

Before I start outlining what's new in Piecewise this month, I'd like to take the time to thank everyone who has supported Piecewise so far. I understand that the editor is still rough around the edges, and the documentation is a little sparse right now. I hope that – if it isn't already – Piecewise will grow and change into something you'll be able to use to learn programming or create bots rapidly.

Now then! Here's what's new in Piecewise 21.12:

Editor highlights

RSS feeds DLC

Piecewise's first DLC releases today! The RSS feed extension blocks allow you to monitor RSS feeds – common on news sites, blogs, or podcast hosts – for new items. You might use this functionality to, for example, create auto-posting news bots, or notify you about new podcast episodes.

RSS feeds

If you own Piecewise, send an email to contact[at]piecewise[dot]im with your Steam or itch.io profile URL and let me know how you plan to use Piecewise and this DLC to receive a free copy.* Otherwise, you can buy it individually on Steam or itch.io.

*Promotion ends December 14, 10am Pacific or while supplies last.

Steam Workshop

Steam Workshop support is now available in Piecewise, albeit in an unfinished and rough state. Upload your own or consume community-created addon blocks, templates, or custom styles to and from the Workshop. For more information on the Steam Workshop, see this page on doc.piecewise.im.

Share Blocks Online

Sharing blocks is now easier using the “Share Blocks Online” function. Simply right click the blocks you want to share, then select “Share Blocks Online” to get a piece.ws link that will automatically open the requested block set within Piecewise.

Paginators

When requesting a lot of something (e.g. messages in a channel, members of a Discord server, statuses a user has written...) data is usually drip-fed across multiple requests instead of returned all at once. The “paginator” model, new in Piecewise, is designed to make it very easy to work with these types of structures. Simply use the “paginator” like you would any other loop.

Paginators

To learn more about paginators, including their benefits and pitfalls, check out this page on doc.piecewise.im.

Welcome screen

Along with some slight visual tweaks, the welcome screen now displays the templates you have installed and the platforms they work with, so you can get started more quickly.

Templates

Mastodon

Polls

Piecewise now allows you to create, vote on, and view the results of polls using their associated blocks under Mastodon –> Polls.

Emoji reactions

If connected to a Pleroma server, Piecewise now allow you to determine the emoji reactions on a post using the emoji reactions to status block.

Other changes

  • On Pleroma, Piecewise now uses a remote subscribe strategy to search for and discover statuses
  • Bots will now ignore their own statuses in feeds, unless configured otherwise
  • Bots will now automatically add mentions consistent with the thread when replying to a status
  • Determining the max length of statuses of an instance is now possible using the instance maximum status length block
  • On Pleroma, you can now specify the format of your post (i.e. Markdown, BBcode, etc.)
  • liblazurite-mastodon is now part of Piecewise itself – you should no longer need to copy this file for bots exported after this update
  • Added me, which represents the user the bot is logged in as
  • Added status <- post status... to immediately get the status after it is posted

Discord

Server management

You can now determine the owner of a server, the approximate member count of a server, leave servers, and determine what servers the bot is in using blocks in the Discord –> Servers category.

Mentions

Determine who or what channel a message mentions, and if a message mentions you, using new blocks in the Discord –> Messages category.

Other changes

  • Added the ability for chat command arguments to be coerced into users and channels
  • Added the ability to find messages, if you have the message ID and the channel they are inside
  • Added paginator for channel messages
  • Added paginator for server members
  • Fixed sending messages before log-on causing an error. Messages sent before log-on will now be queued for after log-on, instead.
  • Fixed deleting a message that does not exist causing a crash – will now print a warning instead.
  • Fixed the (avatar) of user block returning a hash instead of an absolute URL, to match up with expectations of what this actually does

Breaking changes

While I try to keep compatibility with previous releases high, there are some instances where it's not feasible for me to do so. Here's a list of all of the things to watch out for when opening new projects in Piecewise 21.12:

  • Mastodon: bots will now ignore their own statuses in feeds, unless configured otherwise.
  • Mastodon: bots will now automatically add mentions consistent with the thread when replying to a status, unless configured otherwise.
  • Discord: sending messages before log-on will no longer throw an error. Messages sent before log-on will now be queued until after log-on.
  • Discord: deleting a message that does not exist will now emit a warning instead of crashing the bot.
  • Discord: (avatar) of user now returns an absolute URL to an avatar, instead of a plain hash.
  • Discord: the “embed” block now forces text blocks for nearly all connections.
  • Piecewise now uses a different method to change HTML to text. For most this is a seamless change, but output text will now be formatted to look more like the input HTML, and links will be annotated.
  • Piecewise now stores bot-specific data in a different location.
    • On Windows, the new location is C:\Users\[You]\AppData\Roaming\Piecewise\.lazurite.
    • On macOS, the new location is /Users/[you]/Application Support/Piecewise/.lazurite
    • On Linux, the new location is ~/.lazurite.
  • The “prompt for text” block is no longer available (but never worked anyway).

Miscellaneous additions and fixes

  • Piecewise now runs natively on Apple silicon when running from Steam. Non-Steam builds always defaulted to native support.
  • Added text (text) [starts|ends] with (prefix or suffix)
  • Added parse text (text) as [json|xml]
  • Added warning when using multiple of a configuration block
  • Fixed styling of input dialogs so they all at least match. This is a rough edge and a work in progress.
  • Added workspace renaming
  • Added next workspace, previous workspace, clear workspace keyboard shortcuts
  • Reworked help menu – now contains various other documentation and help resources
  • Added update checking/notifications
  • Reworked bot runtime – everything now runs in a Worker, making starting/stopping significantly more responsive
  • Added parse date from text (text), (property) of date (date), add (time) to date (date)
  • Added stop
  • Fixed the require property not working properly for extension blocks
  • Upgrade Electron to 16.0.x
  • Upgrade Discord.js to 13.3.1

Upcoming changes and looking ahead

I don't really have a lot planned this month – with the holidays getting in the way, I don't imagine I'll be nearly as productive. I do plan to work on at least the following, though:

  • Add system blocks – list files, execute commands, get environment variables, etc.
  • Add blocks for Discord right-click/context menu commands
  • Smooth out Steam Workshop for a “full” release next month

I hope everyone has a safe and restful holiday, and thanks again for your support! The next release is tentatively scheduled for January 4th at 10am Pacific.

Piecewise is now available on itch.io with a 10% launch discount!*

Piecewise is a tool for assembling (literally!) Discord, Mastodon/Pleroma, and Matrix chat bots (with more platforms planned in the future!) using a friendly puzzle-like format.

Easy to learn Skip confusing syntax and dive right into logic. Piecewise provides a friendly and familiar interface – even to beginners – based on a visual scripting framework.

Powerful Thanks to Piecewise's large coverage of the platform tools it uses, you'll have full control of a lot of the features you'd expect from a bot written from scratch.

Multi-platform Create bridges from one platform to another, or make your bot play nice with everyone: the possibilities are endless.

Shareable Write an interesting function? Share it with the world using the “Share Blocks” feature, or turn to the community to find functions to add to your bots.

Pluggable Purchase extension packs or make your own to plug into services that provide rich data.

Export and run anywhere Ready for prime time? Easily export and run your bot anywhere; on your computer or on a remote server.

For experienced developers, too Looking for a rapid development tool for chat bots? Piecewise provides a simple interface – no more syntax errors, no finagling with your environment, no more mess. Build bots of any complexity, click the Play button, and you're online.

* Offer ends December 3, 10am Pacific

Piecewise 21.11.7 has been released. The 0.5~3.2MB update will be applied automatically by Steam. The changes include:

  • Fixed some voice events emitting for bots even if “ignore bots” is checked in Discord configuration. You'll need to re-export your bot to receive this change.

Feel free to follow me from any ActivityPub-compatible server (i.e. Mastodon, Pleroma, Misskey...) at @piecewise@pub.piecewise.im and on Twitter @piecewisechat for shorter-form progress reports and blog posts.

If you don't already have an account on the Fediverse, I highly recommend joining! Peruse instances.social to help find a community that fits your interests.

And of course, this blog can also be followed via any ActivityPub-compatible server at @blog@blog.piecewise.im.

Piecewise 21.11.6 has been released. The 0.6~1.5MB update will be applied automatically by Steam. The changes include:

  • Update copyright and third-party legal notices
  • Fix Mastodon files always being uploaded as “file.bin”
  • Fix potential vulnerability in the Mastodon token tool

Piecewise 21.11.5 has been released. The 0.8~1.6MB update will be applied automatically by Steam. The changes include:

  • Remove block shadowing from “(Discord) create author with...”

Piecewise 21.11.4 has been released. The 0.8~1.4MB update will be applied automatically by Steam. The changes include:

  • Fix crash when trying to parse number-type arguments from Discord chat commands
  • Fix crash when extracting some types of variables from events
  • Fix crash when checking Discord permissions
  • Fix crash when deleting an unknown (already deleted?) message – a warning is now printed instead

Also: this is your final chance to get Piecewise at 10% off! Sale ends tomorrow, 10am PT.

Piecewise 21.11.3 has been released. The 0.9~2.0MB update will be applied automatically by Steam. The changes include:

  • Various changes to Piecewise debugging logs
  • Block loading no longer creates a console entry
  • Update third-party legal notices
  • Fix potential crash with “[Discord] user (user) has permission (permission) in (target)” block when (target) is a DM
  • Update Discord.js to 13.3.1

Piecewise 21.11.2 has been released. The 1.2~1.9MB update will be applied automatically by Steam. The changes include:

  • Documentation: fix links on “your first bot” tutorial
  • Adjust styling on Mastodon token generator
  • Adjust Mastodon-Danbooru poster template

Piecewise is now available on Steam with a 10% launch discount!*

Piecewise is a tool for assembling (literally!) chat bots that work across multiple platforms using a friendly puzzle-like format.

Easy to learn Skip confusing syntax and dive right into logic. Piecewise provides a friendly and familiar interface – even to beginners – based on a visual scripting framework.

Powerful Thanks to Piecewise's large coverage of the platform tools it uses, you'll have full control of a lot of the features you'd expect from a bot written from scratch.

Multi-platform Create bridges from one platform to another, or make your bot play nice with everyone: the possibilities are endless.

Shareable Write an interesting function? Share it with the world using the “Share Blocks” feature, or turn to the community to find functions to add to your bots.

Pluggable Purchase extension packs or make your own to plug into services that provide rich data.

Export and run anywhere Ready for prime time? Easily export and run your bot anywhere; on your computer or on a remote server.

For experienced developers, too Looking for a rapid development tool for chat bots? Piecewise provides a simple interface – no more syntax errors, no finagling with your environment, no more mess. Build bots of any complexity, click the Play button, and you're online.

* Offer ends November 9, 10am Pacific