added bulk command to bulk deliver.
This commit is contained in:
parent
ec4d294539
commit
0f05b7ea93
|
|
@ -118,6 +118,67 @@ class IdaCogs(commands.Cog):
|
|||
channel = self.bot.get_channel(self.debugChannel)
|
||||
await channel.send(f"{author} generated the following exception : {traceback.format_exc()}")
|
||||
|
||||
## bulk delivery
|
||||
|
||||
@option("commodity",required=True,
|
||||
description = "The Commodity you want to deliver",
|
||||
choices = [
|
||||
"Aluminium",
|
||||
"Ceramic Composites",
|
||||
"CMM Composite",
|
||||
"Computer Components",
|
||||
"Copper",
|
||||
"Food Cartridges",
|
||||
"Fruit and Vegetables",
|
||||
"Insulating Membrane",
|
||||
"Liquid Oxygen",
|
||||
"Medical Diagnostic Equipment",
|
||||
"Non-Lethal Weapons",
|
||||
"Polymers",
|
||||
"Power Generators",
|
||||
"Semiconductors",
|
||||
"Steel",
|
||||
"Superconductors",
|
||||
"Titanium",
|
||||
"Water",
|
||||
"Water Purifiers"
|
||||
])
|
||||
|
||||
@option("quantity",required=True,
|
||||
description="Please be nice and input a value between 1 and 25000",
|
||||
type=int, min_value=1, max_value=25000)
|
||||
@option("target", required=True,
|
||||
description="Are you delivering to a carrier or the target station?",
|
||||
type=str, choices=['Station', 'Carrier'])
|
||||
|
||||
async def bulk(self, ctx,commodity, quantity,target):
|
||||
|
||||
author = str(ctx.author)
|
||||
author = author[:author.find(" ")]
|
||||
|
||||
await ctx.defer()
|
||||
|
||||
data = {
|
||||
"postType":"delivery",
|
||||
"username":author,
|
||||
"commodity": commodity,
|
||||
"quantity": quantity,
|
||||
"target": target
|
||||
}
|
||||
|
||||
try:
|
||||
response = await helpers.postToSheet(self.session, data, self.gsheetToken)
|
||||
if response == 200:
|
||||
await ctx.followup.send(f"your delivery of {quantity} of {commodity} to a {target} has been added to the sheet!")
|
||||
print(f"[{datetime.isoformat(datetime.now())}]{author} delivery of {quantity} of {commodity} to a {target}")
|
||||
await helpers.writeDeliveryToCommandFile(author, data)
|
||||
else:
|
||||
await ctx.followup.send(f"Google returned an error. (HTTP {response}). But your delivery may have gone through. Maybe. Maybe not? who knows? Not fucking Google apparently. ")
|
||||
|
||||
except Exception as e:
|
||||
await ctx.followup.send(f"Something broke. Why do you keep breaking the bot, uh? :(")
|
||||
channel = self.bot.get_channel(self.debugChannel)
|
||||
await channel.send(f"{author} generated the following exception : {traceback.format_exc()}")
|
||||
|
||||
|
||||
# delivery command for misc commodity only
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user