Closed CCleanerShot closed 2 years ago
I've been using it in a few projects in production (including multiplayer) since it has been released, along with beta/rc releases. Please provide samples for reproduction.
using just Bancho.js and dotenv modules:
0.9.7 returns a beatmap inside no matter the map 0.10.0 has never returned a beatmap on any map 0.9.7 lobby closed the 0.10.0 lobby never closed
idk if its just only these 2 but these were the things that I was using
launched with node version v16.9.1 if that's of any relevance
code (theres a bunch of useless stuff in here because I thought the _beatmap could be delayed or something)
const Banchojs = require('bancho.js');
require('dotenv').config();
const client = new Banchojs.BanchoClient({
username: process.env.IRC_USERNAME,
password: process.env.IRC_PASSWORD,
apiKey: process.env.OSU_API_KEY
});
async function BanchoStart() {
await client.connect();
channel = await client.createLobby(`zzzzzz ${process.env.IRC_USERNAME}`);
console.log('created lobby')
lobby = channel.lobby;
lobby.setMap(22538, 0);
lobby.setPassword('123');
console.log('set pass');
lobby.on('playerJoined', PJ => {
lobby.setHost(PJ.player.user.ircUsername);
console.log('setting host');
console.log(lobby);
});
setTimeout(() => {try{console.log(lobby.beatmap.version)} catch (err) {console.log('errors cuz no beatmap')}}, 40000);
setTimeout(() => {TryThis(lobby)}, 80000);
}
BanchoStart();
function TryThis(lobby) {
try {
lobby.closeLobby().then(
console.log(`Closing...`));
} catch (err) {
console.log(`ERROR!`, err);
} finally {
process.exit();
}
}
EDIT: idk if this is needed but i'll be thorough anyways
REPLICATION create main folder create node_modules folder inside main folder node command prompt (node version v16.9.1) cd main folder npm install bancho.js@0.9.7 npm install dotenv create index.js create .env populate .env with IRC_USERNAME, IRC_PASSWORD, OSU_API_KEY copypaste above code into index.js node index.js into command prompt
REPEAT WITH NEW VERSION IN SEPERATE FOLDER
EDIT 2: I almost forgot why I even edited in the first place. Below are pastebins to edited logs (unedited shows my password and apikey)
Your closeLobby
handling is wrong, here's an edited version:
function TryThis(lobby) {
console.log(`Closing...`);
lobby.closeLobby()
.then(() => {
console.log('Closed lobby');
client.disconnect();
console.log('Disconnected');
// once disconnected, since the process will be come completely idle, it will exit automatically. though after .disconnect() you can also safely call process.exit(0)
})
.catch(console.error);
}
The beatmap issue is a regression and has been fixed in 0.10.1, pushed to npm just now thanks to your report.
Please open new issues if you encounter other regressions.
(IF NEED MORE CONTEXT THAN BELOW, REPLY)
I was creating a new project with ur latest bancho.js module, and for several hours I thought I was going crazy. Simple methods were not working (BanchoLobby.closeLobby(), the beatmap property under BanchoLobby). I was freaking out because I've ended up using the exact same methods under my older projects (that also used Bancho.js), and they are still working.
And after several hours of freaking out, I decided to copypaste code (just simple execution tests on several things) from a 0.10.0 project to 0.9.7, and am convinced that ur new version is potentially broken.
OLD VERSION(no problems): 0.9.7 NEW VERSION (with many problems on my end): 0.10.0