#Advanced CreateEmbed

1 messages · Page 1 of 1 (latest)

sonic hull
#

Could anyone help?

primal tide
#

Help with what?

sonic hull
primal tide
#

Can you be more specific?

#

"I need help with the issue"

#

But what part?

sonic hull
#

@primal tide So could you help?

dusty elk
#

args.split('$v') will return a new array with each embed option object u can remove the {} from each option and pass it onto an embed

sonic hull
dusty elk
#

just ask

sonic hull
#

okay

#

so i want to make it so like you can make the embed like

#

,ce {title: welcome to server}$v{description: hi}

dusty elk
#

yea i got that

#

im assuming 'args' for you returns an array of strings separated by each space right

sonic hull
#

yeah

#

but how do i do

#

the embed creating part?

dusty elk
#

first

#

start by splitting args

#

hold on

sonic hull
#

kk

dusty elk
#

you can try uhh args.join(' ').split('$v') then console log , it should return an array separated by each $v

dusty elk
#

just console log it to start

sonic hull
#

kk

#
    name: "cre",
    run: async (client, message, args) => {

        const Discord = require('discord.js')

const arg = args.join(' ').split('$v')
console.log(arg)
    }
}
#

?

dusty elk
#

sure

sonic hull
#

logs [ '' ]

dusty elk
#

did u send a test embed

sonic hull
#

no

dusty elk
#

do it

#

,createembed {title: f}$v{description: f}$v{color: #000000}

sonic hull
#

kk

sonic hull
#

so the user

#

can create an embed

dusty elk
#

yea i know

sonic hull
#
    name: "cre",
    run: async (client, message, args) => {

        const Discord = require('discord.js')

const arg = args.join(' ').split('$v')
console.log(arg)

const eb = new Discord.MessageEmbed()
.setDescription(arg)
message.channel.send({ embeds: [eb] });
    }
}
dusty elk
#

no

#

?

#

what are u doing

sonic hull
#

wha u said

dusty elk
#

module.exports = {
name: "cre",
run: async (client, message, args) => {

    const Discord = require('discord.js')

const arg = args.join(' ').split('$v')
console.log(arg)
}
}

#

start off with this

#

all i told u was to send a test embed

#

like if the command was done

sonic hull
#

oh

dusty elk
#

,createembed {title: f}$v{description: f}$v{color: #000000}

#

something like this

sonic hull
#

my fault

#

[ '{title: f}', '{description: f}', '{color: #000000}' ]

dusty elk
#

ok

#

now replace each { } with an empty string so it "removes" it

#

.replace([{|}]/g, '')

sonic hull
#

const arg = args.join(' ').split('$v').replace([{|}]/g, '')

#

?

dusty elk
#

yr

#

then log it again

sonic hull
dusty elk
#

oh my bad

#

/[{|}]/g

sonic hull
#

const arg = args.join(' ').split('$v').replace(/[{|}]/g , '')

#

?

dusty elk
#

ye

sonic hull
#

args.join(...).split(...).replace is not a function

dusty elk
#

hold up

#

put replace before split

sonic hull
#

[ 'title: f', 'description: f', 'color: #000000' ]

dusty elk
#

ok now u can just join it with a , and pass arg onto an embed

sonic hull
#
    name: "cre",
    run: async (client, message, args) => {

        const Discord = require('discord.js')

const arg = args.join(' ').replace(/[{|}]/g    , '').split('$v')

console.log(arg)

const eb = new Discord.MessageEmbed()
.setDescription(arg)
message.channel.send({ embeds: [eb] });
    }
}```
#

?

dusty elk
#

lol

#

why are you passing the entire arg into a description

sonic hull
#

it sent that

#
    name: "cre",
    run: async (client, message, args) => {

        const Discord = require('discord.js')

const arg = args.join(' ').replace(/[{|}]/g    , '').split('$v')

console.log(arg)

const eb = new Discord.MessageEmbed()
.setDescription(`${arg}`)
message.channel.send({ embeds: [eb] });
    }
}```
#

@dusty elk you here?

#

yo

fading grove
#

you should really try doing this with interactions... its so much easier to specify every part of the embed with interaction options