This repository has been archived by the owner on Oct 28, 2022. It is now read-only.
forked from Prodigy-Hacking/Reviewer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
30 changed files
with
644 additions
and
56 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
const Discord = require("discord.js"); | ||
const fs = require("fs"); | ||
const Perks = require("../utils/perks.js"); | ||
const devsio = require('../utils/devsio.js'); | ||
const colors = require("../colors.json"); | ||
const botsettings = require("../botsettings.json"); | ||
const prefix = botsettings.prefix; | ||
|
||
module.exports.run = async (bot, message, args) => { | ||
const member = message.guild.member(message.mentions.members.first() || args[0]); | ||
const confirmationEmbed = new Discord.RichEmbed() | ||
.setAuthor("Reviewer -", bot.avatarURL) | ||
.setTitle("SUCCESS") | ||
.setDescription("This user is now a bug hunter! :tada:") | ||
.setColor(colors.valid) | ||
|
||
message.delete() | ||
|
||
if(!member) return error(`ERROR: Incorrect usage. You must specify the member to add as a bug hunter. Correct Usage: \`${prefix}addbughunter bug_hunter\``); | ||
|
||
devsio.readdevs(devs => { | ||
if(!devs.includes(message.author.id)) return error("ERROR: Missing Permissions. You are not allowed to run this command.") | ||
fs.readFile("./bughuntertracker.json", "utf8", async (err, data) => { | ||
if(err) return console.error(err); | ||
const bughunterArr = await JSON.parse(data); | ||
const bughunter = bughunterArr.find(bughunter => bughunter.id === member.id); | ||
if(!bughunter) | ||
bughunterArr.push({id: member.id, tokens: 0, tier: 0, perks: new Perks()}) | ||
else return error("ERROR: This user is already a bug hunter"); | ||
const bughunterJSON = JSON.stringify(bughunterArr); | ||
fs.writeFile("./bughuntertracker.json", bughunterJSON, "utf8", err => { | ||
if(err) console.error(err); | ||
}); | ||
message.channel.sendEmbed(confirmationEmbed).then(msg => msg.delete(5000)); | ||
}); | ||
}); | ||
|
||
// Error Handler | ||
|
||
function error(errorMessage) { | ||
const errorEmbed = new Discord.RichEmbed() | ||
.setAuthor("Reviewer -", bot.avatarURL) | ||
.setTitle("ERROR") | ||
.setDescription(`${errorMessage}\nBug Hunter Addition process halted. Please run the command again to restart.`) | ||
.setColor(colors.error); | ||
message.channel.send(errorEmbed).then(msg => { | ||
message.delete(0); | ||
msg.delete(10000); | ||
}); | ||
} | ||
} | ||
module.exports.help = { | ||
name: "addbughunter", | ||
description:"Adds a bug hunter." | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
const Discord = require("discord.js"); | ||
const fs = require("fs"); | ||
const Perks = require("../utils/perks.js") | ||
const colors = require("../colors.json"); | ||
const botsettings = require("../botsettings.json"); | ||
const storeJSON = require("../store.json"); | ||
const prefix = botsettings.prefix; | ||
const bugHunterRoleID = botsettings.roleid_bughunter; | ||
|
||
const perksPath = "../utils/Perks/"; | ||
|
||
/** | ||
* | ||
* @param {Discord.Client} bot | ||
* @param {Discord.TextChannel} channel | ||
*/ | ||
module.exports.run = async (bot, message, args) => { | ||
let channel = message.channel; | ||
let member = message.author; | ||
let item = args.slice(0).join(" "); | ||
let storeItems = {}; | ||
Object.entries(storeJSON).forEach(([key, val]) => storeItems[key.split("_").map(perk => perk.charAt(0).toUpperCase() + perk.slice(1)).join(" ")] = val); | ||
|
||
if(!item) return error(`ERROR: Incorrect usage. Please specify an item to buy using: \`${prefix}buy Item_Name\`. If you are unsure of this item's name, you can use \`${prefix}store\` to check it.`) | ||
item = item.split(" ").map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(" "); | ||
if(!(storeItems.hasOwnProperty(item) || item.startsWith("Color Roles"))) return error(`ERROR: Incorrect usage. Could not find an item with the name of \`${item}\`. If you are unsure of this item's name, you can use \`${prefix}store\` to check it.`) | ||
|
||
const tierColors = [colors.tier0, colors.tier1, colors.tier2, colors.tier3, colors.tier4, colors.tier5] | ||
const tierRomanNumerals = ["I", "II", "III", "IV", "V"] | ||
// Get user info | ||
fs.readFile("./bughuntertracker.json", "utf8", async (err, data) => { | ||
if(err) return console.error(err); | ||
const bugHunterArr = JSON.parse(data); | ||
const bugHunter = bugHunterArr.find(bughunter => bughunter.id === member.id); | ||
if(bugHunter) { | ||
const storeItem = storeItems[item] || storeItems["Color Roles"]; | ||
if(bugHunter.tokens < storeItem.tokens) return error(`ERROR: You do not have enough tokens to buy this item, you need \`${storeItem.tokens - bugHunter.tokens}\` more Bug Token.`); | ||
try { | ||
if(item.startsWith("Color Roles")) { | ||
const perkUnlockResponse = await buyColorRole(args[2]); | ||
if(perkUnlockResponse !== true) return error(perkUnlockResponse); | ||
} else { | ||
const perk = require(`${perksPath + item}.js`) | ||
const perkUnlockResponse = perk.unlock(channel.guild, bugHunter); | ||
if(perkUnlockResponse !== true) return error(perkUnlockResponse); | ||
} | ||
bugHunter.tokens -= storeItem.tokens; | ||
} catch (err) { | ||
return error(`ERROR: This item has not been implemented: \`(${err})\``) | ||
} | ||
} else return error("ERROR: Only Bug Hunters can use the store! If you would like to become a bug hunter, check out the <#711987145392390254> channel."); | ||
const bugHunterJSON = JSON.stringify(bugHunterArr); | ||
fs.writeFile("./bughuntertracker.json", bugHunterJSON, "utf8", err => { | ||
if(err) { | ||
console.error(err); | ||
return error(`ERROR: Write to database failed. Please send the following message to Whimpers: (${err})`); | ||
} | ||
}); | ||
const confirmationEmbed = new Discord.RichEmbed() | ||
.setAuthor("Reviewer -", bot.avatarURL) | ||
.setTitle("SUCCESS") | ||
.setDescription("Your purchase was successfull! :tada:") | ||
.setColor(colors.valid); | ||
channel.sendEmbed(confirmationEmbed).then(msg => msg.delete(5000)); | ||
}); | ||
|
||
message.delete(0); | ||
|
||
async function buyColorRole(color) { | ||
if(!color) return `ERROR: Incorrect Usage. Please specify a color. Correct usage: \`${prefix}buy Color Roles color\``; | ||
if(!(/^#[0-9A-Fa-f]{6}$/).test(color)) return "ERROR: Color must be in a hex format. Example: #f00ba7"; | ||
const bugHunterRole = message.guild.roles.find(r => r.id === bugHunterRoleID); | ||
const colorRole = await channel.guild.createRole({ | ||
name: color, | ||
color: color, | ||
position: bugHunterRole.position | ||
}) | ||
message.guild.member(member).addRole(colorRole) | ||
return true; | ||
} | ||
|
||
// Error Handler | ||
|
||
function error(errorMessage) { | ||
const errorEmbed = new Discord.RichEmbed() | ||
.setAuthor("Reviewer -", bot.avatarURL) | ||
.setTitle("ERROR") | ||
.setDescription(`${errorMessage}\nPurchase process halted. Please run the command again to restart.`) | ||
.setColor(colors.error); | ||
channel.send(errorEmbed).then(msg => { | ||
message.delete(0); | ||
msg.delete(10000); | ||
}); | ||
} | ||
}; | ||
|
||
|
||
module.exports.help = { | ||
name: "buy", | ||
description:"Purchases a perk from the store." | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
const Discord = require("discord.js"); | ||
const {isBugHunter} = require("../utils/isBugHunter.js") | ||
const botSettings = require("../botsettings.json"); | ||
const colors = require("../colors.json"); | ||
const prefix = botSettings.prefix; | ||
|
||
module.exports.run = async (bot, message, args) => { | ||
message.delete(); | ||
|
||
if(!(isBugHunter(message.author.id) && isBugHunter(message.author.id).embederUnlocked)) return error(`ERROR: Missing permissions. You do not have the embeder perk unlocked.`) | ||
if(args.length < 1) return error(`ERROR: Incorrect usage. You must specify a message to embed. Correct usage: \`${prefix}embed color message\``); | ||
|
||
const colorTester = args[0]; | ||
let color; | ||
let msg = args.slice(1).join(" "); | ||
|
||
if((/[0-9A-Fa-f]{6}/g).test(colorTester)) { | ||
color = colorTester; | ||
} else { | ||
msg = args.slice(0).join(" "); | ||
} | ||
|
||
let embed = new Discord.RichEmbed() | ||
.setTitle(msg) | ||
.setColor(color || colors.info) | ||
.setFooter("- " + message.author.tag) | ||
message.channel.send(embed); | ||
|
||
// Error Handler | ||
|
||
function error(errorMessage) { | ||
const errorEmbed = new Discord.RichEmbed() | ||
.setAuthor('Reviewer -', bot.avatarURL) | ||
.setTitle("ERROR") | ||
.setDescription(`${errorMessage}\nEmbeder process halted. Please run the command again to restart your report.`) | ||
.setColor(colors.error) | ||
message.channel.send(errorEmbed).then(msg => { | ||
message.delete(0) | ||
msg.delete(5000) | ||
}); | ||
} | ||
} | ||
|
||
module.exports.help = { | ||
name: "embed", | ||
description: "Creates an embed with specified message" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
const Discord = require("discord.js"); | ||
const fs = require("fs"); | ||
const Perks = require("../utils/perks.js"); | ||
const devsio = require('../utils/devsio.js'); | ||
const colors = require("../colors.json"); | ||
const botsettings = require("../botsettings.json"); | ||
const prefix = botsettings.prefix; | ||
|
||
module.exports.run = async (bot, message, args) => { | ||
const member = message.guild.member(message.mentions.members.first() || args[0]); | ||
const tokens = Number(args[1]); | ||
|
||
const confirmationEmbed = new Discord.RichEmbed() | ||
.setAuthor("Reviewer -", bot.avatarURL) | ||
.setTitle("SUCCESS") | ||
.setDescription("Tokens given! :tada:") | ||
.setColor(colors.valid) | ||
|
||
message.delete() | ||
|
||
if(!member || !tokens) return error(`ERROR: Incorrect usage. You must specify the bug hunter and the amount of tokens you want to give. Correct Usage: \`${prefix}givetokens bug_hunter token_count\``); | ||
|
||
devsio.readdevs(devs => { | ||
if(!devs.includes(message.author.id)) return error("ERROR: Missing Permissions. You are not allowed to run this command.") | ||
fs.readFile("./bughuntertracker.json", "utf8", (err, data) => { | ||
if(err) return console.error(err); | ||
const bughunterArr = JSON.parse(data); | ||
const bughunter = bughunterArr.find(bughunter => bughunter.id === member.id); | ||
if(!bughunter) | ||
bughunterArr.push({id: member.id, tokens: tokens, tier: 0, perks: new Perks()}) | ||
else bughunter.tokens += tokens; | ||
const bughunterJSON = JSON.stringify(bughunterArr); | ||
fs.writeFile("./bughuntertracker.json", bughunterJSON, "utf8", err => { | ||
if(err) console.error(err); | ||
}); | ||
message.channel.sendEmbed(confirmationEmbed).then(msg => msg.delete(5000)); | ||
}); | ||
}); | ||
|
||
// Error Handler | ||
|
||
function error(errorMessage) { | ||
const errorEmbed = new Discord.RichEmbed() | ||
.setAuthor("Reviewer -", bot.avatarURL) | ||
.setTitle("ERROR") | ||
.setDescription(`${errorMessage}\nToken addition process halted. Please run the command again to restart.`) | ||
.setColor(colors.error); | ||
message.channel.send(errorEmbed).then(msg => { | ||
message.delete(0); | ||
msg.delete(10000); | ||
}); | ||
} | ||
} | ||
module.exports.help = { | ||
name: "givetokens", | ||
description:"Gives tokens a bug hunter." | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
const Discord = require('discord.js'); | ||
const {isBugHunter} = require("../utils/isBugHunter.js") | ||
const colors = require("../colors.json"); | ||
const takeOff = new Discord.Attachment("./assets/takeOff.jpeg", "takeOff.jpeg"); | ||
const launchSuccess = new Discord.Attachment("./assets/launchSuccess.gif", "launchSuccess.gif"); | ||
const launchFail = new Discord.Attachment("./assets/launchFail.gif", "launchFail.gif"); | ||
|
||
module.exports.run = async (bot, message, args) => { | ||
const user = message.mentions.users.first() || message.author; | ||
const randomNumber = Math.round(Math.random()); | ||
|
||
message.delete() | ||
if(!(isBugHunter(message.author.id) && isBugHunter(message.author.id).launcherUnlocked)) return error(`ERROR: Missing permissions. You do not have the launcher perk unlocked.`) | ||
|
||
const launchEmbed = new Discord.RichEmbed() | ||
.setAuthor('Reviewer -', bot.avatarURL) | ||
.setTitle('LAUNCH') | ||
|
||
if(randomNumber) { | ||
launchEmbed.addField(`${user.username} was launched into space by ${message.author.username}!`, `${user.username}'s rocket flew to space!`); | ||
launchEmbed.attachFile(launchSuccess) | ||
launchEmbed.setImage("attachment://launchSuccess.gif"); | ||
launchEmbed.setColor(colors.valid) | ||
} else { | ||
launchEmbed.addField(`${user.username} was launched into space by ${message.author.username}!`, `${user.username}'s rocket blew up!`); | ||
launchEmbed.attachFile(launchFail) | ||
launchEmbed.setImage("attachment://launchFail.gif"); | ||
launchEmbed.setColor(colors.error) | ||
} | ||
|
||
message.channel.sendEmbed(launchEmbed) | ||
|
||
// Error Handler | ||
|
||
function error(errorMessage) { | ||
const errorEmbed = new Discord.RichEmbed() | ||
.setAuthor("Reviewer -", bot.avatarURL) | ||
.setTitle("ERROR") | ||
.setDescription(`${errorMessage}\nLauncher process halted. Please run the command again to restart.`) | ||
.setColor(colors.error); | ||
message.channel.send(errorEmbed).then(msg => { | ||
msg.delete(10000); | ||
}); | ||
} | ||
} | ||
|
||
module.exports.help = { | ||
name: "launch", | ||
description:"Launch someone into space!" | ||
} |
Oops, something went wrong.