77
88import aiocache
99import discord
10- import pycord_rest
10+ try :
11+ from pycord_rest import Bot as PycordRestBot
12+ except ImportError :
13+ class PycordRestBot : ...
14+
1115import uvicorn
1216from discord import Interaction , Message , WebhookMessage
1317from discord .ext import bridge
@@ -192,8 +196,7 @@ def configure_logging(self) -> None:
192196 log .patch ("uvicorn.error" )
193197 log .patch ("uvicorn.access" )
194198
195-
196- class CustomRestBot (pycord_rest .Bot , CustomBot ): # pyright: ignore[reportIncompatibleMethodOverride,reportUnsafeMultipleInheritance]
199+ class CustomRestBot (PycordRestBot , CustomBot ): # pyright: ignore[reportIncompatibleMethodOverride,reportUnsafeMultipleInheritance]
197200 __rest__ : bool = True
198201
199202 _UvicornConfig : type [uvicorn .Config ] = CustomUvicornConfig
@@ -202,7 +205,7 @@ def __init__(
202205 self , * args : Any , cache_type : str = "memory" , cache_config : RedisConfig | None = None , ** options : Any
203206 ) -> None :
204207 CustomBot .__init__ (self , * args , cache_type = cache_type , cache_config = cache_config , ** options )
205- pycord_rest . Bot .__init__ (self , * args , ** options )
208+ PycordRestBot .__init__ (self , * args , ** options )
206209
207210 @self .listen (name = "on_connect" , once = True )
208211 async def on_connect () -> None :
0 commit comments