2021年4月29日星期四

making a new channel discord.js v11.3

Im trying to make a ticket bot. not sure what is wrong with my !new command Please help. Im using what discord has in their (https://discord.js.org/#/docs/main/v11/class/Guild?scrollTo=createChannel) The code is below!

  const Discord = require('discord.js');    module.exports.run = async (bot, message, args) => {              message.react('✅');        let modrole = message.guild.roles.cache.find(r => r.name === 'Staff');        if (!modrole) {          console.log('Err: ModRole Not Found');        }          message.reply(`${message.author.username}#${message.author.discriminator}`);        message.guild.createChannel(`${message.author.username}#${message.author.discriminator}`, {            parent: '',          topic: message.author.id,          type: '',          permissionOverwrites: [              { id: message.guild.id, deny: ['VIEW_CHANNEL'] },              { id: modrole.id, allow: ['VIEW_CHANNEL', 'SEND_MESSAGES'] },              { id: message.author.id, allow: ['VIEW_CHANNEL', 'SEND_MESSAGES'] }            ]      }).then(c => {          message.reply(`, <@Staff>`)          const embed = new Discord.message.embed()          .setTitle('**New Ticket**')          .setDescription(`Thank you for opening a ticket *<@${message.author.id}>, a staff member will be with you shortly!`)      })    }    //name this whatever the command name is.  module.exports.help = {    name: "new"  }      

Theese are the errors

(node:1664) UnhandledPromiseRejectionWarning: TypeError: message.guild.createChannel is not a function      at Object.module.exports.run (C:\Users\8fwbu\Desktop\CodeTProj\Molten Dev\commands\new.js:20:19)      at Client.<anonymous> (C:\Users\8fwbu\Desktop\CodeTProj\Molten Dev\main.js:42:31)      at Client.emit (events.js:315:20)      at MessageCreateAction.handle (C:\Users\8fwbu\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)      at Object.module.exports [as MESSAGE_CREATE] (C:\Users\8fwbu\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)      at WebSocketManager.handlePacket (C:\Users\8fwbu\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)      at WebSocketShard.onPacket (C:\Users\8fwbu\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)      at WebSocketShard.onMessage (C:\Users\8fwbu\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)      at WebSocket.onMessage (C:\Users\8fwbu\node_modules\ws\lib\event-target.js:132:16)      at WebSocket.emit (events.js:315:20)  (Use `node --trace-warnings ...` to show where the warning was created)  (node:1664) 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:1664) [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.  

It wont let me post due to lack of words so ignore this The quick brown fox jumped over the lazy dog The quick brown fox jumped over the lazy dog The quick brown fox jumped over the lazy dog The quick brown fox jumped over the lazy dog The quick brown fox jumped over the lazy dog The quick brown fox jumped over the lazy dog The quick brown fox jumped over the lazy dog The quick brown fox jumped over the lazy dog

https://stackoverflow.com/questions/67327857/making-a-new-channel-discord-js-v11-3 April 30, 2021 at 11:32AM

没有评论:

发表评论