javascript - 自动更新补货产品
问题描述
所以这是我的旧代码,它从文件中读取行,然后在库存中显示该文件有多少行。但是现在我希望我的机器人在从以下网站补货时自动更新:阿迪达斯欧盟、耐克欧盟和最高欧盟。那可能吗?
代码:
const Discord = require('discord.js');
const fs = require('fs');
module.exports.run = async (bot, message, args) => {
let file1 = fs.readFileSync('spotify.txt').toString();
let file2 = fs.readFileSync('netflix.txt').toString();
let file3 = fs.readFileSync('disney+.txt').toString();
lineCount1 = (file1.match(/\n/g) || '').length;
lineCount2 = (file2.match(/\n/g) || '').length;
lineCount3 = (file3.match(/\n/g) || '').length;
var embed = new Discord.RichEmbed()
.setColor("#c59c16")
.addField(`This guild has the following service(s):`, `**SPOTIFY:** ${lineCount1} \n **NETFLIX:** ${lineCount2} \n **DISNEY+:** ${lineCount3}`)
message.channel.sendEmbed(embed);
}
module.exports.help = {
name: "stock"
}
解决方案
推荐阅读
- qt - QML:列不适用于自定义类型
- javascript - 快速切换页面后在 axios 调用中反应 setState
- python - 通过在 Pandas 中创建列按组展平 DataFrame
- javascript - 响应式设计宽度问题
- templates - 资源解释为样式表,但使用 MIME 类型 text/html 传输:“http://localhost:4000/style.css”
- c# - 最新 Autofac 版本不支持 .Net Framework 4.6.2
- android - 无法访问“FavoriteBottomDialogFragment”的超类型“androidx.lifecycle.HasDefaultViewModelProviderFactory”。检查你的模块分类
- c# - 为什么此语法在 C# 中有效?
- css - 为什么我的 SVG 有响应但偶尔会响应?
- flutter - GridView在SingleChildScrollView中溢出