-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
82 lines (50 loc) · 1.87 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
77
78
79
80
81
82
const chalk = require(`chalk`);
const express = require(`express`);
const app = express();
const axios = require('axios');
const path = require("path");
const Nuggies = require('nuggies');
let port = 3000 || 3001
app.listen(port, () => {
// process.exit()
console.log(chalk.bgBlueBright("WebServer Ready!"))
})
app.get('/', (req, res) => {
res.send(`Online Yoooooooo`)
// res.render('pages/home')
})
app.set("view engine", "ejs")
const { Client, Collection, MessageEmbed } = require("discord.js");
const client = new Client({
intents: 32767,
// restTimeOffset: 0,
disableMentions: "all"
});
Nuggies.handleInteractions(client);module.exports = client;
// Global Variables
client.commands = new Collection();
client.slashCommands = new Collection();
client.config = require("./config.json");
client.snipes = new Collection()
// Initializing the project
require("./handler")(client);
//VOTE---------------
const Topgg = require('@top-gg/sdk')
const db = require('quick.db')
client.db = db;
const webhook = new Topgg.Webhook(process.env.webhookPW)
app.post('/vote', webhook.middleware(), (req, res) => {
console.log(req.vote)
const voteCnt = client.db.add(`${req.vote.user}_votes`, 1)
const voteEmbed = new MessageEmbed()
.setTitle(`I Just Got A Vote!`)
.setDescription(`<@${req.vote.user}> (${req.vote.user}) Just Voted Me!\nThey Now Have ${voteCnt} Votes! ❤️`)
.setColor(client.config.color)
.setFooter(`https://top.gg/bot/900248756329512990/vote`)
const e = client.db.fetch(`${req.vote.user}_vote`)
const user = client.users.cache.get(req.vote.user);
user.send(`Thanks For Voting Me!\nJoin https://discord.gg/aN2W6GP2kd To Check How many Votes you have in <#902735823039000626>`)
client.channels.cache.get('902735823039000626').send({embeds: [voteEmbed]})
})
//-----------------
client.login(client.config.token)