Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jakehamilton/leverage-plugin-discord
🎙 A Discord plugin for Leverage
https://github.com/jakehamilton/leverage-plugin-discord
discord leverage node
Last synced: about 5 hours ago
JSON representation
🎙 A Discord plugin for Leverage
- Host: GitHub
- URL: https://github.com/jakehamilton/leverage-plugin-discord
- Owner: jakehamilton
- License: mit
- Created: 2017-07-04T20:58:58.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-20T05:11:17.000Z (over 5 years ago)
- Last Synced: 2024-09-18T17:39:41.313Z (about 2 months ago)
- Topics: discord, leverage, node
- Language: TypeScript
- Homepage:
- Size: 85.9 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Discord for [Leverage](http://github.com/jakehamilton/leverage)!
This is a plugin for Leverage that handles the `discord` type of components.
## Discord Component
A Discord Component has the following interface:
```typescript
import { ComponentConfig, ComponentUnit } from '@leverage/core';export interface DiscordConfig extends ComponentConfig {
discord?: {
event?: string; // A `Discord.js` event name (defaults to 'message')
command?: string; // A prefix to listen for on "message" events (defaults to '')
};
}export interface DiscordComponent extends ComponentUnit {
config: DiscordConfig;// The `payload` is a `Discord.js` object related to the event your component is listening to
discord: (payload: any) => void;
}
```## Example
```js
import { manager } from '@leverage/core';
import { Discord, DiscordComponent } from '@leverage/plugin-discord';const discord = new Discord();
const component: DiscordComponent = {
is: 'component',
type: 'discord',
discord ({ channel }) {
// Respond to all messages with "Hello, World!"
channel.send('Hello, World!');
},
};manager.add(discord, component);
discord.login('');
```## Questions
Have a question? Feel free to [file an issue](https://github.com/jakehamilton/leverage-plugin-discord/issues/new)!