-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
100 changed files
with
3,822 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import similarity from 'similarity' | ||
const threshold = 0.72 | ||
export async function before(m) { | ||
let id = m.chat | ||
if (!m.quoted || !m.quoted.fromMe || !m.quoted.isBaileys || !m.text || !/Ketik.*hlen/i.test(m.quoted.text) || /.*hlen/i.test(m.text)) | ||
return !0 | ||
this.lengkapikalimat = this.lengkapikalimat ? this.lengkapikalimat : {} | ||
if (!(id in this.lengkapikalimat)) | ||
return conn.sendButton(m.chat, 'Soal itu telah berakhir', author, null, buttonlengkapikalimat, m) | ||
if (m.quoted.id == this.lengkapikalimat[id][0].id) { | ||
let isSurrender = /^((me)?nyerah|surr?ender)$/i.test(m.text) | ||
if (isSurrender) { | ||
clearTimeout(this.lengkapikalimat[id][3]) | ||
delete this.lengkapikalimat[id] | ||
return conn.sendButton(m.chat, '*Yah Menyerah :( !*', author, null, buttonlengkapikalimat, m) | ||
} | ||
let json = JSON.parse(JSON.stringify(this.lengkapikalimat[id][1])) | ||
// m.reply(JSON.stringify(json, null, '\t')) | ||
if (m.text.toLowerCase() == json.jawaban.toLowerCase().trim()) { | ||
global.db.data.users[m.sender].exp += this.lengkapikalimat[id][2] | ||
conn.sendButton(m.chat, `*Benar!*\n+${this.lengkapikalimat[id][2]} XP`, author, null, buttonlengkapikalimat, m) | ||
clearTimeout(this.lengkapikalimat[id][3]) | ||
delete this.lengkapikalimat[id] | ||
} else if (similarity(m.text.toLowerCase(), json.jawaban.toLowerCase().trim()) >= threshold) | ||
m.reply(`*Dikit Lagi!*`) | ||
else | ||
conn.sendButton(m.chat, `*Salah!*`, author, null, [ | ||
['Hint', '/hlen'], | ||
['Nyerah', 'menyerah'] | ||
], m) | ||
} | ||
return !0 | ||
} | ||
export const exp = 0 | ||
|
||
const buttonlengkapikalimat = [ | ||
['lengkapikalimat', '/lengkapikalimat'] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
let handler = async (m, { conn }) => { | ||
conn.lengkapikalimat = conn.lengkapikalimat ? conn.lengkapikalimat : {} | ||
let id = m.chat | ||
if (!(id in conn.lengkapikalimat)) throw false | ||
let json = conn.lengkapikalimat[id][1] | ||
conn.sendButton(m.chat, '```' + json.jawaban.replace(/[AIUEOaiueo]/ig, '_') + '```', author, null, [ | ||
['Nyerah', 'menyerah'] | ||
], m) | ||
} | ||
handler.command = /^hlen$/i | ||
|
||
handler.limit = true | ||
|
||
export default handler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
let handler = async (m, { conn, args, usedPrefix, command }) => { | ||
conn.math = conn.math ? conn.math : {} | ||
const buttons = Object.keys(modes).map(v => [v, `${usedPrefix}${command} ${v}`]) | ||
if (args.length < 1) return conn.sendButton(m.chat, ` | ||
Mode: ${Object.keys(modes).join(' | ')} | ||
Contoh penggunaan: ${usedPrefix}math medium | ||
`.trim(), author, null, buttons, m) | ||
let mode = args[0].toLowerCase() | ||
if (!(mode in modes)) return conn.sendButton(m.chat, ` | ||
Mode: ${Object.keys(modes).join(' | ')} | ||
Contoh penggunaan: ${usedPrefix}math medium | ||
`.trim(), author, null, buttons, m) | ||
let id = m.chat | ||
if (id in conn.math) return conn.reply(m.chat, 'Masih ada soal belum terjawab di chat ini', conn.math[id][0]) | ||
let math = genMath(mode) | ||
conn.math[id] = [ | ||
await conn.reply(m.chat, `Berapa hasil dari *${math.str}*?\n\nTimeout: ${(math.time / 1000).toFixed(2)} detik\nBonus Jawaban Benar: ${math.bonus} XP`, m), | ||
math, 4, | ||
setTimeout(() => { | ||
if (conn.math[id]) conn.sendButton(m.chat, `Waktu habis!\nJawabannya adalah ${math.result}`, author, null, [['again', `${usedPrefix}${command} ${math.mode}`], ...buttons], conn.math[id][0]) | ||
delete conn.math[id] | ||
}, math.time) | ||
] | ||
} | ||
handler.help = ['math <mode>'] | ||
handler.tags = ['game'] | ||
handler.command = /^math/i | ||
|
||
|
||
let modes = { | ||
noob: [-3, 3, -3, 3, '+-', 15000, 10], | ||
easy: [-10, 10, -10, 10, '*/+-', 20000, 40], | ||
medium: [-40, 40, -20, 20, '*/+-', 40000, 150], | ||
hard: [-100, 100, -70, 70, '*/+-', 60000, 350], | ||
extreme: [-999999, 999999, -999999, 999999, '*/', 99999, 9999], | ||
impossible: [-99999999999, 99999999999, -99999999999, 999999999999, '*/', 30000, 35000], | ||
impossible2: [-999999999999999, 999999999999999, -999, 999, '/', 30000, 50000] | ||
} | ||
|
||
let operators = { | ||
'+': '+', | ||
'-': '-', | ||
'*': '×', | ||
'/': '÷' | ||
} | ||
|
||
function genMath(mode) { | ||
let [a1, a2, b1, b2, ops, time, bonus] = modes[mode] | ||
let a = randomInt(a1, a2) | ||
let b = randomInt(b1, b2) | ||
let op = pickRandom([...ops]) | ||
let result = (new Function(`return ${a} ${op.replace('/', '*')} ${b < 0 ? `(${b})` : b}`))() | ||
if (op == '/') [a, result] = [result, a] | ||
return { | ||
str: `${a} ${operators[op]} ${b}`, | ||
mode, | ||
time, | ||
bonus, | ||
result | ||
} | ||
} | ||
|
||
function randomInt(from, to) { | ||
if (from > to) [from, to] = [to, from] | ||
from = Math.floor(from) | ||
to = Math.floor(to) | ||
return Math.floor((to - from) * Math.random() + from) | ||
} | ||
|
||
function pickRandom(list) { | ||
return list[Math.floor(Math.random() * list.length)] | ||
} | ||
|
||
handler.modes = modes | ||
|
||
export default handler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
let handler = m => m | ||
handler.before = async function (m) { | ||
if (!/^-?[0-9]+(\.[0-9]+)?$/.test(m.text)) return !0 | ||
let id = m.chat | ||
if (!m.quoted || !m.quoted.fromMe || !m.text || !/^Berapa hasil dari/i.test(m.quoted.text)) return !0 | ||
this.math = this.math ? this.math : {} | ||
if (!(id in this.math)) return conn.sendButton(m.chat, 'Soal itu telah berakhir', author, null, [['math', '/math']], m) | ||
if (m.quoted.id == this.math[id][0].id) { | ||
let math = JSON.parse(JSON.stringify(this.math[id][1])) | ||
if (m.text == math.result) { | ||
global.db.data.users[m.sender].exp += math.bonus | ||
clearTimeout(this.math[id][3]) | ||
delete this.math[id] | ||
conn.sendButton(m.chat, `*Jawaban Benar!*\n+${math.bonus} XP`, author, null, [['again', `/math ${math.mode}`]], m) | ||
} else { | ||
if (--this.math[id][2] == 0) { | ||
clearTimeout(this.math[id][3]) | ||
delete this.math[id] | ||
conn.sendButton(m.chat, `*Kesempatan habis!*\nJawaban: *${math.result}*`, author, null, [['again', `/math ${math.mode}`]], m) | ||
} else m.reply(`*Jawaban Salah!*\nMasih ada ${this.math[id][2]} kesempatan`) | ||
} | ||
} | ||
return !0 | ||
} | ||
|
||
export default handler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { siapakahaku } from '@bochilteam/scraper' | ||
|
||
let timeout = 120000 | ||
let poin = 4999 | ||
let handler = async (m, { conn, usedPrefix }) => { | ||
conn.siapakahaku = conn.siapakahaku ? conn.siapakahaku : {} | ||
let id = m.chat | ||
if (id in conn.siapakahaku) { | ||
conn.reply(m.chat, 'Masih ada soal belum terjawab di chat ini', conn.siapakahaku[id][0]) | ||
throw false | ||
} | ||
const json = await siapakahaku() | ||
let caption = ` | ||
Siapakah aku? ${json.soal} | ||
Timeout *${(timeout / 1000).toFixed(2)} detik* | ||
Ketik ${usedPrefix}who untuk bantuan | ||
Bonus: ${poin} XP | ||
`.trim() | ||
conn.siapakahaku[id] = [ | ||
await conn.sendButton(m.chat, caption, author, ['hint', `${usedPrefix}who`], m), | ||
json, poin, | ||
setTimeout(() => { | ||
if (conn.siapakahaku[id]) conn.sendButton(m.chat, `Waktu habis!\nJawabannya adalah *${json.jawaban}*`, author, ['siapahaku', '/siapakahaku'], conn.siapakahaku[id][0]) | ||
delete conn.siapakahaku[id] | ||
}, timeout) | ||
] | ||
} | ||
handler.help = ['siapakahaku'] | ||
handler.tags = ['game'] | ||
handler.command = /^siapa(kah)?aku/i | ||
|
||
export default handler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import similarity from 'similarity' | ||
const threshold = 0.72 | ||
let handler = m => m | ||
handler.before = async function (m) { | ||
let id = m.chat | ||
if (!m.quoted || !m.quoted.fromMe || !m.quoted.isBaileys || !m.text || !/Ketik.*(who|hint)/i.test(m.quoted.text) || /.*(who|hint)/i.test(m.text)) return !0 | ||
this.siapakahaku = this.siapakahaku ? this.siapakahaku : {} | ||
if (!(id in this.siapakahaku)) return conn.sendButton(m.chat, 'Soal itu telah berakhir', author, ['siapakahaku', '/siapakahaku'], m) | ||
if (m.quoted.id == this.siapakahaku[id][0].id) { | ||
let json = JSON.parse(JSON.stringify(this.siapakahaku[id][1])) | ||
// m.reply(JSON.stringify(json, null, '\t')) | ||
if (m.text.toLowerCase() == json.jawaban.toLowerCase().trim()) { | ||
global.db.data.users[m.sender]. | ||
exp += this.siapakahaku[id][2] | ||
conn.sendButton(m.chat, `*Benar!*\n+${this.siapakahaku[id][2]} XP`, author, ['siapakahaku', '/siapakahaku'], m) | ||
clearTimeout(this.siapakahaku[id][3]) | ||
delete this.siapakahaku[id] | ||
} else if (similarity(m.text.toLowerCase(), json.jawaban.toLowerCase().trim()) >= threshold) m.reply(`*Dikit Lagi!*`) | ||
else m.reply(`*Salah!*`) | ||
} | ||
return !0 | ||
} | ||
handler.exp = 0 | ||
|
||
export default handler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
let handler = async (m, { conn }) => { | ||
conn.siapakahaku = conn.siapakahaku ? conn.siapakahaku : {} | ||
let id = m.chat | ||
if (!(id in conn.siapakahaku)) throw false | ||
let json = conn.siapakahaku[id][1] | ||
let ans = json.jawaban | ||
let clue = ans.replace(/[bcdfghjklmnpqrstvwxyz]/ig, '_') | ||
m.reply('```' + clue + '```') | ||
} | ||
handler.command = /^who$/i | ||
|
||
handler.limit = true | ||
|
||
export default handler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import similarity from 'similarity' | ||
const threshold = 0.72 | ||
export async function before(m) { | ||
let id = m.chat | ||
if (!m.quoted || !m.quoted.fromMe || !m.quoted.isBaileys || !m.text || !/Ketik.*hben/i.test(m.quoted.text) || /.*hben/i.test(m.text)) | ||
return !0 | ||
this.tebakbendera = this.tebakbendera ? this.tebakbendera : {} | ||
if (!(id in this.tebakbendera)) | ||
return conn.sendButton(m.chat, 'Soal itu telah berakhir', author, null, buttontebakbendera, m) | ||
if (m.quoted.id == this.tebakbendera[id][0].id) { | ||
let isSurrender = /^((me)?nyerah|surr?ender)$/i.test(m.text) | ||
if (isSurrender) { | ||
clearTimeout(this.tebakbendera[id][3]) | ||
delete this.tebakbendera[id] | ||
return conn.sendButton(m.chat, '*Yah Menyerah :( !*', author, null, buttontebakbendera, m) | ||
} | ||
let json = JSON.parse(JSON.stringify(this.tebakbendera[id][1])) | ||
//m.reply(JSON.stringify(json, null, '\t')) | ||
if (m.text.toLowerCase() == json.name.toLowerCase().trim()) { | ||
global.db.data.users[m.sender].exp += this.tebakbendera[id][2] | ||
conn.sendButton(m.chat, `*Benar!*\n+${this.tebakbendera[id][2]} XP`, author, null, buttontebakbendera, m) | ||
clearTimeout(this.tebakbendera[id][3]) | ||
delete this.tebakbendera[id] | ||
} else if (similarity(m.text.toLowerCase(), json.name.toLowerCase().trim()) >= threshold) | ||
m.reply(`*Dikit Lagi!*`) | ||
else | ||
conn.sendButton(m.chat, `*Salah!*`, author, null, [ | ||
['Hint', '/hben'], | ||
['Nyerah', 'menyerah'] | ||
], m) | ||
} | ||
return !0 | ||
} | ||
export const exp = 0 | ||
|
||
const buttontebakbendera = [ | ||
['tebakbendera', '/tebakbendera'] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
let handler = async (m, { conn }) => { | ||
conn.tebakbendera = conn.tebakbendera ? conn.tebakbendera : {} | ||
let id = m.chat | ||
if (!(id in conn.tebakbendera)) throw false | ||
let json = conn.tebakbendera[id][1] | ||
conn.sendButton(m.chat, '```' + json.name.replace(/[AIUEOaiueo]/ig, '_') + '```', author, null, [ | ||
['Nyerah', 'menyerah'] | ||
], m) | ||
} | ||
handler.command = /^hben$/i | ||
|
||
handler.limit = true | ||
|
||
export default handler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import fetch from 'node-fetch' | ||
let timeout = 120000 | ||
let poin = 4999 | ||
let handler = async (m, { conn, usedPrefix }) => { | ||
conn.tebakbendera = conn.tebakbendera ? conn.tebakbendera : {} | ||
let id = m.chat | ||
if (id in conn.tebakbendera) { | ||
conn.sendButton(m.chat, 'Masih ada soal belum terjawab di chat ini', author, null, buttons, conn.tebakbendera[id][0]) | ||
throw false | ||
} | ||
let src = await (await fetch('https://raw.githubusercontent.com/BochilTeam/database/master/games/tebakbendera2.json')).json() | ||
let json = src[Math.floor(Math.random() * src.length)] | ||
let caption = ` | ||
Timeout *${(timeout / 1000).toFixed(2)} detik* | ||
Ketik ${usedPrefix}hben untuk bantuan | ||
Bonus: ${poin} XP | ||
`.trim() | ||
conn.tebakbendera[id] = [ | ||
await conn.sendButton(m.chat, caption, author, json.img, buttons, m), | ||
json, poin, | ||
setTimeout(() => { | ||
if (conn.tebakbendera[id]) conn.sendButton(m.chat, `Waktu habis!\nJawabannya adalah *${json.name}*`, author, null, [ | ||
['tebakbendera', '/tebakbendera'] | ||
], conn.tebakbendera[id][0]) | ||
delete conn.tebakbendera[id] | ||
}, timeout) | ||
] | ||
} | ||
handler.help = ['tebakbendera'] | ||
handler.tags = ['game'] | ||
handler.command = /^tebakbendera/i | ||
|
||
export default handler | ||
|
||
const buttons = [ | ||
['Hint', '/hben'], | ||
['Nyerah', 'menyerah'] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import similarity from 'similarity' | ||
const threshold = 0.72 | ||
export async function before(m) { | ||
let id = m.chat | ||
if (!m.quoted || !m.quoted.fromMe || !m.quoted.isBaileys || !m.text || !/Ketik.*hgame/i.test(m.quoted.text) || /.*hgame/i.test(m.text)) | ||
return !0 | ||
this.tebakgame = this.tebakgame ? this.tebakgame : {} | ||
if (!(id in this.tebakgame)) | ||
return conn.sendButton(m.chat, 'Soal itu telah berakhir', author, null, buttontebakgame, m) | ||
if (m.quoted.id == this.tebakgame[id][0].id) { | ||
let isSurrender = /^((me)?nyerah|surr?ender)$/i.test(m.text) | ||
if (isSurrender) { | ||
clearTimeout(this.tebakgame[id][3]) | ||
delete this.tebakgame[id] | ||
return conn.sendButton(m.chat, '*Yah Menyerah :( !*', author, null, buttontebakgame, m) | ||
} | ||
let json = JSON.parse(JSON.stringify(this.tebakgame[id][1])) | ||
// m.reply(JSON.stringify(json, null, '\t')) | ||
if (m.text.toLowerCase() == json.jawaban.toLowerCase().trim()) { | ||
global.db.data.users[m.sender].exp += this.tebakgame[id][2] | ||
conn.sendButton(m.chat, `*Benar!*\n+${this.tebakgame[id][2]} XP`, author, null, buttontebakgame, m) | ||
clearTimeout(this.tebakgame[id][3]) | ||
delete this.tebakgame[id] | ||
} else if (similarity(m.text.toLowerCase(), json.jawaban.toLowerCase().trim()) >= threshold) | ||
m.reply(`*Dikit Lagi!*`) | ||
else | ||
conn.sendButton(m.chat, `*Salah!*`, author, null, [ | ||
['Hint', '/hgame'], | ||
['Nyerah', 'menyerah'] | ||
], m) | ||
} | ||
return !0 | ||
} | ||
export const exp = 0 | ||
|
||
const buttontebakgame = [ | ||
['tebakgame', '/tebakgame'] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
let handler = async (m, { conn }) => { | ||
conn.tebakgame = conn.tebakgame ? conn.tebakgame : {} | ||
let id = m.chat | ||
if (!(id in conn.tebakgame)) throw false | ||
let json = conn.tebakgame[id][1] | ||
conn.sendButton(m.chat, '```' + json.jawaban.replace(/[AIUEOaiueo]/ig, '_') + '```', author, null, [ | ||
['Nyerah', 'menyerah'] | ||
], m) | ||
} | ||
handler.command = /^hgame$/i | ||
|
||
handler.limit = true | ||
|
||
export default handler |
Oops, something went wrong.