Gacha game centered around vore.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
vore-gacha/src/commands/game/PullCommand.ts

52 lines
2.0 KiB

import {CommandContext, CommandOptionType, SlashCommand, SlashCreator} from "slash-create";
import {Chance} from "chance";
import {ChannelManager} from "../../queries/ChannelManager.js";
import {Snowflake} from "discord-api-types";
import {checkGameCommandAndRun} from "../permissions/ChannelPermissions.js";
const rand = Chance()
export class PullCommand extends SlashCommand {
readonly channelManager: ChannelManager
constructor(creator: SlashCreator, {channelManager, gameGuildIds}: {
channelManager: ChannelManager,
gameGuildIds: Snowflake[]
}) {
super(creator, {
name: "pull",
guildIDs: gameGuildIds,
description: "Pulls one or more new heroines from the ether.",
options: [
{
name: "count",
description: "The number of heroines to pull.",
required: false,
max_value: 10,
min_value: 1,
type: CommandOptionType.NUMBER,
}
]
});
this.channelManager = channelManager
}
async run(ctx: CommandContext): Promise<any> {
return checkGameCommandAndRun(ctx, this.channelManager, async () => {
const count: number = typeof ctx.options.count === "number" && ctx.options.count >= 1 && ctx.options.count <= 10 ? Math.floor(ctx.options.count) : 1
const results: string[] = []
for (let x = 0; x < count; x += 1) {
results.push(rand.weighted(["**Nicole**: D tier Predator Podcaster",
"**Herja**: C tier Viking Warrior",
"**Sharla**: B tier Skark Girl",
"**Melpomene**: A tier Muse of Tragedy",
"**Lady Bootstrap**: S tier Time Traveler"], [20, 15, 10, 5, 1]))
}
return ctx.send({
content: `_${ctx.user.mention}_, you pulled...\n \\* ${results.join("\n \\* ")}`,
ephemeral: false,
})
})
}
}