Skip to content

Commit

Permalink
feat: add cogbase for default init func
Browse files Browse the repository at this point in the history
  • Loading branch information
ooliver1 committed Jun 4, 2022
1 parent c1459bb commit c9b6026
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
4 changes: 2 additions & 2 deletions botbase/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from logging import NullHandler, getLogger
from typing import Literal, NamedTuple

from .botbase import BotBase, get_handler
from .checks import *
Expand All @@ -14,8 +13,9 @@
WrappedThread,
WrappedUser,
)
from .models import CogBase

__version__ = "1.15.0"
__version__ = "1.16.0"


getLogger(__name__).addHandler(NullHandler())
7 changes: 2 additions & 5 deletions botbase/coggies/blacklist.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@

from nextcord import Embed, Object
from nextcord.ext.commands import Cog, group, is_owner

from ..models import CogBase
from ..wraps import MyContext

if TYPE_CHECKING:
from ..botbase import BotBase


class BlacklistCog(Cog):
def __init__(self, bot: BotBase) -> None:
self.bot = bot

class BlacklistCog(CogBase):
@group(invoke_without_command=True, hidden=True)
@is_owner()
async def blacklist(self, ctx: MyContext) -> None:
Expand Down
13 changes: 13 additions & 0 deletions botbase/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from typing import Generic, TypeVar

from nextcord.ext.commands import Cog

from .botbase import BotBase

B = TypeVar("B", bound=BotBase)
__all__: tuple[str, ...] = ("CogBase",)


class CogBase(Cog, Generic[B]):
def __init__(self, bot: B):
self.bot = bot
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ooliver-botbase"
version = "1.15.0"
version = "1.16.0"
description = "A personal nextcord bot base package for bots."
authors = ["ooliver1 <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit c9b6026

Please sign in to comment.