Options
All
  • Public
  • Public/Protected
  • All
Menu

Client utils

Hierarchy

  • CosmosUtils

Index

Constructors

Properties

client: CosmosClient

Accessors

  • get boundary(): string
  • get versions(): { cosmos: string; revolt: undefined | string; revolt.js: string }
  • Get the versions for cosmos, revolt API and revolt.js

    Returns { cosmos: string; revolt: undefined | string; revolt.js: string }

    • cosmos: string
    • revolt: undefined | string
    • revolt.js: string

Methods

  • appendFormData(name: string, data: any, fileName: string): undefined | Buffer[]
  • For the multipart/form-data purposes

    Parameters

    • name: string
    • data: any
    • fileName: string

    Returns undefined | Buffer[]

  • escapeBlockQuotes(message: string): { count: number; message: string }
  • Remove block quotes from a message

    Parameters

    • message: string

      the string

    Returns { count: number; message: string }

    an object where count represents total block quotes removed & message represents original string without block quotes

    • count: number
    • message: string
  • escapeSpoilers(message: string): string | { count: number; message: string }
  • Remove the spoiler tags from a string

    Parameters

    • message: string

      the string

    Returns string | { count: number; message: string }

    an object where count represents total spoiler tags ("!!" is counted as 1) removed & message represents original string without spoiler tags

  • getEmbeddedLink(message: string): string[]
  • Get the link embedded inside a message

    Parameters

    • message: string

      the string

    Returns string[]

    array of embedded links

  • getUserBadge(user: User): ("Developer" | "Translator" | "Supporter" | "Responsible Disclosure" | "Founder" | "Platform Moderation" | "Active Supporter" | "Paw" | "Early Adopter" | "Reserved Relevant Joke Badge 1")[]
  • Get the badges of a user

    Parameters

    • user: User

      the user object

    Returns ("Developer" | "Translator" | "Supporter" | "Responsible Disclosure" | "Founder" | "Platform Moderation" | "Active Supporter" | "Paw" | "Early Adopter" | "Reserved Relevant Joke Badge 1")[]

    an array of badges

  • imgToURL(id: string, type?: AttachmentTag, size: number): string
  • Get the Autumn URL of a file

    Parameters

    • id: string

      the attachment ID

    • type: AttachmentTag = "attachments"

      the file type, either "attachhments", "avatars", "backgrounds", "icons" or "banners"

    • size: number

      The file size, max 20000000 for attachments

    Returns string

    the Autumn URL

  • purgeMessages(channel: Channel, amount: number): Promise<PromiseSettledResult<undefined>[]>
  • Purge messages in a channel

    Parameters

    • channel: Channel

      the channel object

    • amount: number

      amount of messages to delete, max 100

    Returns Promise<PromiseSettledResult<undefined>[]>

    an array of results when all the provided Promises resolve or reject

  • uploadFile(file: { file: Buffer; name: string }, type?: AttachmentTag): Promise<string>
  • Upload a file to Autumn

    Parameters

    • file: { file: Buffer; name: string }

      the file name and buffer

      • file: Buffer
      • name: string
    • type: AttachmentTag = "attachments"

      the file type, either "attachhments", "avatars", "backgrounds", "icons" or "banners"

    Returns Promise<string>

    the attachment ID

Generated using TypeDoc