Merge pull request 'dev-prodId' (#2) from dev-prodId into main
Reviewed-on: #2
This commit is contained in:
commit
bc25ae71b3
|
|
@ -3,6 +3,7 @@ from discord import option
|
||||||
from discord.ext import commands, tasks
|
from discord.ext import commands, tasks
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import helpers
|
import helpers
|
||||||
|
import traceback
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
class IdaCogs(commands.Cog):
|
class IdaCogs(commands.Cog):
|
||||||
|
|
@ -112,7 +113,9 @@ class IdaCogs(commands.Cog):
|
||||||
else:
|
else:
|
||||||
await ctx.followup.send(f"Failed to log delivery (HTTP {response}). Please contact the yellow people if that keeps happening")
|
await ctx.followup.send(f"Failed to log delivery (HTTP {response}). Please contact the yellow people if that keeps happening")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
await ctx.followup.send(f"help : Error: {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()}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -156,6 +159,7 @@ class IdaCogs(commands.Cog):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@discord.slash_command(
|
@discord.slash_command(
|
||||||
name="last",
|
name="last",
|
||||||
# guild_ids=[401372086746087425],
|
# guild_ids=[401372086746087425],
|
||||||
|
|
@ -286,9 +290,9 @@ class IdaCogs(commands.Cog):
|
||||||
|
|
||||||
#writes to the whats left to haul channel ever 60 seconds about.. the stuff left to haul.
|
#writes to the whats left to haul channel ever 60 seconds about.. the stuff left to haul.
|
||||||
#also updates the current commodity List
|
#also updates the current commodity List
|
||||||
@tasks.loop(seconds=60)
|
@tasks.loop(seconds=120)
|
||||||
async def writeToWhatsLeftToHaul(self):
|
async def writeToWhatsLeftToHaul(self):
|
||||||
|
try:
|
||||||
|
|
||||||
response = await helpers.getFromSheet(self.session, self.gsheetToken, "commodity")
|
response = await helpers.getFromSheet(self.session, self.gsheetToken, "commodity")
|
||||||
|
|
||||||
|
|
@ -343,7 +347,7 @@ class IdaCogs(commands.Cog):
|
||||||
embed2.add_field(name=key, value=str(progressDict[key]), inline=True)
|
embed2.add_field(name=key, value=str(progressDict[key]), inline=True)
|
||||||
|
|
||||||
|
|
||||||
embed2.set_footer(text="This message updates every 60 seconds(ish). Last updated")
|
embed2.set_footer(text="This message updates every 120 seconds(ish). Last updated")
|
||||||
embed.set_author(name=u'\U0001F517 ' + self.stationName + u' \U0001F517',
|
embed.set_author(name=u'\U0001F517 ' + self.stationName + u' \U0001F517',
|
||||||
url=self.stationUrl)
|
url=self.stationUrl)
|
||||||
embed2.set_author(name=u'\U0001F517 ' + self.stationName + u' \U0001F517',
|
embed2.set_author(name=u'\U0001F517 ' + self.stationName + u' \U0001F517',
|
||||||
|
|
@ -361,13 +365,17 @@ class IdaCogs(commands.Cog):
|
||||||
if not found:
|
if not found:
|
||||||
await channel.send(embeds=[embed, embed2])
|
await channel.send(embeds=[embed, embed2])
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print("Something bad happened in the whatlefttohaul function :(")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#writes the carriers state to... the carrier state channel. Seriously, who is writing this?
|
#writes the carriers state to... the carrier state channel. Seriously, who is writing this?
|
||||||
@tasks.loop(seconds=60)
|
@tasks.loop(seconds=120)
|
||||||
async def writeTocarrierState(self):
|
async def writeTocarrierState(self):
|
||||||
|
try:
|
||||||
response = await helpers.getInternalCarrierState(self.session, self.gsheetToken)
|
response = await helpers.getInternalCarrierState(self.session, self.gsheetToken)
|
||||||
carrierState = await helpers.parseCarrierState(response)
|
carrierState = await helpers.parseCarrierState(response)
|
||||||
|
|
||||||
|
|
@ -381,7 +389,7 @@ class IdaCogs(commands.Cog):
|
||||||
embed.set_author(name=u'\U0001F517 ' + self.stationName + u' \U0001F517',
|
embed.set_author(name=u'\U0001F517 ' + self.stationName + u' \U0001F517',
|
||||||
url=self.stationUrl)
|
url=self.stationUrl)
|
||||||
|
|
||||||
embed.set_footer(text="This message updates every 60 seconds(ish). Last updated")
|
embed.set_footer(text="This message updates every 120 seconds(ish). Last updated")
|
||||||
|
|
||||||
for carrier, state in carrierState.items():
|
for carrier, state in carrierState.items():
|
||||||
embed.add_field(name=carrier, value=state, inline=True)
|
embed.add_field(name=carrier, value=state, inline=True)
|
||||||
|
|
@ -395,6 +403,8 @@ class IdaCogs(commands.Cog):
|
||||||
break
|
break
|
||||||
if not found:
|
if not found:
|
||||||
await channel.send(embed=embed)
|
await channel.send(embed=embed)
|
||||||
|
except Exception as e:
|
||||||
|
print("Something bad happened in the carrierState function :(")
|
||||||
|
|
||||||
def setup(bot): # this is called by Pycord to setup the cog
|
def setup(bot): # this is called by Pycord to setup the cog
|
||||||
bot.add_cog(IdaCogs(bot)) # add the cog to the bot
|
bot.add_cog(IdaCogs(bot)) # add the cog to the bot
|
||||||
Loading…
Reference in New Issue
Block a user