Skip to content

Commit

Permalink
Merge branch 'main' into rpg-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
MAYKELL07 authored Dec 20, 2021
2 parents b86bac5 + b779434 commit 6709c0e
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 5 deletions.
3 changes: 3 additions & 0 deletions handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ module.exports = {
if (!isNumber(user.level)) user.level = 1
if (!isNumber(user.money)) user.money = 0
if (!isNumber(user.bank)) user.bank = 0
if (!isNumber(user.premiumDate)) user.premiumDate = 0
if (!'premium' in user) user.premium = false
if (!isNumber(user.banklimit)) user.banklimit = 10000
if (!isNumber(user.banknote)) user.banknote = 0
if (!isNumber(user.lastclaim)) user.lastclaim = 0
Expand All @@ -48,6 +50,7 @@ module.exports = {
if (!isNumber(user.age)) user.age = -1
if (!isNumber(user.regTime)) user.regTime = -1
}
if (!isNumber(user.lastseen)) user.lastseen = 0
if (!isNumber(user.afk)) user.afk = -1
if (!('afkReason' in user)) user.afkReason = ''
if (!('banned' in user)) user.banned = false
Expand Down
2 changes: 1 addition & 1 deletion plugins/_expired.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ handler.before = async function (m) {

if (m.isGroup && db.data.chats[m.chat].expired != 0) {
if (new Date() * 1 >= db.data.chats[m.chat].expired) {
this.reply(m.chat, `waktunya *${this.user.name}* untuk meninggalkan grup`, null).then(() => {
this.reply(m.chat, `Trial atau waktu sewa anda sudah habis\nwaktunya *${this.user.name}* untuk meninggalkan grup`, null).then(() => {
this.sendContact(m.chat, owner[0], this.getName(owner[0] + '@s.whatsapp.net'), m).then(() => {
this.groupLeave(m.chat).then(() => {
db.data.chats[m.chat].expired = 0
Expand Down
2 changes: 1 addition & 1 deletion plugins/monthly.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
let { MessageType } = require('@adiwajshing/baileys')

let handler = async (m, { conn }) => {
let user = global.DATABASE._data.users[m.sender]
let user = global.db.data.users[m.sender]
let _timers = (2592000000 - (new Date - user.lastmonthly))
let timers = clockString(_timers)
if (new Date - user.lastmonthly > 2592000000) {
Expand Down
57 changes: 57 additions & 0 deletions plugins/sider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
let { MessageType, Presence } = require('@adiwajshing/baileys')
let handler = async (m, { conn, text, participants }) => {
await conn.updatePresence(m.chat, Presence.composing)
var lama = 86400000 * 7
let member = participants.map(u => u.jid)
if(!text) {
var pesan = "Harap aktif di grup karena akan ada pembersihan member setiap saat"
} else {
var pesan = text
}
sum = member.length
var total = 0
var sider = []
for(let i = 0; i < sum; i++) {
let users = m.isGroup ? participants.find(u => u.jid == member[i]) : {}
if((typeof global.DATABASE.data.users[member[i]] == 'undefined' || new Date() * 1 - global.DATABASE.data.users[member[i]].lastseen > lama) && !users.isAdmin && !users.isSuperAdmin) {
if (typeof global.DATABASE.data.users[member[i]] !== 'undefined'){
if(global.DATABASE.data.users[member[i]].whitelist == false){
total++
sider.push(member[i])
}
}else {
total++
sider.push(member[i])
}
}
}
if(total == 0) return conn.reply(m.chat, `*Digrup ini tidak terdapat sider.*`, m)
conn.reply(m.chat, `*${total}/${sum}* anggota grup *${conn.getName(m.chat)}* adalah sider dengan alasan :\n1. Tidak aktif selama lebih dari 7 hari\n2. Baru join tetapi tidak pernah nimbrung\n\n_“${pesan}”_\n\n*LIST SIDER :*\n${sider.map(v => ' ○ @' + v.replace(/@.+/, '' + typeof global.DATABASE.data.users[v] == "undefined" ? ' join doang' : ' off ' + msToDate(new Date()*1 - global.DATABASE.data.users[v].lastseen))).join('\n')}`, m,{ contextInfo: { mentionedJid: sider } })
}
handler.help = ['sider']
handler.tags = ['group', 'group admin']
handler.command = /^(sider)$/i
handler.group = true
handler.botAdmin = true
handler.fail = null
module.exports = handler

const more = String.fromCharCode(8206)
const readMore = more.repeat(4001)

function msToDate(ms) {
temp = ms
days = Math.floor(ms / (24*60*60*1000));
daysms = ms % (24*60*60*1000);
hours = Math.floor((daysms)/(60*60*1000));
hoursms = ms % (60*60*1000);
minutes = Math.floor((hoursms)/(60*1000));
minutesms = ms % (60*1000);
sec = Math.floor((minutesms)/(1000));
if (days == 0 && hours == 0 && minutes == 0){
return "Baru Saja"
}else {
return days+"H "+hours+"J";
}
// +minutes+":"+sec;
}
4 changes: 2 additions & 2 deletions plugins/trial.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ let handler = async (m, { conn, text, usedPrefix }) => {
let [_, code] = text.match(linkRegex) || []
if (!code) throw 'Link Salah'
let res = await conn.acceptInvite(code)
m.reply(`Berhasil join grup ${res.gid}`).then(() => {
m.reply(`Berhasil join grup ${res.gid}\nTrial 5 hari di mulai`).then(() => {
var jumlahHari = 86400000 * 0.5
var now = new Date() * 1
if (now < global.db.data.chats[res.gid].expired) global.db.data.chats[res.gid].expired += jumlahHari
else global.db.data.chats[res.gid].expired = now + jumlahHari
})
await conn.sendButton(res.gid, `
*${conn.user.name}* adalah bot whatsapp yang dibangun dengan Nodejs, *${conn.user.name}* diundang oleh @${m.sender.split`@`[0]}
*${conn.user.name}* adalah bot whatsapp yang dibangun dengan Nodejs,\nTrial 5 hari di mulai\n*${conn.user.name}* diundang oleh @${m.sender.split`@`[0]}
ketik *${usedPrefix}menu* untuk melihat daftar perintah`.trim(), '© Raiden', 'Menu', `${usedPrefix}?`, { contextInfo: { mentionedJid: [m.sender] } })
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/weekly.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
let { MessageType } = require('@adiwajshing/baileys')

let handler = async (m, { conn }) => {
let user = global.DATABASE._data.users[m.sender]
let user = global.db.data.users[m.sender]
let _timers = (604800000 - (new Date - user.lastweekly))
let timers = clockString(_timers)
if (new Date - user.lastweekly > 604800000) {
Expand Down

0 comments on commit 6709c0e

Please sign in to comment.