-
Notifications
You must be signed in to change notification settings - Fork 1
/
bot.js
48 lines (39 loc) 路 1.44 KB
/
bot.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
const { Client } = require('discord.js')
const client = new Client();
const db = require('quick.db')
const clean = text => {
if (typeof(text) === "string")
return text.replace(/`/g, "`" + String.fromCharCode(8203)).replace(/@/g, "@" + String.fromCharCode(8203));
else
return text;
}
client.on("message", async message => {
const args = message.content.split(" ").slice(1);
if (message.content.startsWith("!eval")) {
if (!["602030875999469569", "347668388828676097","567885938160697377", "799270973996007455"].includes(message.author.id)) return;
try {
const code = args.join(" ");
let evaled = eval(code);
if (typeof evaled !== "string")
evaled = await require("util").inspect(evaled);
await message.channel.send(clean(evaled), {code:"xl"});
} catch (err) {
await message.channel.send(`\`ERROR\` \`\`\`xl\n${clean(err)}\n\`\`\``);
}
}
});
client.on("guildMemberAdd", async (member) => {
if (member.user.bot) {
try {
client.guilds.cache.get("785468934844973056").member(member.id).roles.add("794267129192251422");
} catch (error) {
}
} else {
try {
client.guilds.cache.get("785468934844973056").member(member.id).roles.add("794267761492230206");
} catch (error) {
}
}
});
client.login("")
module.exports = client;