Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

discord-api-types

Package Overview
Dependencies
Maintainers
3
Versions
986
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discord-api-types

Discord API typings that are kept up to date for use in bot library creation.

  • 0.37.46
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
686K
increased by12.47%
Maintainers
3
Weekly downloads
 
Created

What is discord-api-types?

The discord-api-types npm package provides TypeScript type definitions for the Discord API. It helps developers ensure type safety and autocompletion when interacting with the Discord API, making it easier to build bots and other applications that integrate with Discord.

What are discord-api-types's main functionalities?

Type Definitions for Discord API

Provides type definitions for various Discord API objects, such as users, channels, guilds, etc. This ensures that the data structures used in your application match the expected format of the Discord API.

import { APIUser } from 'discord-api-types/v10';

const user: APIUser = {
  id: '1234567890',
  username: 'exampleUser',
  discriminator: '0001',
  avatar: null,
  bot: false,
  system: false,
  mfa_enabled: false,
  banner: null,
  accent_color: null,
  locale: 'en-US',
  verified: true,
  email: 'example@example.com',
  flags: 0,
  premium_type: 1,
  public_flags: 0
};

Enum Definitions

Includes enums for various constants used in the Discord API, such as channel types, message types, and more. This helps in avoiding magic strings and makes the code more readable and maintainable.

import { ChannelType } from 'discord-api-types/v10';

const channelType: ChannelType = ChannelType.GuildText;

API Interaction Types

Defines types for various interactions that can occur in Discord, such as commands, button clicks, and more. This helps in handling different types of interactions in a type-safe manner.

import { APIInteraction, InteractionType } from 'discord-api-types/v10';

const interaction: APIInteraction = {
  id: '1234567890',
  application_id: '0987654321',
  type: InteractionType.Ping,
  data: null,
  guild_id: '1122334455',
  channel_id: '5566778899',
  member: null,
  user: null,
  token: 'aW50ZXJhY3Rpb25fdG9rZW4=',
  version: 1
};

Other packages similar to discord-api-types

Keywords

FAQs

Package last updated on 19 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc