mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-03 22:15:37 +00:00
feat: rename .js files to .ts
This commit is contained in:
1 parent
40bf9d926b
commit
92b1992b1a
54 files changed
No files matched your search
@@ -0,0 +1,47 @@
|
||||
const config = require('config');
|
||||
const loadTestOptions = config.get('loadTestOptions');
|
||||
|
||||
exports.startLoadTest = async ({ client, executionId }) => {
|
||||
const logger = require('../../services/logger').child({
|
||||
source: 'startLoadTest.js',
|
||||
module: 'utilOther',
|
||||
name: 'startLoadTest',
|
||||
executionId: executionId,
|
||||
shardId: client.shard.ids[0]
|
||||
});
|
||||
|
||||
if (!loadTestOptions.enabled) {
|
||||
logger.debug('Load test is disabled in options, cancelling.');
|
||||
return;
|
||||
}
|
||||
|
||||
const channelIds = loadTestOptions.channelIdsToJoin;
|
||||
const track = loadTestOptions.trackUrl;
|
||||
|
||||
logger.info(`Starting load test in ${channelIds.length} specified channels.`);
|
||||
|
||||
channelIds.forEach((each) => {
|
||||
client.shard.broadcastEval(
|
||||
async (shardClient, { channelId, track }) => {
|
||||
const channel = shardClient.channels.cache.get(channelId);
|
||||
if (channel) {
|
||||
/* eslint-disable no-undef */
|
||||
await player.play(channel.id, track, {
|
||||
nodeOptions: {
|
||||
leaveOnEmpty: false,
|
||||
leaveOnEnd: false,
|
||||
leaveOnStop: false,
|
||||
metadata: {
|
||||
channel: channel,
|
||||
client: shardClient
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
{ context: { channelId: each, track: track } }
|
||||
);
|
||||
});
|
||||
|
||||
logger.info('Load test started across shards in specified channels.');
|
||||
};
|
||||
Reference in new issue
Block a user