-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
137 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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,16 @@ | ||
from discord import Member | ||
from sqlalchemy import Column, BigInteger | ||
from sqlalchemy.ext.hybrid import hybrid_property | ||
|
||
from models.base import Base | ||
from models.guild_settings import GuildSettingsMixin | ||
|
||
|
||
class BlockedUser(GuildSettingsMixin, Base): | ||
__tablename__ = "blocked_users" | ||
|
||
_user = Column(BigInteger, primary_key=True) | ||
|
||
@hybrid_property | ||
def member(self) -> Member: | ||
return self.guild.get_member(self._user) |
This file contains 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,14 @@ | ||
from discord import Interaction | ||
from discord.ui import View | ||
|
||
|
||
class BaseView(View): | ||
""" | ||
Has to be called and checked by extending classes. | ||
I.e., if False, the interaction_check has to fail | ||
""" | ||
|
||
async def interaction_check(self, interaction: Interaction, /) -> bool: | ||
return not interaction.client.is_author_blocked_in_guild( | ||
interaction.user, interaction.guild | ||
) |
This file contains 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