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';
|
|
|
|
import YouTube from 'youtube.ts';
|
|
|
|
import Spotify from 'spotify-web-api-node';
|
|
|
|
import {
|
|
|
|
DISCORD_TOKEN,
|
|
|
|
DISCORD_CLIENT_ID,
|
|
|
|
YOUTUBE_API_KEY,
|
|
|
|
SPOTIFY_CLIENT_ID,
|
|
|
|
SPOTIFY_CLIENT_SECRET,
|
|
|
|
DATA_DIR,
|
|
|
|
CACHE_DIR
|
|
|
|
} from './utils/config';
|
|
|
|
|
2020-03-15 20:36:59 +01:00
|
|
|
// Managers
|
|
|
|
import PlayerManager from './managers/player';
|
|
|
|
import QueueManager from './managers/queue';
|
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-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-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';
|
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());
|
|
|
|
|
2020-03-15 20:36:59 +01:00
|
|
|
// Managers
|
|
|
|
container.bind<PlayerManager>(TYPES.Managers.Player).to(PlayerManager).inSingletonScope();
|
|
|
|
container.bind<QueueManager>(TYPES.Managers.Queue).to(QueueManager).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-13 04:41:26 +01:00
|
|
|
// Commands
|
2020-03-15 04:03:31 +01:00
|
|
|
container.bind<Command>(TYPES.Command).to(Clear).inSingletonScope();
|
2020-03-13 04:41:26 +01:00
|
|
|
container.bind<Command>(TYPES.Command).to(Config).inSingletonScope();
|
2020-03-15 21:35:34 +01:00
|
|
|
container.bind<Command>(TYPES.Command).to(ForwardSeek).inSingletonScope();
|
2020-03-17 04:12:02 +01:00
|
|
|
container.bind<Command>(TYPES.Command).to(Help).inSingletonScope();
|
2020-03-16 01:30:07 +01:00
|
|
|
container.bind<Command>(TYPES.Command).to(Pause).inSingletonScope();
|
2020-03-13 04:41:26 +01:00
|
|
|
container.bind<Command>(TYPES.Command).to(Play).inSingletonScope();
|
|
|
|
container.bind<Command>(TYPES.Command).to(QueueCommad).inSingletonScope();
|
2020-03-14 02:36:42 +01:00
|
|
|
container.bind<Command>(TYPES.Command).to(Seek).inSingletonScope();
|
2020-03-17 01:37:54 +01:00
|
|
|
container.bind<Command>(TYPES.Command).to(Shortcuts).inSingletonScope();
|
2020-03-14 18:41:00 +01:00
|
|
|
container.bind<Command>(TYPES.Command).to(Shuffle).inSingletonScope();
|
2020-03-15 22:55:44 +01:00
|
|
|
container.bind<Command>(TYPES.Command).to(Skip).inSingletonScope();
|
|
|
|
container.bind<Command>(TYPES.Command).to(Unskip).inSingletonScope();
|
2020-03-13 04:41:26 +01:00
|
|
|
|
|
|
|
// Config values
|
|
|
|
container.bind<string>(TYPES.Config.DISCORD_TOKEN).toConstantValue(DISCORD_TOKEN);
|
|
|
|
container.bind<string>(TYPES.Config.DISCORD_CLIENT_ID).toConstantValue(DISCORD_CLIENT_ID);
|
|
|
|
container.bind<string>(TYPES.Config.YOUTUBE_API_KEY).toConstantValue(YOUTUBE_API_KEY);
|
|
|
|
container.bind<string>(TYPES.Config.DATA_DIR).toConstantValue(DATA_DIR);
|
|
|
|
container.bind<string>(TYPES.Config.CACHE_DIR).toConstantValue(CACHE_DIR);
|
|
|
|
|
|
|
|
// Static libraries
|
|
|
|
container.bind<YouTube>(TYPES.Lib.YouTube).toConstantValue(new YouTube(YOUTUBE_API_KEY));
|
|
|
|
container.bind<Spotify>(TYPES.Lib.Spotify).toConstantValue(new Spotify({clientId: SPOTIFY_CLIENT_ID, clientSecret: SPOTIFY_CLIENT_SECRET}));
|
|
|
|
|
|
|
|
export default container;
|