New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

create-discordbot-app

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

create-discordbot-app

Create a discord bot app

unpublished
latest
npmnpm
Version
0.0.2
Version published
Maintainers
1
Created
Source

Create discord bot app

Create a discord bot project quickly using create-discordbot-app. The project has a handler of commands, events and components of discord.js, you can choose the version of the api you want to use.

start using:

npx create-discordbot-app

See some examples of this project

Create a command just by exporting a class in the command directory

// src/client/commands/staff/manage.ts
import { Command } from "@app/base/Command";
import { config } from "@src/index";
import { ApplicationCommandType, ColorResolvable, EmbedBuilder } from "discord.js";

export default new Command({
    name: "Manage",
    type: ApplicationCommandType.User,
    async run(interaction) {
        if (!interaction.inCachedGuild()) return;
        const { member } = interaction;

        const embed = new EmbedBuilder({
            author: { 
                name: member.displayName, 
                iconURL: member.displayAvatarURL({extension: "png"}) 
            }
        });

        if (member.permissions.has("Administrator")){
            embed.setColor(config.colors.success as ColorResolvable)
            .setDescription("you are an admin")
        } else {
            embed.setColor(config.colors.danger as ColorResolvable)
            .setDescription("You are not an admin")
        }

        interaction.reply({embeds: [embed]});
    },
})

Components defined directly in the command. Create a function for a discord.js component just using the customId

// src/client/commands/common/ping.ts
export default new Command({
    name: "ping",
    description: "reply with pong",
    type: ApplicationCommandType.ChatInput,
    async run(interaction) {
        interaction.reply({content: "pong", components: [
            new ActionRowBuilder<ButtonBuilder>({components: [
                new ButtonBuilder({customId: "ping-button", label: "pong", style: ButtonStyle.Success})
            ]})
        ]});
    },
    buttons: {
        "ping-button":(interaction) => {
            interaction.reply({content: "ping"})
        }
    }
})

It is possible to create scheduled tasks to repeat continuously using node-cron and Task class

// src/client/tasks/daily/good-morning.ts
import { Task } from "@app/base/Task";

export default new Task({
    name: "good-morning",
    enable: false, // is currently disabled
    display: "Good morning message",
    // This website can help you create frequencies for node cron https://crontab.guru/
    frequency: "0 6 * * *", 
    run() {
        console.log("Good morning")
    },
})

FAQs

Package last updated on 10 May 2023

Did you know?

Socket

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.

Install

Related posts