🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

distype

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

distype

A Discord library written in TypeScript for developers looking to interface directly with the Discord API with little to no abstractions.

2.0.0
latest
Source
npm
Version published
Maintainers
1
Created
Source



About

A Discord library written in TypeScript for developers looking to interface directly with the Discord API with little to no abstractions.

Features

  • Lightweight: Distype uses minimal dependencies, and is highly performant due to the absence of transforming raw data from Discord into complex structures and abstractions.
  • Scalable: With a built-in sharding manager (that supports big bot sharding) and a focus on performance, Distype makes it easy to scale your bot.
  • Predictable: Distype is as close as you can get to the Discord API, meaning that typically, what you see in Discord's documentation is also here.
  • Modular: The cache manager, gateway manager, and rest manager can all be instantiated independently, allowing for super lightweight solutions.
  • Fully Featured: Distype covers 100% of the Discord API, meaning that you'll never be missing out on any features.
  • Highly Configurable: Distype aims to offer as much configuration as possible of its internals, such as fully controllable cache behavior, retry and rate limit behavior, custom rest and gateway base URLs for proxy solutions, access to low-level http and websocket options, and more.

Example Bot

// Import Distype and logging typings.
import { Client, LogCallback } from 'distype';

// Distype pushes logging events through callbacks, and allows you to define your own logger.
const logger: LogCallback = (message, { level }) => console.log(`${level} | ${message}`);

// Creates the client. The client creates a cache, gateway, and rest manager. The first parameter is your
// bot's token, followed by client options, then finally the log callback.
const client = new Client(YOUR_BOT_TOKEN, {}, logger);

// This connects the client to the gateway.
client.gateway.connect();

Note that Discord API typings are for API version 10, and are from discord-api-types. While you can still specify different API versions to be used, it is not recommended.

Installation

Distype can be installed via npm.

npm install distype

Prerequisites

Optional packages

Keywords

api

FAQs

Package last updated on 02 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