discordjs-kit
v0.0.21
Published
A declarative Bot script development tool.
Downloads
23
Readme
DiscordJS-Kit
A declarative Bot script development tool.
Latest version
Supported versions
Requirements
This tool requires Node.js version 16.20.2 or higher.
Feature
- Logger
- Slash Command
- Message Stack
Install
npm install discordjs-kit
Usage
import "dotenv/config";
import { Bot } from "discordjs-kit";
const bot = new Bot({
meta: {
appName: "discordjs-kit",
token: process.env.TOKEN!,
clientID: process.env.CLIENT_ID!,
guildsID: [process.env.GUILD_ID!],
},
slashCommands: [
{
name: "ping",
description: "Replies with Pong!",
async execute(interaction) {
await interaction.reply("Pong!");
},
},
],
messageStacks: [
{
channelsID: [process.env.CHANNEL_ID!],
// Return an empty string if you don't want to send anything
content: "",
cron: ["*/10 * * * * *", "*/20 * * * * *"],
},
{
channelsID: [process.env.CHANNEL_ID!],
content: "Hello, World! " + new Date().toLocaleTimeString(),
cron: "*/10 * * * * *",
},
{
channelsID: [process.env.CHANNEL_ID!],
content: () => "Hello, World! (from a function) " + new Date().toLocaleTimeString(),
cron: "*/15 * * * * *",
},
{
channelsID: [process.env.CHANNEL_ID!],
content: async () => {
return new Promise<string>((resolve) => {
resolve("Hello, World! (from a promise) " + new Date().toLocaleTimeString());
});
},
cron: "*/20 * * * * *",
},
],
});
bot.start();