Skip to content

Commit

Permalink
vote changes and djs update
Browse files Browse the repository at this point in the history
  • Loading branch information
DiabolusGX committed Apr 5, 2021
1 parent 7a3ac47 commit 83faa64
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 48 deletions.
15 changes: 4 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"author": "Ankit Malik",
"license": "MIT",
"dependencies": {
"discord.js": "^12.5.2",
"discord.js": "github:discordjs/discord.js#3af8179878c093985c8a94ee2fd7e99d45243bda",
"dotenv": "^8.2.0",
"mongoose": "^5.11.15"
}
Expand Down
3 changes: 2 additions & 1 deletion src/commands/mod/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ module.exports = {

return message.channel.send(`${client.myEmojis[0]} | **Started Game** in ${targetChannel}`).then(msg => {
targetChannel.send(`${client.myEmojis[0]} | **Started Game**\nMin number is \`${min}\` & Max number is \`${max}\`\n`+
`You'll get **${points} Points** ${reward} for guessing the correct number.`)
`You'll get **${points} Points** ${reward} for guessing the correct number.\n`+
`Please vote the bot! It helps a lot <https://top.gg/bot/818420448131285012/vote>`)
.then(m => { if (m.pinnable) m.pin({ reason: "Game Start" }).catch(console.error); }).catch(console.error);
return message.author.send(`${client.myEmojis[0]} | Started game with random answer ||${randomAnswer}|| in ${targetChannel}`)
.catch(err => message.channel.send("Could not send game's answer to " + message.author));
Expand Down
3 changes: 2 additions & 1 deletion src/commands/user/invite.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ module.exports = {
.setColor(client.colors[0])
.setAuthor("Bot Invite Links", "https://cdn.discordapp.com/attachments/797404067432890378/797404132037361684/partying-face.png")
.setDescription(`\n**Bot invite** : \n[Default Invite](${defaultInvite})\n[Admin Invite](${adminInvite}) (recommended)` +
`\n\n__Support Server__ : \nhttps://discord.gg/8kdx63YsDf\n`)
`\n\n__Vote Link__ : \nhttps://top.gg/bot/818420448131285012/vote\n`+
`\n__Support Server__ : \nhttps://discord.gg/8kdx63YsDf\n`)
.setFooter("Checkout Booster Bot - Everything for server boosts", "https://cdn.discordapp.com/attachments/699571659635556372/782257966933344256/622857534742593536.gif")
return message.channel.send(inviteEmbed);
},
Expand Down
8 changes: 5 additions & 3 deletions src/commands/user/leaderboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ module.exports = {
value.user = key;
tempData.push(value);
});

if(!tempData.length) return message.channel.send(`${client.myEmojis[1]} | **No one won any game yet!**`)

tempData.sort((a, b) => b.points - a.points);
tempData.forEach(data => {
winners.push(`<@${data.user}> [**${data.wins}x**] with **${data.points}** Points\n`);
Expand All @@ -40,9 +43,8 @@ module.exports = {
userEmbeds[i] = new MessageEmbed()
.setColor(client.colors[0])
.setAuthor(`${message.guild.name} has ${winners.length} Winnners`, client.user.displayAvatarURL)
.setDescription(`\n${userDesc[i].substring(1)}\n`)
.setTimestamp()
.setFooter(`Total Winners - ${winners.length}`);
.setDescription(`\n${userDesc[i].substring(1)}`+
`[Please vote the bot! It helps a lot](https://top.gg/bot/818420448131285012/vote)`)
}
return paginationEmbed(message, userEmbeds, emojiList, 30000);
},
Expand Down
9 changes: 5 additions & 4 deletions src/commands/user/userinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ module.exports = {
.setColor(client.colors[0])
.setAuthor(message.member.nickname||message.author.username, message.author.displayAvatarURL({ format: "png", dynamic: true }))
.setDescription(`${target} **${target.user.tag}** (\`${target.user.id}\`)\n\n`+
`Total Wins : **${userData.wins}** 🎉\n`+
`Total Points : **${userData.points}** ⚖️`)
`Total Wins : **${userData.wins}**⁣ 🎉\n`+
`Total Points : **${userData.points}**⁣ ⚖️\n\n`+
`[Please vote the bot! It helps a lot](https://top.gg/bot/818420448131285012/vote)`)
.setThumbnail( target.user.displayAvatarURL({ format: "png", dynamic: true, size: 1024 }) )
.setFooter("Stats are maintained after user wins any game!")
//.setFooter("Stats are maintained after user wins any game!")

return message.channel.send(userInfoEmbed);
},
};
20 changes: 7 additions & 13 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
require("dotenv").config();
const { Client } = require("discord.js");
// const DBL = require("dblapi.js");
// const dbl = new DBL(process.env.DBL_TOKEN, { webhookPort: 8081, webhookAuth: "king.Dbl@07" });
const client = new Client({ intents: ["GUILDS", "GUILD_MEMBERS", "GUILD_MESSAGES"] });
const client = new Client({
messageCacheMaxSize: 10,
messageCacheLifetime: 10,
messageSweepInterval: 60,
intents: ["GUILDS", "GUILD_MEMBERS", "GUILD_MESSAGES"]
});
const registery = require("./utils/registery");

(async () => {
Expand All @@ -20,13 +23,4 @@ const registery = require("./utils/registery");
// Warning handling err catch
process.on("unhandledRejection", error => {
console.error("Unhandled promise rejection:", error);
});

// dbl.webhook.on("ready", webhook => {
// const webhookReadyEvent = require("./webhook/ready");
// return webhookReadyEvent(webhook, client, dbl);
// });
// dbl.webhook.on("vote", vote => {
// const voteEvent = require("./webhook/vote");
// return voteEvent(vote, client);
// });
});
18 changes: 4 additions & 14 deletions src/utils/answerFound.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,6 @@ module.exports = async (client, message) => {
const { answer, points } = games.get(message.channel.id);
games.delete(message.channel.id);

/*let replyMsg = guildConfig.msg;
const varMap = new Map();
varMap.set("{user}", message.author);
varMap.set("{answer}", answer);
varMap.set("{points}", points);
varMap.forEach((value, key) => {
while (replyMsg.includes(key)) {
replyMsg = replyMsg.replace(key, value);
}
});*/

const users = guildData.users;
if (users.has(message.author.id)) {
const { wins, points } = users.get(message.author.id);
Expand All @@ -43,10 +31,12 @@ module.exports = async (client, message) => {
}

if (guildConfig.dm) {
message.author.send(`${client.myEmojis[0]} | **Congratulations** 🎉\nYou guessed the correct number ||${answer}|| in ${message.channel} and won **${points} Points!**`);
message.author.send(`${client.myEmojis[0]} | **Congratulations** 🎉\nYou guessed the correct number ||${answer}|| in ${message.channel} and won **${points} Points!**\n`+
`Please vote the bot! It helps a lot <https://top.gg/bot/818420448131285012/vote>`);
}
message.channel.send(`${client.myEmojis[0]} | **Congratulations** ${message.author} 🎉\nYou guessed the correct number ||${answer}|| after total of **${guesses}** guesses!\n`+
`Also, you received **${points} Points!** ${reward}`).then(msg => {
`Also, you received **${points} Points!** ${reward}\n`+
`Please vote the bot! It helps a lot <https://top.gg/bot/818420448131285012/vote>`).then(msg => {
if (msg.pinnable) msg.pin({ reason: "win message" }).catch(console.error);
}).catch(console.error);

Expand Down

0 comments on commit 83faa64

Please sign in to comment.