@pure0cd/freefire-api
Version:
A powerful Node.js library to interact with Garena Free Fire API using Protobuf. Login, Search Players, and get Profile Stats.
28 lines (23 loc) • 1.03 kB
JavaScript
const FreeFireAPI = require('../index');
async function testSearch() {
const searchName = process.argv[2] || "folaa";
console.log(`Starting Search Test for '${searchName}'...`);
const api = new FreeFireAPI();
try {
// await api.login(); - New Update 1.1.0: Auto login is handled automatically with Default Creds.
const searchResults = await api.searchAccount(searchName);
if (searchResults && searchResults.length > 0) {
console.log(`Found ${searchResults.length} players.`);
console.log(`Top Result: ${searchResults[0].nickname} (UID: ${searchResults[0].accountid})`);
// Print all results for better visibility
searchResults.forEach((res, index) => {
console.log(`[${index + 1}] ${res.nickname} - UID: ${res.accountid} - LVL: ${res.level}`);
});
} else {
console.log("No players found.");
}
} catch (e) {
console.error("Search failed:", e.message);
}
}
testSearch();