Skip to content

aoijs/aoi.panel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aoi.panel

@aoijs/aoi.panel

npm GitHub GitHub package.json version GitHub last commit GitHub repo size GitHub forks GitHub Repo stars GitHub watchers

Table of Contents

Installation

npm i @aoijs/aoi.panel

Login Page

Setup

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();

Example userconfig file for panel:

File: panel.userconfig.js

module.exports = [
    {
        username: "administratorAccount",
        password: "adminpassword",
        perms: ["admin"]
    }, {
        username: "user",
        password: "user",
        perms: [ "startup"]
    }
]
Panel Main Page

Panel Main Page

Panel Code Editor

code editor

Panel Terminal

terminal

Panel Code evaluate

eval1 eval2

Making Custom Pages

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.");
})