discord.js 랜덤 이미지 질문
조회수 1023회
// Send hikari's image
client.on('message', message => {
if (message.content.startsWith ("hikari")) {
const hikari = [
'https://example/giphy.gif',
'https://example/giphy2.gif',
'https://example/giphy3.gif',
]
message.channel.send({
file: hikari[Math.floor(Math.random() * hikari.length)]
});
}
});
이런다음 hikari
를 치면
(node:12432) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message
at RequestHandler.execute (C:\로컬주소\node_modules\discord.js\src\rest\RequestHandler.js:170:25)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:12432) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:12432) [DEP0018] 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.
라는 오류가 뜨면서 불러오지를 못합니다.
message.channel.send({
file: hikari[Math.floor(Math.random() * hikari.length)]
});
에서 문제가 있는것같은데 고치기에는 능력이 부족하네요 ㅠㅠ
-
(•́ ✖ •̀)
알 수 없는 사용자
댓글 입력