Catch error if interaction_tree doesn't exist

This commit is contained in:
Zeva Rose 2022-10-04 12:51:06 -06:00
parent 4d111e459c
commit c7314b45bf

View file

@ -62,6 +62,7 @@ class EventMixin(MemberEventMixin, MessageEventMixin, ComponentEventMixin):
guild_base_commands = 0 guild_base_commands = 0
global_context_menus = 0 global_context_menus = 0
guild_context_menus = 0 guild_context_menus = 0
try:
for cid in self.interaction_tree: for cid in self.interaction_tree:
if cid == 0: if cid == 0:
global_base_commands = sum( global_base_commands = sum(
@ -85,11 +86,13 @@ class EventMixin(MemberEventMixin, MessageEventMixin, ComponentEventMixin):
for _ in self.interaction_tree[cid] for _ in self.interaction_tree[cid]
if isinstance(self.interaction_tree[cid][_], ContextMenu) if isinstance(self.interaction_tree[cid][_], ContextMenu)
) )
self.logger.info("Loaded {:>3} global base slash commands".format(global_base_commands)) self.logger.info("Loaded {:>3} global base slash commands".format(global_base_commands))
self.logger.info("Loaded {:>3} global context menus".format(global_context_menus)) self.logger.info("Loaded {:>3} global context menus".format(global_context_menus))
self.logger.info("Loaded {:>3} guild base slash commands".format(guild_base_commands)) self.logger.info("Loaded {:>3} guild base slash commands".format(guild_base_commands))
self.logger.info("Loaded {:>3} guild context menus".format(guild_context_menus)) self.logger.info("Loaded {:>3} guild context menus".format(guild_context_menus))
except Exception:
self.logger.error("interaction_tree not found, try updating NAFF")
self.logger.debug("Hitting Reminders for faster loads") self.logger.debug("Hitting Reminders for faster loads")
_ = await Reminder.find().to_list(None) _ = await Reminder.find().to_list(None)