❔ @reconlx/discord.js
A simple api to configure and enhance the ways on coding your discord bot. Compatible with discord.js v12 but it should also work on older versions. Variety of different usages for this api.
📝 Table of contents
Installation
First install Node.js. Then:
$ npm install @reconlx/discord.js
🛠 Usages (Click on it for more info on how to use it)
- reconDB - simple way to store data into mongodb
- DaysAgo - check how many days ago was it using date format
- EmbedPages - simple pagination to make your "MessageEmbed" interactable.
- Confirmation - A reaction collector which returns the first emoji collected, can be used as a confirmation prompt.
- fetchTranscript - Specify an amount of messages and it will return a discord chat template with messages, acts like a transcript.
- timeout - Makes it easier to delete messages according to your needs
✈ Importing
const recon = require('@reconlx/discord.js');
import recon from '@reconlx/discord.js';
🙋♂️ Support
Feel free to join the support discord server -> https://discord.gg/xCCpfth
🔧 Usages
DaysAgo
const recon = require('@reconlx/discord.js')
const daysAgo = recon.daysAgo
const discord = require('discord.js')
client.on('guildMemberAdd', async(member) => {
console.log(daysAgo(member.user.createdAt))
})
EmbedPages
Example :
const recon = require('@reconlx/discord.js')
const EmbedPages = recon.EmbedPages
const { MessageEmbed } = require('discord.js');
const embed1 = new MessageEmbed().setTitle('1')
const embed2 = new MessageEmbed().setTitle('2')
const pages = [
embed1,
embed2
]
const emojis = [
"⏪",
"⏩"
]
const time = 30000
EmbedPages(msg, pages, emojis, time);
Preview on a music list :
confirmation
const { confirmation } = require('@reconlx/discord.js')
message.channel.send('Confirmation for banning members').then(async msg => {
const emoji = confirmation(msg, message.author, ['✅', '❌'], 30000)
if(emoji === '✅') {
msg.delete()
guildMember.ban()
}
if(emoji === '❌') {
msg.delete()
}
})
fetchTranscript
const { fetchTransript } = require('@reconlx/discord.js')
module.exports = {
name : 'transcript',
run : async(client, message) => {
fetchTranscript(message, 5, true)
}
}
Preview on a general chat
timeout
const { timeout } = require('@reconlx/discord.js')
const messageToDelete = await message.channel.send('Hello There 👋')
timeout(message, messageToDelete, 5000)
Preview
reconDB
1. Importing the package
const { reconDB } = require('@reconlx/discord.js')
import { reconDB } from '@reconlx/discord.js'
2. Establishing and exporting reconDB
const db = new reconDB({
uri : "your mongodb connection string"
})
module.exports = db;
3. Example on using it
const db = require('./db.js')
db.set('numbers', '123')
Methods
.set
db.set('key', 'value')
.get
db.get('key')
.has
db.has('key')
.delete
db.delete('key')
db.has('key')