Skip to content

Floppa Lua API

htmlcsjs edited this page Apr 13, 2022 · 7 revisions

This is the API for the discord related functions of the lua API

Structure

This API is contained in the floppa package in lua. The root object contains:

  • msg -> a message object that contains the information of the message that invoked the command.
  • get_message -> a function that returns a message object from message id and a channel object. The channel object is optional and if it is not provided it defaults to the sender channel.
  • get_channel -> a function that returns a channel object from a channel id.

currently wip

  • get_user -> a function that returns a user object from a user id.

Message Object

This is a table that holds information about a message:

  • author -> the author of the messages id, if applicable.
  • id -> the id of the message.
  • channel -> the id of the channel the message was sent in.
  • content -> a string representing the content of the message.
  • attachment -> an array of the urls for any attachments. not present if there is no attachments.
  • flags -> a list of any flags the message has. a list of flags can be found here.

Channel Object

This is a table that holds the information about a channel depending on the type of channel:

  • id -> the id of the channel.
  • type -> the type of channel.
  • mention -> the mention for the channel.

GUILD_TEXT channels

  • rate_limit -> the rate limit on the channel. doesn't affect some users + bots
  • is_nsfw -> if the channel is nsfw.
  • last_messages -> return the latest 20 messages sent in the channel. not in currently due to lag issues.
  • last_message -> the id of the last message sent.
  • topic -> the topic of the channel if it present.
  • category -> the category the channel is in if it is in one.
  • name -> name of the channel.

GUILD_VOICE channels

  • bitrate -> the bitrate the channel is set too.
  • user_limit -> the limit of users in the channel at once.
  • video_quality_mode -> the video quality mode that is imposed on the channel.
  • region -> the region the channel is set too.
  • topic -> the topic of the channel if it present.
  • category -> the category the channel is in if it is in one.
  • name -> name of the channel.

User Object

This is a table that holds information about a user

  • accent_colour -> (optional) the hex code for an users accent colour.
  • animated_avatar -> bool showing if the user has an animated avatar.
  • animated_banner -> bool showing if the user has an animated banner.
  • animated_guild_avatar -> bool showing if the user has an animated guild avatar.
  • avatar_url -> the url to the users avatar.
  • banner_url -> (optional) the url for the users banner.
  • bot -> bool if the user is a bot or not.
  • colour -> (optional) the colour used to represent this user in the discord client.
  • discriminator -> the discriminator of the users discord tag. e.g. the 1234 bit of floppa#1234.
  • display_name -> the display name of the user. It is their nick if they have one, or their username.
  • default_avatar_url -> the url of the default avatar for this user. e.g this is mine.
  • flags -> a list with whatever flags the user has, like hypesquad houses. a full list can be found here.
  • guild_avatar -> (optional) the url to the users guild avatar.
  • nick -> (optional) the users nickname.
  • roles -> a list of role ids for any roles the user might have.
  • tag -> the users tag. e.g. floppa#1234
  • username -> the users username. e.g. floppa from floppa#1234.

Clone this wiki locally