Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

exclude: ".json"
repos:
- repo: https://github.com/psf/black
rev: 22.8.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.12.0
hooks:
- id: black

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -20,7 +20,7 @@ repos:
- id: check-merge-conflict

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 7.0.0
hooks:
- id: isort

Expand Down
1 change: 1 addition & 0 deletions Backend/alembic/versions/2b04ec01b78e_.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-06-01 16:16:48.372839+00:00

"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
Expand Down
1 change: 1 addition & 0 deletions Backend/alembic/versions/37f73a9d15d5_.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-04-02 10:42:18.076326+00:00

"""

import sqlalchemy as sa
from alembic import op

Expand Down
1 change: 1 addition & 0 deletions Backend/alembic/versions/73765744a1f6_.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-04-02 11:19:02.574169+00:00

"""

import sqlalchemy as sa
from alembic import op

Expand Down
1 change: 1 addition & 0 deletions Backend/alembic/versions/ef97c8cef951_.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-06-01 14:51:34.843488+00:00

"""

import sqlalchemy as sa
from alembic import op

Expand Down
1 change: 1 addition & 0 deletions Backend/alembic/versions/fe382d5e9771_.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-08-02 08:30:27.944319+00:00

"""

import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
Expand Down
28 changes: 16 additions & 12 deletions Backend/bungio/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,9 @@ async def get_all_activities(self) -> dict[int, DestinyActivityModel]:
activity_ids=[activity.hash for activity in activities],
mode=mode.value,
modes=[m.value for m in modes],
image_url=f"https://www.bungie.net/{activities[0].pgcr_image}"
if activities[0].pgcr_image
else None,
image_url=(
f"https://www.bungie.net/{activities[0].pgcr_image}" if activities[0].pgcr_image else None
),
)
for reference_id in model.activity_ids:
result[reference_id] = model
Expand Down Expand Up @@ -319,9 +319,9 @@ async def get_seals(self) -> dict[DestinyPresentationNodeDefinition, list[Destin

async with get_seals_lock:
if not self._manifest_seals:
presentation_nodes: list[
DestinyPresentationNodeDefinition
] = await get_bungio_client().manifest.fetch_all(manifest_class=DestinyPresentationNodeDefinition)
presentation_nodes: list[DestinyPresentationNodeDefinition] = (
await get_bungio_client().manifest.fetch_all(manifest_class=DestinyPresentationNodeDefinition)
)

seals = []
for node in presentation_nodes:
Expand Down Expand Up @@ -428,9 +428,11 @@ async def get_grandmaster_nfs(self) -> list[DestinyActivityModel]:
activity_ids=reference_ids,
mode=mode.value,
modes=[m.value for m in modes],
image_url=f"https://www.bungie.net/{activities[0].pgcr_image}"
if activities[0].pgcr_image
else None,
image_url=(
f"https://www.bungie.net/{activities[0].pgcr_image}"
if activities[0].pgcr_image
else None
),
)
)

Expand Down Expand Up @@ -516,9 +518,11 @@ async def get_challenging_solo_activities(self) -> dict[str, list[DestinyActivit
activity_ids=[activity.hash],
mode=mode.value,
modes=[m.value for m in modes],
image_url=f"https://www.bungie.net/{activity.pgcr_image}"
if activity.pgcr_image
else None,
image_url=(
f"https://www.bungie.net/{activity.pgcr_image}"
if activity.pgcr_image
else None
),
)
else:
data.activity_ids.append(activity.hash)
Expand Down
16 changes: 6 additions & 10 deletions Backend/core/destiny/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,9 +827,7 @@ async def get_time_played(
character_class=character_class,
)

async def get_character_items(
self, character_id: int
) -> dict[
async def get_character_items(self, character_id: int) -> dict[
Literal["helmet", "gauntlets", "chest", "leg", "class"],
dict[Literal["equipped", "inventory"], list[DestinyItemComponent]],
]:
Expand Down Expand Up @@ -904,9 +902,7 @@ async def get_character_items(

return items

async def __get_inventory_bucket(
self, *buckets: DestinyInventoryBucketEnum
) -> dict[
async def __get_inventory_bucket(self, *buckets: DestinyInventoryBucketEnum) -> dict[
DestinyInventoryBucketEnum,
dict[int, dict[Literal["item", "power_level", "quantity"], DestinyItemComponent | int]],
]:
Expand Down Expand Up @@ -988,9 +984,9 @@ def add_info(
result_dict[char_id][bucket].update({item.item_instance_id: {"item": item}})
if include_item_level:
try:
result_dict[char_id][bucket][item.item_instance_id][
"power_level"
] = result.item_components.instances.data[item.item_instance_id].primary_stat.value
result_dict[char_id][bucket][item.item_instance_id]["power_level"] = (
result.item_components.instances.data[item.item_instance_id].primary_stat.value
)
except KeyError:
pass
break
Expand Down Expand Up @@ -1121,7 +1117,7 @@ def get_max_power_subprocess(
char_data: dict[
int,
dict[DestinyInventoryBucketEnum, dict[int, dict[Literal["item", "power_level"], DestinyItemComponent | int]]],
]
],
) -> int:
"""Run in anyio subprocess on another thread since this might be slow"""

Expand Down
12 changes: 6 additions & 6 deletions Backend/crud/destiny/activities.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,14 @@ def _convert_to_model(
player_count=int(player_pgcr.values["playerCount"].basic.value),
team_score=int(player_pgcr.values["teamScore"].basic.value),
precision_kills=int(extended_data.values["precisionKills"].basic.value) if extended_data else 0,
weapon_kills_grenade=int(extended_data.values["weaponKillsGrenade"].basic.value)
if extended_data
else 0,
weapon_kills_grenade=(
int(extended_data.values["weaponKillsGrenade"].basic.value) if extended_data else 0
),
weapon_kills_melee=int(extended_data.values["weaponKillsMelee"].basic.value) if extended_data else 0,
weapon_kills_super=int(extended_data.values["weaponKillsSuper"].basic.value) if extended_data else 0,
weapon_kills_ability=int(extended_data.values["weaponKillsAbility"].basic.value)
if extended_data
else 0,
weapon_kills_ability=(
int(extended_data.values["weaponKillsAbility"].basic.value) if extended_data else 0
),
)

if extended_data:
Expand Down
6 changes: 5 additions & 1 deletion Backend/crud/destiny/discordUsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ async def insert_profile(

# split the state
(discord_id, guild_id, channel_id) = state.split(":")
discord_id, guild_id, channel_id, = (
(
discord_id,
guild_id,
channel_id,
) = (
int(discord_id),
int(guild_id),
int(channel_id),
Expand Down
1 change: 1 addition & 0 deletions Backend/database/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ class ElevatorServers(Base):
################################################################
# Roles


# for activities
class RolesActivity(Base):
__tablename__ = "rolesActivity"
Expand Down
16 changes: 10 additions & 6 deletions ElevatorBot/commandHelpers/optionTemplates.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,11 @@ def wrapper(func):
choices=[
SlashCommandChoice(
name=expansion.name,
value=f"{expansion.name}|{int(expansion.start.timestamp())}|{int(expansion_dates[(expansion_dates.index(expansion) + 1)].start.timestamp())}"
if expansion_dates.index(expansion) + 1 < len(expansion_dates)
else f"{expansion.name}|{int(expansion.start.timestamp())}|9999999999",
value=(
f"{expansion.name}|{int(expansion.start.timestamp())}|{int(expansion_dates[(expansion_dates.index(expansion) + 1)].start.timestamp())}"
if expansion_dates.index(expansion) + 1 < len(expansion_dates)
else f"{expansion.name}|{int(expansion.start.timestamp())}|9999999999"
),
)
for expansion in expansion_dates
],
Expand Down Expand Up @@ -205,9 +207,11 @@ def wrapper(func):
choices=[
SlashCommandChoice(
name=season.name,
value=f"{season.name}|{int(season.start.timestamp())}|{int(season_and_expansion_dates[(season_and_expansion_dates.index(season) + 1)].start.timestamp())}"
if season_and_expansion_dates.index(season) + 1 < len(season_and_expansion_dates)
else f"{season.name}|{int(season.start.timestamp())}|9999999999",
value=(
f"{season.name}|{int(season.start.timestamp())}|{int(season_and_expansion_dates[(season_and_expansion_dates.index(season) + 1)].start.timestamp())}"
if season_and_expansion_dates.index(season) + 1 < len(season_and_expansion_dates)
else f"{season.name}|{int(season.start.timestamp())}|9999999999"
),
)
for season in season_and_expansion_dates
],
Expand Down
40 changes: 25 additions & 15 deletions ElevatorBot/commands/c_admin/setup/overview.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ async def overview(self, ctx: ElevatorInteractionContext):
obj = handy_dict["clan_join_request"] if "clan_join_request" in handy_dict else None
embed.add_field(
name="Clan Join Button",
value=f"[Click To View The Linked Message](https://canary.discord.com/channels/{obj.guild_id}/{obj.channel_id}/{obj.message_id})"
if obj
else "Not Set-Up",
value=(
f"[Click To View The Linked Message](https://canary.discord.com/channels/{obj.guild_id}/{obj.channel_id}/{obj.message_id})"
if obj
else "Not Set-Up"
),
inline=True,
)

Expand Down Expand Up @@ -75,9 +77,11 @@ async def overview(self, ctx: ElevatorInteractionContext):
obj = handy_dict["increment_button"] if "increment_button" in handy_dict else None
embed.add_field(
name="Increment Button",
value=f"[Click To View The Linked Message](https://canary.discord.com/channels/{obj.guild_id}/{obj.channel_id}/{obj.message_id})"
if obj
else "Not Set-Up",
value=(
f"[Click To View The Linked Message](https://canary.discord.com/channels/{obj.guild_id}/{obj.channel_id}/{obj.message_id})"
if obj
else "Not Set-Up"
),
inline=True,
)

Expand All @@ -91,9 +95,11 @@ async def overview(self, ctx: ElevatorInteractionContext):
obj = handy_dict["registration"] if "registration" in handy_dict else None
embed.add_field(
name="Registration Button",
value=f"[Click To View The Linked Message](https://canary.discord.com/channels/{obj.guild_id}/{obj.channel_id}/{obj.message_id})"
if obj
else "Not Set-Up",
value=(
f"[Click To View The Linked Message](https://canary.discord.com/channels/{obj.guild_id}/{obj.channel_id}/{obj.message_id})"
if obj
else "Not Set-Up"
),
inline=True,
)

Expand All @@ -117,18 +123,22 @@ async def overview(self, ctx: ElevatorInteractionContext):
obj = handy_dict["other_game_roles"] if "other_game_roles" in handy_dict else None
embed.add_field(
name="Miscellaneous Roles Message",
value=f"[Click To View The Linked Message](https://canary.discord.com/channels/{obj.guild_id}/{obj.channel_id}/{obj.message_id})"
if obj
else "Not Set-Up",
value=(
f"[Click To View The Linked Message](https://canary.discord.com/channels/{obj.guild_id}/{obj.channel_id}/{obj.message_id})"
if obj
else "Not Set-Up"
),
inline=False,
)

obj = handy_dict["status"] if "status" in handy_dict else None
embed.add_field(
name="ElevatorBot Status Message",
value=f"[Click To View The Linked Message](https://canary.discord.com/channels/{obj.guild_id}/{obj.channel_id}/{obj.message_id})"
if obj
else "Not Set-Up",
value=(
f"[Click To View The Linked Message](https://canary.discord.com/channels/{obj.guild_id}/{obj.channel_id}/{obj.message_id})"
if obj
else "Not Set-Up"
),
inline=True,
)

Expand Down
4 changes: 3 additions & 1 deletion ElevatorBot/core/destiny/dayOneRace.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ class DayOneRace:
cutoff_time: datetime.datetime = datetime.datetime(2021, 5, 23, 17, 0, tzinfo=datetime.timezone.utc)

# cosmetic data for the raid
image_url: str = "https://static.wikia.nocookie.net/destinypedia/images/6/62/Vault.jpg/revision/latest/scale-to-width-down/1000?cb=20150330170833"
image_url: str = (
"https://static.wikia.nocookie.net/destinypedia/images/6/62/Vault.jpg/revision/latest/scale-to-width-down/1000?cb=20150330170833"
)
raid_name: str = "Vault of Glass"
location_name: str = "Ishtar Sink, Venus"

Expand Down
28 changes: 16 additions & 12 deletions ElevatorBot/core/destiny/lfg/lfgSystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ async def from_lfg_output_model(
joined_ids=model.joined_members,
backup_ids=model.backup_members,
voice_channel=await client.fetch_channel(model.voice_channel_id) if model.voice_channel_id else None,
voice_category_channel=await client.fetch_channel(model.voice_category_channel_id)
if model.voice_category_channel_id
else None,
voice_category_channel=(
await client.fetch_channel(model.voice_category_channel_id) if model.voice_category_channel_id else None
),
started=model.started,
)

Expand Down Expand Up @@ -280,9 +280,11 @@ async def create(
description=description,
start_time=start_time,
max_joined_members=max_joined_members,
voice_category_channel=await ctx.bot.fetch_channel(result.voice_category_channel_id)
if result.voice_category_channel_id
else None,
voice_category_channel=(
await ctx.bot.fetch_channel(result.voice_category_channel_id)
if result.voice_category_channel_id
else None
),
joined_ids=[ctx.author.id],
started=result.started,
)
Expand Down Expand Up @@ -664,12 +666,14 @@ async def __sort_lfg_messages(self):
creation_time=event.creation_time,
joined_ids=event.joined_members,
backup_ids=event.backup_members,
voice_channel=await self.client.fetch_channel(event.voice_channel_id)
if event.voice_channel_id
else None,
voice_category_channel=await self.client.fetch_channel(event.voice_category_channel_id)
if event.voice_category_channel_id
else None,
voice_channel=(
await self.client.fetch_channel(event.voice_channel_id) if event.voice_channel_id else None
),
voice_category_channel=(
await self.client.fetch_channel(event.voice_category_channel_id)
if event.voice_category_channel_id
else None
),
started=event.started,
)
)
Expand Down
8 changes: 5 additions & 3 deletions ElevatorBot/core/misc/ticTacToe.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,11 @@ async def send_message(
if not self.message:
embed = embed_message(
f"{self.ctx.author.display_name}'s TicTacToe Game",
footer=f"""You are green{f" - Easy Mode: On" if self.easy_mode else ""}"""
if not self.versus
else "First user to press a button plays green, second plays red",
footer=(
f"""You are green{f" - Easy Mode: On" if self.easy_mode else ""}"""
if not self.versus
else "First user to press a button plays green, second plays red"
),
)
self.message = await self.ctx.send(components=self.buttons, embeds=embed)
else:
Expand Down
Loading
Loading