Reduce api usage and hardcode the list of commodoties

This commit is contained in:
Luke Robles 2023-10-02 07:47:39 -07:00
parent 3572e09668
commit eed0b60346

View File

@ -71,17 +71,101 @@ class StarCitizen(commands.Cog):
async def get_all_commodities(ctx: discord.AutocompleteContext):
"""
Query the API to get a list of all commodities in the game,
Then offer them as auto-complete options for the /trade function
Returns a list of commododites that can be used for autocomplete
for the /trade function.
Turning off its call to the API just to save key usage / i hear the devs
took data out of the game files so this may go away soon
"""
headers = {"api_key": os.getenv("uexcorp_key")}
# headers = {"api_key": os.getenv("uexcorp_key")}
response = requests.get(
"https://portal.uexcorp.space/api/commodities/", headers=headers
)
# response = requests.get(
# "https://portal.uexcorp.space/api/commodities/", headers=headers
# )
all_commodities = [x["name"] for x in response.json()["data"]]
# all_commodities = [x["name"] for x in response.json()["data"]]
all_commodities = [
"Agricultural Supplies",
"Agricium",
"Agricium (Ore)",
"Altruciatoxin",
"Aluminum",
"Aluminum (Ore)",
"Amioshi Plague",
"Aphorite",
"Astatine",
"Audio Visual Equipment",
"Beryl (Raw)",
"Beryl",
"Bexalite",
"Bexalite (Raw)",
"Borase",
"Borase (Ore)",
"Chlorine",
"Construction Materials",
"Compboard",
"Copper",
"Copper (Ore)",
"Corundum",
"Corundum (Raw)",
"Degnous Root",
"Diamond",
"Diamond (Ore)",
"Distilled Spirits",
"Dolivine",
"E'tam",
"Fireworks",
"Fluorine",
"Gasping Weevil Eggs",
"Genalite",
"Golden Medmon",
"Gold",
"Gold (Ore)",
"Hadanite",
"Helium",
"Hephaestanite",
"Hephaestanite (Raw)",
"Heart of the Woods",
"Hydrogen",
"Inert Materials",
"Iodine",
"Iron",
"Janalite",
"Laranite",
"Laranite (Ore)",
"Luminalia Gift",
"Maze",
"Medical Supplies",
"Neon",
"Osoian Hides",
"Party Favors",
"Pitambu",
"Processed Food",
"Prota",
"Quartz (Raw)",
"Quantainium",
"Quartz",
"Quantainium (Raw)",
"Ranta Dung",
"Recycled Material Composite",
"Red Festival Envelope",
"Revenant Pod",
"Revenant Tree Pollen",
"Stone Bug Shell",
"Scrap",
"SLAM",
"Stims",
"Sunset Berries",
"Souvenirs",
"Taranite",
"Taranite (Raw)",
"Titanium",
"Titanium (Ore)",
"Tungsten",
"Tungsten (Ore)",
"Waste",
"WiDoW",
]
return all_commodities
@commands.slash_command(