Update constants

This commit is contained in:
JelNiSlaw 2022-12-02 23:53:29 +01:00
parent ec2fa5b4c1
commit 51857de8b4
No known key found for this signature in database
GPG key ID: EA41571A0A88E97E
3 changed files with 10 additions and 10 deletions

View file

@ -7,7 +7,7 @@ from discord.ext import commands
from .. import bot from .. import bot
from ..utils import github from ..utils import github
from ..utils.constants import REPO from ..utils.constants import GITHUB_REPO
from ..utils.views import DeleteButton from ..utils.views import DeleteButton
Repo = tuple[str, str] Repo = tuple[str, str]
@ -156,20 +156,20 @@ class GitHub(commands.Cog):
try: try:
topic = message.channel.topic # type: ignore topic = message.channel.topic # type: ignore
except AttributeError: except AttributeError:
channel_repo = REPO channel_repo = GITHUB_REPO
else: else:
if topic is not None: if topic is not None:
channel_repo = find_repo_in_channel_topic(topic) channel_repo = find_repo_in_channel_topic(topic)
if channel_repo is None: if channel_repo is None:
channel_repo = REPO channel_repo = GITHUB_REPO
else: else:
channel_repo = REPO channel_repo = GITHUB_REPO
for word in words: for word in words:
match = parse_issue(word, default_owner=channel_repo[0], default_repo=channel_repo[1]) match = parse_issue(word, default_owner=channel_repo[0], default_repo=channel_repo[1])
if match is not None: if match is not None:
repo, issue_number = match repo, issue_number = match
repo = repo or REPO repo = repo or GITHUB_REPO
try: try:
issue = await self.github.fetch_issue(*repo, issue_number) issue = await self.github.fetch_issue(*repo, issue_number)
except aiohttp.ClientResponseError: except aiohttp.ClientResponseError:

View file

@ -6,7 +6,7 @@ from discord.ext import commands
from .. import bot from .. import bot
from ..utils import github, wulkanowy_manager from ..utils import github, wulkanowy_manager
from ..utils.constants import ACCENT_COLOR, BUILDS_CHANNEL_ID, REPO from ..utils.constants import ACCENT_COLOR, BUILDS_CHANNEL_ID, GITHUB_REPO
from ..utils.wulkanowy_manager import WulkanowyBuild, WulkanowyManagerException from ..utils.wulkanowy_manager import WulkanowyBuild, WulkanowyManagerException
OTHER_DOWNLOADS = " | ".join( OTHER_DOWNLOADS = " | ".join(
@ -35,7 +35,7 @@ class Wulkanowy(commands.Cog):
async def pobierz(self, interaction: discord.Interaction): async def pobierz(self, interaction: discord.Interaction):
await interaction.response.defer(thinking=True) await interaction.response.defer(thinking=True)
release = await self.github.fetch_latest_release(*REPO) release = await self.github.fetch_latest_release(*GITHUB_REPO)
download_urls = [] download_urls = []
for asset in release["assets"]: for asset in release["assets"]:
name = asset["name"] name = asset["name"]
@ -43,7 +43,7 @@ class Wulkanowy(commands.Cog):
download_urls.append(f"[{name}]({url})") download_urls.append(f"[{name}]({url})")
download_urls = "\n".join(download_urls) download_urls = "\n".join(download_urls)
pulls = await self.github.fetch_open_pulls(*REPO) pulls = await self.github.fetch_open_pulls(*GITHUB_REPO)
branches = ["develop"] branches = ["develop"]
branches.extend((pull["head"]["ref"] for pull in pulls)) branches.extend((pull["head"]["ref"] for pull in pulls))
builds: list[WulkanowyBuild | WulkanowyManagerException] = await asyncio.gather( builds: list[WulkanowyBuild | WulkanowyManagerException] = await asyncio.gather(

View file

@ -1,4 +1,4 @@
REPO = ("wulkanowy", "wulkanowy") GITHUB_REPO = ("wulkanowy", "wulkanowy")
ACCENT_COLOR = 0xD32F2F ACCENT_COLOR = 0xD32F2F
DEFAULT_BRANCH = "develop" DEFAULT_BRANCH = "develop"
BUILDS_CHANNEL_ID = 983106478426693653 BUILDS_CHANNEL_ID = 898126463134490664