eclipsia
v1.0.5-beta
Published
Eclipsia is a form for create discord bot easily.
Downloads
3
Readme
Astralisia
Astralisia creates advanced Discord bots easily.
Astralisia is a package that streamlines the development of Discord bots, offering a simple and efficient approach built upon the discord.js library.
Installation
Start your project using Bun:
bun init
Then, add Astralisia and discord.js:
bun add astralisia
bun add discord.js
Configuration
Set up your environment for TypeScript or JavaScript and in the main file, insert the following code:
import { Astralisia } from "astralisia";
import { GatewayIntentBits, Partials } from "discord.js";
const client = new Astralisia({
intents: [GatewayIntentBits.Guilds],
partials: [Partials.User],
});
client.eventsPath("src/test/events/**/**/*.js");
client.commandsPath("src/test/commands/**/**/*.js");
client.login("bot token");
Usage
Create commands or events in the specified folders using the eventsPath()
or commandsPath()
functions.
Command Example:
import { SlashCommand } from "../../../lib/class/commands";
export default new SlashCommand({
data: {
name: "ping",
description: "Responds with Pong!",
},
async execute({ interaction }) {
interaction.reply({ content: "Pong!" });
},
});
Event Example:
import { Event } from "../../../lib/class/events";
export default new Event({
name: "ready",
once: true,
execute: async (client) => {
console.log("Connected as", client.user?.tag);
},
});
Autocomplete example
import { ApplicationCommandOptionType } from "discord.js";
import { SlashCommand } from "astralisia";
export default new SlashCommand({
data: {
name: "autocomplete",
description: "example of autocomplete!",
options: [
{
name: "input",
description: "autocomplete input!",
type: ApplicationCommandOptionType.STRING,
autocomplete: true,
},
],
},
async autocomplete() {
return [
{
name: "item 1!",
value: "value!",
},
{
name: "item 2",
value: "value 2!",
},
{
name: "test 3",
value: "thing 3!",
},
];
},
async execute({ interaction }) {
const autocompleteValue = interaction.options.getString("ping");
interaction.reply({ content: `Response! ${autocompleteValue}` });
},
});
PrefixCommand example
import { PrefixCommand } from "../../..";
export default new PrefixCommand({
data: {
name: "prefixcommand_test",
options: {
onwer: false, // it's return a message for dev commands [optional]
guilds: [
"1078379189100626000", // commands available only in servers [optional]
"1126344713579016342",
"1065760715442495559",
],
aliases: ["p", "ping"], // aliases [optional]
cooldown: 5000, // cooldown [optional]
arguments: {
args: [
{
name: "test", // params for command [optional]
required: false,
},
],
},
},
},
async execute({ message, params }) {
const test = params[0];
await message.reply("test" + test);
},
});
Support
For more information or support, visit our official server: server link.
Note
It is not yet possible to create prefix commands in the same folder you defined in the slash commands loading function, so create another folder for that.