いろんなサイトを探してみたのですが、どれを実行してもエラーが出てしまいます....
どうすればよいのでしょうか...?
ソースコード☟
js
1client.on('message', async message => { 2 if(message.content.startsWith('ここに発火させるコマンド')){ 3 guild.channels.create('チャンネル名') 4 } 5 });
ツールは
Replit
です。
補足
①(このコマンドのみ動かない状態です....)
②pingコマンド・helpコマンドなどは正常動作しています。
③しっかりパッケージはインストールしています。
④最近始めたばかりです。(discord.pyは前からやっていました。)
エラーコード?
js
1(node:7606) UnhandledPromiseRejectionWarning: ReferenceError: guild is not defined 2 at Client.<anonymous> (/home/runner/bot/server.js:65:9) 3 at Client.emit (events.js:326:22) 4 at MessageCreateAction.handle (/home/runner/bot/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14) 5 at Object.module.exports [as MESSAGE_CREATE] (/home/runner/bot/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32) 6 at WebSocketManager.handlePacket (/home/runner/bot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31) 7 at WebSocketShard.onPacket (/home/runner/bot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22) 8 at WebSocketShard.onMessage (/home/runner/bot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10) 9 at WebSocket.onMessage (/home/runner/bot/node_modules/ws/lib/event-target.js:132:16) 10 at WebSocket.emit (events.js:314:20) 11 at Receiver.receiverOnMessage (/home/runner/bot/node_modules/ws/lib/websocket.js:1008:20) 12(node:7606) 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) 13(node:7606) [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.

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。