Skip to content

Commit 4f6bc49

Browse files
committed
fix: clean up SharedChatOnlyCurrent
1 parent d126150 commit 4f6bc49

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

twitchAPI/chat/middleware.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
from typing import Optional, List, TYPE_CHECKING, Callable, Awaitable, Dict
3939

4040
if TYPE_CHECKING:
41-
from . import ChatCommand
41+
from twitchAPI.chat import ChatCommand
4242

4343

4444
__all__ = ['BaseCommandMiddleware', 'ChannelRestriction', 'UserRestriction', 'StreamerOnly',
@@ -235,11 +235,10 @@ async def was_executed(self, command: 'ChatCommand'):
235235
class SharedChatOnlyCurrent(BaseCommandMiddleware):
236236
"""Restricts commands to only current chat room in Shared Chat streams"""
237237

238-
async def can_execute(self, command: ChatCommand) -> bool:
239-
if "source-room-id" in command._parsed["tags"]:
240-
if command._parsed["tags"]["source-room-id"] != command._parsed["tags"].get("room-id"):
241-
return False
238+
async def can_execute(self, command: 'ChatCommand') -> bool:
239+
if command.source_room_id != command.room.room_id:
240+
return False
242241
return True
243242

244-
async def was_executed(self, command: ChatCommand):
243+
async def was_executed(self, command: 'ChatCommand'):
245244
pass

0 commit comments

Comments
 (0)