axislib.fast
v1.0.0
Published
A lib Discord mais fácil e poderosa — por Axis
Maintainers
Readme
AxisLib.js
A lib Discord mais fácil, organizada e poderosa. Feita para quem quer criar bots sem decorar a estrutura do discord.js.
Instalação
# 1. Copie a pasta axislib para seu projeto
# 2. Instale as dependências da lib
cd axislib && npm install && npm run build && cd ..
# 3. No package.json do seu bot, adicione:
# "axislib": "file:./axislib"
# 4. npm install no seu bot
npm installSetup mínimo
import { Client } from "axislib";
const client = new Client({
token: "SEU-TOKEN",
});
await client.loadCommands("./commands");
await client.loadEvents("./events");
await client.start();Configuração completa
const client = new Client({
token: "SEU-TOKEN",
prefix: ["!", "?"], // string ou array
slashGuildId: "ID_SERVER", // slashs só nesse server
prefixGuildId: "ID_SERVER", // prefixos só nesse server
owners: ["SEU_ID"],
debug: true, // tabela de cmds/eventos no console
welcome: {
channelId: "ID_CANAL",
message: (member) => [ /* components v2 */ ],
},
});Components V2
import { v2, v2Button, MessageFlags } from "axislib";
await i.reply({
flags: MessageFlags.IsComponentsV2,
components: [
v2.container([
v2.section(
[v2.text("## Título\nConteúdo")],
v2.thumbnail("https://...")
),
v2.separator("large"),
v2.gallery(["https://img1.png", "https://img2.png"]),
v2.row(
v2Button.success("ok", "Confirmar"),
v2Button.danger("cancel", "Cancelar"),
v2Button.link("https://...", "Site"),
),
], { color: 0x5865F2 })
]
});Select Menus
import { StringSelect, UserSelect, RoleSelect, ChannelSelect, MentionableSelect, Row } from "axislib";
// String Select
Row(StringSelect({
customId: "meu-select",
placeholder: "Escolha...",
options: [
{ label: "Opção 1", value: "op1", emoji: "1️⃣" },
{ label: "Opção 2", value: "op2", emoji: "2️⃣" },
]
}))
// User Select
Row(UserSelect({ customId: "sel-user", placeholder: "Selecione um usuário" }))
// Role Select
Row(RoleSelect({ customId: "sel-cargo", placeholder: "Selecione um cargo" }))
// Channel Select (filtra por tipo)
Row(ChannelSelect({ customId: "sel-canal", channelTypes: [ChannelType.GuildText] }))
// Mentionable (usuários + cargos)
Row(MentionableSelect({ customId: "sel-mention" }))Tempo
import { Time } from "axislib";
Time.now() // "30/05/2026 17:42:00"
Time.now("HH:mm") // "17:42"
Time.now("DD/MM/YYYY") // "30/05/2026"
Time.discord(Date.now(), "R") // "<t:1234567:R>" (relativo no Discord)
Time.discord(Date.now(), "F") // "<t:1234567:F>" (data+hora completa)
Time.in(7, "days") // Date 7 dias no futuro
Time.ago(new Date("2026-01-01")) // "4 meses atrás"
Time.unix() // 1748623320JSON fácil
import { JsonDB, forEach, readJson, saveJson } from "axislib";
const db = new JsonDB("./data/config.json", { prefix: "!" });
db.get("prefix") // "!"
db.set("prefix", "?") // salva automaticamente
db.set("loja.aberta", true) // suporta path aninhado
db.push("admins", "123") // adiciona no array
db.has("prefix") // true
db.delete("prefix") // remove
db.all() // objeto inteiro
// Loop fácil para select options
const opts = forEach(db.get("produtos"), (p, i) => ({
label: p.nome,
value: String(i),
}));Eventos + Interactions no mesmo arquivo
// events/loja.ts
import { EventHandler, InteractionHandler } from "axislib";
export const onMessage = new EventHandler({
event: "messageCreate",
run: (client, msg) => { /* ... */ }
});
// Interaction junto com o evento!
export const btnComprar = new InteractionHandler({
customId: "comprar:*", // wildcard
run: async (client, i) => {
const itemId = i.customId.split(":")[1];
// ...
}
});Comandos inline no index.ts
client.slash({
name: "ping",
description: "Pong!",
run: async (client, i) => { await i.reply("Pong!"); }
});
client.prefix({
name: "oi",
aliases: ["olá", "hey"],
run: async ({ message }) => { await message.reply("Oi!"); }
});
client.on_interaction({
customId: "meu-botao",
run: async (client, i) => { await i.reply("Clicou!"); }
});