Logo OmniDevvKANA Web
Masuk
Kembali ke katalog plugin

fun

cekmood

Cek persen mood kamu hari ini, buat hiburan

Check your mood percent for today, just for fun

plugins/fun/cekmood.js

Lokasi file di repo kana-md

1

Perintah termasuk alias

2.7 KB

Ukuran file sumber

4/11/2026

Update terakhir, commit 44f4010

Daftar perintah

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

.cekmood

Cara pakai

.cekmood

Contoh

.cekmood

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 { sendButtons } from '../../src/ui/buttons.js'
import { wibDateString } from '../../src/services/user-service.js'

export const config = {
  name: 'cekmood',
  alias: [],
  category: 'fun',
  description: { id: 'Cek persen mood kamu hari ini, buat hiburan', en: 'Check your mood percent for today, just for fun' },
  usage: '.cekmood',
  example: '.cekmood',
  cooldown: 3,
}

// Hash deterministik kecil jadi persen 0 sampai 100. Duplikasi disengaja
// di tiap plugin cek-* supaya plugin tetap mandiri satu file.
export function hashPercent(seed) {
  let h = 0
  const s = String(seed ?? '')
  for (let i = 0; i < s.length; i++) h = (h * 31 + s.charCodeAt(i)) >>> 0
  return h % 101
}

export const i18n = {
  id: {
    cekmood: {
      title: 'Cek Mood ๐ŸŒธ',
      result: 'Mood {name} hari ini: {percent}%!\n{comment}\n\n{disclaimer}',
      low: 'Lagi mendung yaa... istirahat bentar, minum air, KANA temenin kok (ยดโ€ข ฯ‰ โ€ข`) ๐Ÿ’•',
      mid: 'Moodnya lumayan nih, cukup buat jalan santai hari ini~ โœจ',
      high: 'Moodnya bagus banget! Cocok buat ngerjain hal yang kamu suka~ (โ‰งโ–ฝโ‰ฆ)',
      max: 'Uwahh moodnya meledak positif! Hari ini harimu banget~ ๐ŸŽ‰๐Ÿ’–',
      disclaimer: 'Ini cuma hiburan yaa, persennya dari ramalan iseng KANA, bukan ukuran perasaan beneran~',
      btnAgain: 'Cek Lagi',
      btnMenu: 'Menu Fun',
    },
  },
  en: {
    cekmood: {
      title: 'Mood Check ๐ŸŒธ',
      result: '{name} mood today: {percent}%!\n{comment}\n\n{disclaimer}',
      low: 'A bit cloudy today... take a short rest, drink some water, KANA is here with you (ยดโ€ข ฯ‰ โ€ข`) ๐Ÿ’•',
      mid: 'Your mood is decent, enough for a chill day~ โœจ',
      high: 'Your mood is great! Perfect for doing things you love~ (โ‰งโ–ฝโ‰ฆ)',
      max: 'Whoaa your mood is bursting with positivity! Today is your day~ ๐ŸŽ‰๐Ÿ’–',
      disclaimer: 'This is just for fun, the percent comes from KANA playful reading, not a real measure of feelings~',
      btnAgain: 'Check Again',
      btnMenu: 'Fun Menu',
    },
  },
}

export const test = { input: '.cekmood', expect: /mood/i }

export async function handler(ctx) {
  const percent = hashPercent(`${ctx.senderDigits}:mood:${wibDateString()}`)
  const band = percent < 30 ? 'low' : percent < 60 ? 'mid' : percent < 85 ? 'high' : 'max'
  const body = ctx.t('cekmood.result', {
    name: ctx.pushName || ctx.senderDigits,
    percent,
    comment: ctx.t(`cekmood.${band}`),
    disclaimer: ctx.t('cekmood.disclaimer'),
  })
  return sendButtons(ctx.sock, ctx.chat, {
    title: ctx.t('cekmood.title'),
    body,
    footer: ctx.t('menu.footer'),
    replies: [
      { text: ctx.t('cekmood.btnAgain'), id: '.cekmood' },
    ],
    textFallback: body,
  })
}