Skip to content

Commit

Permalink
feat: use generic type to ClientT (#58)
Browse files Browse the repository at this point in the history
* feat: use generic type to ClientT

* style: apply code style
  • Loading branch information
SaidBySolo authored Feb 15, 2024
1 parent ae90a35 commit 64dd7c5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions crenata/application/tree.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
from __future__ import annotations

from discord import Interaction
from discord._types import ClientT
from discord.app_commands.errors import AppCommandError
from discord.app_commands.tree import CommandTree

from crenata.application.client import Crenata
from crenata.application.error.handler import ErrorHandler


class CrenataCommandTree(CommandTree[Crenata]):
def __init__(self, client: Crenata, *, fallback_to_global: bool = True):
class CrenataCommandTree(CommandTree[ClientT]):
def __init__(self, client: ClientT, *, fallback_to_global: bool = True):
super().__init__(client, fallback_to_global=fallback_to_global)
self.error_handler: ErrorHandler[Crenata] = ErrorHandler()
self.error_handler: ErrorHandler[ClientT] = ErrorHandler()

def set_error_handler(self, handler: ErrorHandler[Crenata]) -> None:
def set_error_handler(self, handler: ErrorHandler[ClientT]) -> None:
self.error_handler = handler

async def on_error(
self, interaction: Interaction[Crenata], error: AppCommandError
self, interaction: Interaction[ClientT], error: AppCommandError
) -> None:
await self.error_handler.on_error(interaction, error)

async def interaction_check(self, interaction: Interaction[Crenata]) -> bool:
async def interaction_check(self, interaction: Interaction[ClientT]) -> bool:
...

0 comments on commit 64dd7c5

Please sign in to comment.