javascript - 我的不和谐机器人是否可以将当前聊天中的图像下载到我电脑上的目录中?
问题描述
所以,这就是我的设想,我做了一个简单的消息收集器,我希望机器人收集文件,然后将它们保存在自己的文件夹中,我是 discord.js 的新手,我很可能做错了如果我得到一些答案,会有很大帮助code example
。
client.on('message', inspire);
function inspire(msg) {
if (msg.content === '?create') {
msg.channel.send('Inspire me...');
let filter = m => !m.author.bot;
let collector = new Discord.MessageCollector(msg.channel, filter);
collector.on('collect', colMessage);
function colMessage(msg) {
console.log('Feeling inspired with ' + msg.content);
if (msg.content === "?enough") {
collector.stop();
}
}
collector.on('end', overWith => {
console.log('Was inspired by ' + overWith.size + ' messages');
const painter = Math.floor(Math.random() * artists.length);
msg.channel.send('Here is your ' + artists[painter] + ':');
// Artist is an array of famous painters' names, which is just there for the bot to do a funny comparison of the image it is going to send back (which is a filtered version of the image I want to download) with a masterpiece.
});
}
}
解决方案
推荐阅读
- javascript - 如何使用 {variableName} 创建变量/常量
- java - JSP Spring eval是解析int(为什么不解析long)
- c++ - 为 iostream 和 fstream 重载 <<
- c# - JSON 日期字段不绑定到 C# 日期时间字段
- php - 致命错误:未捕获的 PDOException:SQLSTATE[HY093]:无效参数号:未定义参数
- java - java调用c++多线程库,不释放c++创建的线程
- python - 数据框 - 使用 IF 公式创建基于另一个列
- python - 使用 BeautifulSoup 解析网站时遇到问题
- nativescript - 无法从 NS6 中的自定义组件中捕获事件
- javascript - 如何通过 Google 表格中的键值返回匹配的行数据