Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
discord-msg
Advanced tools
Hi 👋 Discord-Measage Discord-Message - A lightweight and easy to use, framework for discord bots, uses MongoDB.
Version | Support |
---|---|
v12 | ✔ |
v13 | ✔ |
npm i discord-msg
First things first, we include the module into the project.
const Message = require("discord-msg");
Message.Setup(client, 'DataBase Url')
onMessage({
message,
guildID: <Message>.guild.id,
userID: <Message>.author.id
})
AddMessage({
guildID: <Message>.guild.id,
userID: <Message>.author.id,
Value: Num
})
SubtractMessage({
guildID: <Message>.guild.id,
userID: <Message>.author.id,
Value: Num
})
Fetch({
guildID: <Message>.guild.id,
userID: <Message>.author.id,
}).then(count => <Measage>.channel.send(count))
Leaderboard({
guildID: <Message>.guild.id,
UsersFetch: num,
}).then(Leader => <Measage>.channel.send(Leader))
.SubtractAllMessage({
guildID: <Message>.guild.id,
})
const Discord = require('discord.js')
const client = new Discord.Client()
const Message = require('discord-msg')
const prefix = "+"
Message.Setup(client, 'MongoDB DataBase Url')
client.on('message', async message => {
if(message.content.startsWith(prefix + "top")){
if(message.author.bot || !message.guild) return
await Message.Leaderboard({
guildID: message.guild.id,
UsersFetch: 2
}).then(Leader => {
message.channel.send(new Discord.MessageEmbed().setAuthor(message.author.tag, message.author.avatarURL({dynamic: true})).setDescription(Leader).setTimestamp().setFooter(`Leaderboard For: ${message.guild.name}`).setColor('BLUE'))
})
}
})
client.on('message', async message => {
if(message.author.bot || !message.guild) return
await Message.onMessage({
message,
userID: message.author.id,
guildID: message.guild.id,
})
})
client.on('message', async message => {
if(message.content.startsWith(prefix + "fetch")){
if(message.author.bot || !message.guild) return
let u = message.mentions.users.first()
if(!u) return
await Message.Fetch({
userID: u.id,
guildID: message.guild.id
}).then(count => {
message.channel.send(`<@${u.id}> Have ${count} Message`)
}).catch(err => console.log(err))
}
})
client.on('message', async message => {
if(message.content.startsWith(prefix + "add")){
if(message.author.bot || !message.guild) return
if(message.author.id == 'Your ID'){
let u = message.mentions.users.first()
if(!u) return
let args = message.content.split(' ').slice(2).join(' ')
if(!args) return
if(args.includes('-')) return message.channel.send('Nice Try Bro')
await Message.AddMessage({
userID: u.id,
guildID: message.guild.id,
value: parseInt(args)
})
message.channel.send('done')
}
}
})
client.on('message', async message => {
if(message.content.startsWith(prefix + "subtract")){
if(message.author.bot || !message.guild) return
if(message.author.id == 'Your ID'){
let u = message.mentions.users.first()
let args = message.content.split(' ').slice(2).join(' ')
if(!args) return
await Message.SubtractMessage({
userID: u.id,
guildID: message.guild.id,
count: args
})
message.channel.send('done')
}
}
})
client.on('message', async message => {
if(message.content.startsWith(prefix + "subtractall")){
if(message.author.bot || !message.guild) return
if(message.author.id == 'Your ID'){
await Message.SubtractAllMessage({
guildID: message.guild.id,
})
message.channel.send('done')
}
}
})
const { Client, Intents } = require("discord.js")
const client = new Client({ intents: 32767 })
const Message = require('discord-msg')
const prefix = "+"
Message.Setup(client, 'DataBase Url')
client.on('messageCreate', async message => {
if(message.content.startsWith(prefix + "top")){
if(message.author.bot || !message.guild) return
await Message.Leaderboard({
guildID: message.guild.id,
UsersFetch: 2
}).then(Leader => {
message.channel.send({embeds: [new MessageEmbed().setAuthor(message.author.tag, message.author.avatarURL({dynamic: true})).setDescription(Leader).setTimestamp().setFooter(`Leaderboard For: ${message.guild.name}`).setColor('BLUE')]})
})
}
})
client.on('messageCreate', async message => {
if(message.author.bot || !message.guild) return
await Message.onMessage({
message,
userID: message.author.id,
guildID: message.guild.id,
})
})
client.on('messageCreate', async message => {
if(message.content.startsWith(prefix + "fetch")){
if(message.author.bot || !message.guild) return
let u = message.mentions.users.first()
if(!u) return
await Message.Fetch({
userID: u.id,
guildID: message.guild.id
}).then(count => {
message.channel.send(`<@${u.id}> Have ${count} Message`)
}).catch(err => console.log(err))
}
})
client.on('messageCreate', async message => {
if(message.content.startsWith(prefix + "add")){
if(message.author.bot || !message.guild) return
if(message.author.id == 'Your ID'){
let u = message.mentions.users.first()
if(!u) return
let args = message.content.split(' ').slice(2).join(' ')
if(!args) return
if(args.includes('-')) return message.channel.send('Nice Try Bro')
await Message.AddMessage({
userID: u.id,
guildID: message.guild.id,
value: parseInt(args)
})
message.channel.send('done')
}
}
})
client.on('messageCreate', async message => {
if(message.content.startsWith(prefix + "subtract")){
if(message.author.bot || !message.guild) return
if(message.author.id == 'Your ID'){
let u = message.mentions.users.first()
let args = message.content.split(' ').slice(2).join(' ')
if(!args) return
await Message.SubtractMessage({
userID: u.id,
guildID: message.guild.id,
count: args
})
message.channel.send('done')
}
}
})
client.on('messageCreate', async message => {
if(message.content.startsWith(prefix + "subtractall")){
if(message.author.bot || !message.guild) return
if(message.author.id == 'Your ID'){
await Message.SubtractAllMessage({
guildID: message.guild.id,
})
message.channel.send('done')
}
}
})
Discord: #B A D B O Y #1502
FAQs
Hi 👋 Discord-Measage Discord-Message - A lightweight and easy to use, framework for discord bots, uses MongoDB.
We found that discord-msg 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
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.