与sql一起使用命令

92vpleto  于 2021-07-29  发布在  Java
关注(0)|答案(0)|浏览(198)

discord.js版本11.4.2

先读这个

如果类型!emoji(第一次)它将发送嵌入和发送随机emoiji和Reactemoji在下面的代码
但在第二次我只想发送表情符号和React表情符号只不发送
我在heroku中运行bot并在我的计算机中测试命令

我想这么做

如何添加sql并完成所有这些
如果类型!emoji-->先在sql中检查id
如果没有那么保存 message.author.id 然后在sql中发送消息嵌入和随机表情符号和React表情符号
如果在sql中有则发送随机表情符号和React表情符号
下面的代码

var sql = require('mysql')

  if(message.content === '!emoji' || message.content === '!!emoji' || message.content === '?emoji'){
    var emoa = [emo0, emo1, emo2, emo3, emo4 , emo5 ,emo6 , emo7, emo8, emo9, emo10, emo11, emo12, emo13, emo14, emo15, emo16, emo17,
      emo18, emo19, emo20, emo21, emo22, emo23, emo24, emo25, emo26, emo27, emo28, emo29, emo30, emo31, emo32, emo33, emo34, emo35,
      emo36, emo37, emo38, emo39, emo40, emo41, emo42, emo43, emo44, emo45, emo46, emo47, emo48, emo49, emo50, emo51, emo52, emo53,
      emo54, emo55, emo56, emo57, emo58, emo59, emo60, emo61, emo62, emo63, emo64, emo65, emo66, emo67, emo68, emo69, emo70, emo71,
      emo72, emo73, emo74, emo75, emo76, emo77, emo78
    ]
    var randomItem = emoa[Math.floor(Math.random()*emoa.length)];
    var usersent = client.users.get(message.author.id);
    if (message.channel.type === "dm") { return usersent.send(`<${randomItem}>`).then(() => message.react(`${randomItem}`)); }
    var ownerid = message.guild.owner.id;
    if(message.author.id === ownerid){
      message.channel.send(`<${randomItem}>`)
      .then(() => message.react(`${randomItem}`))
    }else{
      if(talkedRecently.has(message.author.id)) {  
        message.channel.send(`<${randomItem}>`)
        .then(() => message.react(`${randomItem}`))
      } else {
        talkedRecently.add(message.author.id);
        message.channel.send(`<${randomItem}>`)
        .then(() => message.react(`${randomItem}`))
        message.author.send(EmbedHelp)
      }
    }
  };

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题