Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
discord-analytics
Advanced tools
Readme
npm install discord-analytics
Note: To use Discord Analytics, you need to have an API token. Check the docs for more informations : https://docs.discordanalytics.xyz/get-started/bot-registration
With Discord.js:
// Import Discord.js's client and intents
const { Client, IntentsBitField } = require("discord.js")
// import discord-analytics
const { default: DiscordAnalytics } = require("discord-analytics/discordjs")
// Create Discord client
const client = new Client({
intents: [IntentsBitField.Flags.Guilds] // This intent is required
});
// Create Discord Analytics instance
// Don't forget to replace YOUR_API_TOKEN by your Discord Analytics token !
const analytics = new DiscordAnalytics({
client: client,
apiToken: 'YOUR_API_TOKEN',
sharded: false // Set it to true if your bot use shards
});
// start tracking selected events
analytics.trackEvents();
// When Discord client is ready
client.on('ready', () => {
console.log("Bot is ready!");
});
// Login to Discord
// Don't forget to replace token by your Discord bot token !
client.login('token');
With Eris:
const {Client} = require("eris");
const {default: DiscordAnalytics} = require("discord-analytics/eris");
// Create Eris client.
// Don't forget to replace token by your Discord bot token !
const bot = new Client("token");
bot.on("ready", () => {
// Create Discord Analytics instance
// Don't forget to replace YOUR_API_TOKEN by your Discord Analytics token !
const analytics = new DiscordAnalytics({
client: client,
apiToken: 'YOUR_API_TOKEN'
});
// start tracking selected events
analytics.trackEvents();
console.log("Ready!");
});
// Login to Discord
bot.connect();
With Oceanic.js:
// Import Discord.js's client and intents
const { Client } = require("oceanic.js")
// import discord-analytics
const { default: DiscordAnalytics } = require("discord-analytics/oceanic")
// Create Discord client
const client = new Client({
auth: "Bot <YOUR_BOT_TOKEN>",
gateway: {
intents: ["GUILDS"] // This intent is required
}
})
// Create Discord Analytics instance
// Don't forget to replace YOUR_API_TOKEN by your Discord Analytics token !
const analytics = new DiscordAnalytics({
client: client,
apiToken: 'YOUR_API_TOKEN'
});
// start tracking selected events
analytics.trackEvents();
// When Discord client is ready
client.on('ready', () => {
console.log("Bot is ready!");
});
// Login to Discord
// Don't forget to replace token by your Discord bot token !
client.login('token');
For advanced usages and updated docs, please check https://docs.discordanalytics.xyz/get-started/installation
FAQs
A discord bot analytics to send your bot data
The npm package discord-analytics receives a total of 14 weekly downloads. As such, discord-analytics popularity was classified as not popular.
We found that discord-analytics demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.