Taking Words/Or Arguements from a string in discord.js

Solution for Taking Words/Or Arguements from a string in discord.js
is Given Below:

So what I want to do with my bot is basically take words from a user and pass it in the command as arguments when the arguments are seperated by a $ sign. For example, if the user types cat$dog$cute, the program should take ‘cat’ , ‘dog’ and ‘cute’ as the arguments.

const Discord = require('discord.js')
const settings = {
module.exports = {
     description:'this is a picture command',
      const args = message.content.slice(settings.prefix.length).trim().split(/ +/g);
        const Booru = require('booru')
        const tags1 = args.slice(0, args.indexOf("$"));
        const tags2 = args.slice(0, args.indexof("$"));
        Booru.search('gelbooru', [`${tags1}`, `${tags2}`], { limit: 1, random: true })
          .then(posts => {
            for (let post of posts)
            embed1 = new Discord.MessageEmbed()
        // or (using alias support and creating boorus)
``` this code is like a reference 

Here is a simple way of doing that:

let tags = args.map(arg => arg.split("$")).flat()

Given, for example,

const args = ["cat$dog$cute", "hey$world"];

this will produce the result of

["cat", "dog", "cute", "hey", "world"]

If instead you only wanted to split a single one of the arguments into tags, simply use string.split

let arg = args[0];
let tags = arg.split("$");