Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/opl-/discord-raw
https://github.com/opl-/discord-raw
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/opl-/discord-raw
- Owner: opl-
- Created: 2016-11-06T18:57:06.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2022-03-26T02:30:22.000Z (almost 3 years ago)
- Last Synced: 2024-11-16T12:33:01.433Z (2 months ago)
- Language: JavaScript
- Size: 13.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## About
Discord Raw is a small library written specifically for anyone who only wants to listen to Discord events. It's main task is to take connecting to the Discord gateway off your shoulders, so that you can focus on processing the data instead. The library also comes with session resuming capabilities, which means that you don't have to lose any data.This library runs only on node.js v6 and newer.
## Installation
`npm install discord-raw --save`That's it! Now you can use it in your project.
## Examples
```javascript
const DiscordRaw = require('discord-raw');var bot = new DiscordRaw({
token: 'xxx',
shard: [0, 1]
});bot.on(DiscordRaw.EVENT_EVENT, event => {
// Process the data however you want toif (event.t === 'MESSAGE_CREATE') {
console.log(`#${event.d.channel_id} ${event.d.author.username}: ${event.d.content}`);
}
});
```