Logo OmniDevvKANA Web
Kembali ke katalog plugin

group

demote

Turunkan admin grup jadi member biasa

Demote a group admin to member

plugins/group/demote.js

Lokasi file di repo kana-md

1

Perintah termasuk alias

1.4 KB

Ukuran file sumber

4/11/2026

Update terakhir, commit ab47575

Daftar perintah

Ketuk tombol salin untuk menyalin perintah, lalu tempel di chat WhatsApp bot KANA.

.demote

Cara pakai

.demote <@user|balas pesan|nomor>

Contoh

.demote @user

Kode sumber plugin

Unduh .js

Cara pasang: simpan file ini ke folder plugins/group/ di bot KANA kamu, lalu restart bot. Pemilik source code lain bisa mengambil update plugin terbaru dari halaman ini kapan saja.

import { digitsOf, resolveTargetJids } from '../../src/services/guard-rules.js'

export const config = {
  name: 'demote',
  alias: [],
  category: 'group',
  description: { id: 'Turunkan admin grup jadi member biasa', en: 'Demote a group admin to member' },
  usage: '.demote <@user|balas pesan|nomor>',
  example: '.demote @user',
  cooldown: 3,
  isGroup: true,
  isAdmin: true,
  isBotAdmin: true,
}

export const i18n = {
  id: { demote: { noTarget: 'Siapa yang mau diturunkan? Mention, balas pesannya, atau tulis nomornya yaa~', ok: '@{digits} udah KANA turunkan jadi member biasa yaa.', fail: 'Gagal menurunkan @{digits}: {error}' } },
  en: { demote: { noTarget: 'Who should be demoted? Mention them, reply to their message, or write their number~', ok: '@{digits} has been demoted to a regular member.', fail: 'Failed to demote @{digits}: {error}' } },
}

export const test = { input: '.demote', expect: /grup|group/i }

export async function handler(ctx) {
  const targets = resolveTargetJids(ctx)
  if (!targets.length) return ctx.reply(ctx.t('demote.noTarget'))
  for (const jid of targets) {
    const digits = digitsOf(jid)
    try {
      await ctx.sock.groupParticipantsUpdate(ctx.chat, [jid], 'demote')
      await ctx.sock.sendMessage(ctx.chat, { text: ctx.t('demote.ok', { digits }), mentions: [jid] }, { quoted: ctx.raw })
    } catch (err) {
      await ctx.reply(ctx.t('demote.fail', { digits, error: err.message }))
    }
  }
}