This is an API wrapper for Loot Bot (https://telegra.ph/Guida-alle-LootBot-API-04-06)
pip install LootBotApi
from LootBotApi import LootBotApi
api = LootBotApi(TOKEN)
--> the token can be found using the command /token on https://t.me/lootplusbot- Call the methods from the object created above
Most of this methods will return a list of Munch objects. This means that the attributes of the result can either be accessed as dictionary keys or object attributes
get_items(rarity = None)
It returns all the items in the game, if rarity is passed it returns all the items of that rarityget_item(item)
It returns the info about a given item
print(api.get_item("Meccanismo di Ferro").id) #363
print(api.get_item(363).name) #Meccanismo di Ferro
get_history(place = "payments",limit = None,offset = None,fromPlayer = None,toPlayer = None,fromItem = None,toItem = None,both = None,fromPrice = None,toPrice = None,orderBy = "desc")
It returns the transactions with the specificied parameters
get_players()
It returns all the players of LootBotget_player(player)
It returns the info about the player
get_crafts()
It returns all the crafts in the gameget_craft_needed(item_id)
It returns the items requested to craft the itemget_craft_used(item_id)
It returns the item that you can craft using the item
items = api.get_craft_needed(363)
for item in items:
print(item.name)
#Perno
#Meccanismo di Legno
#Ferro
get_shop(shop)
It returns the infos about the shop
get_cards()
It returns all the cards in the game
get_global()
It returns the progress of the current global challenge, it's updated every hourget_info()
It returns infos about the current global challenge
get_team(team)
it returns the infos about a team
get_searches(quantity)
It returns the searches made on the bot
These methods are not natively implemented in the API but they are derived by them.
The inventory paramater excepts a dict structured like this:
{
item1: quantity,
item2: quantity,
.,
.,
.,
itemN: quantity
}
get_total_craft_points(item)
It returns the total craft points that you will get to craft the item
print(api.get_total_craft_points("Ordigno Polverizzatore")) #113
get_crafting_steps(item,num_elements=1,inventory=dict())
It returns as a list of dicts all the steps to craft a certain element (and in a certain quantity). If the inventory is passed the items already owned will not be listed.
def print_steps(steps):
for step in steps:
for elemento in step:
print(f"Crea {elemento},{step[elemento]}")
steps = api.get_crafting_steps("Scudo Punta Doppia",5)
print_steps(steps)
"""
Crea Scudo Punta Singola,3
Crea Scudo Punta Singola,2
Crea Scudo Punta Doppia,3
Crea Scudo Punta Doppia,2
"""
inventory = {"Scudo Punta Singola":2}
steps = api.get_crafting_steps("Scudo Punta Doppia",5,inventory=inventory)
print_steps(steps)
"""
Crea Scudo Punta Singola,3
Crea Scudo Punta Doppia,3
Crea Scudo Punta Doppia,2
"""
get_craft_total_needed_base_items(item,num_elements=1,inventory=dict())
It returns a dict containing the name of all the base items needed to craft a certain element (and in a certain quantity). If the inventory is passed the items already owned will not be listed.
print(api.get_craft_total_needed_base_items("Scudo Punta Tripla",2))
#{'Ambra Nera': 2, 'Materiale Affilante': 2, 'Manico': 2, 'Scaglia di Rubino': 2, 'Metallo': 2, 'Scheggia': 2, 'Nastro Adesivo': 2}
get_craft_needed_base(item_id)
It returns a list of base elements needed to craft the item
print(api.get_craft_needed_base(api.get_exact_item("Scudo Punta Tripla").id))
#[Munch({'id': 80, 'name': 'Ambra Nera', 'rarity': 'UR', 'craftable': 0}), Munch({'id': 127, 'name': 'Materiale Affilante', 'rarity': 'UR', 'craftable': 0})]
get_average_market_price(item)
It returns the average price of an item in the market as an integer
print(api.get_average_market_price("Ferro")) #37394
get_exact_item(item)
It returns the exact item searched
print(api.get_element("Carta"))
"""
[Munch({'id': 1, 'name': 'Carta', 'rarity': 'C', 'rarity_name': 'Comuni', 'value': 410, 'max_value': 205000, 'estimate': 2000, 'spread': 46, 'spread_tot': 0.116, 'craftable': 0, 'reborn': 1, 'power': 0, 'power_armor': 0, 'power_shield': 0, 'dragon_power': 0, 'critical': 0, 'craft_pnt': 0, 'cons_val': 0}), Munch({'id': 8, 'name': 'Carta Stropicciata', 'rarity': 'NC', 'rarity_name': 'Non Comuni', 'value': 810, 'max_value': 405000, 'estimate': 1237, 'spread': 44, 'spread_tot': 0.084, 'craftable': 0, 'reborn': 1, 'power': 0, 'power_armor': 0, 'power_shield': 0, 'dragon_power': 0, 'critical': 0, 'craft_pnt': 0, 'cons_val': 0}), Munch({'id': 35, 'name': 'Aereo di Carta Piccolo', 'rarity': 'NC', 'rarity_name': 'Non Comuni', 'value': 1121, 'max_value': 1121000, 'estimate': 11750, 'spread': 30, 'spread_tot': 0.001, 'craftable': 1, 'reborn': 1, 'power': 0, 'power_armor': 0, 'power_shield': 0, 'dragon_power': 0, 'critical': 0, 'craft_pnt': 0, 'cons_val': 0.1}), Munch({'id': 36, 'name': 'Aereo di Carta Grande', 'rarity': 'R', 'rarity_name': 'Rari', 'value': 1697, 'max_value': 1697000, 'estimate': 13045, 'spread': 28, 'spread_tot': 0.001, 'craftable': 1, 'reborn': 1, 'power': 0, 'power_armor': 0, 'power_shield': 0, 'dragon_power': 0, 'critical': 0, 'craft_pnt': 1, 'cons_val': 0.15}), Munch({'id': 37, 'name': 'Caccia di Carta', 'rarity': 'UR', 'rarity_name': 'Ultra Rari', 'value': 3468, 'max_value': 3468000, 'estimate': 4650, 'spread': 25, 'spread_tot': 0, 'craftable': 1, 'reborn': 1, 'power': 0, 'power_armor': 0, 'power_shield': 0, 'dragon_power': 0, 'critical': 0, 'craft_pnt': 3, 'cons_val': 0.25})]
"""
print(api.get_exact_item("Carta"))
"""
Munch({'id': 1, 'name': 'Carta', 'rarity': 'C', 'rarity_name': 'Comuni', 'value': 410, 'max_value': 205000, 'estimate': 2000, 'spread': 46, 'spread_tot': 0.116, 'craftable': 0, 'reborn': 1, 'power': 0, 'power_armor': 0, 'power_shield': 0, 'dragon_power': 0, 'critical': 0, 'craft_pnt': 0, 'cons_val': 0})
"""