diff --git a/src/Player.ts b/src/Player.ts index 7a95a89..340bd3e 100644 --- a/src/Player.ts +++ b/src/Player.ts @@ -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) { diff --git a/src/utils/Util.ts b/src/utils/Util.ts index f1f4d21..a5ce8f3 100644 --- a/src/utils/Util.ts +++ b/src/utils/Util.ts @@ -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;