Skip to content

Commit 27b9640

Browse files
authored
Merge pull request #245 from UnifierHQ/dev
3.11.7: Another bugfix release
2 parents 103adbd + eeff4a0 commit 27b9640

File tree

7 files changed

+21
-5
lines changed

7 files changed

+21
-5
lines changed

cogs/bridge.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,10 @@ class AgeGateUnsupported(BridgeError):
612612
"""Platform does not support age gate."""
613613
pass
614614

615+
class AgeGateDisabled(BridgeError):
616+
"""NSFW rooms are disabled."""
617+
pass
618+
615619
def verify_message_content(self, message: UnifierMessageContent):
616620
"""Verifies a UnifierMessageContent object to ensure it is valid."""
617621

@@ -1049,6 +1053,8 @@ async def join_room(self, user, room, channel, webhook_id=None, platform='discor
10491053
raise self.NotAgeGated('room is NSFW but channel is not NSFW')
10501054
elif nsfw and not roominfo['meta'].get('settings', {}).get('nsfw', False):
10511055
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')
10521058

10531059
limit = self.get_connections_limit(guild_id)
10541060

@@ -2106,6 +2112,8 @@ async def can_send(self, room, message, content, files, source='discord', is_fir
21062112
raise self.NotAgeGated('room is NSFW but channel is not NSFW')
21072113
elif nsfw and not roomdata['meta'].get('settings', {}).get('nsfw', False):
21082114
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')
21092117

21102118
# Check if server is banned from the room
21112119
if str(server) in roomdata['meta']['banned']:

cogs/config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,8 @@ def check(interaction):
612612
# Could've used inheritance here, but I'd need to override every method anyway, so better off not
613613
class SettingsDialog:
614614
def __init__(self, bot, ctx: Union[nextcord.Interaction, commands.Context], room=None, query=None):
615+
global settings_keys
616+
615617
self.ctx = ctx
616618
self.__bot = bot
617619
self.room = room
@@ -628,6 +630,9 @@ def __init__(self, bot, ctx: Union[nextcord.Interaction, commands.Context], room
628630
self.match_desc = True
629631
self.title = self.__bot.ui_emojis.rooms + ' ' + self.selector.fget('title',values={'room':self.room})
630632

633+
if not self.__bot.config['allow_nsfw_rooms']:
634+
settings_keys.remove('nsfw')
635+
631636
@property
632637
def author(self):
633638
if type(self.ctx) is nextcord.Interaction:

cogs/moderation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ async def warn(self, ctx: Union[nextcord.Interaction, commands.Context], target:
929929
log_embed.set_author(name=f'@{user.name}', icon_url=user.avatar.url if user.avatar else None)
930930
log_embed.add_field(
931931
name=language.get("modlogs_title", "moderation.ban"),
932-
value=language.fget("modlogs_body", "moderation.ban", values={"recent_warns": actions_count_recent["warns"],"total_bans": actions_count["bans"]}),
932+
value=language.fget("modlogs_body", "moderation.ban",values={"recent_warns": actions_count_recent["warns"],"total_warns": actions_count["warns"],"recent_bans": actions_count_recent["bans"],"total_bans": actions_count["bans"]}),
933933
inline=False
934934
)
935935
try:

config.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ reports_channel = -1
5656
moderator_role = -1
5757

5858
[bridge]
59+
allow_nsfw_rooms = false # Strongly recommended to be kept false for public instances.
5960
use_multicore = true
6061
enable_exp = false
6162
exp_cooldown = 30

languages/english.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,7 @@
753753
"too_many": "Server has reached maximum number of Private Rooms connections.",
754754
"not_agegate": "This Room is marked as NSFW. Only age-gated channels can connect to this Room.",
755755
"is_agegate": "This Room is not marked as NSFW. Age-gated channels may not connect to this Room.",
756+
"agegate_disabled": "NSFW Rooms are disabled on this instance.",
756757
"already_linked_server": "Your server is already binded to this room. Unbind the room and try again.",
757758
"success": "Connected to room!",
758759
"say_hi": "You're now connected! Say hi!"

plugins/system.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"id": "system",
33
"name": "System extensions",
44
"description": "Unifier system extensions",
5-
"version": "v3.11.6",
6-
"release": 160,
7-
"reboot": 159,
5+
"version": "v3.11.7",
6+
"release": 161,
7+
"reboot": 160,
88
"b_reboot": 158,
99
"minimum": 0,
1010
"shutdown": false,

unifier.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,8 @@ def no_presence(cls) -> Self:
654654
sys.exit(1)
655655

656656
# Create pre-boot copy of good data file
657-
shutil.copy2(bot.db.file_path, 'data-preboot.json')
657+
if os.path.exists(bot.db.file_path):
658+
shutil.copy2(bot.db.file_path, 'data-preboot.json')
658659

659660
if not bot.test_decrypt():
660661
del os.environ['UNIFIER_ENCPASS']

0 commit comments

Comments
 (0)