Binato/server/commands/Ranking.ts

35 lines
1.2 KiB
TypeScript
Raw Permalink Normal View History

2023-09-10 12:59:22 +01:00
import Channel from "../objects/Channel";
import User from "../objects/User";
2023-10-07 13:09:10 +01:00
import { RankingMode } from "../enums/RankingMode";
2023-09-10 12:59:22 +01:00
import BaseCommand from "./BaseCommand";
2023-08-20 13:03:01 +01:00
2023-09-10 12:59:22 +01:00
export default class RankingCommand extends BaseCommand {
public readonly helpText:string = `Ranking Modes:
2023-08-20 13:03:01 +01:00
!ranking pp - Sets your ranking mode to pp
!ranking score - Sets your ranking mode to score
!ranking acc - Sets your ranking mode to accuracy`;
public readonly helpDescription:string = "Sets your prefered ranking type";
public exec(channel:Channel, sender:User, args:Array<string>) {
if (args.length === 0) {
channel.SendBotMessage("You must specify a ranking mode, use \"!help ranking\" to see the options.");
return;
}
switch (args[0].toLowerCase()) {
case "pp":
2023-10-07 13:09:10 +01:00
sender.rankingMode = RankingMode.PP;
2023-08-20 13:03:01 +01:00
channel.SendBotMessage("Set ranking mode to pp.");
break;
case "score":
2023-10-07 13:09:10 +01:00
sender.rankingMode = RankingMode.RANKED_SCORE;
2023-08-20 13:03:01 +01:00
channel.SendBotMessage("Set ranking mode to score.");
break;
case "acc":
2023-10-07 13:09:10 +01:00
sender.rankingMode = RankingMode.AVG_ACCURACY;
2023-08-20 13:03:01 +01:00
channel.SendBotMessage("Set ranking mode to accuracy.");
break;
}
sender.updateUserInfo(true);
}
}