-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
54 lines (42 loc) · 1.62 KB
/
index.js
File metadata and controls
54 lines (42 loc) · 1.62 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
const { Client, Collection } = require("discord.js")
const client = new Client()
const { prefix } = require("./config.json")
const fs = require('fs');
const express = require("express")
const app = express()
const axios = require("axios")
app.get("/", (request, response) => {
const ping = new Date();
ping.setHours(ping.getHours() - 3);
console.log(`Ping recebido às ${ping.getUTCHours()}:${ping.getUTCMinutes()}:${ping.getUTCSeconds()}`);
response.sendStatus(200);
});
app.listen(process.env.PORT || 3000, () => {
setInterval(() => {
axios.get('https://HashTagBot.iiamfilippin.repl.co')
}, 25 * 60000)
})
require("dotenv").config()
client.commands = new Collection()
const commandFiles = fs.readdirSync('./comandos').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./comandos/${file}`);
client.commands.set(command.name, command);
}
client.once("ready", () => console.log("[BOT] Ligado"))
client.on('message', message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).trim().split(/ +/);
const commandName = args.shift().toLowerCase();
const command = client.commands.get(commandName)
|| client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName));
if (!command) return;
try {
client.commands.get(command.name).execute(client, message, args);
} catch (error) {
console.error(error);
message.channel.send("Ocorreu um erro ao executar este comando.")
}
});
client.on("messageUpdate", (oldMsg, newMsg) => client.emit("message", newMsg))
client.login(process.env.TOKEN)