Skip to content

A Discord API Wrapper that works for both user and bot. Currently not all classes are implemented.

License

Notifications You must be signed in to change notification settings

learnedtim/discorator.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

discorator.js

The Discord API Wrapper that works for both bots and user accounts.

Warning

This library is still a work in progress. Only the following classes are implemented:

  • Event Listeners
  • Interactions
  • TextChannels
  • Messages (excluding special elements like Embeds or ActionRows)

Installing

npm

npm i discorator.js

Example

You can check the example files in the testing directory for more details, however the following shows how one would sign into Discord:

import { Client, IntentBits, TextChannel, generateNonce } from 'discorator.js'

(async function() {
    const client = await new Client({ 
        verbose: true, 
        userType: 'user',
        intents: [IntentBits.Guilds, IntentBits.Direct_Messages, IntentBits.Message_Content, IntentBits.Guild_Messages]
    });
    await client.loginByToken('token') // token login
    // await client.loginByCredentials({email: 'h@h.com', password: 'h', captchaToken: '2captcha-token'}) // credential login (todo: totp support)

    // send command to a channel
    let channel = await new TextChannel(client).fetch('channel_id') // create a new channel and initialize it
    let res = await channel.emitCommand('ping', 'id') // issue a command (name and application id), subcommand and args are under the 'options' argument, although they need to be manually constructed at the moment.
    
})();

Contribution

We're looking for contributors! Pull requests, Issues, and Documentation updates are all heavily encouraged. We're hoping to finish implementing all methods, classes and endpoints in a while.

About

A Discord API Wrapper that works for both user and bot. Currently not all classes are implemented.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published