From eed0b60346f061f01502768a6318085169f6101e Mon Sep 17 00:00:00 2001 From: Luke Robles Date: Mon, 2 Oct 2023 07:47:39 -0700 Subject: [PATCH] Reduce api usage and hardcode the list of commodoties --- app/cogs/star_citizen.py | 98 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 91 insertions(+), 7 deletions(-) diff --git a/app/cogs/star_citizen.py b/app/cogs/star_citizen.py index 77da3b62..d3e808d0 100644 --- a/app/cogs/star_citizen.py +++ b/app/cogs/star_citizen.py @@ -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(