@sodacore/discord
Version:
Sodacore Discord is a plugin that offers Discord SSO/OAuth2 support and the ability to create bots in a similar controller pattern.
26 lines (25 loc) • 950 B
JavaScript
import { BasePlugin, Utils } from '@sodacore/core';
import { file } from 'bun';
import DiscordService from '../service/discord';
import SlashCommandsProvider from '../provider/slash-commands';
import PromptsHelper from '../provider/prompts';
const packageJson = file(Utils.resolve(import.meta.dirname, '../../package.json'));
if (!await packageJson.exists())
throw new Error('Package.json not found.');
const packageMeta = await packageJson.json();
export default class DiscordPlugin extends BasePlugin {
constructor(config = {}) {
super(config);
this.config = config;
this.name = packageMeta.name;
this.version = packageMeta.version;
this.description = packageMeta.description;
this.author = packageMeta.author;
this.setup();
}
async install(app) {
app.register(DiscordService);
app.register(SlashCommandsProvider);
app.register(PromptsHelper);
}
}