-
Notifications
You must be signed in to change notification settings - Fork 144
Input resolution
Bilal Bassam edited this page Nov 5, 2024
·
6 revisions
For convenience, some Discordia methods accept more than one type of input. For example, a method that strictly requires a user ID may also accept a user object, since a user object can be directly resolved into a user ID.
This page details the resolveable types in Discordia. For example, if a method calls for a "User ID Resolveable", then any type listed for "User ID" may be used.
Due to Luvit/LuaJIT's lack of native 64-bit integers, integers are resolved as strings in Discordia. If you wish to input the purest type where ever an integer is accepted, usually a Discord Snowflake ID, use a Lua string.
- Lua string via
tonumber(str) and str or nil
- Lua number via
string.format('%i', num)
- LuaJIT int64_t or uint64_t via
tostring(int):match('%d*')
-
Date via
Date:toSnowflake()
-
User object via
User.id
-
Member object via
Member.user.id
-
Message object via
Message.author.id
-
Guild object via
Guild.ownerId
- Integer
-
Message object via
Message.id
- Integer
-
Channel object via
Channel.id
- Integer
-
Role object via
Role.id
- Integer
-
Emoji object via
Emoji.id
- Integer
-
Sticker object via
Sticker.id
- Integer
-
Guild object via
Guild.id
- Integer
-
AuditLogEntry object via
Entry.id
- Integer
- Iterable of Message ID resolveables
- Lua table of Message ID resolveables
- Iterable of Role ID resolveables
- Lua table of Role ID resolveables
-
Emoji object via
Emoji.hash
-
Reaction object via
Reaction.emojiHash
- Lua string, where the string is a unicode emoji or of the form
"{Emoji.name}:{Emoji.id}"
-
Sticker object via
Sticker.hash
- Lua string, TODO: what string exactly?
-
Color object via
Color.value
- Lua number via
tonumber(obj)
-
Permissions object via
Permissions.value
- Lua number via
tonumber(obj)
- Lua string equivalent to the name of a Discordia permissions enumeration
- Lua number equivalent to the value of a Discordia permissions enumeration
- Lua string equivalent to the name of a Discordia gateway intent enumeration
- Lua number equivalent to the value of a Discordia gateway intent enumeration
- Lua string equivalent to the name of a Discordia action type enumeration
- Lua number equivalent to the value of a Discordia action type enumeration
- Lua string representing the base64 string, prefixed by an appropriate
"data:.*;base64"
URI scheme - Lua string representing a relative or absolute path to a local file, read via
fs.readFileSync