if(msg.content.includes("[mid]")) {
let str = msg.content
let pokeID = str.substring(
str.indexOf("[mid]") + 5,
str.lastIndexOf("[/mid") //get the unique-code for a pokemon
);
msg.channel.send({ content: `Here is your Pokemon:`, embeds: [midData(pokeID)] });
this code works fine, I'm would to be able to put in any user text that is before or after the [mid]code[/mid]
example user inputs "this text can be of any length or even null [mid]unique-code[/mid] this text can also be of any text or null"
the output should be :
this text can be of any length or even null this text can also be of any text or null
[mid]unique-code[/mid] (which is a link)
I have tried this: https://imgur.com/a/uq8CVpn //image of output
I need 3 strings from the user input.
string1 = all text, if any before [mid]unique-code[/mid] // pokemon code
string2 = [mid]unique-code[/mid]
string3 = all text if any behind [mid]unique-code[/mid] //pokemon code
using node v16 and discord v13
thank you