-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
76 lines (61 loc) · 2.19 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const Discord = require('discord.js');
const firebase = require('firebase')
const client = new Discord.Client({ intents: [1, 512, 32768, 2, 128] })
const config = require('./config.json');
const token = config.token;
client.on('messageCreate', message =>{
const embed_mencao = new Discord.EmbedBuilder()
.setTitle("Template Bot")
.setColor("BLUE")
.setDescription(`Hello ${message.author} How are you? I'm a simple Discord bot **[/]**, my owner name is **crow_ler** To see my commands type /help`)
.setImage("") //gif or photo if you want
if(message.content === `<@${client.user.id}>` || message.content === `<@!${client.user.id}>`){
return message.channel.send({embeds: [embed_mencao]})
}
})
const { initializeApp } = require("firebase/app") ;
const firebaseConfig = {
apiKey: "",
authDomain: "",
databaseURL: "",
projectId: "",
storageBucket: "",
messagingSenderId: "",
appId: "",
measurementId: ""
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
let database = firebase.database()
const fs = require("fs");
const { readdirSync } = require('fs');
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const path = require('path');
require('colors');
client.commands = new Discord.Collection();
client.slash = new Discord.Collection();
client.aliases = new Discord.Collection();
const commands = []
readdirSync("./slash/").map(async dir => {
readdirSync(`./slash/${dir}/`).map(async (cmd) => {
commands.push(require(path.join(__dirname, `./slash/${dir}/${cmd}`)))
})
})
const rest = new REST({ version: "9" }).setToken(token);
(async () => {
try {
console.log('Start update commands!'.yellow);
await rest.put(
Routes.applicationGuildCommands(config.botID, config.serverID),
{ body: commands },
);
console.log('Update finished'.green);
} catch (error) {
console.error(error);
}
})();
["events", "slash"].forEach(handler => {
require(`./handlers/${handler}`)(client);
});
client.login(config.token);