npm i @aoijs/aoi.panel
const {Panel} = require("@aoijs/aoi.panel")
const {AoiClient} = require("aoi.js");
const client = new AoiClient({
intents: ["MessageContent", "Guilds", "GuildMessages"],
events: ["onMessage", "onInteractionCreate"],
prefix: "Discord Bot Prefix",
token: "Discord Bot Token",
database: {
type: "aoi.db",
db: require("@akarui/aoi.db"),
dbType: "KeyValue",
tables: ["main"],
securityKey: "a-32-characters-long-string-here",
}
});
// Ping Command
client.command({
name: "ping",
code: `Pong! $pingms`
});
client.loadCommands("./commands/", true);
const panel = new Panel({
port:3000,//port
client:bot,//aoi.js client
accounts : "/panel.userconfig.js" //accounts file (for security reasons must be a separate file)
})
panel.loadPanel();
File: panel.userconfig.js
module.exports = [
{
username: "administratorAccount",
password: "adminpassword",
perms: ["admin"]
}, {
username: "user",
password: "user",
perms: [ "startup"]
}
]
Panel uses the express.js framework. So all resources of express can be used while making custom pages e.t.c.
const app = panel.app;
app.get("/example", (req, res) => {
res.send("This is an example page.");
})