简体   繁体   English

在为 Discord 服务器创建 BOT 时,如何“scanf()”和“printf()”discord.js 中的用户消息?

[英]How do I "scanf()" and "printf()" a user's message in discord.js when creating a BOT for Discord server?

I am new at coding and I only have the basic knowledge of C but I do know how other codes work if I know the functions its equivalent in C. I am using discord.js (12.0.2) to make my Discord bot.我是新的编码和我只有基础知识C但我知道如何代码的其他工作,如果我知道它相当于C.我的功能使用AM discord.js (12.0.2),使我的不和谐机器人。 How do I scan and print a user's sent message?如何扫描和打印用户发送的消息?

To 'scan' a user's message, use the content property of their message.要“扫描”用户的消息,请使用其消息的content属性。 I barely know C but I'm pretty sure the equivalent of printf is console.log :我几乎不知道 C 但我很确定printf的等价物是console.log

const {Client} = require('discord.js')

const client = new Client()

client.on('message', message => {
  console.log(message.content)
}

client.login(yourToken)

I recommend reading the Discord.js guide .我建议阅读Discord.js 指南

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何让我的 Discord.JS 机器人对其自己的直接消息做出反应? - How do I make my Discord.JS bot react to it's own Direct Message? 如何在 discord.js 中为 discord bot 合并图像? - How do I merge images in discord.js for a discord bot? Discord.js 如何让机器人对它刚刚通过 id 在 discord 中发送的消息做出反应? - Discord.js How do I get the bot to react to the message it just sent in discord by id? 如何让 discord 机器人在 discord.js 中发送消息后有表情符号反应? - How do I make discord bot have an emoji reaction after it sends its message in discord.js? (Discord.JS) 当用户加入时机器人不发送 DM 消息 - (Discord.JS) Bot not sending DM message when a user join 如何在 index.js [机器人的启动文件] 中创建 discord.js 命令,该命令在发送包含“hi”的消息时删除该消息 - How do I create a discord.js command in index.js [The bot's startup file] that deletes the message when a message that contains "hi" was sent discord.js 我不断收到机器人所说的而不是用户的消息 - discord.js I keep getting what the bot says instead of user's message 如何将服务器中每个用户的 id 放入数组中? (Discord.js v12) - How do I get every user's id in a server into an array? (Discord.js v12) discord 机器人中的错误消息? (discord.js) - error message in discord bot? (discord.js) 我如何让机器人在不带“\\_poll”的情况下使用 discord.js 发送轮询消息的 adv poll 命令 - How do I get a bot to send the message of the poll without the '\_poll' for an adv poll command with discord.js
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM