File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -53,8 +53,11 @@ async def zeus_upload(
53
53
@commands .slash_command (name = "zeus-set-mission" )
54
54
async def zeus_set_mission (self , ctx : discord .ApplicationContext , filename : str ):
55
55
"""Activate the given a mission file as a Zeus"""
56
- await ctx .respond (f"Setting mission to { filename = } " )
57
- self .reforger_confgen .zeus_set_mission (filename )
56
+ try :
57
+ self .reforger_confgen .zeus_set_mission (filename )
58
+ await ctx .respond (f"Setting mission to { filename = } " )
59
+ except ConfigFileNotFound :
60
+ await ctx .respond (f"Error: could not find mission '{ filename } '" )
58
61
59
62
@commands .slash_command (name = "zeus-list" )
60
63
async def zeus_list (self , ctx : discord .ApplicationContext ):
@@ -75,3 +78,10 @@ async def current_mission(self, ctx: discord.ApplicationContext):
75
78
)
76
79
except ConfigFileNotFound as e :
77
80
await ctx .respond (f"Could not find configured mission: { str (e )} " )
81
+
82
+ @commands .Cog .listener ()
83
+ async def on_application_command_error (
84
+ self , ctx : discord .ApplicationContext , error : discord .DiscordException
85
+ ):
86
+ """Handles application command errors that are not caught elsewhere"""
87
+ await ctx .respond (f"Unhandled exception: { error } " )
You can’t perform that action at this time.
0 commit comments