Important
Discordly is still in development.
The embed and button system can not send more then 1 embed and button per message.
About
discordly is a powerful Node.js module that allows you to easily interact with the
Discord API.
- Object-oriented
- Predictable abstractions
- Performant
- 100% coverage of the Discord API
Default usage
const Discordly = require('discordly')
const client = new Discordly.Client({intents: [Discordly.Intents.FLAGS.GUILDS, Discordly.Intents.FLAGS.GUILD_MESSAGES, Discordly.Intents.FLAGS.GUILD_MESSAGE_REACTIONS]})
client.on('ready', () => {
console.log(`${client.me.tag} is ready.`)
})
client.on('message', message => {
if(message.author.bot) return;
if(message.content == '!help'){
message.channel.send('I\'m here to help.')
}
})
client.login('Your secret bot token.')
Example usage
Embeds (No Buttons or Text)
const Discordly = require('discordly')
const client = new Discordly.Client({intents: [Discordly.Intents.FLAGS.GUILDS, Discordly.Intents.FLAGS.GUILD_MESSAGES, Discordly.Intents.FLAGS.GUILD_MESSAGE_REACTIONS]})
client.on('ready', () => {
console.log(`${client.me.tag} is ready.`)
})
client.on('message', message => {
if(message.author.bot) return;
if(message.content == '!help'){
var helpEmbed = new Discordly.DiscordEmbed()
.setTitle('Help 🌐')
.setColor('RANDOM')
.addField('Moderation', "View moderation commands by doing: `help moderation`")
message.channel.send({embeds: [helpEmbed]})
}
})
client.login('Your secret bot token.')
Buttons (No Embeds or Text)
const Discordly = require('discordly')
const client = new Discordly.Client({intents: [Discordly.Intents.FLAGS.GUILDS, Discordly.Intents.FLAGS.GUILD_MESSAGES, Discordly.Intents.FLAGS.GUILD_MESSAGE_REACTIONS]})
client.on('ready', () => {
console.log(`${client.me.tag} is ready.`)
})
client.on('message', message => {
if(message.author.bot) return;
if(message.content == '!help'){
var helpButton = new DiscordButton()
.setName(`Help button 🔲`)
.setStyle('Primary')
.setId('Help Button')
message.channel.send({button: [helpButton]})
}
})
client.on('ButtonClicked', async(button) => {
if(button.id == 'Help Button'){
var helpEmbed = new Discordly.DiscordEmbed()
.setTitle('Help 🌐')
.setColor('RANDOM')
.addField('Moderation', "View moderation commands by doing: `help moderation`")
button.channel.send({embeds: [helpEmbed]})
}
})
client.login('Your secret bot token.')
Text (No Embeds or Buttons)
const Discordly = require('discordly')
const client = new Discordly.Client({intents: [Discordly.Intents.FLAGS.GUILDS, Discordly.Intents.FLAGS.GUILD_MESSAGES, Discordly.Intents.FLAGS.GUILD_MESSAGE_REACTIONS]})
client.on('ready', () => {
console.log(`${client.me.tag} is ready.`)
})
client.on('message', message => {
if(message.author.bot) return;
if(message.content == '!help'){
message.channel.send(`I'm here to help`)
}
})
client.login('Your secret bot token.')
Text & Buttons (No embeds)
const Discordly = require('discordly')
const client = new Discordly.Client({intents: [Discordly.Intents.FLAGS.GUILDS, Discordly.Intents.FLAGS.GUILD_MESSAGES, Discordly.Intents.FLAGS.GUILD_MESSAGE_REACTIONS]})
client.on('ready', () => {
console.log(`${client.me.tag} is ready.`)
})
client.on('message', message => {
if(message.author.bot) return;
if(message.content == '!help'){
var helpButton = new DiscordButton()
.setName(`Help button 🔲`)
.setStyle('Primary')
.setId('Help Button')
message.channel.send(`I'm here to help`, {buttons: [helpButton]})
}
})
client.on('ButtonClicked', async(button) => {
if(button.id == 'Help Button'){
var helpEmbed = new Discordly.DiscordEmbed()
.setTitle('Help 🌐')
.setColor('RANDOM')
.addField('Moderation', "View moderation commands by doing: `help moderation`")
button.channel.send(`Help is here :D`, {embeds: [helpEmbed]})
}
})
client.login('Your secret bot token.')
Text & Embeds (No Buttons)
const Discordly = require('discordly')
const client = new Discordly.Client({intents: [Discordly.Intents.FLAGS.GUILDS, Discordly.Intents.FLAGS.GUILD_MESSAGES, Discordly.Intents.FLAGS.GUILD_MESSAGE_REACTIONS]})
client.on('ready', () => {
console.log(`${client.me.tag} is ready.`)
})
client.on('message', message => {
if(message.author.bot) return;
if(message.content == '!help'){
var helpEmbed = new Discordly.DiscordEmbed()
.setTitle('Help 🌐')
.setColor('RANDOM')
.addField('Moderation', "View moderation commands by doing: `help moderation`")
message.channel.send(`I'm here to help`, {embeds: [helpEmbed]})
}
})
client.login('Your secret bot token.')
Buttons & Embeds (No Text)
const Discordly = require('discordly')
const client = new Discordly.Client({intents: [Discordly.Intents.FLAGS.GUILDS, Discordly.Intents.FLAGS.GUILD_MESSAGES, Discordly.Intents.FLAGS.GUILD_MESSAGE_REACTIONS]})
client.on('ready', () => {
console.log(`${client.me.tag} is ready.`)
})
client.on('message', message => {
if(message.author.bot) return;
if(message.content == '!help'){
var helpEmbed = new Discordly.DiscordEmbed()
.setTitle('Help 🌐')
.setColor('RANDOM')
.addField('Moderation', "View moderation commands by doing: `help moderation`")
var helpButton = new DiscordButton()
.setName(`Help button 🔲`)
.setStyle('Primary')
.setId('Help Button')
message.channel.send({embeds: [helpEmbed], buttons:[helpButton]})
}
})
client.on('ButtonClicked', async(button) => {
if(button.id == 'Help Button'){
var helpEmbed = new Discordly.DiscordEmbed()
.setTitle('Help 🌐')
.setColor('RANDOM')
.addField('Moderation', "View moderation commands by doing: `help moderation`")
button.channel.send({embeds: [helpEmbed]})
}
})
client.login('Your secret bot token.')
Text, Buttons & Embeds
const Discordly = require('discordly')
const client = new Discordly.Client({intents: [Discordly.Intents.FLAGS.GUILDS, Discordly.Intents.FLAGS.GUILD_MESSAGES, Discordly.Intents.FLAGS.GUILD_MESSAGE_REACTIONS]})
client.on('ready', () => {
console.log(`${client.me.tag} is ready.`)
})
client.on('message', message => {
if(message.author.bot) return;
if(message.content == '!help'){
var helpEmbed = new Discordly.DiscordEmbed()
.setTitle('Help 🌐')
.setColor('RANDOM')
.addField('Moderation', "View moderation commands by doing: `help moderation`")
var helpButton = new DiscordButton()
.setName(`Help button 🔲`)
.setStyle('Primary')
.setId('Help Button')
message.channel.send(`I'm here to help.`, {embeds: [helpEmbed], buttons:[helpButton]})
}
})
client.on('ButtonClicked', async(button) => {
if(button.id == 'Help Button'){
var helpEmbed = new Discordly.DiscordEmbed()
.setTitle('Help 🌐')
.setColor('RANDOM')
.addField('Moderation', "View moderation commands by doing: `help moderation`")
button.channel.send(`Help is here :D`, {embeds: [helpEmbed]})
}
})
client.login('Your secret bot token.')