Skip to content

Commit

Permalink
Removed console.logs for final release
Browse files Browse the repository at this point in the history
- Removed console.logs for final release
  • Loading branch information
Vexify4103 committed Oct 26, 2024
1 parent 67ad3e6 commit 626ed65
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
11 changes: 0 additions & 11 deletions src/structures/Manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export class Manager extends EventEmitter {

if (!fs.existsSync(playerStatesDir)) {
fs.mkdirSync(playerStatesDir, { recursive: true });
console.log(`Created directory at ${playerStatesDir}`);
}

const playerFiles = fs.readdirSync(playerStatesDir);
Expand All @@ -91,7 +90,6 @@ export class Manager extends EventEmitter {
const filePath = path.join(playerStatesDir, file);

if (!fs.existsSync(filePath)) {
console.warn(`File not found: ${filePath}. Skipping...`);
continue;
}

Expand All @@ -118,7 +116,6 @@ export class Manager extends EventEmitter {
try {
player.connect();
} catch (error) {
console.log(error);
continue;
}
}
Expand Down Expand Up @@ -176,11 +173,8 @@ export class Manager extends EventEmitter {
if (state.isAutoplay) {
player.setAutoplay(state.isAutoplay, state.data.Internal_BotUser);
}
console.log(`Loaded player state for ${state.options.guild}.`);
}
}

console.log("Finished loading player states from player files.");
}

/** Gets each player's JSON file */
Expand All @@ -189,7 +183,6 @@ export class Manager extends EventEmitter {
const configDir = path.dirname(playerStateFilePath);
if (!fs.existsSync(configDir)) {
fs.mkdirSync(configDir, { recursive: true });
console.log(`Created directory at: ${configDir}`);
}
return playerStateFilePath;
}
Expand All @@ -202,8 +195,6 @@ export class Manager extends EventEmitter {
if (!player || player.state === "DISCONNECTED" || !player.voiceChannel) return this.cleanupInactivePlayers();
const serializedPlayer = this.serializePlayer(player) as unknown as Player;
fs.writeFileSync(playerStateFilePath, JSON.stringify(serializedPlayer, null, 2), "utf-8");

console.log(`Saved ${guildId} player state to: ${playerStateFilePath}`);
}

/** Serializes a Player instance to avoid circular references. */
Expand Down Expand Up @@ -246,7 +237,6 @@ export class Manager extends EventEmitter {
// Create the directory if it does not exist
if (!fs.existsSync(playerStatesDir)) {
fs.mkdirSync(playerStatesDir, { recursive: true });
console.log(`Created directory at ${playerStatesDir}`);
}

const playerFiles = fs.readdirSync(playerStatesDir);
Expand All @@ -259,7 +249,6 @@ export class Manager extends EventEmitter {
if (!activeGuildIds.has(guildId)) {
const filePath = path.join(playerStatesDir, file);
fs.unlinkSync(filePath);
console.log(`Deleted inactive player state file: ${filePath}`);
}
}
}
Expand Down
7 changes: 0 additions & 7 deletions src/structures/Node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ let sessionIdsMap: Map<string, string> = new Map();
const configDir = path.dirname(sessionIdsFilePath);
if (!fs.existsSync(configDir)) {
fs.mkdirSync(configDir, { recursive: true });
console.log(`Created directory at ${configDir}`);
}

export class Node {
Expand Down Expand Up @@ -131,7 +130,6 @@ export class Node {
public createSessionIdsFile(): void {
if (!fs.existsSync(sessionIdsFilePath)) {
fs.writeFileSync(sessionIdsFilePath, JSON.stringify({}), "utf-8");
console.log(`Created sessionIds.json at ${sessionIdsFilePath}`);
}
}

Expand All @@ -140,15 +138,13 @@ export class Node {
if (fs.existsSync(sessionIdsFilePath)) {
const sessionIdsData = fs.readFileSync(sessionIdsFilePath, "utf-8");
sessionIdsMap = new Map(Object.entries(JSON.parse(sessionIdsData)));
console.log(`Loaded session IDs from JSON file`);
}
}

/** Updates the session ID in the sessionIds.json file. */
public updateSessionId(): void {
sessionIdsMap.set(this.options.identifier, this.sessionId);
fs.writeFileSync(sessionIdsFilePath, JSON.stringify(Object.fromEntries(sessionIdsMap)));
console.log(`Updated session ID for ${this.options.identifier} to ${this.sessionId}`);
}

/** Connects to the Node. */
Expand All @@ -166,7 +162,6 @@ export class Node {
} else if (this.options.resumeStatus && sessionIdsMap.has(this.options.identifier)) {
this.sessionId = sessionIdsMap.get(this.options.identifier) || null;
headers["Session-Id"] = this.sessionId;
console.log(`Resuming session with ID: ${this.sessionId}`);
}

this.socket = new WebSocket(`ws${this.options.secure ? "s" : ""}://${this.address}/v4/websocket`, { headers });
Expand Down Expand Up @@ -255,8 +250,6 @@ export class Node {
this.info = await this.fetchInfo();
// Log if the session was resumed successfully
if (payload.resumed) {
console.log(`Session resumed successfully for ${this.options.identifier}`);

// Load player states from the JSON file
await this.manager.loadPlayerStates(this.options.identifier);
}
Expand Down

0 comments on commit 626ed65

Please sign in to comment.