Logo OmniDevvKANA Web
Kembali ke katalog plugin

fun

tebakkimia

Kuis Tebak Kimia: tebak nama unsur dari lambangnya atau sebaliknya

Chemistry quiz: guess the element name from its symbol or the reverse

plugins/fun/tebakkimia.js

Lokasi file di repo kana-md

2

Perintah termasuk alias

3.1 KB

Ukuran file sumber

4/11/2026

Update terakhir, commit 5d6f23b

Daftar perintah

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

.tebakkimia.kimia

Cara pakai

.tebakkimia lalu balas pesan pertanyaannya dengan jawabanmu

Contoh

.tebakkimia

Kode sumber plugin

Unduh .js

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

import { getSession, startQuiz, bindQuestionMessage } from '../../src/quiz/engine.js'
import { sendButtons } from '../../src/ui/buttons.js'

export const config = {
  name: 'tebakkimia',
  alias: ['kimia'],
  category: 'fun',
  description: { id: 'Kuis Tebak Kimia: tebak nama unsur dari lambangnya atau sebaliknya', en: 'Chemistry quiz: guess the element name from its symbol or the reverse' },
  usage: '.tebakkimia lalu balas pesan pertanyaannya dengan jawabanmu',
  example: '.tebakkimia',
  cooldown: 5,
}

export const i18n = {
  id: {
    tebakkimia: {
      title: 'Kuis Tebak Kimia',
      introName: '🧪 KUIS TEBAK KIMIA\n\nLambang unsur ini nama unsurnya apa?\n\n{clue}\n\nPoin: {points} | Waktu: {seconds} detik. Balas (reply) pesan ini dengan namanya yaa~ {mood}',
      introSymbol: '🧪 KUIS TEBAK KIMIA\n\nUnsur ini lambang kimianya apa?\n\n{clue}\n\nPoin: {points} | Waktu: {seconds} detik. Balas (reply) pesan ini dengan lambangnya yaa~ {mood}',
      already: 'Ehh, masih ada kuis {type} yang jalan di chat ini. Selesaikan dulu atau pencet tombol menyerah di bawah yaa~',
      giveUpBtn: '🏳️ Menyerah (.nyerah)',
      menuBtn: '🎲 Menu Fun',
      footer: 'Kuis KANA',
    },
  },
  en: {
    tebakkimia: {
      title: 'Chemistry Quiz',
      introName: '🧪 CHEMISTRY QUIZ\n\nWhat is the element name for this symbol?\n\n{clue}\n\nPoints: {points} | Time: {seconds} seconds. Reply to this message with the name~ {mood}',
      introSymbol: '🧪 CHEMISTRY QUIZ\n\nWhat is the chemical symbol for this element?\n\n{clue}\n\nPoints: {points} | Time: {seconds} seconds. Reply to this message with the symbol~ {mood}',
      already: 'Eh, a {type} quiz is still running in this chat. Finish it first or tap the give up button below~',
      giveUpBtn: '🏳️ Give Up (.nyerah)',
      menuBtn: '🎲 Fun Menu',
      footer: 'KANA Quiz',
    },
  },
}

export const test = { input: '.tebakkimia', expect: /tebak kimia|kuis/i }

export async function handler(ctx) {
  const existing = await getSession(ctx.storage, ctx.chat)
  if (existing) {
    const body = ctx.t('tebakkimia.already', { type: existing.type })
    return sendButtons(ctx.sock, ctx.chat, {
      title: ctx.t('tebakkimia.title'),
      body,
      footer: ctx.t('tebakkimia.footer'),
      replies: [
        { text: ctx.t('tebakkimia.giveUpBtn'), id: '.nyerah' },
      ],
      textFallback: body,
    })
  }
  const { question } = await startQuiz(ctx.storage, ctx.chat, 'tebakkimia', {
    lang: ctx.lang,
    startedBy: ctx.senderDigits,
  })
  const key = question.mode === 'name-to-symbol' ? 'tebakkimia.introSymbol' : 'tebakkimia.introName'
  const body = ctx.t(key, {
    clue: question.text,
    points: question.points,
    seconds: 120,
    mood: ctx.say('senang'),
  })
  const sentQuestion = await sendButtons(ctx.sock, ctx.chat, {
    title: ctx.t('tebakkimia.title'),
    body,
    footer: ctx.t('tebakkimia.footer'),
    replies: [
      { text: ctx.t('tebakkimia.giveUpBtn'), id: '.nyerah' },
    ],
    textFallback: body,
  })
  await bindQuestionMessage(ctx.storage, ctx.chat, sentQuestion?.key?.id)
  return sentQuestion
}