最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Discordjs how i can send a embed message with multi link - Stack Overflow

programmeradmin1浏览0评论

I want to make the embed message like the regular music bot like this embed message with the link can click

I want my content is the Description will show and the highlight is a link attach to it like the picture. and here is my embed

here's my code

if (mand === 'test') {

  var search = message.content.split(/\s+/g).slice(1).join(" ");
  if (!search.length) {
    return message.channel.send("PLs enter a name!");
  }
  else {
    const puppeteer = require("puppeteer");

    const browser = await puppeteer.launch();
    const page = await browser.newPage();
    await page.goto(`https://i hide website cause privacy?keyword=${search}`);


    let Anime = await page.evaluate(() => {
      let items = document.querySelectorAll('ul[class= "last-film-box"] > li > a');
      let links = [];

      items.forEach(item => {
        links.push({
          titl: item.title,
          url: item.href

        });

      });
      return links;
    });

    let i = 0;
    let content = Anime.map(e => {
      i++;
      return i + "/ " + `${e.titl.slice(0, 50)} ${e.url}`;
    })

    let ContentEmbed = new Discord.MessageEmbed();
    ContentEmbed.setTitle("Here the result");
    ContentEmbed.setDescription(content);
    message.channel.send(ContentEmbed);

  }
}

I want to make the embed message like the regular music bot like this embed message with the link can click

I want my content is the Description will show and the highlight is a link attach to it like the picture. and here is my embed

here's my code

if (mand === 'test') {

  var search = message.content.split(/\s+/g).slice(1).join(" ");
  if (!search.length) {
    return message.channel.send("PLs enter a name!");
  }
  else {
    const puppeteer = require("puppeteer");

    const browser = await puppeteer.launch();
    const page = await browser.newPage();
    await page.goto(`https://i hide website cause privacy?keyword=${search}`);


    let Anime = await page.evaluate(() => {
      let items = document.querySelectorAll('ul[class= "last-film-box"] > li > a');
      let links = [];

      items.forEach(item => {
        links.push({
          titl: item.title,
          url: item.href

        });

      });
      return links;
    });

    let i = 0;
    let content = Anime.map(e => {
      i++;
      return i + "/ " + `${e.titl.slice(0, 50)} ${e.url}`;
    })

    let ContentEmbed = new Discord.MessageEmbed();
    ContentEmbed.setTitle("Here the result");
    ContentEmbed.setDescription(content);
    message.channel.send(ContentEmbed);

  }
}

Share Improve this question edited Jun 29, 2020 at 14:52 Syntle 5,1743 gold badges15 silver badges34 bronze badges asked Jun 29, 2020 at 14:05 ThiệnThiện 331 silver badge5 bronze badges 2
  • 1 Answers gave the solution but not really the reason, it's using markdown which is sort of just easy styled text, many sites use it including stackoverflow, guides.github./features/mastering-markdown – user13429955 Commented Jun 29, 2020 at 14:57
  • Does this answer your question? Set embed title to a clickable link – Cursed Commented Jun 29, 2020 at 15:22
Add a ment  | 

2 Answers 2

Reset to default 3

You can use [Video Title](Video Link) to achieve that

let content = Anime.map(e => {
  i++;
  return `${i}/ [${e.titl.slice(0, 50)}](${e.url})`;
})
return `/`${i}/ /` [${e.titl.slice(0,50)}](${e.url})`;
发布评论

评论列表(0)

  1. 暂无评论