- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试使用 bulkDelete
让我的机器人删除它的消息,但我收到此错误:
(node:5724) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Bad Request
(node:5724) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
这是我的代码:
const Discord = require('discord.js');
const bot = new Discord.Client();
const config = require("./config.json");
bot.on('ready', () =>{
console.log('I am ready!');
});
//var cleanarr=[];
bot.on("message", message =>{
if (message.author.bot) return;
var cleanarr=[];
let command = message.content.split(" ")[0];
command = command.slice(config.prefix.length);
let args = message.content.split(" ").slice(1);
if (message.content == 'lol'){
message.channel.sendMessage('LUL');
cleanarr.unshift(`${message.channel.lastMessageID}`);
}
if (command == "clean") {
message.channel.sendMessage('Cleaning...');
message.channel.bulkDelete(cleanarr);
var cleanarr = [];
bulkDelete 需要什么?是消息 ID 还是其他?
我不知道我这样做是否正确(显然我不是),因为我开始编码时对 javascript 或任何相关知识都是零知识。
最佳答案
最简单的删除方法x
来自 channel 的消息是提供来自 2 - 100
的整数作为 <TextChannel>.bulkDelete
的参数方法。
例子:
message.channel.bulkDelete(100).then(() => {
message.channel.send("Deleted 100 messages.").then(msg => msg.delete(3000));
});
关于javascript - bulkDelete 如何工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41574971/
我正在创建一个清理聊天的命令,这样你就可以删除垃圾邮件或不需要的聊天等。该命令曾经运行良好,但没有再次运行,所以我倾向于认为这是我无法控制的事情,但我不知道。 try { let mod = me
我尝试使用 bulkDelete 让我的机器人删除它的消息,但我收到此错误: (node:5724) UnhandledPromiseRejectionWarning: Unhandled promi
最近看了"Cruddy by Design" - Laracon US 2017现在我正试图摆脱我的 Controller 中的任何额外方法(所以我只有 index、create、store、show
我有一个种子,我将 bulkDelete 与查询界面一起使用。没关系,但我需要截断表格。我设置了 truncate: true 选项,但出现错误: Cannot truncate a table re
我正在尝试编写一个种子文件的down,并且我想bulkDelete 我在up 中创建的数据。但我找不到任何有关如何执行此操作的文档。官方文档没有举例:http://docs.sequelizejs.c
我正在尝试调用 BulkDelete() Action本地 Microsoft Dynamics CRM 365 (2016/v8.2) 实例的 WebAPI(OData REST 服务)。 目前,我
我是一名优秀的程序员,十分优秀!