发送未定义,嵌入消息问题(编辑)

时间:2020-04-25 22:18:53

标签: javascript bots embed discord.js message

public class projectile : MonoBehaviour
{
    void OnCollisionEnter2D(Collision2D other){
        parentWeapon.launchable = true;
    }
}

那么我能嵌入整个东西吗?因为... public class weaponScript : MonoBehaviour { public gameobject projectilePrefab; public bool launchable; private projectile projectileScript; void Update{ if(launchable){ GameObject projectileIntantiated = Instantiate(projectilePrefab, firePoint.transform.position, transform.rotation); projectileScript = projectileIntantiated.GetComponent<projectile>(); projectileScript.parentWeapon = this.gameObject.GetComponent<weaponScript>(); launchable = false; } } public class projectile : MonoBehaviour { public weaponScript parentWeapon; void OnCollisionEnter2D(Collision2D other){ parentWeapon.launchable = true; } } 在非嵌入版本中效果很好。

1 个答案:

答案 0 :(得分:1)

Discord嵌入消息的构造不同。 send()不是对象,而是函数,必须使用msg.edit。您应该自己制作颜色。

`module.exports = {
  name: 'lat2',
  description: 'Let the Bot display latency/Response Time and API latency',
  execute(message, args) {
    let Embed1 = new Discord.MessageEmbed()
      .setColor("#"+String(Math.floor(Math.random()*16777215).toString(16)))
      .setDescription("Pinging...")

    let Embed2 = new Discord.MessageEmbed()
      .setColor("#"+String(Math.floor(Math.random()*16777215).toString(16)))
      .setTitle("Latencies")
      .setDescription(`Latency/Response Time: ${send.createdTimestamp - message.createdTimestamp}ms\nAPI latency/"Remote Response time": ${Math.round(message.client.ws.ping)}ms`)

    msg.channel.send(Embed1).then(msg => {
      msg.edit(Embed2);
    });
  }
};`
相关问题