-
-
Notifications
You must be signed in to change notification settings - Fork 1
feat: adjust settings to use guild configs #87
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
Closed
Closed
Changes from 31 commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
07ff50e
feat: add server count to web ui
JacobCoffee 100afd3
feat: add event message for new guild joins in dev discord
JacobCoffee 5493f26
feat: use guild settings for issue creation link
JacobCoffee a9c2512
fix(ui): adjust plurality of server count
JacobCoffee 17c3849
feat: allow guild-specific github issues
JacobCoffee 884ac3d
docs: add api ref docs
JacobCoffee ba8c053
fix(docs): adjust stale links
JacobCoffee 1b6c0f5
fix: better type hints
179567c
feat: add scaffolding for guild configuration
JacobCoffee 2d420b2
docs: update documentation refs
JacobCoffee 3fc9cc5
docs: add basic usage information docs
JacobCoffee b4ca2d2
feat(ui): add live health to home page
JacobCoffee 12a3eab
feat: enhance guild schema detail
JacobCoffee a065749
feat: add predicate for guild admin check
JacobCoffee 7049464
feat: add guild configuration command (#78)
JacobCoffee 14de143
feat: add model for forum configuration
JacobCoffee a5654db
feat: update schema for updateable settings
JacobCoffee c456370
ci: add helpers for container setup and teardown
JacobCoffee 5280591
feat: update schemas and route for updating
JacobCoffee fa3e0c9
fix: correctly load forum config
JacobCoffee adebee9
ci: update deps
JacobCoffee ad51f34
feat: add routes to display sections on guild data
JacobCoffee 69f322b
ci: add helper for full container refresh
JacobCoffee 6b39f28
fix!: new migration for uuid issues
JacobCoffee 5dc1634
fix: remove blanket check for delete button view
JacobCoffee 1ae4a7e
fix: allow dropdown for config key
JacobCoffee 93f8fca
chore: updates
JacobCoffee d2988d5
ci: 3.11 only in railway
JacobCoffee 4aac895
feat: fully rebased off of uv PR
JacobCoffee 7b31ee9
fix: lol jk but for real this time
JacobCoffee 1bdb95a
style: idk but it auto added so committing
JacobCoffee 09f653e
Update .pdm-python
JacobCoffee 90c2ef1
Update Makefile
JacobCoffee c841ae3
fix(ci): update run cmd
JacobCoffee e419a50
fix: adjust to new advanced-alchemy signature
JacobCoffee 262ba1a
chore: add todo line for #88
JacobCoffee bfa5ca3
chore: update deps
JacobCoffee cc5e24d
feat: add in partial container load support (migrations, not fixtures)
JacobCoffee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
.venv/bin/python | ||
/Users/jcoffee5/git/public/JacobCoffee/byte/.venv/bin/python |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
python 3.11 | ||
python 3.12 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
"""Byte library module.""" | ||
|
||
from byte_bot.byte.lib import common, log, settings, utils | ||
from byte_bot.byte.lib import common, log, settings, types, utils | ||
|
||
__all__ = [ | ||
"settings", | ||
"utils", | ||
"log", | ||
"common", | ||
"types", | ||
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
""":doc:`Checks <discord.py:Checks>` for Byte.""" | ||
|
||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
from discord.ext.commands import CheckFailure, Context, check | ||
|
||
from byte_bot.byte.lib import settings | ||
|
||
if TYPE_CHECKING: | ||
from collections.abc import Callable | ||
|
||
from discord.ext.commands._types import Check | ||
|
||
__all__ = ("is_byte_dev", "is_guild_admin") | ||
|
||
|
||
def is_guild_admin() -> Callable[[Context], Check]: | ||
"""Check if the user is a guild admin. | ||
|
||
Returns: | ||
A check function. | ||
""" | ||
|
||
async def predicate(ctx: Context) -> bool: | ||
"""Check if the user is a guild admin. | ||
|
||
Args: | ||
ctx: Context object. | ||
|
||
Returns: | ||
True if the user is a guild admin, False otherwise. | ||
""" | ||
if not (member := ctx.guild.get_member(ctx.author.id)): | ||
msg = "Member not found in the guild." | ||
raise CheckFailure(msg) | ||
return member.guild_permissions.administrator | ||
|
||
return check(predicate) | ||
|
||
|
||
def is_byte_dev() -> Callable[[Context], Check]: | ||
"""Determines if the user is a Byte developer or owner. | ||
|
||
Returns: | ||
A check function. | ||
""" | ||
|
||
async def predicate(ctx: Context) -> bool: | ||
"""Check if the user is a Byte developer or owner. | ||
|
||
Args: | ||
ctx: Context object. | ||
|
||
Returns: | ||
True if the user is a Byte developer or owner, False otherwise. | ||
""" | ||
return ( | ||
await ctx.bot.is_owner(ctx.author) | ||
or ctx.author.id == settings.discord.DEV_USER_ID | ||
or any(role.name == "byte-dev" for role in ctx.author.roles) | ||
) | ||
|
||
return check(predicate) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.