【发布时间】:2021-02-14 17:00:54
【问题描述】:
我的接吻命令需要帮助,我试图做到这一点,所以当我执行!kiss 时,它会亲吻我提到的那个人。但是当它尝试发送嵌入时它不会发送并且我收到一个错误:
错误:
0|index | DiscordAPIError: Invalid Form Body
0|index | embed.image.url: Scheme "2" is not supported. Scheme must be one of ('http', 'https').
0|index | at RequestHandler.execute (/Users/mahdiabbas/Documents/metanoia/node_modules/discord.js/src/rest/RequestHandler.js:154:13)
0|index | at processTicksAndRejections (internal/process/task_queues.js:93:5)
0|index | at async RequestHandler.push (/Users/mahdiabbas/Documents/metanoia/node_modules/discord.js/src/rest/RequestHandler.js:39:14) {
0|index | method: 'post',
0|index | path: '/channels/808886209899397150/messages',
0|index | code: 50035,
0|index | httpStatus: 400
0|index | }
我的代码:
const Discord = require('discord.js');
const fs = require('fs');
const db = require('quick.db');
module.exports = {
name: 'kiss',
async execute(message, args) {
let mention = message.mentions.users.first();
if (!mention) {
return message.channel.send('You need to mention a user to kiss.');
}
db.add(`commandran_${message.guild.id}`, 1);
let dbfetch = db.fetch(`commandran_${message.guild.id}`);
const responses = [
"https://tenor.com/view/anime-couple-peck-cute-kiss-gif-12612515",
"https://tenor.com/view/anime-kiss-crying-cute-couple-gif-13970544",
"https://tenor.com/view/koi-to-uso-anime-kiss-gif-13344412"
];
const randomIndex = Math.floor(Math.random() * responses.length);
const kissEmbed = new Discord.MessageEmbed()
.setAuthor(`You have kissed ${mention}`)
.setFooter(`You have kissed a total of ${dbfetch} people.`)
.setImage(randomIndex)
message.channel.send(kissEmbed)
}
}
【问题讨论】:
标签: javascript node.js discord discord.js