Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Embed

The Fuwa#Embed class is a built in way to create beautiful Discord embeds with our API. This class extends the basic discord api with more functions.

Hierarchy

  • Embed

Implements

  • IEmbed

Index

Constructors

constructor

  • new Embed(opts?: Embed): Embed

Properties

Optional author

author?: { icon_url: string; name: string; proxy_icon_url: string; url: string }

Type declaration

  • icon_url: string
  • name: string
  • proxy_icon_url: string
  • url: string

Optional color

color?: number

Optional description

description?: string

Optional fields

fields?: { inline?: boolean; name: string; value: string }[] = []

Optional footer

footer?: { icon_url: string; proxy_icon_url: string; text: string }

Type declaration

  • icon_url: string
  • proxy_icon_url: string
  • text: string

Optional image

image?: Media

Optional provider

provider?: { name: string; url: string }

Type declaration

  • name: string
  • url: string

Optional thumbnail

thumbnail?: Media

Optional timestamp

timestamp?: Date

Optional title

title?: string

type

type: string = 'rich'

The type of embed for discord's api

Optional url

url?: string

Optional video

video?: Media

Methods

addField

  • addField(field: { inline?: boolean; name: string; value: string }): Embed
  • Parameters

    • field: { inline?: boolean; name: string; value: string }

      A field for embed

      • Optional inline?: boolean
      • name: string
      • value: string

    Returns Embed

addFields

  • addFields(fields: { inline?: boolean; name: string; value: string }[]): Embed
  • Parameters

    • fields: { inline?: boolean; name: string; value: string }[]

      fields For embed

      embed.addFields([{ name: 'some name', value: 'some value' }])
      

    Returns Embed

setAuthor

setColor

  • setColor(color: string | number): Embed
  • Parameters

    • color: string | number

      The hex color code for the embed

      embed.setColor('#6f00ff')
      embed.setColor(0x6f00f)

    Returns Embed

setDescription

  • setDescription(description: string): Embed

setFooter

  • setFooter(footerText: string, opts?: { icon?: string; proxyIconUrl?: string }): Embed
  • Parameters

    • footerText: string

      text to be displayed in footer of embed

    • Optional opts: { icon?: string; proxyIconUrl?: string }
      • Optional icon?: string
      • Optional proxyIconUrl?: string

    Returns Embed

setImage

  • setImage(imageUrl: string, opts?: { height?: number; proxyUrl?: string; width?: number }): Embed
  • Parameters

    • imageUrl: string

      Url of the image, this can also be a file name

    • Optional opts: { height?: number; proxyUrl?: string; width?: number }
      • Optional height?: number
      • Optional proxyUrl?: string
      • Optional width?: number

    Returns Embed

setProvider

  • setProvider(name: string, url?: string): Embed

setThumbnail

  • setThumbnail(url: string, opts?: { height?: number; proxyUrl?: string; width?: number }): Embed
  • Parameters

    • url: string

      Url for thumbnail in embed

    • Optional opts: { height?: number; proxyUrl?: string; width?: number }

      Extra options for thumbnail.

      //without options
      embed.setThumbnail('https://cdn.discordapp.com/attachments/792884815631351869/.jpg')

      //with options
      embed.setThumbnail('https://cdn.discordapp.com/attachments/792884815631351869/.jpg', { height: 100, width:100 })
      • Optional height?: number
      • Optional proxyUrl?: string
      • Optional width?: number

    Returns Embed

setTimestamp

  • setTimestamp(time?: string | number | Date): Embed
  • Parameters

    • Optional time: string | number | Date

      The timestamp of the embed.

      embed.setTimestamp()
      

    Returns Embed

setTitle

  • setTitle(title: string): Embed

setUrl

  • setUrl(url: string): Embed

setVideo

  • setVideo(url: string, opts?: { height?: number; proxyUrl?: string; width?: number }): Embed
  • Parameters

    • url: string

      url for video in embed

    • Optional opts: { height?: number; proxyUrl?: string; width?: number }

      extra options


      embed.setVideo('https://tinyurl.com/icehacks')
      • Optional height?: number
      • Optional proxyUrl?: string
      • Optional width?: number

    Returns Embed