From bdfec0f9a438e363eb95d546d410aa9a091ac59b Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Mon, 19 Apr 2021 04:02:51 +0000 Subject: [PATCH] Format commands in code --- README.md | 92 +++++++++++++++++++++++++-------------------------- print_help.py | 9 +++-- 2 files changed, 52 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index db9043b..3e732cc 100644 --- a/README.md +++ b/README.md @@ -38,103 +38,103 @@ Use prefix (in this case, "1") to call to attention before giving command. (EX. These can be ran by anyone, all bots will reply -!ping - replies with "pong" +`!ping` - replies with "pong" -!echo [data] - replies with "data" +`!echo [data]` - replies with "data" -!pos - replies with position and dimension +`!pos` - replies with position and dimension -!afk - goes AFK with /afk +`!afk` - goes AFK with /afk -!unafk - goes not AFK with /afk +`!unafk` - goes not AFK with /afk -!error - raises an error +`!error` - raises an error -!inv - prints current inventory +`!inv` - prints current inventory -!time - replies with Minecraft world time +`!time` - replies with Minecraft world time -!count [id] - counts the number of items with that id +`!count [id]` - counts the number of items with that id -!loaded - replies with the current loaded area +`!loaded` - replies with the current loaded area -!players - prints the current players +`!players` - prints the current players -!players clear - clears the current player list +`!players clear` - clears the current player list -!objects - prints the current items on ground +`!objects` - prints the current items on ground -!objects clear - clears the current object list +`!objects clear` - clears the current object list -!mobs - prints the current mobs +`!mobs` - prints the current mobs -!mobs clear - clears the current mob list +`!mobs clear` - clears the current mob list -!monsters - prints the current monsters +`!monsters` - prints the current monsters -!villagers - prints the current villagers +`!villagers` - prints the current villagers -!threats - prints the dangerous monsters within 20 blocks +`!threats` - prints the dangerous monsters within 20 blocks -!threats [num] - prints the dangerous monsters within num blocks +`!threats [num]` - prints the dangerous monsters within num blocks -"zzz" or !zzz - bot does /afk to let others sleep +`"zzz" or !zzz` - bot does /afk to let others sleep -!tree - replies with the closest tree +`!tree` - replies with the closest tree -!block x y z - replies what block is at (x, y, z) +`!block x y z` - replies what block is at (x, y, z) ### Bot-specific Commands These will only run for the bot they are addressed to -1respawn - respawns the bot if it's dead +`1respawn` - respawns the bot if it's dead -1gather wood - gathers wood from the world +`1gather wood` - gathers wood from the world -1gather sand - gathers sand from the world +`1gather sand` - gathers sand from the world -1farm wood - farms wood from a certain area +`1farm wood` - farms wood from a certain area -1farm sand - farms sand from a certain area +`1farm sand` - farms sand from a certain area -1farm wart - farms netherwart from a certain area +`1farm wart` - farms netherwart from a certain area -1farm crop - farms mature crops from a certain area +`1farm crop` - farms mature crops from a certain area -1loiter - stands still but eats, sleeps, and flees +`1loiter` - stands still but eats, sleeps, and flees -1trade - sells items to villagers to get emeralds +`1trade` - sells items to villagers to get emeralds -1stop - stops the current job and resets bot +`1stop` - stops the current job and resets bot -1drop - drops the current stack its holding +`1drop` - drops the current stack its holding -1select [id] - moves item with id into main hand +`1select [id]` - moves item with id into main hand -1dump [id] - drops all items matching id +`1dump [id]` - drops all items matching id -1drain - drops all items in inventory +`1drain` - drops all items in inventory -1fill [x] [y] [z] [x] [y] [z] - fills the cuboid with the block at the first coordinate +`1fill [x] [y] [z] [x] [y] [z]` - fills the cuboid with the block at the first coordinate -1here - bot comes to your location +`1here` - bot comes to your location -1goto [x] [y] [z] - sends the bot to coordinate (x, y, z) +`1goto [x] [y] [z]` - sends the bot to coordinate (x, y, z) -1close - closes the current Minecraft window +`1close` - closes the current Minecraft window -1click [slot] [button] [mode] - clicks the current window +`1click [slot] [button] [mode]` - clicks the current window -1use - use the item it's currently holding +`1use` - use the item it's currently holding -1interact [entity id] - interacts with that entity +`1interact [entity id]` - interacts with that entity ### Authorized Commands These dangerous commands can only be ran by the bot owner -1print [expression] - replies with Python eval(expression) +`1print [expression]` - replies with Python eval(expression) -1exit - exits the program +`1exit` - exits the program diff --git a/print_help.py b/print_help.py index 79bb22d..33eeedf 100644 --- a/print_help.py +++ b/print_help.py @@ -1,4 +1,3 @@ - HELP_LINES = [] with open('game.py', 'r') as f: @@ -8,6 +7,10 @@ with open('game.py', 'r') as f: for line in HELP_LINES: - print(line) - print() + if ' - ' in line: + command, doc = line.split(' - ') + print('`{}` - {}\n'.format(command, doc)) + else: + print(line) + print()