\w* | [0-9]* | ([0-9]|,)* | ([0-9]+|Seconds?|Minutes?|"
+ r"Hours?)+ | [0-9]+")
+ needed_regex = re.compile(r" | (\w+( )?)+")
+
+ type_iter = type_regex.finditer(str(texte))
+ value_iter = value_regex.finditer(str(texte))
+ building_iter = building_regex.finditer(str(texte))
+ time_iter = time_regex.finditer(str(texte))
+ quantity_iter = quantity_regex.finditer(str(texte))
+ needed_iter = needed_regex.finditer(str(texte))
+
+ # Extract value from regex result
+ result["type"] = format_string(re.sub(r"Type ", "", str(type_iter.__next__().group(0))))
+ result["value"] = int(
+ re.sub(r"SellPrice ", "", str(value_iter.__next__().group(0))).replace(
+ ",", ""))
+ # Extract for recipe
+ try:
+ result["building"] = format_string(re.sub(
+ r"\w*iscreatedfromthisrecipe"
+ r"BuildingName | UnlockedatDepth | Cost"
+ r"ToUnlock | TimeRequired | AmountCreated | ItemsRequired | "
+ r"thead>\w*iscreatedfromthisrecipeBuildingName | UnlockedatDepth | CostToUnlock | TimeRequired | AmountCreated | ItemsRequired |
---|
\w* | [0-"
+ r"9]* | ([0-9]|,)* | ",
+ "",
+ str(time_iter.__next__().group(0))))
+ # Time:
+ time_str = time_str.replace("s", "") # remove plural
+ time_list = re.split("([0-9]+)", time_str)
+ if time_list[0] == '':
+ del time_list[0]
+ time = 0
+ for number, unit in zip(time_list[::2], time_list[1::2]):
+ if unit == "Second":
+ time += int(number)
+ elif unit == "Minute":
+ time += int(number) * 60
+ elif unit == "Hour":
+ time += int(number) * 60 * 60
+ print(time)
+
+ result["quantity"] = int(str(re.sub("\w*iscrea"
+ "tedfromthisrecipeBuild"
+ "ingName | UnlockedatDepth | CostToUnlock | TimeRequired<"
+ "/th> | AmountCreated | ItemsRequired |
---|
\w*([0-9]|,)* | ([0-9]|,)* | ([0-9]+|Seconds?"
+ "|Minutes?|Hours?)+ | ",
+ "",
+ quantity_iter.__next__().group(0))))
+ needed_text = re.sub(r" | ", "", needed_iter.__next__().group(0))
+ item_name_iter = re.finditer(r"[A-Za-z]+[0-9]+", str(needed_text))
+
+ for item_name_match, item_quantity_match in zip(item_name_iter, item_quantity_iter):
+ item_name = re.sub(r"[A-Za-z]+", "", item_quantity_match.group(0)))
+ result["needed"].update({format_string(item_name): item_quantity})
+
+
+ except StopIteration:
+ pass
+
+ return result
+
+def get_sector_info():
+ page = requests.get("https://deeptownguide.com/Items")
+ num_regex = re.compile(r"[0-9]+")
+
+
+
+def update_data(file_system):
+ items = {}
+ urls_item = get_all_item_urls()
+ for item_url in urls_item:
+ items.update({
+ format_string(re.sub("https://deeptownguide.com/Items/Details/[0-9]+/", "", item_url)): get_item_info(
+ item_url)
+ })
+ return None
+
+
+
+if __name__ == "__main__":
+ update_data()
diff --git a/requirements.txt b/requirements.txt
index ce8bf6e..1cddc73 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,13 +1,16 @@
aiohttp==3.3.2
+appdirs==1.4.3
async-timeout==3.0.0
attrs==18.1.0
cffi==1.11.5
chardet==3.0.4
-git+https://github.com/Rapptz/discord.py@rewrite#egg=discord.py
+discord.py==1.0.0a1497+g8d39ab8
+fs==2.1.0
idna==2.7
multidict==4.3.1
pycparser==2.18
+pytz==2018.5
six==1.11.0
websockets==6.0
yarl==1.2.6
-fs
+lxml
diff --git a/traductions.py b/traductions.py
index 311e333..4f53071 100644
--- a/traductions.py
+++ b/traductions.py
@@ -95,8 +95,29 @@ tr = {
},
"deeptown": {
"description": "Commandes relatives au jeu deeptown.",
- "aide": {
+ "help": {
+ "best_place_mine": {
+ "description": "Montre les meilleurs emplacements de mine pour un cerain minerais.",
+ "examples": [
+ ("`{prefix}best_place_mine iron`",
+ "Donne les meilleurs emplaceent pour le minerais de fer.")
+ ],
+ },
+ "to_make": {
+ "description": "Donne les resource nécessaires pour faire un item.",
+ "example": [
+ ("`{prefix}to_make copperNail 100`",
+ "Donne les resources pour faire 100 clous en cuivre, càd 10 copperBar."),
+ ],
+ },
+ "to_make_recursive": {
+ "description": "Donne toutes les resources nécessaires pour faire un item.",
+ "example": [
+ ("`{prefix}to_make_recursive copperNail 100`",
+ "Donne les resources pour faire 100 copperNail, càd 10 copperBar et 50 copper."),
+ ],
+ }
},
"best_place_mine": "Voici les meilleurs emplacements pour le minerais {ore}\n```\n",
"to_make": "Pour faire {quantity} {item} il faudra {time}. Il vous faudra {needed}. La valeur totale "
| | | |