mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 22:15:29 +00:00
fix: Add check on startup to see if ffmpeg is available
This commit is contained in:
1 parent
ee5451320e
commit
0b72e92693
1 file changed
+17
@@ -5,6 +5,7 @@ import 'dotenv/config';
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
import { Client, Shard, ShardEvents, ShardingManager, ShardingManagerOptions } from 'discord.js';
|
import { Client, Shard, ShardEvents, ShardingManager, ShardingManagerOptions } from 'discord.js';
|
||||||
import { randomUUID as uuidv4 } from 'node:crypto';
|
import { randomUUID as uuidv4 } from 'node:crypto';
|
||||||
|
import { exec } from 'child_process';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from './services/logger';
|
import loggerModule from './services/logger';
|
||||||
const shardingOptions: ShardingManagerOptions = config.get('shardingOptions');
|
const shardingOptions: ShardingManagerOptions = config.get('shardingOptions');
|
||||||
@@ -54,4 +55,20 @@ manager.on('shardCreate', (shard: Shard) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
exec('ffmpeg -version', (error) => {
|
||||||
|
if (error) {
|
||||||
|
const logger: Logger = loggerModule.child({
|
||||||
|
module: 'shardingManager',
|
||||||
|
name: 'shardingManager',
|
||||||
|
shardId: 'manager'
|
||||||
|
});
|
||||||
|
|
||||||
|
logger.error('FFmpeg is not installed or available on your system.');
|
||||||
|
logger.error('Install FFmpeg (https://ffmpeg.org/download.html) and try again.');
|
||||||
|
logger.error('If you are using Windows, make sure to add FFmpeg to your PATH.');
|
||||||
|
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
manager.spawn();
|
manager.spawn();
|
||||||
Reference in new issue
Block a user