1.2.0 • Published 2 years ago

@cordis/gateway v1.2.0

Weekly downloads
90
License
-
Repository
github
Last release
2 years ago

@cordis/gateway

GitHub npm TypeScript

The cordis WS client for Discord's API.

Installation

  • npm install @cordis/gateway
  • pnpm install @cordis/gateway
  • yarn add @cordis/gateway

Example Usage

const { Cluster } = require('@cordis/gateway');

const main = async () => {
  const manager = new Cluster('token');

  manager
    .on('ready', () => console.log('Hello world!'))
    .on('dispatch', ({ t, d }) => {
      switch (t) {
        case 'MESSAGE_CREATE': {
          if (d.content === '!ping') console.log('pong!');
          break;
        }

        default: break;
      }
    });

  await manager.connect();
};

main();

Documentation

You can find documentation for the whole project over at https://cordis.js.org

Contributing

Please see the main README.md for info on how to contribute to this package or the other @cordis packages.

LICENSE

Licensed under the Apache 2.0 license.