-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
39 lines (33 loc) · 1.1 KB
/
app.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
const Hiven = require("hiven");
const client = new Hiven.Client({type: "user"});
const config = require("./config.json");
const util = require("util");
const { join } = require("path");
client.on("init", () => {
console.log("Connected to Hiven Swarm!");
});
client.on("message", (message) => {
if(!message.content.startsWith(config.prefix)) return;
const args = message.content.slice(config.prefix.length).split(" ");
const command = args.shift().toLowerCase();
if(command === "say-hi") {
message.room.send("hello")
}
if(command === "ping") {
message.room.send("Pong!").then(x => {
x.edit(`${x.timestamp - message.timestamp}ms!`);
});
} else if(message.author.id === "your_user_id_here" && command === "eval") {
try {
const stdout = util.inspect(eval(args.join(" ")), {depth: 0});
if(stdout.includes(config.token)) {
message.room.send(":warning: output contains token!");
} else {
message.room.send(`\`\`\`js\n${stdout}\`\`\``);
}
} catch(err) {
message.room.send(`\`\`\`js\n${err}\`\`\``);
}
}
});
client.connect(config.token)