kick

Kicks an user from the current guild.

Syntax

kick(userID)

Parameters

  • userID : The user to kick. Value must be a valid user snowflake ID.

Permissions

Required permission which the bot must have for this function to work properly.

  • kick

Example

try {
  const msg = message.replace(commandPrefix, '').trim();

  if (!msg) {
    setResponse(`Usage : \` ${commandPrefix} [@user] \``);
  } else {
    const mention = /^<@!?(\d{17,20})>/.test(msg);

    if (!mention || !userMentions[0])
      throw new Error('Mention an user!');

    if (userMentions[0] === authorId)
      throw new Error('You can\'t kick yourself!');

    sendChannelMessage(channelId, `*<@${authorId}> kicked <@${userMentions[0]}>!!*`);

    kick(userMentions[0]);
  };
} catch (err) {
  setResponse('Command Error : ` ' + err.message + ' `');
};

Screenshot_20220919_163929
InShot_20220919_164211838