From 92f902cb157ee3bc05203a7bcb54329143f290ae Mon Sep 17 00:00:00 2001 From: Rene Teigen Date: Thu, 5 Jan 2023 22:46:59 +0000 Subject: [PATCH] return message if no opener folder --- models/autocomplete_model.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/models/autocomplete_model.py b/models/autocomplete_model.py index adf5779..5698412 100644 --- a/models/autocomplete_model.py +++ b/models/autocomplete_model.py @@ -31,4 +31,7 @@ class Settings_autocompleter: class File_autocompleter: async def get_openers(ctx: discord.AutocompleteContext): - return [file for file in os.listdir('openers') if file.startswith(ctx.value.lower())][:25] # returns the 25 first files from your current input \ No newline at end of file + try: + return [file for file in os.listdir('openers') if file.startswith(ctx.value.lower())][:25] # returns the 25 first files from your current input + except: + return ["No 'openers' folder"] \ No newline at end of file