小编Lin*_*ips的帖子

Discord.js 发送 webhook

您好,我一直在尝试使用 Webhook,我想知道如何通过具有自定义头像和名称的 Webhook 发送普通消息(未嵌入)


        const user = message.mentions.users.first() || client.users.cache.get(args[0]);
        let announcement = args.slice(1).join(" ");
        if(!announcement) return message.channel.send(`lol say something`)

        const wc = new WebhookClient('id', 'token')
        const embed = new MessageEmbed()
            .setTitle("").setColor('GREEN').setTimestamp().setDescription(announcement)
    wc.send({
        username : user.username,
        avatarURL : user.displayAvatarURL({ dynamic : true }),
        embeds : [embed]
    })
    
    }
    ```
Run Code Online (Sandbox Code Playgroud)

node.js discord discord.js

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

discord ×1

discord.js ×1

node.js ×1