late @late

guys please use regex or your code will end up like mine

let suggestionTitle = ""
        if (args.find(x => x.startsWith("["))) {
            if (args.find(x => x.endsWith("]"))) {
                for (let i = 0; i < (args.indexOf(args.find(x => x.endsWith("]"))) - args.indexOf(args.find(x => x.startsWith("[")))) + 1; i++) {
                    suggestionTitle += args[args.indexOf(args.find(x => x.startsWith("["))) + i]
                    if (i < (args.indexOf(args.find(x => x.endsWith("]"))) - args.indexOf(args.find(x => x.startsWith("["))))) {
                        suggestionTitle += " "
                    }
                }
            } else {
                message.reply("Please make sure you have a closing bracket!")
                return
            }
        } else {
            message.reply("Please provide a title for your suggestion!")
            return
        }
Jul 24, 2022, 4:35 AM
0

comments