Table of contents generated with markdown-toc
The user object is a serialized combination of:
- https://discord.com/developers/docs/resources/user#user-object-user-structure
- https://discord.com/developers/docs/resources/guild#guild-member-object-guild-member-structure
The channel object structure can be found here:
The message object structure can be found here:
The embed object structure can be found here:
Util (util) isn't a data structure per se, but rather a collection of useful functions.
Returns a list of users (max. 10) maching the input query. If the input query is a Snowflake, tries to find a user with the given id. If the input query is a mention, converts the mention to a Snowflake and ^.
The output is sorted by relevancy to the input query.
Allows attaching embeds to replies. Or, it's there if for whatever reason you want to reply without using the last transferrable value.
Can only be used once per execution.
HTTP (http) is a library that contains request, a function capable of making synchronous HTTP requests.
The config argument can either be a string containing URL (GET request), or a verbose RequestConfig object following the next structure:
Keep in mind that functions and classes cannot be passed to the RequestConfig object.
The response schema is defined here:
Overclocking (overclocking) isn't a data structure per se, but rather a collection of various GTCE-related overclocking methods. Primarily adopted from the OC calculator, however do keep in mind that function and enum names are different.
GTTiers=>gtTiersV=>voltagesVNames=>voltageNamesGetTierByVoltage=>getTierByVoltageGetByproductChanceMultiplier=>getByproductChanceMultiplierCalculateOverclockInternal=>calculateOverclockInternalCalculateOverclock=>calculateOverclock
Function args and outputs are consistent with the linked source file.
The common context provides with the following items:
{
msg: {
...Message,
author: User,
channel: Channel
},
util: [object Util],
overclocking: [object Overclocking]
}See Data Structures and Libraries.
Most of the standard JavaScript global objects and libraries are available, such as:
Object, Function, Array, Number, parseFloat, parseInt, Infinity, NaN, undefined, Boolean, String, Symbol, Date, Promise, RegExp, Error, AggregateError, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError, globalThis, JSON, Math, console, Intl, ArrayBuffer, Uint8Array, Int8Array, Uint16Array, Int16Array, Uint32Array, Int32Array, Float32Array, Float64Array, Uint8ClampedArray, BigUint64Array, BigInt64Array, DataView, Map, BigInt, Set, WeakMap, WeakSet, Proxy, Reflect, FinalizationRegistry, WeakRef, decodeURI, decodeURIComponent, encodeURI, encodeURIComponent, escape, unescape, eval, isFinite, isNaN, SharedArrayBuffer, Atomics, WebAssembly
The tag context provides everything the common one does, additionally providing tag-related items:
{
...<common_evaluation_context>
tag: {
args?: string,
body: string,
name: string,
owner: string,
}
}(tag.args is whatever passed after %t tag, e. g. foo bar if the message is %t tag foo bar, can be undefined)
Tags must follow the next pattern to be treated as JavaScript:
%t add tag ``` <-- the newline is required!
"code"
```
%t add tag ```js <-- the newline is required!
"code"
```
The last transferrable is used as the tag output. In the example above, the output would be "code".
- If the last transferrable value is
null,undefinedor an empty string, the bot will fail silently - If the response is a valid message link, the bot will automatically make an embed for it, provided it's both actually accessible and the channel isn't blacklisted
Since 10/6/2025, http.request now also includes auth headers, allowing you to verify that the requests are coming from the bot (for example, if you want to host an API specifically for Leveret tags).
The headers are as follows:
X-Leveret-Signature-Ed25519: Base64 Ed25519 signature of the canonical request string.X-Leveret-Timestamp: ISO-8601 timestamp used inside the canonical string.X-Leveret-Request-Id: Unique identifier for the request.X-Leveret-Discord-User: Discord user ID of the command invoker when available.X-Leveret-Source: The execution origin (e.g.,evalortag).X-Leveret-Tag: Name/identifier of the tag that triggered the request (when applicable).X-Leveret-Tag-Owner: Discord user ID of the tag owner (when applicable).
See the file attached below for a minimal Express server that verifies requests.
