javascript - 如何修复“TypeError:无法读取未定义的属性‘包含’”
问题描述
我已经在我的机器人上发出命令,但是这个问题在几个小时内都可以正常工作,但突然它抛出了一个错误。
exports.run = (client, message, args) => {
if (!args[0].includes("https://www.roblox.com/games/")) return message.reply("Invalid Format!");
// ^ Where it throws an error - TypeError: Cannot read property 'includes' of undefined
const { pathname } = new URL(args[0]);
if (!pathname) return message.channel.send("Invalid URL Provided");
let id = pathname.slice(pathname.indexOf("s/") + 2, pathname.lastIndexOf("/"));
}
解决方案
推荐阅读
- python-3.x - subprocess.Popen 仅在终端中工作
- react-native - 使用图像和uri动态设置react native的图像源
- php - 自定义字段的 Smarty PHP 多选
- r - 为纵向数据创建时间轴;使用数据变量进行计算
- html - 如何在 AMP-HTML 页面中加载外部页眉和页脚 HTML
- python - Node JS中Python AES加密/解密代码的实现
- android - Exoplayer 缓冲区状态冻结 UI?
- python - 使用 np.where 创建列时出现问题,ArrayType 错误
- python - 使用 GoogleV3 的 Geopy 表示仅在几个请求后就超出了配额
- python - Python 正则表达式:如何从字符串中提取人体高度(美国)