1.1.0 • Published 3 years ago
discord-shooter v1.1.0
Shooter Class Documentation
The Shooter class is a TypeScript class that extends the built-in Events module. It contains methods to simulate a shooting game between two Discord guild members.
Constructor
The constructor method initializes an instance of the Shooter class with the following parameters:
opponent: A required parameter of typeGuildMemberrepresenting the opponent in the game.fighter: A required parameter of typeGuildMemberrepresenting the fighter in the game.interaction: An optional parameter of typeCommandInteractionrepresenting the interaction object if the game is played via a Discord slash command.message: An optional parameter of typeMessagerepresenting the message object if the game is played via a Discord message.boost: A required parameter of typebooleanindicating if the player has a boost in the game.isSlash: An optional parameter of typebooleanindicating if the game is played via a Discord slash command. Default value isfalse.major: An optional parameter of typestringrepresenting the major of the fighter. Default value is"Lt Yung".
Methods
send(content: string): Promise<void>
This method sends a message to the channel where the game was initiated. It takes in one required parameter:
content: A string representing the content of the message to be sent.
Returns a Promise that resolves to void.
start(): Promise<void>
This method simulates the shooting game between the two players and sends a message indicating the winner. It generates random numbers to determine the winner based on the odds of winning determined by the boost parameter.
Returns a Promise that resolves to void.
Properties
The Shooter class has the following properties:
opponent: A readonly property of typeGuildMemberrepresenting the opponent in the game.fighter: A readonly property of typeGuildMemberrepresenting the fighter in the game.interaction: A readonly property of typeCommandInteractionorundefinedrepresenting the interaction object if the game is played via a Discord slash command.message: A readonly property of typeMessageorundefinedrepresenting the message object if the game is played via a Discord message.boost: A readonly property of typebooleanindicating if the player has a boost in the game.isSlash: A readonly property of typebooleanindicating if the game is played via a Discord slash command.major: An optional readonly property of typestringrepresenting the major of the fighter. Default value is"Lt Yung".