check repl.it

This commit is contained in:
Snowflake107 2021-04-07 20:10:45 +05:45
parent 610edb9755
commit 647535b5de
2 changed files with 23 additions and 1 deletions

View file

@ -602,7 +602,11 @@ export class Player extends EventEmitter {
queue.stream = newStream;
queue.voiceConnection.play(newStream, {
type: 'opus',
bitrate: 'auto'
bitrate: 'auto',
// disable inline volume for replit.com, leave it as it is for other platforms
// thx Amish Shah for this info :D
volume: Util.isRepl() ? false : undefined
});
if (seekTime) {

View file

@ -127,6 +127,24 @@ export class Util {
.catch(() => resolve([]));
});
}
static isRepl() {
if ('DP_REPL_NOCHECK' in process.env) return false;
const REPL_IT_PROPS = [
'REPL_SLUG',
'REPL_OWNER',
'REPL_IMAGE',
'REPL_PUBKEYS',
'REPL_ID',
'REPL_LANGUAGE',
'REPLIT_DB_URL'
];
for (const prop of REPL_IT_PROPS) if (prop in process.env) return true;
return false;
}
}
export default Util;