# Using BladeBotList's Webhooks
# Post to Discord Webhooks
# Create the webhook
- Go to server settings
- Go to Integrations
- Click on "Create Webhook"
- Edit the name (1), The channel (2) and the avatar (3)
- And finally copy the webhook url
- If you did everything you must got an url like
https://discord.com/api/webhooks/000111222333444555/T0K3EN
# Add it to BladeBotList
- Go to
https://bladebotlist.xyz/bot/:YOURBOTID/edit/webhook
- Paste the webhook url in the "Discord Webhook" field
- Click on "Edit Webhook" and you're done !
- Test it by voting for the bot !
# Post to Custom Webhook server
# Using the BBL-API module
Default config (opens new window)
const BBL = require("../app");
const client = new BBL(
"", // BOT_ID
"", // API_KEY,
{
server_count: "20", // number of servers ie: discordjs v12 => client.guilds.cache.size
shard_count: "0", // number of shards, null if not defined
interval: 300000, // interval bethween each post
});
client.on("ready", () => console.log("Client is started !")); // when the module is loaded and ready to post data
client.on("debug", (log) => console.log(log)) // debug messages for developers, not required
client.on("update", () => console.log("Stats updated !")); // event when autopost or manual post
client.on("error", (error) => console.log(`Something was wrong when the module has posted stats: ${error}`)); // complete reports about errors like invalid api key or bot id
- Add in the module config this:
webhook: {
status: true,
port: 6060,
password: "youshallnotpass",
endpoint:"/hook"
}
- Change the port if need (default: 3000)
- Change the password or left empty to disable (Not recommanded at all) (default: none)
- Change the endpoint if you want (default: /hook)
- Final code (opens new window)
const BBL = require("../app");
const client = new BBL(
"", // BOT_ID
"", // API_KEY,
{
server_count: "3000",
shard_count: "20",
interval: 300000,
webhook: {
status: true,
port: 6060,
password: "youshallnotpass",
endpoint:"/hook"
}
});
client.on("ready", () => console.log("Client is started !")); // when the module is loaded and ready to post data
client.on("debug", (log) => console.log(log))
client.on("update", () => console.log("Stats updated !")); // autopost or manual post
client.on("error", (error) => console.log(`Something was wrong when the module has posted stats: ${error}`)); // complete reports about errors like invalid api key or bot id
client.on("vote", (out) => {
/*
out must looks like
{
"userid":355995885085392896,
"usertag":`HiiZun#0001`,
"username":`HiiZun`,
"userdiscriminator":`0001`,
"botID":`643499304950038539`,
"date":1603908629750
}
*/
console.log(`Whoohoo ! ${out.usertag} just voted !`)
})
the event "vote" is emitted when you receve a bot
Go to
https://bladebotlist.xyz/bot/:BOTID/edit/webhook
, and put url as:http://<serverIP>:<port>/<endpoint>
ex: http://mybot.bladebotlist.xyz:6060/hook
Add the password if you added it (you can seee it by clicking on "show password")
And finally test !
# Using custom Webserver/Library/Code
We don't give support for custom webhooks
Informations:
- Requests are made as POST
- we proivde password in headers
- data is in the body