2021-04-04 22:44:45 +05:00
|
|
|
import { EventEmitter } from 'events';
|
|
|
|
import { Client } from 'discord.js';
|
|
|
|
import { PlayerOptions } from './types/Player';
|
|
|
|
import Util from './Util';
|
2021-04-04 22:36:40 +05:00
|
|
|
|
|
|
|
export default class Player extends EventEmitter {
|
|
|
|
public client!: Client;
|
|
|
|
public options: PlayerOptions;
|
|
|
|
|
|
|
|
constructor(client: Client, options?: PlayerOptions) {
|
|
|
|
super();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The discord client that instantiated this player
|
|
|
|
*/
|
2021-04-04 22:44:45 +05:00
|
|
|
Object.defineProperty(this, 'client', {
|
2021-04-04 22:36:40 +05:00
|
|
|
value: client,
|
|
|
|
enumerable: false
|
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The player options
|
|
|
|
*/
|
|
|
|
this.options = Object.assign({}, Util.DefaultPlayerOptions, options ?? {});
|
|
|
|
|
|
|
|
// check FFmpeg
|
|
|
|
void Util.alertFFmpeg();
|
|
|
|
}
|
2021-04-04 22:44:45 +05:00
|
|
|
}
|