Skip to content

Global Objects

Craig Edwards edited this page Nov 13, 2019 · 3 revisions

The following global objects are available at all times within your bot's JavaScript event:

message

The message object contains the flollowing fields:

field content
content the content of the message
edited_timestamp the time the message was last edited
id the snowflake id of the message
mention_everyone true if there is an @everyone mention in this message
nonce a field used to determine if messages have been sent
pinned true if this message is pinned
timestamp timestamp of the message
tts true if this is a text-to-speech message
type message type: Generally all messages received via this API will have a type of 0, meaning a channel message

channel

The channel object represents the channel the message occurred upon, and contains the following fields:

field content
dm True if the channel is a direct message channel. In all instances at present, this will be false
id The snowflake id of the channel
guild_id The guild id of the guild this channel exists on
name The name of the channel
nfsw True if this channel is marked as NSFW

author

The author object represents the author of the message, and contains the following fields:

field content
bot True if the author is a bot. Generally, these messages will be filtered from the bot so you shouldn't see any with this value set to anything other than false
discriminator The user's discriminator value
username The user's username
guild_id The user's guild they are a member of, will always be the same guild ID as the one on which the message is received regardless of other memberships (which are not visible to you)
id The user's snowflake unique id
mfa_enabled True if the user is using multi-factor authentication
verified True if the user is verified

mentions

The mentions object contains an array of user ids who were mentioned in the message. Note that these values, as with all ids in the scripting system, are strings.

guild

The guild object contains the information about the guild Sporks is connected to, where the message arrived. The following fields are available:

field content
id The snowflake ID of your guild
member_count The member count of the guild
name The name of the guild
owner The snowflake id of the guild owner
region The region string representing where the region is hosted