0
所以我试图做一个机器人,发布数据给hastebin。 但它并不真正表现良好。我正在使用discord.js和hastebin-gen。Discord x Hastebin命令行为不如预期
这是代码:
const hastebin = require('hastebin-gen');
exports.run = (client, msg, args) => {
let haste = args.slice(0).join(" ")
let type = args.slice(1).join(" ")
if (!args[0]) { return msg.channel.send("Usage: bin.haste yourmsghere.") }
hastebin(haste, type).then(r => {
msg.channel.send(":white_check_mark: Posted text to Hastebin at this URL: " + r);
}).catch(console.error);
}
跑时,例如bin.haste this code is awesome
,它返回:(https://a.pomf.cat/rkjqog.png)(注:不能发表图片呢,抱歉)
如果我点击。 (https://a.pomf.cat/ovcpzb.png)
但是有一个令人讨厌的事实,就是它重复给定的文本,如在链接末尾和链接之后所看到的那样。