mirror of
https://github.com/BluemediaGER/muse.git
synced 2024-11-14 05:35:29 +01:00
55 lines
1.9 KiB
TypeScript
55 lines
1.9 KiB
TypeScript
|
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';
|
||
|
|
||
|
// Services
|
||
|
import Queue from './services/queue';
|
||
|
import Player from './services/player';
|
||
|
|
||
|
// Comands
|
||
|
import Command from './commands';
|
||
|
import Config from './commands/config';
|
||
|
import Play from './commands/play';
|
||
|
import QueueCommad from './commands/queue';
|
||
|
|
||
|
let container = new Container();
|
||
|
|
||
|
// Bot
|
||
|
container.bind<Bot>(TYPES.Bot).to(Bot).inSingletonScope();
|
||
|
container.bind<Client>(TYPES.Client).toConstantValue(new Client());
|
||
|
|
||
|
// Services
|
||
|
container.bind<Player>(TYPES.Services.Player).to(Player).inSingletonScope();
|
||
|
container.bind<Queue>(TYPES.Services.Queue).to(Queue).inSingletonScope();
|
||
|
|
||
|
// Commands
|
||
|
container.bind<Command>(TYPES.Command).to(Config).inSingletonScope();
|
||
|
container.bind<Command>(TYPES.Command).to(Play).inSingletonScope();
|
||
|
container.bind<Command>(TYPES.Command).to(QueueCommad).inSingletonScope();
|
||
|
|
||
|
// 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;
|