Answer the question
In order to leave comments, you need to log in
How to pull the argument after the given flags?
Good day,
my problem is that I want to pull out a line after the flag,
as it looks like for me:
if(message.content.startsWith("/bug")) {
var Author = message.author;
var Channel = message.channel;
var title = message.content.split('-t');
var bug = message.content.split('-p');
var embed = new Discord.MessageEmbed()
.setTitle("Баг")
.setColor(RColor)
.setAuthor(Author)
.addFields(
{name: "Заглавие:", value: `${}`},
{name: "Баг:", value: `${}`},
{name: '\u200B', value: '\u200B'},
{name: "ПО:\u200B", value: `${}`, inline: true},
{name: "Лаунчер:\u200B", value: `${}`, inline: true}
)
.addField("Версия:\u200B", `${title()}`, true)
message.channel.send(embed);
}
Answer the question
In order to leave comments, you need to log in
Well, after I sat for a while and thought, I wrote this code, and it worked:
if (message.content.startsWith("/bug"))
{
var Author = message.author;
var Channel = message.channel;
Ttitle = function () {
const title = message.content.split('-t');
const Rbug = title[1].split('-b');
return Rbug[0];
}
Tbug = function () {
const Textbug = message.content.split('-b');
const RPO = Textbug[1].split('-p');
return RPO[0];
}
TPO = function () {
const TextPO = message.content.split('-p');
const Rlauncher = TextPO[1].split('-l');
return Rlauncher[0];
}
Tlauncher = function () {
const Textlauncher = message.content.split('-l');
const Rversion = Textlauncher[1].split('-v');
return Rversion[0];
}
TVersion = function () {
const Textversion = message.content.split('-v');
return Textversion[1];
}
var embed = new Discord.MessageEmbed()
.setTitle("Баг")
.setColor(RColor())
.setAuthor(Author)
.addFields(
{name: "Заглавие:", value: `${Ttitle()}`},
{name: "Баг:", value: `${Tbug()}`},
{name: '\u200B', value: '\u200B'},
{name: "ПО:\u200B", value: `${TPO()}`, inline: true},
{name: "Лаунчер:\u200B", value: `${Tlauncher()}`, inline: true}
)
.addField("Версия:\u200B", `${TVersion()}`, true)
message.channel.send(embed);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question