Skip to content

Commit edba066

Browse files
fix: always show guild overrides
1 parent 2762d86 commit edba066

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

monty/exts/backend/bot_features.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ async def show_feature(
168168
*,
169169
with_guilds: bool = False,
170170
guild_id: int | None = None,
171-
show_all: bool = False,
171+
show_all: bool = True,
172172
) -> None:
173173
"""Show properties of the provided feature."""
174174
components: list = [
@@ -180,7 +180,7 @@ async def show_feature(
180180

181181
guild_to_check = guild_id or (inter.guild.id if inter.guild else None)
182182

183-
if not guild_id and with_guilds:
183+
if not guild_id or with_guilds:
184184
async with self.bot.db.begin() as session:
185185
stmt = sa.select(Guild).where(Guild.feature_ids.any_() == feature.name)
186186
result = await session.scalars(stmt)
@@ -194,9 +194,10 @@ async def show_feature(
194194
guild_names.sort()
195195

196196
if guild_names:
197-
components[-1].children.append(
198-
disnake.ui.TextDisplay("**Guilds**\n" + "\n".join(guild_names) or "No guilds have overrides")
199-
)
197+
text = "**Guilds**\n" + "\n".join(guild_names).strip()
198+
else:
199+
text = "**Guilds**\n*No guilds have overrides.*"
200+
components[-1].children.append(disnake.ui.TextDisplay(text))
200201

201202
# add a button to give the feature the guild if the feature is using guild overrides
202203
if feature.enabled is None and guild_to_check:
@@ -754,7 +755,7 @@ async def FEATURES_GLOBAL_TOGGLE_listener(self, inter: disnake.MessageInteractio
754755
go_back_button=disnake.ui.Button(
755756
emoji="\u21a9",
756757
style=disnake.ButtonStyle.secondary,
757-
custom_id=f"{FEATURE_VIEW_PREFIX}{feature.name}:1",
758+
custom_id=f"{FEATURE_VIEW_PREFIX}{feature.name}:1:{guild_id}:{'1' if show_all else '0'}",
758759
),
759760
)
760761
if confirm is None or conf_inter is None:
@@ -769,7 +770,7 @@ async def FEATURES_GLOBAL_TOGGLE_listener(self, inter: disnake.MessageInteractio
769770
feature,
770771
with_guilds=True,
771772
guild_id=int(guild_id) if guild_id else None,
772-
show_all=show_all == "1",
773+
show_all=show_all,
773774
)
774775

775776
@commands.Cog.listener("on_button_click")

0 commit comments

Comments
 (0)