-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
58 lines (51 loc) · 1.29 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const express = require("express");
const app = express();
const aoijs = require("aoi.js");
const config = {
token:process.env.token,
prefix:"!",
port:3000,
yourUserId:"818377414367379487"
}
const bot = new aoijs.AoiClient({
token: process.env.token || config.token,
prefix: config.prefix || "!",
intents: ["GUILDS", "GUILD_MESSAGES"]
})
bot.onMessage()
bot.command({
name: "ping",
code: `Pong! $pingms`
})
bot.readyCommand({
channel: "",
code: `$log[Ready on $userTag[$clientID]]`
})
const event = new aoijs.CustomEvent(bot)
event.command({
listen: "message",
code: `
$title[1;$eventData[[0]] Sent you a message from your website.]
$description[1;$eventData[[1]]]
$color[1;RANDOM]
$dm[${config.yourUserId}]`
})
event.listen("message")
app.get('/', (req, res) => {
if (req.query.submit=="true") {
return res.sendFile(__dirname + '/views/form2.html');
}
res.sendFile(__dirname + '/views/form.html');
});
app.get('/submit', (req, res) => {
//console.log("User:"+req.query.usrname);
//console.log("Message:"+req.query.msg);
event.emit('message', req.query.usrname,req.query.msg);
res.redirect("/?submit=true");
})
app.get("/pic.png",(req,res)=>{
res.sendFile(__dirname + '/views/user.png');
})
app.listen(config.port, () => {
console.log('server started');
});