
Product
Socket MCP Adds Org Alerts, Threat Feed Review, and Package Inspection
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.
This npm package provides a web-based dashboard for managing settings of a Discord bot. It enables bot developers to integrate a settings dashboard into their Discord bots, allowing settings like prefixes and welcome messages to be updated dynamically through a web interface. The package also uses SweetAlert2 for stylish alerts and notifications.
Install the package:
npm install dcdash@latest
Set up environment variables: Ensure you have the following environment variables set in your .env file:
TOKEN=your-discord-bot-token
MONGO_URL=your-mongodb-connection-url
CLIENT_ID="bot id"
CLIENT_SECRET="bot secret"
REDIRECT_URI=http://<url>/auth/discord/callback
SECRET="any strong secret for session"
Initialize the Dashboard: In your index.js or main bot file, initialize the dashboard and connect to MongoDB.
require('dotenv').config();
const { Client, GatewayIntentBits } = require('discord.js');
const { startDashboard, setSlashCmds } = require('your-package-name');
const { connectMongoDB, setSettings, getSettings } = require('your-package-name');
const { loadSlashCommands, handleSlashCommands } = require('./commandHandler');
// Connect to MongoDB
connectMongoDB(process.env.MONGO_URL);
const client = new Client({ intents: Object.keys(GatewayIntentBits) });
client.once('ready', async () => {
console.log(`Logged in as ${client.user.tag}`);
// Initialize the dashboard
startDashboard(client, { port: 3000 });
// Load slash commands
loadSlashCommands(client);
// Prepare command data for the dashboard
const commands = client.slashCommands.map(cmd => cmd.data.toJSON());
const commandDisplayData = commands.map(cmd => ({
name: cmd.name,
description: cmd.description || 'No description available',
usage: client.slashCommands.find(c => c.data.name === cmd.name)?.usage || 'No usage information available'
}));
setSlashCmds(commandDisplayData);
// Register slash commands with Discord API
await client.application.commands.set(commands).catch(console.error);
// Initialize default settings (if any)
client.guilds.cache.forEach(async guild => {
const guildSettings = await getSettings(guild.id);
const Settings = [
{ name: 'prefix', type: 'text', value: '!' },
{ name: 'msg', type: 'text', value: 'Hello World!' }
];
const existingSettings = guildSettings.map(setting => setting.name);
const settingsToAdd = Settings.filter(setting => !existingSettings.includes(setting.name));
if (settingsToAdd.length > 0) {
await setSettings(guild.id, settingsToAdd);
}
const prefixSetting = guildSettings.find(setting => setting.name === 'prefix');
client.prefixes = client.prefixes || {};
client.prefixes[guild.id] = prefixSetting ? prefixSetting.value : '!';
});
});
client.on('messageCreate', async message => {
if (!message.guild) return;
const guildSettings = await getSettings(message.guild.id);
const prefixSetting = guildSettings.find(setting => setting.name === 'prefix');
const msgSetting = guildSettings.find(setting => setting.name === 'msg');
const prefix = prefixSetting ? prefixSetting.value : '!';
const msg = msgSetting ? msgSetting.value : 'Hello World!';
if (message.content.startsWith(prefix)) {
const args = message.content.slice(prefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();
if (command === "hello") {
message.reply(msg);
}
}
});
client.on('interactionCreate', interaction => {
handleSlashCommands(interaction);
});
client.login(process.env.TOKEN).catch(console.error);
Create a dashboard for your bot: Use startDashboard(client, { port: 3000 }) to initialize the dashboard and make it accessible at http://localhost:3000.
Define settings: Use the setSettings and getSettings functions to manage settings for each guild. The settings will be accessible and editable through the dashboard.
Handle commands: Register and handle slash commands using loadSlashCommands and handleSlashCommands functions on the dashboard.
SweetAlert2 is used for notifications. To integrate and use SweetAlert2 alerts, you can include the library in your dashboard page and use it as needed for displaying messages.
For more details, visit the SweetAlert2 documentation.
Feel free to contribute to this project by submitting issues or pull requests. Your feedback and contributions are welcome!
This project is licensed under the MIT License. See the LICENSE file for details.
FAQs
Adds a dashboard to your existing discord bot.
The npm package dcdash receives a total of 15 weekly downloads. As such, dcdash popularity was classified as not popular.
We found that dcdash demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.

Research
More than 140 Mastra npm packages were compromised in a supply chain attack that used a typosquatted dependency to deliver a cross-platform infostealer during installation.