
Astrabots.xyz
Astrabots.xyz is a website where you can find the best Discord bots and servers.
Questions?
Website Founder
We are pleased to offer you a warm and hearty welcome as you embark on an exploration of Astrabots.xyz. At Astrabots.xyz, we take great pride in introducing a state-of-the-art platform that enables seamless bot management and access to vital information through our intuitive API.
In today's swiftly evolving digital environment, where automation and AI-driven solutions are progressively becoming essential, Astrabots.xyz stands as your dependable partner. Our platform has been thoughtfully crafted to meet the diverse requirements of bot enthusiasts, developers, and organizations, ensuring you unlock the complete potential of automation technologies.
In order to make this work, you need 2 parameters.
botID
token
const botID = "860206392652595281";
const token = "WEBSITE_BOT_TOKEN"; // Only visible to bot's website owner(s)
fetch("https://astrabots.xyz/api/v1/bot/" + botID, {
method: "GET",
headers: {
"Content-Type": "application/json",
"Authorization": token
}
}).then(res => res.json()).then(json => {
console.log(json);
}).catch(err => {
console.log(err);
});
{
"username": "AstraBot",
"owners": [
"857177733398265876",
"559651275877384193"
],
"votes": 165,
"rates": [
{
"author": "857177733398265876",
"star": 5,
"comment": "Pretty nice bot!",
"date": 1664108015332
},
{
"author": "559651275877384193",
"star": 4,
"comment": "Good bot!",
"date": 1664108015332
}
],
"shortDesc": "AstraBot is a bot that can do many things, such as moderation, fun, utility, and more!",
"total": {
"votes": 165,
"comments": 14
},
"tags": [
"Fun",
"Memes",
"Utility",
"Moderation"
]
}
In order to make this work, you need 2 parameters.
botID
token
const { Client, Intents } = require('discord.js');
const fetch = require('node-fetch'); // Import the 'node-fetch' library
const CLIENT_TOKEN = "YOUR_BOT_TOKEN"; // Replace with your bot's token
const client = new Client({
intents: [Intents.FLAGS.GUILDS]
});
client.once('ready', () => {
console.log(`Logged in as ${client.user.tag}`);
updateGuildsCount();
});
async function updateGuildsCount() {
try {
const guildsCount = client.guilds.cache.size;
const response = await fetch(`https://astrabots.xyz/api/v1/bot/${client.user.id}/guilds`, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": CLIENT_TOKEN
},
body: JSON.stringify({ guildsCount })
});
if (response.ok) {
const data = await response.json();
console.log(data);
} else {
console.error(`Failed to update guilds count: ${response.status} ${response.statusText}`);
}
} catch (error) {
console.error(`Error updating guilds count: ${error}`);
}
}
client.login(CLIENT_TOKEN);
{
"status": "success",
"message": "Successfully updated guild count!"
}