Skip to content
This repository has been archived by the owner on Apr 19, 2021. It is now read-only.
/ eris-typings Public archive

(merged into Eris) Unofficial typescript typings for abalabahaha/eris

License

Notifications You must be signed in to change notification settings

notaurieh/eris-typings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Eris-Typings

Unofficial typings for abalabahaha's eris.
Keep in mind these typings are handwritten, and very experimental. End goal is to merge with eris' repository.

Usage

You can install this library via typings CLI tool, or manually. Keep in mind some requirements:

  • Your project has to target ES6 or above
  • You must have @types/node installed alongside

Example

  • npm i -g typescript typings
  • mkdir eris-typescript-example && cd eris-typescript-example
  • typings init
  • npm init
  • tsc --init
  • npm i -S eris && npm --save-dev @types/node
  • typings install eris=github:aurieh/eris-typings --save --global
  • Change target in compilerOptions of tsconfig.json to es6 or above
  • Make a file called bot.ts
// bot.js
// most of type annotations are not needed in an actual project, this is just an example
import { Client, Message } from 'eris';

const client: Client = new Client('YOUR TOKEN HERE');

client.on('messageCreate', async (message: Message) => {
  if (message.author.bot) return;
  if (message.content.startsWith('ping')) {
    try {
      message.channel.createMessage('pong');
    } catch (e) {
      console.error(e);
    }
  }
});

client.on('ready', () => {
  console.log(`Ready as ${client.user.username}#${client.user.discriminator}`);
});

client.connect();

Contributing

  1. Clone the repo
  2. Implement your changes
  3. Make sure everything compiles (no linting has been set up yet)
  4. Create a pull request

About

(merged into Eris) Unofficial typescript typings for abalabahaha/eris

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages