1.0.3 • Published 6 months ago
discord-logger-midvn v1.0.3
Discord Logger
A simple and efficient logger for sending messages and formatted code snippets to a Discord channel using a bot.
Installation
npm install discord-logger-midvn
Usage
1. Initialize the Logger
const DiscordLogger = require('discord-logger');
const discordLogger = DiscordLogger.getInstance({
discord_token: 'YOUR_TOKEN',
discord_channel_id: 'YOUR_CHANNEL_ID'
});
2. Send a Simple Message
discordLogger.sendMessage('Hello World');
3. Send a Formatted Code Snippet
discordLogger.sendFormattedCode({
code: { error: 'Not found' },
title: 'API Error'
});
Configuration Options
Option | Type | Description |
---|---|---|
discord_token | String | Your Discord bot token. |
discord_channel_id | String | The ID of the channel where messages should be sent. |
License
This project is licensed under the MIT License.