-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathindex.js
More file actions
96 lines (74 loc) · 2 KB
/
index.js
File metadata and controls
96 lines (74 loc) · 2 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
const {Client,
Collection,
Discord
} = require("discord.js");
const client = new Client({
disableEveryone: true
});
const { config } = require('dotenv')
const { prefix } = require("./config.json");
const ms = require("ms");
const fetch = require("fetch");
//----Handler------
client.commands = new Collection();
client.aliases = new Collection();
['command'].forEach(handler => {
require(`./handlers/${handler}`)(client);
});
//-------Ping------------
const express = require("express");
const app = express();
app.get("/", (req, res) => {
res.send("pinging");
});
app.listen(3000, () => {
console.log("server started");
});
//--------Message-------
client.on('message', async message => {
if (message.author.bot) return;
if (!message.guild) return;
if (!message.content.startsWith(prefix)) return;
// If message.member is uncached, cache it.
if (!message.member)
message.member = await message.guild.fetchMember(message);
const args = message.content
.slice(prefix.length)
.trim()
.split(/ +/g);
const cmd = args.shift().toLowerCase();
if (cmd.length === 0) return;
// Get the command
let command = client.commands.get(cmd);
// If none is found, try to find it by alias
if (!command) command = client.commands.get(client.aliases.get(cmd));
if (!command) return;
if (command) command.run(client, message, args);
});
client.on("message", message => {
if (message.content === "hello") {
return message.channel.send("Subscribe to aestra-tech");
}
});
//------status
client.on("ready", () => {
console.log(`Hey user {client.user.username} is online`);
client.user.setPresence({
activity : {
name: "Aestra Tech",
// -----ALL TYPES----
// PLAYING
// WATCHING
// STREAMING
// LISTENING
type: "WATCHING"
},
//TYPES
// -- dnd ( do not disturb )
// -- idle
// -- invisible
// -- online
status : 'dnd'
})
})
client.login(process.env.TOKEN);