Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Commit

Permalink
SpeedRank added
Browse files Browse the repository at this point in the history
Added the "rank" command to allow speedrunners to pull their specific stats in the general categories.

The new command has the form:
rank <playername> <category> <type>
playername = name in the speedrun sheet
category = 3star, 4star, 5star, or Torment (defaults to 4star)
type = overall or no-csb (defaults to overall)
  • Loading branch information
drgoonic committed Nov 19, 2018
1 parent 002a403 commit 599b7a8
Show file tree
Hide file tree
Showing 4 changed files with 401 additions and 43 deletions.
62 changes: 62 additions & 0 deletions commands/misc/speedrank.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
const {Command} = require('discord.js-commando');
const path = require('path');
speedrankPath = path.join(__dirname,
'..', '..', 'utilities', 'speedrank-utils.js');
const speedrankUtils = require('../../utilities/speedrank-utils.js');

module.exports = class ReplyCommand extends Command {
/** constructor for looking up soulbreaks.
* @param {Object} client: discord.js-commando client.
**/
constructor(client) {
super(client, {
name: 'rank',
group: 'misc',
memberName: 'speedrank',
description: 'Looks up all the entries for a given speedrunner in a specified leaderboard' +
' from the FFRecordKeeper Discord Speedrun challenge leaderboard' +
' (https://docs.google.com/spreadsheets/d/11gTjAkpm4D3uoxnYCN7ZfbiVnKyi7tmm9Vp9HvTkGpw).',
examples: ['rank EverythingIsGravy 5star', 'top 10 no-csb', 'top 5 cod', 'top 3 Maliris'],
args: [
{
key: 'name',
prompt: 'Enter the speedrunner you want to query.' +
' Make sure you use the name as it appears in the spreadsheet.',
type: 'string',
default: 'EverythingIsGravy',
},
{
key: 'category',
prompt: 'Enter the name of the category you want to look up.' +
' (Can be "5star", "4star", "3star", or "Torment" ' +
' on the chart. The default is "4star")',
type: 'string',
default: '4star',
},
{
key: 'secondaryCategory',
prompt: 'Specify if you want the overall or no-csb ranking' +
' no-csb does not apply to Torment' +
' (defaults to "overall".)',
type: 'string',
default: 'overall',
},
],
aliases: ['speedrank'],
});
}

/** trigger to run upon invocation.
* @param {Object} msg: discord.js-commando message.
* @param {Array} args: args from the user input.
* @return {Method} msg.say: string
**/
run(msg, args) {
console.log('Im in ur msg');
const {name, category, secondaryCategory} = args;
return speedrankUtils.speedrank(msg, name, category, secondaryCategory)
.catch( (err) => {
console.log('error in speedrank command:', err);
});
};
};
2 changes: 1 addition & 1 deletion ffrkbot.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const client = new Commando.Client({

client.on('ready', () => {
console.log(`Logged in as ${client.user.username}!`);
client.user.setGame(',help');
client.user.setActivity(',help');
});

client.registry
Expand Down
77 changes: 35 additions & 42 deletions package-lock.json

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

Loading

0 comments on commit 599b7a8

Please sign in to comment.