1.0.1 • Published 4 years ago
discordjs-facts v1.0.1
discordjs-facts
Send easy an fact in discord
Installation
npm install discordjs-facts
Examples
const Discord = require('discord.js'); // Require discord.js
const RandomFact = require('discordjs-facts'); // Require RandomFact
const bot = new Discord.Client(); // Create client
const fact = new RandomFact({
title: 'facts', // Title of the embed while displaying the game. Default: facts
color: 'RANDOM', // Color of the embed. Default: RANDOM
lang: 'en', // Custom the language for the embeds. Default: en
footer: 'This is my custom footer', // Custom text for the embed title of the game over embed. Default: 'Game Over'
subject: "dogs", // chose a category for the facts. Default: random
thumbnail: 'https://www.gettyimages.be/gi-resources/images/500px/983794168.jpg', // A thumbnail at the embed. Remove this to remove the embed
embed: true, // remove rhis for your facts in text version without embed
});
// Config
bot.config = {
token: "TOKEN"
}
// Ready Event
bot.on('ready', () => {
console.log(`Logged in as ${bot.user.tag}!`);
});
// Message Event
bot.on('message', message => {
if (message.content.toLowerCase() === '!test') {
message.reply("Test command work!")
}
else if (message.content.toLowerCase() === '!fact') {
fact.newFact(message);
}
})
// Login the bot
bot.login(bot.config.token)
Available languages
- English -> en
- Nederlands -> nl (Dutch)
Available categories (Do not use caps)
- Cats
- Chickens
- Computer
- Covid
- Dogs
- Emoji
- Space