N
N
Nikita NeVajno2019-12-28 12:32:46
JavaScript
Nikita NeVajno, 2019-12-28 12:32:46

TypeError: fn.bind is not a function?

Hello.
I'm trying to make a mute command. Its essence is to restrict the user from writing text. That is, he will not have writing privileges and, as planned, he will not be able to.
But an error occurs.
Here is the code:

spoiler
const { Command } = require('discord.js-commando');
const { RichEmbed } = require('discord.js');
const ms = require('ms');

module.exports = class MuteCommand extends Command {
  constructor(client) {
    super(client, {
      name: 'mute',
      memberName: 'mute',
      group: 'guild',
      description: 'mute',
      guildOnly: true,
      userPermissions: ['ADMINISTRATOR']
    });
  }

 async run(message, args) {
    let tomute = message.guild.member(message.mentions.members.first() || message.guild.members.get(args[0]));
    let mod = message.author
    let muterole = message.guild.roles.find(`name`, "Muted");
     if (!muterole) {
      try{
      muterole = await message.guild.createRole({
        name: "Muted",
        color: "#000000",
        permissions:[]
      })
      message.guild.channels.forEach(async (channel, id) => {
        await channel.overwritePermissions(muterole, {
            SEND_MESSAGES: false,
            ADD_REACTIONS: false
        });
      });
    }catch(e){
      console.log(e.stack);
    }
  }
   await tomute.addRole(muterole.id)
   const muteembed = new RichEmbed()
   .setTitle("**Мут**")
   .addField('Пользователь', `<@${tomute.id}>`, true)
   .addField('Модератор', `${mod}`, true)
   .setColor('#FF0000')
   message.embed(muteembed);
 }
};

Mistake
spoiler
TypeError: fn.bind is not a function

Thank you. Happy New Year to all.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question