久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

使用 Discord.js 發(fā)送消息

Send a message with Discord.js(使用 Discord.js 發(fā)送消息)
本文介紹了使用 Discord.js 發(fā)送消息的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在嘗試制作一個不和諧的機器人,但我不太了解 Discord.js.我的代碼如下所示:

I am trying to make a discord bot, but I can't quite understand Discord.js. My code looks like this:

client.on('message', function(message) {
 if (message.content === 'ping') {
  client.message.send(author, 'pong');
 }
});

問題是我不太明白如何發(fā)送消息.

And the problem is that I can't quite understand how to send a message.

誰能幫幫我?

推薦答案

發(fā)送碼又改了.問題和答案中的項目都已過時.對于版本 12,下面將是正確的代碼.有關(guān)此代碼的詳細信息,請參閱此 鏈接.

The send code has been changed again. Both the items in the question as well as in the answers are all outdated. For version 12, below will be the right code. The details about this code are available in this link.

向特定頻道發(fā)送消息

const channel = <client>.channels.cache.get('<id>');
channel.send('<content>');

向 DM 中的特定用戶發(fā)送消息

To send a message to a specific user in DM

const user = <client>.users.cache.get('<id>');
user.send('<content>');

如果你想給用戶發(fā)私信,請注意機器人和用戶應(yīng)該至少有一個共同的服務(wù)器.

If you want to DM a user, please note that the bot and the user should have at least one server in common.

希望這個答案對版本 12 之后來這里的人有所幫助.

Hope this answer helps people who come here after version 12.

這篇關(guān)于使用 Discord.js 發(fā)送消息的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Using discord.js to detect image and respond(使用 discord.js 檢測圖像并響應(yīng))
Check if user ID exists in Discord server(檢查 Discord 服務(wù)器中是否存在用戶 ID)
Guild Member Add does not work (discordjs)(公會成員添加不起作用(discordjs))
Creating my first bot using REPLIT but always error Discord.JS(使用 REPLIT 創(chuàng)建我的第一個機器人,但總是錯誤 Discord.JS)
How do I code event/command handlers for my Discord.js bot?(如何為我的 Discord.js 機器人編寫事件/命令處理程序?)
How to find a User ID from a Username in Discord.js?(如何從 Discord.js 中的用戶名中查找用戶 ID?)
主站蜘蛛池模板: 午夜影院在线观看 | 全免费a级毛片免费看视频免费下 | 91精品一区| 国产精品精品视频一区二区三区 | 97伦理 | 国产在线资源 | 久久久久久免费免费 | 国产成人免费视频 | 免费三级av | 久久高清免费视频 | 在线亚洲免费 | 免费成人在线网 | 九色在线| 国精产品一区二区三区 | 人人做人人澡人人爽欧美 | 亚洲天堂精品久久 | 亚洲精品白浆高清久久久久久 | 日韩欧美国产一区二区三区 | 成人av一区二区三区 | 国产精品亚洲一区 | 久久精品| 日韩国产欧美视频 | 一区二区三区视频在线观看 | 亚洲一区国产精品 | 婷婷丁香在线视频 | 美女天堂 | 国产精品美女久久久久aⅴ国产馆 | 欧美日韩福利视频 | 在线中文一区 | 色播视频在线观看 | 欧美日韩1区2区3区 欧美久久一区 | 国产精品久久久久久久久久免费看 | 欧美一区二区三区在线播放 | 国产精品特级毛片一区二区三区 | 日韩毛片在线观看 | 国产乱码精品一区二区三区五月婷 | a级片播放 | 精品一区国产 | 久久精品69 | 国产精品爱久久久久久久 | 欧美成人猛片aaaaaaa |