discordjs-chatlog
v1.0.11
Published
Lightweight discord.js chat log package
Downloads
3
Readme
discord.js chat log
Lightweight discord.js chat logging constructor
Installation
npm i discordjs-chatlog
Usage
const ChatLog = require("discordjs-chatlog"); //imports the module
let log = new ChatLog(); //constructor
log.setMessage("Logged message"); //set the message
log.setId(12345678987654321); //set the author id
log.setTag("some-user-tag#0069"); //set the author tag
log.setTimestamp(Date.now()); //set the timestamp
message.channel.send(log.generateEmbed()); //generate the embed
const ChatLog = require("discordjs-chatlog); //imports the module
let log = new ChatLog();
log.setMessage("Message");
log.setId(12345678987654321);
log.setTag("some-user-tag#0069");
log.setTimestamp(Date.now());
console.log(log.getMessage()) //returns "Message"
console.log(log.getTag()) //returns "Tag"
console.log(log.getId()) //returns "Id"
console.log(log.getTimestamp()) //returns "Timestamp"
const Discord = require("discord.js");
const ChatLog = require("discordjs-chatlog"); //imports the module
const client = new Discord.Client();
client.on("message", message => {
if (message.author.bot) return;
let log = new ChatLog(); //constructor
log.setMessage(message.content); //set the message
log.setId(message.author.id); //set the author id
log.setTag(message.author.tag); //set the author tag
log.setTimestamp(Date.now()); //set the timestamp
message.guild.channels.cache.find(c => c.name === "log").send(log.generateEmbed()); //sends the embed in a channel called "log"
});
client.login(token);