Skip to content

Commit 224afd5

Browse files
committed
Fix copilot suggestions
1 parent 55471ee commit 224afd5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/thread.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2695,7 +2695,6 @@ async def callback(self, interaction: discord.Interaction):
26952695
except Exception:
26962696
logger.warning("Failed unsnoozing thread prior to menu selection; continuing.")
26972697
chosen_label = self.values[0]
2698-
self.path.append(chosen_label)
26992698
# Resolve option key
27002699
key = chosen_label.lower().replace(" ", "_")
27012700
if key == "main_menu":
@@ -2710,8 +2709,9 @@ async def callback(self, interaction: discord.Interaction):
27102709
is_home=True,
27112710
)
27122711
return await self.menu_msg.edit(view=new_view)
2712+
self.path.append(chosen_label)
27132713
selected: dict = self.option_data.get(key, {})
2714-
if selected["type"] == "submenu":
2714+
if selected.get("type", "command") == "submenu":
27152715
# Build new view for submenu
27162716
submenu_data = self.bot.config.get("thread_creation_menu_submenus") or {}
27172717
option_data = submenu_data.get(key, {})
@@ -2964,7 +2964,7 @@ async def callback(self, interaction: discord.Interaction):
29642964
ctx_.command.checks = old_checks
29652965

29662966
class _ThreadCreationMenuView(discord.ui.View):
2967-
def __init__(self, bot, outer_thread: Thread, option_data: dict, menu_msg: discord.Message, path: list = [], is_home: bool = True):
2967+
def __init__(self, bot, outer_thread: Thread, option_data: dict, menu_msg: discord.Message, path: list, is_home: bool = True):
29682968
super().__init__(timeout=timeout)
29692969
self.outer_thread = outer_thread
29702970
self.path = path
@@ -3094,7 +3094,7 @@ async def on_timeout(self):
30943094
logger.debug("Thumbnail set failed (ignored): %s", e)
30953095
menu_msg = await recipient.send(embed=embed)
30963096
option_data = self.bot.config.get("thread_creation_menu_options") or {}
3097-
menu_view = _ThreadCreationMenuView(self.bot, thread, option_data, menu_msg)
3097+
menu_view = _ThreadCreationMenuView(self.bot, thread, option_data, menu_msg, path=[], is_home=True)
30983098
menu_msg = await menu_msg.edit(view=menu_view)
30993099
# mark thread as pending menu selection
31003100
thread._pending_menu = True

0 commit comments

Comments
 (0)