Skip to content

@aoijs/aoi.canvas

Installation

Terminal window
npm i @aoijs/aoi.canvas

Setup

1
const { AoiClient } = require("aoi.js");
2
const { AoiCanvas } = require("aoi.canvas");
3
4
const client = new AoiClient({
5
intents: ["Guilds", "GuildMessages", "MessageContent"],
6
events: ["onMessage", "onInteractionCreate"],
7
prefix: "Discord Bot Prefix",
8
token: "Discord Bot Token",
9
database: {
10
type: "aoi.db",
11
db: require("@aoijs/aoi.db"),
12
dbType: "KeyValue",
13
tables: ["main"],
14
securityKey: "a-32-characters-long-string-here"
15
}
16
});
17
18
const canvas = new AoiCanvas(client);
19
20
// Ping Command Example
21
client.command({
22
name: "ping",
23
code: `Pong! $pingms`
24
});
25
26
// Canvas Command Example
27
client.command({
28
name: "house",
29
code: `
30
$attachCanvas[mycanvas]
31
$drawLines[mycanvas;draw;#03a9f4;10;50;140;150:60;250:140]
32
$fillRect[mycanvas;#03a9f4;130;190;40;60]
33
$strokeRect[mycanvas;#03a9f4;75;140;150;110]
34
$createCanvas[mycanvas;300;320]
35
`
36
})