New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

discord-msg

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discord-msg

Hi 👋 Discord-Measage Discord-Message - A lightweight and easy to use, framework for discord bots, uses MongoDB.

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14
decreased by-26.32%
Maintainers
1
Weekly downloads
 
Created
Source

Hi 👋

Discord-Measages System Using MongoDB


Discord-Message
- A lightweight and easy to use, framework for discord bots, uses MongoDB.

How To Install It In Your Project:?



npm i discord-msg


Setting Up

First things first, we include the module into the project.

const Message = require("discord-msg");

Then you need to provide a valid MongoDB database url and client
Message.Setup(client, 'DataBase Url')


Methods


onMessage({
message,
guildID: GuildID,
userID: UserID
})

AddMessage({
guildID: GuildID,
userID: UserID,
Value: Num
})

SubtractMessage({
guildID: GuildID,
userID: UserID,
Value: Num
})

Fetch({
guildID: GuildID,
userID: UserID,

}).then(count => <Measage>.channel.send(count))

Leaderboard({
guildID: GuildID,
UsersFetch,
}).then(Leader => <Measage>.channel.send(Leader))

Source Code:


const Discord = require('discord.js')
const client = new Discord.Client()
const Message = require('discord-msg')
const prefix = "+"
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('RANDOM'))
})
}
})

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(count)
}).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')
}
}
})

# In The End ✌️ Any Bug Or Suggestion:
Discord: #B A D B O Y #1502
Good Luck With discord-message

Keywords

FAQs

Package last updated on 06 Jan 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc