Unofficial typings for abalabahaha's eris.
Keep in mind these typings are handwritten, and very experimental. End goal is to merge with eris' repository.
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
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
incompilerOptions
oftsconfig.json
toes6
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();
- Clone the repo
- Implement your changes
- Make sure everything compiles (no linting has been set up yet)
- Create a pull request