2020-03-13 04:41:26 +01:00
|
|
|
import 'reflect-metadata';
|
|
|
|
import {Container} from 'inversify';
|
2021-09-20 04:04:34 +02:00
|
|
|
import {TYPES} from './types.js';
|
|
|
|
import Bot from './bot.js';
|
2021-11-12 20:30:18 +01:00
|
|
|
import {Client, Intents} from 'discord.js';
|
2021-09-20 04:04:34 +02:00
|
|
|
import ConfigProvider from './services/config.js';
|
2020-03-13 04:41:26 +01:00
|
|
|
|
2020-03-15 20:36:59 +01:00
|
|
|
// Managers
|
2021-09-20 04:04:34 +02:00
|
|
|
import PlayerManager from './managers/player.js';
|
2020-03-13 04:41:26 +01:00
|
|
|
|
2020-03-18 03:36:48 +01:00
|
|
|
// Helpers
|
2021-09-20 04:04:34 +02:00
|
|
|
import GetSongs from './services/get-songs.js';
|
|
|
|
import NaturalLanguage from './services/natural-language-commands.js';
|
2020-03-18 03:36:48 +01:00
|
|
|
|
2020-03-13 04:41:26 +01:00
|
|
|
// Comands
|
|
|
|
import Command from './commands';
|
2021-09-20 04:04:34 +02:00
|
|
|
import Clear from './commands/clear.js';
|
|
|
|
import Config from './commands/config.js';
|
|
|
|
import Disconnect from './commands/disconnect.js';
|
|
|
|
import ForwardSeek from './commands/fseek.js';
|
|
|
|
import Help from './commands/help.js';
|
|
|
|
import Pause from './commands/pause.js';
|
|
|
|
import Play from './commands/play.js';
|
2021-11-20 21:10:39 +01:00
|
|
|
import QueueCommand from './commands/queue.js';
|
|
|
|
import Remove from './commands/remove.js';
|
2021-09-20 04:04:34 +02:00
|
|
|
import Seek from './commands/seek.js';
|
|
|
|
import Shortcuts from './commands/shortcuts.js';
|
|
|
|
import Shuffle from './commands/shuffle.js';
|
|
|
|
import Skip from './commands/skip.js';
|
|
|
|
import Unskip from './commands/unskip.js';
|
|
|
|
import ThirdParty from './services/third-party.js';
|
2021-11-19 18:13:45 +01:00
|
|
|
import FileCacheProvider from './services/file-cache.js';
|
2021-11-19 02:55:57 +01:00
|
|
|
import KeyValueCacheProvider from './services/key-value-cache.js';
|
2020-03-13 04:41:26 +01:00
|
|
|
|
2021-09-20 04:24:46 +02:00
|
|
|
const container = new Container();
|
2020-03-13 04:41:26 +01:00
|
|
|
|
2021-11-12 20:30:18 +01:00
|
|
|
// Intents
|
|
|
|
const intents = new Intents();
|
|
|
|
intents.add(Intents.FLAGS.GUILDS); // To listen for guildCreate event
|
|
|
|
intents.add(Intents.FLAGS.GUILD_MESSAGES); // To listen for messages (messageCreate event)
|
|
|
|
intents.add(Intents.FLAGS.DIRECT_MESSAGE_REACTIONS); // To listen for message reactions (messageReactionAdd event)
|
2021-11-17 05:48:48 +01:00
|
|
|
intents.add(Intents.FLAGS.DIRECT_MESSAGES); // To receive the prefix message
|
2021-11-12 20:30:18 +01:00
|
|
|
intents.add(Intents.FLAGS.GUILD_VOICE_STATES); // To listen for voice state changes (voiceStateUpdate event)
|
|
|
|
|
2020-03-13 04:41:26 +01:00
|
|
|
// Bot
|
|
|
|
container.bind<Bot>(TYPES.Bot).to(Bot).inSingletonScope();
|
2021-11-12 20:30:18 +01:00
|
|
|
container.bind<Client>(TYPES.Client).toConstantValue(new Client({intents}));
|
2020-03-13 04:41:26 +01:00
|
|
|
|
2020-03-15 20:36:59 +01:00
|
|
|
// Managers
|
|
|
|
container.bind<PlayerManager>(TYPES.Managers.Player).to(PlayerManager).inSingletonScope();
|
2020-03-13 04:41:26 +01:00
|
|
|
|
2020-03-18 03:36:48 +01:00
|
|
|
// Helpers
|
|
|
|
container.bind<GetSongs>(TYPES.Services.GetSongs).to(GetSongs).inSingletonScope();
|
2020-03-18 23:15:45 +01:00
|
|
|
container.bind<NaturalLanguage>(TYPES.Services.NaturalLanguage).to(NaturalLanguage).inSingletonScope();
|
2020-03-18 03:36:48 +01:00
|
|
|
|
2020-03-13 04:41:26 +01:00
|
|
|
// Commands
|
2020-03-19 00:29:32 +01:00
|
|
|
[
|
|
|
|
Clear,
|
|
|
|
Config,
|
|
|
|
Disconnect,
|
|
|
|
ForwardSeek,
|
|
|
|
Help,
|
|
|
|
Pause,
|
|
|
|
Play,
|
2021-11-20 21:10:39 +01:00
|
|
|
QueueCommand,
|
|
|
|
Remove,
|
2020-03-19 00:29:32 +01:00
|
|
|
Seek,
|
|
|
|
Shortcuts,
|
|
|
|
Shuffle,
|
|
|
|
Skip,
|
2021-09-20 04:24:46 +02:00
|
|
|
Unskip,
|
2020-03-19 00:29:32 +01:00
|
|
|
].forEach(command => {
|
|
|
|
container.bind<Command>(TYPES.Command).to(command).inSingletonScope();
|
|
|
|
});
|
2020-03-13 04:41:26 +01:00
|
|
|
|
|
|
|
// Config values
|
2021-09-20 01:50:25 +02:00
|
|
|
container.bind(TYPES.Config).toConstantValue(new ConfigProvider());
|
2020-03-13 04:41:26 +01:00
|
|
|
|
|
|
|
// Static libraries
|
2021-09-20 01:50:25 +02:00
|
|
|
container.bind(TYPES.ThirdParty).to(ThirdParty);
|
2020-03-13 04:41:26 +01:00
|
|
|
|
2021-11-19 18:13:45 +01:00
|
|
|
container.bind(TYPES.FileCache).to(FileCacheProvider);
|
2021-11-19 02:55:57 +01:00
|
|
|
container.bind(TYPES.KeyValueCache).to(KeyValueCacheProvider);
|
2021-09-20 04:04:34 +02:00
|
|
|
|
2020-03-13 04:41:26 +01:00
|
|
|
export default container;
|