![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
discord-messages
Advanced tools
A lightweight and easy to use message tracking framework for discord bots, uses MongoDB.
You can download it from npm:
npm i discord-messages
You can update to a newer version to receive updates using npm.
npm update discord-messages
First things first, we include the module into the project.
const Messages = require("discord-messages");
After that, you need to provide a valid mongo database url, and set it. You can do so by:
Messages.setURL("mongodb://..."); // You only need to do this ONCE per process.
Examples assume that you have setted up the module as presented in 'Setting Up' section.
Following examples assume that your Discord.Client
is called client
.
Following examples assume that your client.on("message", message
is called message
.
Following example contains isolated code which you need to integrate in your own command handler.
Following example assumes that you are able to write asynchronous code (use await
).
client.on("message", async (message) => {
if (!message.guild) return;
if (message.author.bot) return;
const AddMessage = await Messages.appendMessage(message.author.id, message.guild.id, 1);
});
const target = message.mentions.users.first() || message.author; // Grab the target.
const user = await Messages.fetch(target.id, message.guild.id); // Selects the target from the database.
if (!user) return message.channel.send("Seems like this user does not any messages so far..."); // If there isnt such user in the database, we send a message in general.
message.channel.send(`> **${target.tag}** currently has ${user.data.messages} message(s).`); // We show the message(s) count.
const rawLeaderboard = await Messages.fetchLeaderboard(message.guild.id, 10); // We grab top 10 users with most message(s) in the current server.
if (rawLeaderboard.length < 1) return reply("Nobody's in leaderboard yet.");
const leaderboard = await Messages.computeLeaderboard(client, rawLeaderboard, true); // We process the leaderboard.
const lb = leaderboard.map(e => `${e.position}. ${e.username}#${e.discriminator}\nMessages Count: ${e.messages}`); // We map the outputs.
message.channel.send(`**Leaderboard**:\n\n${lb.join("\n\n")}`);
Is time for you to get creative..
createUser
Creates an entry in database for that user if it doesnt exist.
Messages.createUser(<UserID - String>, <GuildID - String>);
Promise<Object>
deleteUser
If the entry exists, it deletes it from database.
Messages.deleteUser(<UserID - String>, <GuildID - String>);
Promise<Object>
appendMessage
It adds a specified amount of messages to the current amount of messages for that user, in that guild. It creates a new user with that amount of messages, if there is no entry for that user.
Messages.appendMessage(<UserID - String>, <GuildID - String>, <Amount - Integer>);
Promise<Boolean>
setMessage
It sets the messages to a specified amount and re-calculates the level.
Messages.setMessages(<UserID - String>, <GuildID - String>, <Amount - Integer>);
Promise<Boolean/Object>
fetch
Retrives selected entry from the database, if it exists.
Messages.fetch(<UserID - String>, <GuildID - String>, <FetchPosition - Boolean>);
Promise<Object>
subtractMessages
It removes a specified amount of messages to the current amount of messages for that user, in that guild.
Messages.subtractMessages(<UserID - String>, <GuildID - String>, <Amount - Integer>);
Promise<Boolean/Object>
resetGuild
It deletes the entire guild's data.
Messages.resetGuild(<GuildID - String>);
Promise<Boolean/Object>
fetchLeaderboard
It gets a specified amount of entries from the database, ordered from higgest to lowest within the specified limit of entries.
Messages.fetchLeaderboard(<GuildID - String>, <Limit - Integer>);
Promise<Array [Objects]>
computeLeaderboard
It returns a new array of object that include messages, guild id, user id, leaderboard position, username and discriminator.
Messages.computeLeaderboard(<Client - Discord.js Client>, <Leaderboard - fetchLeaderboard output>, <fetchUsers - boolean, disabled by default>);
Promise<Array [Objects]>
Consider donating: https://www.buymeacoffee.com/lebyydev Thanks 😊
FAQs
A lightweight and easy to use message tracking framework for discord bots, uses MongoDB.
The npm package discord-messages receives a total of 1 weekly downloads. As such, discord-messages popularity was classified as not popular.
We found that discord-messages demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.