muse/src/inversify.config.ts

71 lines
1.9 KiB
TypeScript
Raw Normal View History

2020-03-13 04:41:26 +01:00
import 'reflect-metadata';
import {Container} from 'inversify';
import {TYPES} from './types';
import Bot from './bot';
import {Client} from 'discord.js';
2021-09-20 01:50:25 +02:00
import ConfigProvider from './services/config';
2020-03-13 04:41:26 +01:00
// Managers
import PlayerManager from './managers/player';
2020-03-13 04:41:26 +01:00
2020-03-18 03:36:48 +01:00
// Helpers
import GetSongs from './services/get-songs';
2020-03-18 23:15:45 +01:00
import NaturalLanguage from './services/natural-language-commands';
2020-03-18 03:36:48 +01:00
2020-03-13 04:41:26 +01:00
// Comands
import Command from './commands';
2020-03-15 04:03:31 +01:00
import Clear from './commands/clear';
2020-03-13 04:41:26 +01:00
import Config from './commands/config';
2020-03-19 00:29:32 +01:00
import Disconnect from './commands/disconnect';
2020-03-15 21:35:34 +01:00
import ForwardSeek from './commands/fseek';
2020-03-17 04:12:02 +01:00
import Help from './commands/help';
2020-03-16 01:30:07 +01:00
import Pause from './commands/pause';
2020-03-13 04:41:26 +01:00
import Play from './commands/play';
import QueueCommad from './commands/queue';
2020-03-14 02:36:42 +01:00
import Seek from './commands/seek';
2020-03-17 01:37:54 +01:00
import Shortcuts from './commands/shortcuts';
2020-03-14 18:41:00 +01:00
import Shuffle from './commands/shuffle';
2020-03-15 22:55:44 +01:00
import Skip from './commands/skip';
import Unskip from './commands/unskip';
2021-09-20 01:50:25 +02:00
import ThirdParty from './services/third-party';
2020-03-13 04:41:26 +01:00
let container = new Container();
// Bot
container.bind<Bot>(TYPES.Bot).to(Bot).inSingletonScope();
container.bind<Client>(TYPES.Client).toConstantValue(new Client());
// 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,
QueueCommad,
Seek,
Shortcuts,
Shuffle,
Skip,
Unskip
].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
export default container;