Changed line length to 108 in black
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
from pycord_event import EventNotFoundError
|
||||
from pycord_event_stage import EventStageNotFoundError, EventStageMissingSequenceError
|
||||
from .discord import DiscordGuildMemberNotFoundError, DiscordCategoryNotFoundError, DiscordChannelNotFoundError
|
||||
from pycord_event_stage import EventStageMissingSequenceError, EventStageNotFoundError
|
||||
|
||||
from .discord import (
|
||||
DiscordCategoryNotFoundError,
|
||||
DiscordChannelNotFoundError,
|
||||
DiscordGuildMemberNotFoundError,
|
||||
)
|
||||
from .pycord_guild import GuildNotFoundError
|
||||
from .pycord_user import (
|
||||
UserNotFoundError,
|
||||
UserAlreadyRegisteredForEventError,
|
||||
UserNotRegisteredForEventError,
|
||||
UserAlreadyCompletedEventError,
|
||||
UserAlreadyRegisteredForEventError,
|
||||
UserNotFoundError,
|
||||
UserNotRegisteredForEventError,
|
||||
)
|
||||
|
@@ -15,7 +15,9 @@ class DiscordCategoryNotFoundError(Exception):
|
||||
self.category_id: int = category_id
|
||||
self.guild_id: int = guild_id
|
||||
|
||||
super().__init__(f"Category with id {self.category_id} was not found in guild with id {self.guild_id}")
|
||||
super().__init__(
|
||||
f"Category with id {self.category_id} was not found in guild with id {self.guild_id}"
|
||||
)
|
||||
|
||||
|
||||
class DiscordChannelNotFoundError(Exception):
|
||||
@@ -25,4 +27,6 @@ class DiscordChannelNotFoundError(Exception):
|
||||
self.channel_id: int = channel_id
|
||||
self.guild_id: int = guild_id
|
||||
|
||||
super().__init__(f"Channel with id {self.channel_id} was not found in guild with id {self.guild_id}")
|
||||
super().__init__(
|
||||
f"Channel with id {self.channel_id} was not found in guild with id {self.guild_id}"
|
||||
)
|
||||
|
@@ -55,7 +55,9 @@ class PycordBot(LibPycordBot):
|
||||
await super().close(**kwargs)
|
||||
|
||||
async def _schedule_tasks(self) -> None:
|
||||
self.scheduler.add_job(self._execute_event_controller, trigger="cron", minute="*/1", id="event_controller")
|
||||
self.scheduler.add_job(
|
||||
self._execute_event_controller, trigger="cron", minute="*/1", id="event_controller"
|
||||
)
|
||||
|
||||
async def _execute_event_controller(self) -> None:
|
||||
await self._process_events_start()
|
||||
@@ -136,7 +138,9 @@ class PycordBot(LibPycordBot):
|
||||
|
||||
first_stage_files: List[File] | None = first_stage.get_media_files()
|
||||
|
||||
await user_channel.send(f"First stage...\n\n{first_stage.question}", files=first_stage_files)
|
||||
await user_channel.send(
|
||||
f"First stage...\n\n{first_stage.question}", files=first_stage_files
|
||||
)
|
||||
|
||||
# TODO Make a nice message
|
||||
await self.notify_admins(
|
||||
|
@@ -97,7 +97,9 @@ class PycordEvent:
|
||||
return cls(**db_entry)
|
||||
|
||||
@classmethod
|
||||
async def from_name(cls, event_name: str, guild_id: int, cache: Optional[Cache] = None) -> "PycordEvent":
|
||||
async def from_name(
|
||||
cls, event_name: str, guild_id: int, cache: Optional[Cache] = None
|
||||
) -> "PycordEvent":
|
||||
"""Find the event by its name and construct PycordEvent from database entry.
|
||||
|
||||
If multiple events with the same name exist, the one with the greatest start date will be returned.
|
||||
@@ -244,7 +246,9 @@ class PycordEvent:
|
||||
stage_index: int = self.stage_ids.index(event_stage_id)
|
||||
old_stage_index: int = old_stage_ids.index(event_stage_id)
|
||||
|
||||
logger.debug("Indexes for %s: was %s and is now %s", event_stage_id, old_stage_index, stage_index)
|
||||
logger.debug(
|
||||
"Indexes for %s: was %s and is now %s", event_stage_id, old_stage_index, stage_index
|
||||
)
|
||||
|
||||
if stage_index != old_stage_index:
|
||||
await (await bot.find_event_stage(event_stage_id)).update(cache, sequence=stage_index)
|
||||
@@ -407,7 +411,9 @@ class PycordEvent:
|
||||
await self._set(cache, stage_ids=self.stage_ids)
|
||||
await self._update_event_stage_order(bot, old_stage_ids, cache=cache)
|
||||
|
||||
async def remove_stage(self, bot: "PycordBot", event_stage_id: ObjectId, cache: Optional[Cache] = None) -> None:
|
||||
async def remove_stage(
|
||||
self, bot: "PycordBot", event_stage_id: ObjectId, cache: Optional[Cache] = None
|
||||
) -> None:
|
||||
"""Remove a stage from the event.
|
||||
|
||||
Args:
|
||||
|
@@ -18,13 +18,13 @@ from libbot.cache.classes import Cache
|
||||
from pymongo.results import InsertOneResult
|
||||
|
||||
from classes.errors import (
|
||||
UserNotFoundError,
|
||||
UserAlreadyRegisteredForEventError,
|
||||
UserAlreadyCompletedEventError,
|
||||
UserNotRegisteredForEventError,
|
||||
DiscordGuildMemberNotFoundError,
|
||||
DiscordCategoryNotFoundError,
|
||||
DiscordChannelNotFoundError,
|
||||
DiscordGuildMemberNotFoundError,
|
||||
UserAlreadyCompletedEventError,
|
||||
UserAlreadyRegisteredForEventError,
|
||||
UserNotFoundError,
|
||||
UserNotRegisteredForEventError,
|
||||
)
|
||||
from modules.database import col_users
|
||||
from modules.utils import get_logger, restore_from_cache
|
||||
@@ -122,8 +122,12 @@ class PycordUser:
|
||||
"guild_id": self.guild_id,
|
||||
"event_channels": self.event_channels,
|
||||
"is_jailed": self.is_jailed,
|
||||
"current_event_id": (self.current_event_id if not json_compatible else str(self.current_event_id)),
|
||||
"current_stage_id": (self.current_stage_id if not json_compatible else str(self.current_stage_id)),
|
||||
"current_event_id": (
|
||||
self.current_event_id if not json_compatible else str(self.current_event_id)
|
||||
),
|
||||
"current_stage_id": (
|
||||
self.current_stage_id if not json_compatible else str(self.current_stage_id)
|
||||
),
|
||||
"registered_event_ids": (
|
||||
self.registered_event_ids
|
||||
if not json_compatible
|
||||
@@ -356,7 +360,9 @@ class PycordUser:
|
||||
|
||||
# TODO Add documentation
|
||||
async def set_event_stage(self, stage_id: str | ObjectId | None, cache: Optional[Cache] = None) -> None:
|
||||
await self._set(cache, current_stage_id=stage_id if isinstance(stage_id, str) else ObjectId(stage_id))
|
||||
await self._set(
|
||||
cache, current_stage_id=stage_id if isinstance(stage_id, str) else ObjectId(stage_id)
|
||||
)
|
||||
|
||||
# TODO Add documentation
|
||||
async def jail(self, cache: Optional[Cache] = None) -> None:
|
||||
|
Reference in New Issue
Block a user