Skip to content

Commit 8dfa4a6

Browse files
committed
Constants
1 parent 98a242c commit 8dfa4a6

File tree

7 files changed

+580
-471
lines changed

7 files changed

+580
-471
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
node_modules
2-
.github
1+
.github
2+
node_modules

examples/top-gg.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
const discord = require("discord.js");
2+
const client = discord.Client();
3+
4+
const { WebhooksManager } = require("blwebhooks");
5+
6+
// Attatch The Client and Port to the module.
7+
// The client is it attaching to the client, 80 is the port it will run on
8+
const voteClient = new WebhooksManager(client, 80);
9+
client.voteManager = voteClient;
10+
11+
voteClient.extraProtection(true);
12+
13+
voteClient.topggVoteHook("topgg", "LOADS_OF_RANDOMNESS", true);
14+
15+
// This code will run after a new vote was received from Botrix
16+
client.on("BTR-voted", async function (userID) {
17+
console.log(`${userID} Voted!`);
18+
19+
// Add role for 24 hours
20+
const guildD = client.guilds.cache.get("721282458708082713");
21+
guildD.members
22+
.fetch(userID)
23+
.catch(() => null)
24+
.then((member) => {
25+
if (!member) return;
26+
27+
member.roles.add("748340144897261660");
28+
29+
setTimeout(
30+
() => member.roles.remove("748340144897261660").catch(console.error),
31+
1000 * 60 * 60 * 24
32+
);
33+
})
34+
.catch(() => {});
35+
});

package-lock.json

Lines changed: 6 additions & 119 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"body-parser": "^1.19.0",
2121
"chalk": "^4.1.0",
2222
"cookie-parser": "^1.4.5",
23+
"deepmerge": "^4.2.2",
2324
"errorhandler": "^1.5.1",
2425
"events": "^3.2.0",
2526
"express": "^4.17.1",

0 commit comments

Comments
 (0)