@@ -612,6 +612,10 @@ class AgeGateUnsupported(BridgeError):
612
612
"""Platform does not support age gate."""
613
613
pass
614
614
615
+ class AgeGateDisabled (BridgeError ):
616
+ """NSFW rooms are disabled."""
617
+ pass
618
+
615
619
def verify_message_content (self , message : UnifierMessageContent ):
616
620
"""Verifies a UnifierMessageContent object to ensure it is valid."""
617
621
@@ -1049,6 +1053,8 @@ async def join_room(self, user, room, channel, webhook_id=None, platform='discor
1049
1053
raise self .NotAgeGated ('room is NSFW but channel is not NSFW' )
1050
1054
elif nsfw and not roominfo ['meta' ].get ('settings' , {}).get ('nsfw' , False ):
1051
1055
raise self .IsAgeGated ('room is not NSFW but channel is NSFW' )
1056
+ elif nsfw and not self .__bot .config ['allow_nsfw_rooms' ]:
1057
+ raise self .AgeGateDisabled ('NSFW rooms are disabled' )
1052
1058
1053
1059
limit = self .get_connections_limit (guild_id )
1054
1060
@@ -2106,6 +2112,8 @@ async def can_send(self, room, message, content, files, source='discord', is_fir
2106
2112
raise self .NotAgeGated ('room is NSFW but channel is not NSFW' )
2107
2113
elif nsfw and not roomdata ['meta' ].get ('settings' , {}).get ('nsfw' , False ):
2108
2114
raise self .IsAgeGated ('room is not NSFW but channel is NSFW' )
2115
+ elif nsfw and not self .__bot .config ['allow_nsfw_rooms' ]:
2116
+ raise self .AgeGateDisabled ('NSFW rooms are disabled' )
2109
2117
2110
2118
# Check if server is banned from the room
2111
2119
if str (server ) in roomdata ['meta' ]['banned' ]:
0 commit comments