Merge branch 'dev' into 'main'
Fix dbrand embeds See merge request stark-industries/jarvis/jarvis-bot!65
This commit is contained in:
commit
46dda826f7
3 changed files with 16 additions and 14 deletions
|
@ -77,11 +77,11 @@ class Jarvis(Client):
|
||||||
self.phishing_domains = []
|
self.phishing_domains = []
|
||||||
self.pre_run_callback = self._prerun
|
self.pre_run_callback = self._prerun
|
||||||
|
|
||||||
@Task.create(IntervalTrigger(days=1))
|
@Task.create(IntervalTrigger(hours=1))
|
||||||
async def _update_domains(self) -> None:
|
async def _update_domains(self) -> None:
|
||||||
self.logger.debug("Updating phishing domains")
|
self.logger.debug("Updating phishing domains")
|
||||||
async with ClientSession(headers={"X-Identity": "Discord: zevaryx#5779"}) as session:
|
async with ClientSession(headers={"X-Identity": "Discord: zevaryx#5779"}) as session:
|
||||||
response = await session.get("https://phish.sinking.yachts/v2/recent/86415")
|
response = await session.get("https://phish.sinking.yachts/v2/recent/3700")
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
data = await response.json()
|
data = await response.json()
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,9 @@ class DbrandCog(Extension):
|
||||||
fields = None
|
fields = None
|
||||||
if data is not None and data["is_valid"] and data["shipping_available"]:
|
if data is not None and data["is_valid"] and data["shipping_available"]:
|
||||||
fields = []
|
fields = []
|
||||||
fields.append(EmbedField(data["short-name"], data["time-title"]))
|
fields.append(
|
||||||
|
EmbedField(data["carrier"] + " " + data["tier-title"], data["time-title"])
|
||||||
|
)
|
||||||
for service in data["shipping_services_available"][1:]:
|
for service in data["shipping_services_available"][1:]:
|
||||||
service_data = await self._session.get(self.api_url + dest + "/" + service["url"])
|
service_data = await self._session.get(self.api_url + dest + "/" + service["url"])
|
||||||
if service_data.status > 400:
|
if service_data.status > 400:
|
||||||
|
@ -135,7 +137,7 @@ class DbrandCog(Extension):
|
||||||
service_data = await service_data.json()
|
service_data = await service_data.json()
|
||||||
fields.append(
|
fields.append(
|
||||||
EmbedField(
|
EmbedField(
|
||||||
service_data["short-name"],
|
service_data["carrier"] + " " + service_data["tier-title"],
|
||||||
service_data["time-title"],
|
service_data["time-title"],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -151,20 +151,20 @@ async def update(bot: "Client") -> Optional[UpdateResult]:
|
||||||
for module in current_commands.keys():
|
for module in current_commands.keys():
|
||||||
if module not in new_commands:
|
if module not in new_commands:
|
||||||
logger.debug("Module %s removed after update", module)
|
logger.debug("Module %s removed after update", module)
|
||||||
bot.drop_cog(module)
|
bot.unload_extension(module)
|
||||||
unloaded.append(module)
|
unloaded.append(module)
|
||||||
|
|
||||||
logger.debug("Checking for new/modified commands")
|
logger.debug("Checking for new/modified commands")
|
||||||
for module, commands in new_commands.items():
|
for module, commands in new_commands.items():
|
||||||
logger.debug("Processing %s", module)
|
logger.debug("Processing %s", module)
|
||||||
if module not in current_commands:
|
if module not in current_commands:
|
||||||
bot.load_cog(module)
|
bot.load_extension(module)
|
||||||
loaded.append(module)
|
loaded.append(module)
|
||||||
elif len(current_commands[module]) != len(commands):
|
elif len(current_commands[module]) != len(commands):
|
||||||
try:
|
try:
|
||||||
bot.reload_cog(module)
|
bot.reload_extension(module)
|
||||||
except ExtensionNotFound:
|
except ExtensionNotFound:
|
||||||
bot.load_cog(module)
|
bot.load_extension(module)
|
||||||
reloaded.append(module)
|
reloaded.append(module)
|
||||||
else:
|
else:
|
||||||
for command in commands:
|
for command in commands:
|
||||||
|
@ -187,23 +187,23 @@ async def update(bot: "Client") -> Optional[UpdateResult]:
|
||||||
# Check if number arguments have changed
|
# Check if number arguments have changed
|
||||||
if len(old_args) != len(new_args):
|
if len(old_args) != len(new_args):
|
||||||
try:
|
try:
|
||||||
bot.reload_cog(module)
|
bot.reload_extension(module)
|
||||||
except ExtensionNotFound:
|
except ExtensionNotFound:
|
||||||
bot.load_cog(module)
|
bot.load_extension(module)
|
||||||
reloaded.append(module)
|
reloaded.append(module)
|
||||||
elif any(x not in old_arg_names for x in new_arg_names) or any(
|
elif any(x not in old_arg_names for x in new_arg_names) or any(
|
||||||
x not in new_arg_names for x in old_arg_names
|
x not in new_arg_names for x in old_arg_names
|
||||||
):
|
):
|
||||||
try:
|
try:
|
||||||
bot.reload_cog(module)
|
bot.reload_extension(module)
|
||||||
except ExtensionNotFound:
|
except ExtensionNotFound:
|
||||||
bot.load_cog(module)
|
bot.load_extension(module)
|
||||||
reloaded.append(module)
|
reloaded.append(module)
|
||||||
elif any(new_args[idx].type != x.type for idx, x in enumerate(old_args)):
|
elif any(new_args[idx].type != x.type for idx, x in enumerate(old_args)):
|
||||||
try:
|
try:
|
||||||
bot.reload_cog(module)
|
bot.reload_extension(module)
|
||||||
except ExtensionNotFound:
|
except ExtensionNotFound:
|
||||||
bot.load_cog(module)
|
bot.load_extension(module)
|
||||||
reloaded.append(module)
|
reloaded.append(module)
|
||||||
|
|
||||||
return UpdateResult(
|
return UpdateResult(
|
||||||
|
|
Loading…
Add table
Reference in a new issue