#Timeout Command Help

1 messages · Page 1 of 1 (latest)

odd wraith
#

My code

const { Message, MessageEmbed, Client } = require("discord.js");
const ms = require('ms')



module.exports.run = async (bot, message, args) => {


    if (!message.member.permissions.has("MODERATE_MEMBERS")) return message.channel.send("You Dont Have The Permissions To timeout a member! - [Timeout Members]");
    if (!message.guild.me.permissions.has("MODERATE_MEMBERS")) return message.channel.send("**Please give me the following permissions: Timeout Members**");


    const user = message.mentions.members.first()
    if (!user)
        return message.channel.send('Please specify a user');

    const length = args[1]
    const timer = ms(length)
    if (!timer)
        return message.channel.send("Please specify the time!");

    if (!length)
        return message.channel.send("Please specify the time!");

    const reason = args.slice(2).join(' ') || 'no reason provided'


    const Tembed = new MessageEmbed()
        .setTitle('Timeout')
        .setThumbnail(user.displayAvatarURL({ dynamic: true }))
        .setColor('DARK_PURPLE')
        .setFooter(message.author.tag, message.author.displayAvatarURL())
        .addFields(
            {
                name: 'Member Name',
                value: user.user.tag.toString(),
                inline: false
            },
            {
                name: 'Reason',
                value: `${reason.toString()}`,
                inline: false
            },
            {
                name: 'Time',
                value: `${length.toString()}`,
                inline: true
            }
        )
        .setTimestamp()

    user.timeout(timer, reason);
    message.channel.send(
        {
            embeds: [Tembed]
        }
    );
},



    module.exports.config = {
        name: "timeout",
        aliases: []
    }
#

So if I mention the user my bot kills and provided the following error

#

But if I write everything at the same time in one message it works

#

@oak arrow Helpp

topaz cargo
#

check if there is args[1]

odd wraith
topaz cargo
odd wraith
#

So when I mention someone bot kills and gives the error

topaz cargo
#

I already told you what to do

#

and the issue isnt even with djs

#

its with the ms package

odd wraith
#

So when I do +timeout @primal swift

#

I want it to respond backc saying

topaz cargo
#

@odd wraith can you read what I said?

odd wraith
#

specify the time

topaz cargo
#

in the thread?

#

read the answers provided

odd wraith
topaz cargo
#

do it then

odd wraith
#

If I do it it works

#

But anyone then can kill the client

#

Just by doing

#

+timeout @primal swift

#

So when I do that I want it to say specify the time

topaz cargo
#

then do it

odd wraith
#

How?

topaz cargo
#

basic js

#

and as I told you earlier this is not djs related

#

do the same as you did with the user...

odd wraith
#

I am trying to

#

const length = args[1]
const timer = ms(length)
if (!timer)
return message.channel.send("Please specify the time!");

#

Ligit I am mentioning the timer/time

#

And if I dont mention it

#

it does not says please specfiy the time

#

it just kills the client.