0.3.3 • Published 11 months ago

@ikasoba000/distroub v0.3.3

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

example

import { Client, ChatInputCommandInteraction as Interaction } from "discord.js";
import {
  DiscordBot,
  SlashCommand,
  Param,
  ParamType,
} from "@ikasoba000/distroub";

const client = new Client( ... );

class MyBot extends DiscordBot {
  constructor(client: Client) {
    super(client);
  }

  @ClientEvent("ready")
  onReady(){
    console.info("Bot activated, bot user: ", this.client.user?.tag);
  }

  // Create /random command
  @SlashCommand("random", "take a random number", [
    Param(ParamType("number").optional(), "max", "Upper limit of random number"),
  ])
  async getRandomNumber(interaction: Interaction, max?: number) {
    max ??= 10;

    await interaction.deferReply();
    await interaction.editReply("" + Math.floor(Math.random() * max));
  }
}

const bot = new MyBot(client);

await bot.login( ... );
0.3.0

11 months ago

0.2.1

11 months ago

0.2.0

11 months ago

0.3.2

11 months ago

0.3.1

11 months ago

0.3.3

11 months ago

0.1.7

11 months ago

0.1.6

11 months ago

0.1.5

12 months ago

0.1.4

12 months ago

0.1.3

12 months ago

0.1.2

12 months ago

0.1.1

12 months ago

0.1.0

12 months ago