Skip to content

Commit

Permalink
fix: change names to better conform
Browse files Browse the repository at this point in the history
- utils.py -> misc.py
- src/ -> utils/
- modify py files in consequence
- add download links and improve version grabbing to skyblock mods command
  • Loading branch information
Zalk0 committed Dec 13, 2023
1 parent 3f9d149 commit 9d947ac
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 12 deletions.
2 changes: 1 addition & 1 deletion commands/utils.py → commands/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import discord
from discord import app_commands

from src.latex_render import latex_render
from utils.latex_render import latex_render

if TYPE_CHECKING:
from bot import ChouetteBot
Expand Down
42 changes: 33 additions & 9 deletions commands/skyblock.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from __future__ import annotations

import re
from datetime import datetime, timezone
from typing import TYPE_CHECKING

import aiohttp
import discord
from discord import app_commands

from src.skyblock_guild import check
from utils.skyblock_guild import check

if TYPE_CHECKING:
from bot import ChouetteBot
Expand Down Expand Up @@ -35,23 +36,46 @@ async def mods(self, interaction: discord.Interaction[ChouetteBot]):
) as response:
dungeonsguide = await response.json()
async with session.get(
f"{api_github}Moulberry/NotEnoughUpdates/releases/latest"
f"{api_github}NotEnoughUpdates/NotEnoughUpdates/releases"
) as response:
notenoughupdates = await response.json()
async with session.get(
f"{api_github}BiscuitDevelopment/SkyblockAddons/releases/latest"
f"{api_github}Fix3dll/SkyblockAddons/contents/gradle.properties",
headers={"Accept": "application/vnd.github.raw"},
) as response:
skyblockaddons = await response.json()
content = await response.text()
sba_version = re.search(
r"^version\s?=\s?(.*)$", content, re.MULTILINE
)
async with session.get(
f"{api_github}Fix3dll/SkyblockAddons/actions/runs"
) as response:
content = await response.json()
for run in content["workflow_runs"]:
if run["head_branch"] == "main":
skyblockaddons = (
f"{sba_version.group(1)}+{run['run_number']}"
)
artifact_url = run["artifacts_url"]
check_id = run["check_suite_id"]
break
async with session.get(artifact_url) as response:
resp = await response.json()
artifact_id = resp["artifacts"][0]["id"]
async with session.get(
f"{api_github}Skytils/SkytilsMod/releases/latest"
) as response:
skytils = await response.json()
await interaction.followup.send(
f"The latest releases are :\n"
f"Dungeons Guide : `{dungeonsguide['name'].replace('v', '')}`\n"
f"Not Enough Updates : `{notenoughupdates['name']}`\n"
f"SkyblockAddons : `{skyblockaddons['name'].replace('Patch v', '')}`\n"
f"Skytils : `{skytils['name'].replace('Skytils ', '')}`"
f"The latest releases are:\n"
f"- Dungeons-Guide: `{dungeonsguide['tag_name']}` "
f"[link]({dungeonsguide['assets'][0]['browser_download_url']})\n"
f"- NotEnoughUpdates: `{notenoughupdates[0]['tag_name'].replace('v', '')}` "
f"[link]({notenoughupdates[0]['assets'][0]['browser_download_url']})\n"
f"- SkyblockAddons (forked by Fix3dll): `{skyblockaddons}` "
f"[link](https://github.com/Fix3dll/SkyblockAddons/suites/{check_id}/artifacts/{artifact_id})\n"
f"- Skytils: `{skytils['tag_name'].replace('v', '')}` "
f"[link]({skytils['assets'][0]['browser_download_url']})"
)

# Make a command to check if it's raining in Spider's Den in Hypixel Skyblock
Expand Down
2 changes: 1 addition & 1 deletion commands_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import discord

from commands.admin import whisper
from commands.misc import latex, die_roll, ping, cheh, pin, delete
from commands.skyblock import Skyblock
from commands.utils import latex, die_roll, ping, cheh, pin, delete

if TYPE_CHECKING:
from bot import ChouetteBot
Expand Down
2 changes: 1 addition & 1 deletion responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import discord
from discord.abc import Messageable

from src.latex_render import latex_process
from utils.latex_render import latex_process

if TYPE_CHECKING:
from bot import ChouetteBot
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 9d947ac

Please sign in to comment.