Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reorder db interactions and add types to starboard.py #123

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 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
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ exclude = [
"**/member_counter.py",
"**/remindme.py",
"**/snailrace.py",
"**/starboard.py",
"**/uptime.py",
"**/whatsdue.py",
"**/working_on.py",
Expand Down
2 changes: 2 additions & 0 deletions uqcsbot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ def __init__(self, *args: Any, **kwargs: Any):
# Important channel names & constants go here
self.ADMIN_ALERTS_CNAME = "admin-alerts"
self.GENERAL_CNAME = "general"
self.STARBOARD_CNAME = "starboard"
self.BOT_TIMEZONE = timezone("Australia/Brisbane")
self.STARBOARD_ENAME = "starhaj"

self.uqcs_server: discord.Guild

Expand Down
7 changes: 3 additions & 4 deletions uqcsbot/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,14 @@ class Starboard(Base):

# composite key on recv, sent.

# recv == null implies deleted recv message.
# recv_location == null implies deleted recv channel. recv should also be null.
# sent == null implies blacklisted recv message.
# see starboard.StarboardMsgPair
recv: Mapped[Optional[int]] = mapped_column(
"recv", BigInteger, primary_key=True, nullable=True
)
recv_location: Mapped[Optional[int]] = mapped_column(
"recv_location", BigInteger, nullable=True, unique=False
)
sent: Mapped[Optional[int]] = mapped_column(
# external Optional is needed as a type hint that the column can return None values.
sent: Optional[Mapped[Optional[int]]] = mapped_column(
"sent", BigInteger, primary_key=True, nullable=True, unique=True
)
Loading