@@ -157,18 +157,18 @@ def __init__(
157157 if eventsub_secret and not 10 <= len (eventsub_secret ) <= 100 :
158158 raise ValueError ("Eventsub Secret must be between 10 and 100 characters long." )
159159
160- self ._domain : str | None = None
160+ self ._ssl_context : SSLContext | None = ssl_context
161+ self ._proto = "https" if (ssl_context or domain ) else "http"
162+
161163 if domain :
162164 domain_ = domain .removeprefix ("http://" ).removeprefix ("https://" ).removesuffix ("/" )
163- self ._domain = f"https ://{ domain_ } "
165+ self ._domain = f"{ self . _proto } ://{ domain_ } "
164166 else :
165- self ._domain = f"http ://{ self ._host } :{ self ._port } "
167+ self ._domain = f"{ self . _proto } ://{ self ._host } :{ self ._port } "
166168
167169 path : str = eventsub_path .removeprefix ("/" ).removesuffix ("/" ) if eventsub_path else "callback"
168170 self ._eventsub_path : str = f"/{ path } "
169171
170- self ._ssl_context : SSLContext | None = ssl_context
171-
172172 self ._runner_task : asyncio .Task [None ] | None = None
173173 self .startup = self .event_startup
174174 self .shutdown = self .event_shutdown
@@ -197,7 +197,7 @@ def redirect_url(self) -> str:
197197 return f"{ self ._domain } /oauth/callback"
198198
199199 async def event_startup (self ) -> None :
200- logger .info ("Starting %r on http ://%s:%s." , self , self ._host , self ._port )
200+ logger .info ("Starting %r on %s ://%s:%s." , self , self . _proto , self ._host , self ._port )
201201
202202 async def event_shutdown (self ) -> None :
203203 logger .info ("Successfully shutdown TwitchIO <%s>." , self .__class__ .__qualname__ )
0 commit comments