Catch error if interaction_tree doesn't exist
This commit is contained in:
parent
4d111e459c
commit
c7314b45bf
1 changed files with 30 additions and 27 deletions
|
@ -62,34 +62,37 @@ 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
|
||||||
for cid in self.interaction_tree:
|
try:
|
||||||
if cid == 0:
|
for cid in self.interaction_tree:
|
||||||
global_base_commands = sum(
|
if cid == 0:
|
||||||
1
|
global_base_commands = sum(
|
||||||
for _ in self.interaction_tree[cid]
|
1
|
||||||
if not isinstance(self.interaction_tree[cid][_], ContextMenu)
|
for _ in self.interaction_tree[cid]
|
||||||
)
|
if not isinstance(self.interaction_tree[cid][_], ContextMenu)
|
||||||
global_context_menus = sum(
|
)
|
||||||
1
|
global_context_menus = sum(
|
||||||
for _ in self.interaction_tree[cid]
|
1
|
||||||
if isinstance(self.interaction_tree[cid][_], ContextMenu)
|
for _ in self.interaction_tree[cid]
|
||||||
)
|
if isinstance(self.interaction_tree[cid][_], ContextMenu)
|
||||||
else:
|
)
|
||||||
guild_base_commands += sum(
|
else:
|
||||||
1
|
guild_base_commands += sum(
|
||||||
for _ in self.interaction_tree[cid]
|
1
|
||||||
if not isinstance(self.interaction_tree[cid][_], ContextMenu)
|
for _ in self.interaction_tree[cid]
|
||||||
)
|
if not isinstance(self.interaction_tree[cid][_], ContextMenu)
|
||||||
guild_context_menus += sum(
|
)
|
||||||
1
|
guild_context_menus += sum(
|
||||||
for _ in self.interaction_tree[cid]
|
1
|
||||||
if isinstance(self.interaction_tree[cid][_], ContextMenu)
|
for _ in self.interaction_tree[cid]
|
||||||
)
|
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 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 context menus".format(guild_context_menus))
|
||||||
|
except Exception:
|
||||||
|
self.logger.error("interaction_tree not found, try updating NAFF")
|
||||||
|
|
||||||
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} guild base slash commands".format(guild_base_commands))
|
|
||||||
self.logger.info("Loaded {:>3} guild context menus".format(guild_context_menus))
|
|
||||||
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)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue