Perché sto ricevendo: TypeError: channel.updateOverwrite non è una funzione

0

Domanda

Sto seguendo un tutorial su discord.js rendendo un biglietto bot. Ho ricontrollato e sto ancora ricevendo lo stesso errore:

TypeError: channel.updateOverwrite non è una funzione

Ho guardato su tutti i StackOverflow domande che ho potuto trovare, ma nessuno ha funzionato per me. Ho anche esplorato un po ' di più fuori di COSÌ, ancora nessun aiuto. Ecco il mio codice:

module.exports = {
    name: 'ticket',
    description: 'Open a ticket!',
    async execute(client, message, args, cmd, Discord) {
        // creates tickets
        let channel = await message.guild.channels.create(
            `ticket: ${message.author.tag}`,
            { type: 'text' }
        );
        await channel.setParent('912495738947260446');

        // updates channel perms

        channel.updateOverwrite(message.guild.id, {
            SEND_MESSAGE: false,
            VIEW_CHANNEL: false
        });

        channel.updateOverwrite(message.author, {
            SEND_MESSAGE: true,
            VIEW_CHANNEL: true
        });

        const reactionMessage = await channel.send('Thanks for opening a ticket! A staff member will be with you shortly. While you are here, please tell us why you opened this ticket.');

        try {
            await reactionMessage.react("
discord discord.js javascript node.js
2021-11-23 20:58:37
1

Migliore risposta

0

Sembra che si sta utilizzando discord.js v13 e cercando qualche vecchio codice. In v13 il channel#updateOverwrite() il metodo è stato rimosso e mentre nella versione precedente channel#permissionOverwrites era una raccolta di sovrascrive, in v13 è un PermissionOverwriteManager. Significa, che si dovrebbe usare la sua .edit() metodo di aggiornamento sovrascrive:

channel.permissionOverwrites.edit(
  message.author, 
  { SEND_MESSAGES: false, VIEW_CHANNEL: false },
)
2021-11-23 21:49:11

In altre lingue

Questa pagina è in altre lingue

Русский
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................