Class Client

Hierarchy

Constructors

Properties

cache: {
    forumThreads: TypedCollection<string | number, APIForumTopic, ForumThread, []>;
    guilds: TypedCollection<string | number, APIGuild, Guild, []>;
    members: TypedCollection<string | number, APIGuildMember, Member, [guildID: string]>;
    messages: TypedCollection<string | number, APIChatMessage, Message, [params?: {
        oldMessage?: object;
        originalMessageID?: null | string;
    }]>;
    users: TypedCollection<string | number, APIUser, User, []>;
}

Type declaration

calls: call
identifiers: {
    BotServerMembershipCreated: string;
    CalendarEventCreated: string;
    CalendarEventDeleted: string;
    CalendarEventRsvpDeleted: string;
    CalendarEventRsvpUpdated: string;
    CalendarEventUpdated: string;
    ChannelMessageReactionCreated: string;
    ChannelMessageReactionDeleted: string;
    ChatMessageCreated: string;
    ChatMessageDeleted: string;
    ChatMessageUpdated: string;
    DocCreated: string;
    DocDeleted: string;
    DocUpdated: string;
    ForumTopicCommentCreated: string;
    ForumTopicCommentDeleted: string;
    ForumTopicCommentUpdated: string;
    ForumTopicCreated: string;
    ForumTopicDeleted: string;
    ForumTopicLocked: string;
    ForumTopicPinned: string;
    ForumTopicReactionCreated: string;
    ForumTopicReactionDeleted: string;
    ForumTopicUnlocked: string;
    ForumTopicUnpinned: string;
    ForumTopicUpdated: string;
    ListItemCompleted: string;
    ListItemCreated: string;
    ListItemDeleted: string;
    ListItemUncompleted: string;
    ListItemUpdated: string;
    ServerChannelCreated: string;
    ServerChannelDeleted: string;
    ServerChannelUpdated: string;
    ServerMemberBanned: string;
    ServerMemberJoined: string;
    ServerMemberRemoved: string;
    ServerMemberUnbanned: string;
    ServerMemberUpdated: string;
    ServerRolesUpdated: string;
    ServerWebhookCreated: string;
    ServerWebhookUpdated: string;
}

Type declaration

  • BotServerMembershipCreated: string
  • CalendarEventCreated: string
  • CalendarEventDeleted: string
  • CalendarEventRsvpDeleted: string
  • CalendarEventRsvpUpdated: string
  • CalendarEventUpdated: string
  • ChannelMessageReactionCreated: string
  • ChannelMessageReactionDeleted: string
  • ChatMessageCreated: string
  • ChatMessageDeleted: string
  • ChatMessageUpdated: string
  • DocCreated: string
  • DocDeleted: string
  • DocUpdated: string
  • ForumTopicCommentCreated: string
  • ForumTopicCommentDeleted: string
  • ForumTopicCommentUpdated: string
  • ForumTopicCreated: string
  • ForumTopicDeleted: string
  • ForumTopicLocked: string
  • ForumTopicPinned: string
  • ForumTopicReactionCreated: string
  • ForumTopicReactionDeleted: string
  • ForumTopicUnlocked: string
  • ForumTopicUnpinned: string
  • ForumTopicUpdated: string
  • ListItemCompleted: string
  • ListItemCreated: string
  • ListItemDeleted: string
  • ListItemUncompleted: string
  • ListItemUpdated: string
  • ServerChannelCreated: string
  • ServerChannelDeleted: string
  • ServerChannelUpdated: string
  • ServerMemberBanned: string
  • ServerMemberJoined: string
  • ServerMemberRemoved: string
  • ServerMemberUnbanned: string
  • ServerMemberUpdated: string
  • ServerRolesUpdated: string
  • ServerWebhookCreated: string
  • ServerWebhookUpdated: string
params: {
    REST?: boolean;
    RESTOptions?: RESTOptions;
    token: string;
}

Type declaration

  • Optional REST?: boolean
  • Optional RESTOptions?: RESTOptions
  • token: string
user?: UserClient

Accessors

Methods

  • Add a member to a group

    Parameters

    • groupID: string

      ID of a guild group.

    • memberID: string

      ID of a member.

    Returns Promise<void>

  • Award a member using the built-in EXP system.

    Parameters

    • guildID: string

      ID of a guild.

    • memberID: string

      ID of a member.

    • amount: number

      Amount of experience.

    Returns Promise<number>

  • Award every members of a guild having a role using the built-in EXP system.

    Parameters

    • guildID: string

      ID of a guild.

    • roleID: number

      ID of a role.

    • amount: number

      Amount of experience.

    Returns Promise<void>

  • Mark a list item as completed.

    Parameters

    • channelID: string

      ID of a "Lists" channel.

    • itemID: string

      ID of a list item.

    Returns Promise<void>

  • Create an event into a "Calendar" channel.

    Parameters

    • channelID: string

      ID of a "Calendar" channel.

    • options: {
          color?: number;
          description?: string;
          duration?: number;
          isPrivate?: boolean;
          location?: string;
          name: string;
          rsvpLimit?: number;
          startsAt?: string;
          url?: string;
      }

      Event options.

      • Optional color?: number
      • Optional description?: string
      • Optional duration?: number
      • Optional isPrivate?: boolean
      • Optional location?: string
      • name: string
      • Optional rsvpLimit?: number
      • Optional startsAt?: string
      • Optional url?: string

    Returns Promise<CalendarEvent>

  • Create a channel in a specified guild.

    Parameters

    • guildID: string

      ID of a guild.

    • name: string

      Name of the new channel.

    • type: APIChannelCategories

      Type of the new channel. (e.g: chat)

    • Optional options: {
          categoryID?: number;
          groupID?: string;
          isPublic?: boolean;
          topic?: string;
      }

      New channel's additional options.

      • Optional categoryID?: number
      • Optional groupID?: string
      • Optional isPublic?: boolean
      • Optional topic?: string

    Returns Promise<Channel>

  • Create a doc in a "Docs" channel.

    Parameters

    • channelID: string

      ID pf a "Docs" channel.

    • options: {
          content: string;
          title: string;
      }

      Doc's options.

      • content: string
      • title: string

    Returns Promise<Doc>

  • Create a new item in a list channel.

    Parameters

    • channelID: string

      ID of a "Lists" channel.

    • content: string

      String content of the new item.

    • Optional note: {
          content: string;
      }

      Add a note to the new item.

      • content: string

        The note of the list item

    Returns Promise<ListItem>

  • Add a reaction to a specified message.

    Parameters

    • channelID: string

      ID of a "CHAT" channel.

    • messageID: string

      ID of the channel message.

    • reaction: number

      ID of the reaction.

    Returns Promise<void>

  • Create a topic in a specified forum channel.

    Parameters

    • channelID: string

      ID of a "Forums" channel.

    • options: {
          content: string;
          title: string;
      }

      Topic's options including title & content.

      • content: string
      • title: string

    Returns Promise<ForumThread>

  • Add a comment to a forum topic.

    Parameters

    • channelID: string

      ID of a "Forums" channel.

    • topicID: number

      ID of a topic.

    • options: {
          content: string;
      }

      Comment's options.

      • content: string

    Returns Promise<ForumThreadComment>

  • Add a reaction to a forum topic.

    Parameters

    • channelID: string

      ID of a "Forums" channel.

    • topicID: number

      ID of a topic.

    • emoteID: number

      ID of the emotoe you'd like to add.

    Returns Promise<void>

  • Create a webhook

    Parameters

    • guildID: string

      ID of a guild.

    • channelID: string

      ID of a channel.

    • name: string

      Name of the new webhook.

    Returns Promise<Webhook>

  • Delete an event from a "Calendar" channel.

    Parameters

    • channelID: string

      ID of a "Calendar" channel.

    • eventID: number

      ID of a calendar event.

    Returns Promise<void>

  • Delete a RSVP from a calendar event.

    Parameters

    • channelID: string

      ID of a "Calendar" channel.

    • eventID: number

      ID of a calendar event.

    • memberID: string

      ID of a member.

    Returns Promise<void>

  • Delete a doc from a "Docs" channel.

    Parameters

    • channelID: string

      ID of a "Docs" channel.

    • docID: number

      ID of a doc.

    Returns Promise<void>

  • Delete an item from a list channel.

    Parameters

    • channelID: string

      ID of a "Lists" channel.

    • itemID: string

      ID of a list item.

    Returns Promise<void>

  • Delete a specific message.

    Parameters

    • channelID: string

      ID of the channel containing the message.

    • messageID: string

      ID of the message you'd like to delete.

    Returns Promise<void>

  • Delete a topic from a specific forum channel

    Parameters

    • channelID: string

      ID of a "Forums" channel.

    • topicID: number

      ID of a topic.

    Returns Promise<void>

  • Delete a forum topic comment.

    Parameters

    • channelID: string

      ID of a "Forums" channel.

    • topicID: number

      ID of a topic.

    • commentID: number

      ID of a topic comment.

    Returns Promise<void>

  • Remove a reaction from a forum topic.

    Parameters

    • channelID: string

      ID of a "Forums" channel.

    • topicID: number

      ID of a topic.

    • emoteID: number

      ID of the emotoe you'd like to remove.

    Returns Promise<void>

  • Delete a webhook

    Parameters

    • guildID: string

      ID of a guild.

    • webhookID: string

      ID of an existent webhook.

    Returns Promise<void>

  • Disconnect from Guilded.

    Parameters

    • Optional crashOnDisconnect: boolean

      If set, throws an error to stop the process.

    Returns void

  • Edit an event from a "Calendar" channel.

    Parameters

    • channelID: string

      ID of a "Calendar" channel.

    • eventID: number

      ID of a calendar event.

    • options: {
          color?: number;
          description?: string;
          duration?: number;
          isPrivate?: boolean;
          location?: string;
          name?: string;
          rsvpLimit?: number;
          startsAt?: string;
          url?: string;
      }

      Edit options.

      • Optional color?: number
      • Optional description?: string
      • Optional duration?: number
      • Optional isPrivate?: boolean
      • Optional location?: string
      • Optional name?: string
      • Optional rsvpLimit?: number
      • Optional startsAt?: string
      • Optional url?: string

    Returns Promise<CalendarEvent>

  • Edit a doc from a "Docs" channel.

    Parameters

    • channelID: string

      ID of a "Docs" channel.

    • docID: number

      ID of a doc.

    • options: {
          content: string;
          title: string;
      }

      Edit options.

      • content: string
      • title: string

    Returns Promise<Doc>

  • Edit an item from a list channel.

    Parameters

    • channelID: string

      ID of a "Lists" channel.

    • itemID: string

      ID of a list item.

    • content: string

      New item's content.

    • Optional note: {
          content: string;
      }

      Add a note to the item.

      • content: string

        The note of the list item

    Returns Promise<ListItem>

  • Edit a specific message coming from a specified channel.

    Parameters

    • channelID: string

      The ID of the channel.

    • messageID: string

      The ID of the message you'd like to edit.

    • newMessage: object

      object containing new message's options.

    Returns Promise<Message>

  • Edit a topic from a specified forum channel.

    Parameters

    • channelID: string

      ID of a "Forums" channel.

    • topicID: number

      ID of a topic.

    • options: {
          content?: string;
          title?: string;
      }

      Edit options.

      • Optional content?: string
      • Optional title?: string

    Returns Promise<ForumThread>

  • Edit a forum topic's comment.

    Parameters

    • channelID: string

      ID of a "Forums" channel.

    • topicID: number

      ID of a topic.

    • commentID: number

      ID of a topic comment.

    • Optional options: {
          content?: string;
      }

      Edit options.

      • Optional content?: string

    Returns Promise<ForumThreadComment>

  • Returns an array listing the events for which the emitter has registered listeners. The values in the array are strings or Symbols.

    const EventEmitter = require('events');
    const myEE = new EventEmitter();
    myEE.on('foo', () => {});
    myEE.on('bar', () => {});

    const sym = Symbol('symbol');
    myEE.on(sym, () => {});

    console.log(myEE.eventNames());
    // Prints: [ 'foo', 'bar', Symbol(symbol) ]

    Since

    v6.0.0

    Returns (string | symbol)[]

  • This method is used to get a specific calendar event.

    Note: this method requires a "Calendar" channel.

    Parameters

    • channelID: string

      ID of a Calendar channel.

    • eventID: number

      ID of a Calendar event.

    Returns Promise<CalendarEvent>

  • This method is used to get a list of CalendarEvent

    Parameters

    • channelID: string

      ID of a "Calendar" channel.

    • Optional filter: {
          after?: string;
          before?: string;
          limit?: number;
      }

      Object to filter the output.

      • Optional after?: string
      • Optional before?: string
      • Optional limit?: number

    Returns Promise<CalendarEvent[]>

  • This method is used to get a specific CalendarEventRSVP.

    Note: this method requires a Calendar channel.

    Parameters

    • channelID: string

      ID of a Calendar channel

    • eventID: number

      ID of a Calendar Event

    • memberID: string

      ID of a Guild Member

    Returns Promise<CalendarEventRSVP>

  • This method is used to get a list of CalendarEventRSVP.

    Parameters

    • channelID: string

      ID of a "Calendar" channel.

    • eventID: number

      ID of a calendar event.

    Returns Promise<CalendarEventRSVP[]>

  • This method is used to get a specific guild channel.

    Note: You do not need a guildID to get a channel, only the channelID is needed.

    Parameters

    • channelID: string

      The ID of the channel you'd like to get.

    Returns Promise<Channel>

  • This method is used to get a specific channel message

    Parameters

    • channelID: string

      ID of the channel containing the message.

    • messageID: string

      ID of the message you'd like to get.

    Returns Promise<Message>

  • This method is used to get a list of Message

    Parameters

    • channelID: string

      ID of a "Chat" channel.

    • Optional filter: {
          after?: string;
          before?: string;
          includePrivate?: boolean;
          limit?: number;
      }

      Object to filter the output.

      • Optional after?: string
      • Optional before?: string
      • Optional includePrivate?: boolean
      • Optional limit?: number

    Returns Promise<Message[]>

  • This method is used to get a channel doc.

    Note: This method requires a "Docs" channel.

    Parameters

    • channelID: string

      ID of the Docs channel.

    • docID: number

      ID of the channel doc.

    Returns Promise<Doc>

  • This method is used to get a list of "Channel" Doc.

    Parameters

    • channelID: string

      ID of a "Docs" channel.

    • Optional filter: {
          before?: string;
          limit?: number;
      }

      Object to filter the output.

      • Optional before?: string
      • Optional limit?: number

    Returns Promise<Doc[]>

  • This method is used to get a specific forum topic.

    Note: This method requires a "Forum" channel.

    Parameters

    • channelID: string

      ID of a speific Forum channel.

    • topicID: number

      ID of the specific Forum Topic.

    Returns Promise<ForumThread>

  • This method is used to get a specific Guild.

    Note: Guild = Server

    Parameters

    • guildID: string

      The ID of the guild you'd like to get.

    Returns Promise<Guild>

  • This method is used to get a specific list item.

    Parameters

    • channelID: string

      ID of a "List" channel.

    • itemID: string

      ID of a list item.

    Returns Promise<ListItem>

  • This method is used to get a list of ListItem.

    Parameters

    • channelID: string

      ID of a "List" channel.

    Returns Promise<ListItem[]>

  • Returns the current max listener value for the EventEmitter which is either set by emitter.setMaxListeners(n) or defaults to defaultMaxListeners.

    Since

    v1.0.0

    Returns number

  • This method is used to get a specific guild member.

    Parameters

    • guildID: string

      The ID of the Guild.

    • memberID: string

      The ID of the Guild Member you'd like to get.

    Returns Promise<Member>

  • This method is used to get a list of ForumTopic.

    Parameters

    • channelID: string

      ID of a "Forum" channel.

    • Optional filter: {
          before?: string;
          limit?: number;
      }

      Object to filter the output.

      • Optional before?: string
      • Optional limit?: number

    Returns Promise<ForumThread[]>

  • This method is used to get a specific topic comment.

    Parameters

    • channelID: string

      ID of a "Forums" channel.

    • topicID: number

      ID of a Forum topic.

    • commentID: number

      ID of a Forum topic comment.

    Returns Promise<ForumThreadComment>

  • This method is used to get a specific webhook.

    Parameters

    • guildID: string

      ID of a guild.

    • webhookID: string

      ID of a webhook.

    Returns Promise<Webhook>

  • This method is used to get a list of Webhook.

    Parameters

    • guildID: string

      ID of a guild.

    • channelID: string

      ID of a channel.

    Returns Promise<Webhook[]>

  • Lock a forum topic.

    Parameters

    • channelID: string

      ID of a "Forums" channel.

    • topicID: number

      ID of a topic.

    Returns Promise<void>

  • Add a role to a member

    Parameters

    • guildID: string

      ID of a guild.

    • memberID: string

      ID of a member.

    • roleID: number

      ID of a role.

    Returns Promise<void>

  • Remove a role from a member

    Parameters

    • guildID: string

      ID of a guild.

    • memberID: string

      ID of a member.

    • roleID: number

      ID of a role.

    Returns Promise<void>

  • Pin a forum topic.

    Parameters

    • channelID: string

      ID of a "Forums" channel.

    • topicID: number

      ID of a topic.

    Returns Promise<void>

  • Remove a member from a group

    Parameters

    • groupID: string

      ID of a guild group.

    • memberID: string

      ID of a member.

    Returns Promise<void>

  • Remove a reaction from a message.

    Parameters

    • channelID: string

      ID of a "CHAT" channel.

    • messageID: string

      ID of the channel message.

    • reaction: number

      ID of the reaction.

    Returns Promise<void>

  • By default EventEmitters will print a warning if more than 10 listeners are added for a particular event. This is a useful default that helps finding memory leaks. The emitter.setMaxListeners() method allows the limit to be modified for this specific EventEmitter instance. The value can be set toInfinity (or 0) to indicate an unlimited number of listeners.

    Returns a reference to the EventEmitter, so that calls can be chained.

    Since

    v0.3.5

    Parameters

    • n: number

    Returns Client

  • Set a member's xp using the built-in EXP system.

    Parameters

    • guildID: string

      ID of a guild.

    • memberID: string

      ID of a member.

    • amount: number

      Total amount of experience.

    Returns Promise<number>

  • Mark a list item as uncompleted.

    Parameters

    • channelID: string

      ID of a "Lists" channel.

    • itemID: string

      ID of a list item.

    Returns Promise<void>

  • Unlock a forum topic.

    Parameters

    • channelID: string

      ID of a "Forums" channel.

    • topicID: number

      ID of a topic.

    Returns Promise<void>

  • Unpin a forum topic.

    Parameters

    • channelID: string

      ID of a "Forums" channel.

    • topicID: number

      ID of a topic.

    Returns Promise<void>