Skip to content

Execution Limits

Craig Edwards edited this page Nov 20, 2019 · 6 revisions

All scripts you run within Sporks have the following limitations which are put in place to protect the bot as a whole, and ensure you don't create an event which has the potential to cause harm to your server.

  • All events may only reference channels and users within the guild within which they were triggered
  • All scripts can only execute for a maximum of 10 milliseconds per request
  • All scripts have a maximum memory usage per request of 256 kilobytes
  • Up to five channel messages may be sent per request received, this includes embeds.
  • Only channels may be messaged, direct message to user is not supported
  • The @everyone and @here tags will be rendered ineffective before sending to a channel.
  • Storage via the save() and load() functions is restricted to 1024 key/value pairs per guild
  • overly complex (abusive or accidentally broken) regular expressions may be subject to other limits and may return early as a non-match.
  • Your script may only have one web request from get() or post() "in-flight" at any one time, and cannot raise a web request from within the callback of another web request. A web request's callback function runs within its own isolated virtual machine and cannot see other parts of the script it belongs to, but gets its own separate 10ms of execution time and 256kb of RAM which does not intrude on the quota of the main script that created the request by calling get() or post().
  • Web requests made via get() and post() will be made via a proxy server to protect the bot's systems and to protect your discord server with increased anonymity. It is not possible to make a direct request without use of the proxy, this is transparent and built into the bot.

Web Request restrictions

Web requests have the following further set of restrictions. Web requests are held in a queue, run in a separate process to the bot on a first come, first served basis. In the event of a restart of the shard or entire bot, any outstanding web requests will still be delivered to the scripts.

  • Total time limit for each web request: 5 seconds
  • Total time limit for connection to be established: 2 seconds
  • Total time limit for DNS lookups: 1
  • Number of DNS lookup attempts: 1
  • Maximum HTTP redirections per request: 3
  • Maximum download size, including headers: 1mb
  • Maximum upload size, including headers: 256k

Upon reaching any of these limits the execution of the script event will stop at the point where the limit was breached, and a range error will be raised, which can be viewed on the dashboard.

Clone this wiki locally