Changelog - June 11th, 2020

New Feature: CPU Bursts

CPU Bursts

Because Pylon's execution engine limits individual events' CPU time consumption, you may run into problems utilizing Pylon for more computationally expensive tasks. To solve this, we've introduced CPU Bursts to the Pylon runtime. Everyone can start using this feature today, so lets talk about it.

What are CPU bursts?

You can use CPU bursts to run expensive routines or loops that are expected to exceed the base CPU time limit for an event or command handler. A prime use-case for CPU bursting is for generating images, but you can probably imagine several other workloads that require a higher CPU budget.

How do I use them?

We've added async requestCpuBurst(callback: function, requestMs?: number) to the runtime, which is used to request and execute a CPU burst. You can find detailed documentation for CPU bursts over at the documentation site.

As always, you can find detailed type documentation over at the SDK Reference.

Changelog - May 13th, 2020

New Feature: Tasks

Pylon Tasks

We are excited to announce the first phase of a new service available to all Pylon users: Tasks!

With this release, we've added pylon.tasks.cron(name, cron, handler) to the runtime. You may use this to schedule tasks that run at specific intervals or times.

Here's a quick example of a task that is fired every 5 minutes which logs the date to console.

pylon.tasks.cron("your-task-name", "0 0/5 * * * * *", async () => {
console.log(new Date());
});

An example that shows how to update a channel name with the current server member count has been added to the Tasks documentation page.

Tasks Documentation

You can read more about tasks at the following locations:

What's next?

We're working on ways to enable you to schedule task runs from any event handler with custom payloads. Stay tuned for more information on that!

SDK General Additions

New SDK Reference Search

Documentation search for the SDK Reference has bene rebuilt from the ground up. Enjoy lightning-fast searches that are more accurate and context-aware. Filters have been added for the different types objects you can find in the runtime.

Changelog - May 4th, 2020

Discord SDK and Runtime Changes

  • Fixed names of built-in atob and btoa functions.
  • Fixed GUILD_MEMBER_UPDATE event handler mutations.
  • Fix default value of parameter for Guild.getIconUrl.
  • Fixed undefined values for falsy values in AuditLogEntry.changes.
  • Fix Role mutation for second parameter of GUILD_ROLE_UPDATE/DELETE event handlers.
  • Fix optional GuildNewsChannel.IGuildNewsChannelOptions properties.
  • Fixed cases where false-like properties may be stripped from Discord API responses
  • GuildTextChannel.rateLimitPerUser now defaults to 0 instead of null.
  • Fixed GUILD_BAN_ADD and GUILD_BAN_REMOVE events.
  • Made discord.APIError errors more verbose, with extra details under the stack trace if available.

SDK General Additions

Channel Getter Utilities

KV Changes

The key-value storage service has been rewritten from the ground up to empower the new features listed below. Work has started on a UI to manage your KV namespaces on the web dashboard.

New pylon.KVNamespace Functions:

  • count: returns how many keys are set in a namespace.
  • clear: clears all keys from the namespace.
  • items: returns the keys and values of all items in the namespace.
  • transact, transactMulti, transactWithResult & transactMultiWithResult: higher level atomic mutations across multiple keys - providing a more high level API ontop of cas and casMulti. Check out the docs for examples!

See the documentation on pylon.KVNamespace for more information.

pylon.KVNamespace Changes:

  • cas and casMulti are now able to use undefined as the set and compare arguments, allowing you to create "set if not exists" and "delete if equals".
  • cas and casMulti no longer return a Promise<boolean> and instead returns Promise<void>, a failed operation will throw an exception.
  • delete now takes a prevValue option, which will only delete the key if it equals a certain value.

Web Changes

  • Added a save/publish script button to the header of the editor... finally!
  • Added console log feedback for publish status and errors.
  • Added timestamps to console logs.
  • Sped up loading of editor and default editor typings.
  • Fixed some login window bugs.
  • Fixed weird graph y-axis scaling on quotas graphs.

Changelog - April 4th, 2020

Discord SDK and Runtime Changes

Command Handler Updates

Web Changes

  • Enhanced syntax highlighting, much closer to what VSCode looks like now.
  • Set Prettier's "arrowParens" config default to true (respect's latest Prettier recommendations).
  • Enabled the lightbulb widget to make applying code suggestions easier.

General Updates

  • Fixed some problems around uploading larger scripts.
  • Fixed issues with adding new guilds after being logged in for sometime.
  • Discord OAuth popups resized to fit the new design and QR code login method.
  • Gateway performance & stability updates.

Changelog - March 31st, 2020

Discord SDK and Runtime Changes

Event Handler Updates

Some event handlers now send two arguments, the first will always be the latest data from Discord. The second argument is a snapshot the state of the entity in question before applying the event. For example, a MESSAGE_UPDATE event's first parameter will be the latest updated message. The second parameter will be the message prior to being edited by the user.

Here's a list of the updated event handlers and their argument types. You can find all the event handlers and their parameters at the documentation for discord.on.

  • MESSAGE_UPDATE (discord.AnyMessage, discord.AnyMessage)
  • MESSAGE_DELETE (discord.Event.IMessageDelete, discord.AnyMessage)
  • GUILD_UPDATE (discord.Guild, discord.Guild)
  • GUILD_MEMBER_UPDATE (discord.GuildMember, discord.GuildMember)
  • GUILD_MEMBER_REMOVE (discord.Event.IGuildMemberRemove, discord.GuildMember)
  • GUILD_EMOJIS_UPDATE (discord.Event.IGuildEmojisUpdate, discord.event.IGuildEmojisUpdate)
  • GUILD_ROLE_UPDATE (discord.Event.IGuildRoleUpdate, discord.Role)
  • GUILD_ROLE_DELETE (discord.Event.IGuildRoleDelete, discord.Role)
  • CHANNEL_UPDATE (discord.AnyChannel, discord.AnyChannel)
  • VOICE_STATE_UPDATE (discord.VoiceState, discord.VoiceState)
  • USER_UPDATE (discord.User, discord.User)

Changelog - March 22nd, 2020

Discord SDK and Runtime Changes

Cache Improvements

Requesting objects from the cache should be even faster now. The new gateway improvements allow us to stream all the members of a guild into the cache upon connection. This will help reduce cache misses on old/previous values sent with some update/delete events.

Gateway Improvements

The gateway service (the component that talks to Discord's API and gateway) has been completely rewritten. Although the prototype I had in place was working fine, I took the time to make a lot of improvements. You shouldn't notice any changes, but be happy knowing the service is using ~30% of the resources it was consuming previously!

Changelog - March 4th, 2020

Warning: Some information in this changelog is outdated. Please reference the SDK Reference for the latest documentation.

Note: This is the oldest changelog available. Earlier changelog entries may have existed but were not substantial or were fundamental feature additions that are well-understood today.

Discord SDK and Runtime Changes