add calculator help
This commit is contained in:
		
							
								
								
									
										12
									
								
								bot.py
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								bot.py
									
									
									
									
									
								
							| @@ -72,7 +72,9 @@ class BotClient(discord.Client): | ||||
|         return message.content.startswith("%") | ||||
|  | ||||
|     async def on_command(self, message: discord.Message): | ||||
|         match message.content.split(" "): | ||||
|         match re.split(" +", message.content): | ||||
|             case ["%calc?"], ["%calc", "?"]: | ||||
|                 await message.reply(content=self._help_calculate()) | ||||
|             case ["%calc", *args]: | ||||
|                 try: | ||||
|                     calc = await self._calculate(args) | ||||
| @@ -85,6 +87,14 @@ class BotClient(discord.Client): | ||||
|             case _: | ||||
|                 _log.info(f"Unrecognised command {command}") | ||||
|  | ||||
|     async def _help_calculate(self) -> str: | ||||
|         return """ | ||||
|             Run Showdown damage calculations. | ||||
|             Example format: | ||||
|             `  %calc -2 8 SpA Choice Specs Torkoal Overheat vs. 252 HP / 4+ SpD Assault Vest Abomasnow in Sun through Light Screen` | ||||
|             Supported: attacker/defender boosts, EVs, item, species; attacker ability; weather/terrain; screens. | ||||
|         """ | ||||
|  | ||||
|     async def _calculate(self, args: list[str]) -> str: | ||||
|         proc = sp.run( | ||||
|             ["node", "calc_main.js", "--"] + args, stdout=sp.PIPE, stderr=sp.PIPE | ||||
|   | ||||
		Reference in New Issue
	
	Block a user