forked from Ramlan404/babybot
-
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
53 changed files
with
1,328 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,15 @@ | ||
{ | ||
"ownerNumber": "[email protected]", | ||
"botName": "Baby Bot", | ||
"ownerName": "Ramlan ID", | ||
"footer": "*2022 © BABYBOT*", | ||
"apikey": "BELI ATUH", | ||
"pathThumb": "./media/logo.jpg", | ||
"sessionName": "ramlanid", | ||
"limitCount": 30, | ||
"gamewaktu": 60, | ||
"gcount": { | ||
"prem": 50, | ||
"user": 20 | ||
} | ||
} |
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 @@ | ||
[] |
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 @@ | ||
[] |
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 @@ | ||
[] |
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 @@ | ||
[] |
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 @@ | ||
[] |
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 @@ | ||
[] |
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 @@ | ||
[] |
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 @@ | ||
[] |
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 @@ | ||
[] |
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 @@ | ||
[] |
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 @@ | ||
[] |
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 @@ | ||
[] |
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 @@ | ||
[] |
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 @@ | ||
[] |
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 @@ | ||
[] |
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 @@ | ||
[] |
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 @@ | ||
[] |
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 @@ | ||
[] |
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 @@ | ||
[] |
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,80 @@ | ||
const toMs = require('ms') | ||
|
||
// Message filter | ||
const usedCommandRecently = new Set() | ||
|
||
/** | ||
* Check is number filtered. | ||
* @param {String} from | ||
* @returns {Boolean} | ||
*/ | ||
const isFiltered = (from) => { | ||
return !!usedCommandRecently.has(from) | ||
} | ||
|
||
/** | ||
* Add number to filter. | ||
* @param {String} from | ||
*/ | ||
const addFilter = (from) => { | ||
usedCommandRecently.add(from) | ||
setTimeout(() => { | ||
return usedCommandRecently.delete(from) | ||
}, 5000) // 5 seconds delay, I don't recommend below that. | ||
} | ||
|
||
const addSpam = (sender, _db) => { | ||
let position = false | ||
Object.keys(_db).forEach((i) => { | ||
if (_db[i].id === sender) { | ||
position = i | ||
} | ||
}) | ||
if (position !== false) { | ||
_db[position].spam += 1 | ||
} else { | ||
const bulin = ({ | ||
id: sender, | ||
spam: 1, | ||
expired: Date.now() + toMs('10m') | ||
}) | ||
_db.push(bulin) | ||
} | ||
} | ||
|
||
const ResetSpam = (_dir) => { | ||
setInterval(() => { | ||
let position = null | ||
Object.keys(_dir).forEach((i) => { | ||
if (Date.now() >= _dir[i].expired) { | ||
position = i | ||
} | ||
}) | ||
if (position !== null) { | ||
console.log(`Spam expired: ${_dir[position].id}`) | ||
_dir.splice(position, 1) | ||
} | ||
}, 1000) | ||
} | ||
const isSpam = (sender, _db) => { | ||
let found = false | ||
for (let i of _db) { | ||
if (i.id === sender) { | ||
let spam = i.spam | ||
if (spam >= 5) { | ||
found = true | ||
return true | ||
} else { | ||
found = true | ||
return false | ||
} | ||
} | ||
} | ||
} | ||
module.exports = { | ||
isFiltered, | ||
addFilter, | ||
addSpam, | ||
ResetSpam, | ||
isSpam | ||
} |
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,91 @@ | ||
const fs = require('fs') | ||
const toMs = require('ms') | ||
|
||
/** | ||
* Add user to bannedList database | ||
* @param {String} userId | ||
* @param {String} expired | ||
* @param {Object} _data | ||
*/ | ||
const addBanned = (userId, expired, _data) => { | ||
let success = false | ||
if (expired === undefined) { | ||
expired = 'PERMANENT' | ||
} else { | ||
expired = expired | ||
} | ||
|
||
let expired_at = 'PERMANENT' | ||
|
||
if (expired === 'PERMANENT') { | ||
expired_at = 'PERMANENT' | ||
} else { | ||
expired_at = Date.now() + toMs(expired) | ||
} | ||
|
||
const obj = { | ||
id: userId, | ||
expired: expired_at | ||
} | ||
|
||
_data.push(obj) | ||
fs.writeFileSync('./database/ban.json', JSON.stringify(_data, null, 3)) | ||
} | ||
/** | ||
* Unbanned someone. | ||
* @param {String} userId | ||
* @param {Object} _dir | ||
* @returns {Number} | ||
*/ | ||
const unBanned = (userId, _data) => { | ||
let position = null | ||
Object.keys(_data).forEach((i) => { | ||
if (_data[i].id === userId) { | ||
position = i | ||
} | ||
}) | ||
if (position !== null) { | ||
_data.splice(position, 1) | ||
fs.writeFileSync('./database/ban.json', JSON.stringify(_data, null, 3)) | ||
} | ||
return true | ||
} | ||
const BannedExpired = (_dir) => { | ||
setInterval(() => { | ||
let position = null | ||
Object.keys(_dir).forEach((i) => { | ||
if (_dir[i].expired === 'PERMANENT') { | ||
position = null | ||
} else if (Date.now() >= _dir[i].expired) { | ||
position = i | ||
} | ||
}) | ||
if (position !== null) { | ||
console.log(`Banned expired: ${_dir[position].id}`) | ||
_dir.splice(position, 1) | ||
fs.writeFileSync('./database/ban.json', JSON.stringify(_dir, null, 3)) | ||
} | ||
}, 1000) | ||
} | ||
/** | ||
* Check user is premium. | ||
* @param {String} userId | ||
* @param {Object} _dir | ||
* @returns {Boolean} | ||
*/ | ||
const cekBannedUser = (userId, _dir) => { | ||
let status = false | ||
Object.keys(_dir).forEach((i) => { | ||
if (_dir[i].id === userId) { | ||
status = true | ||
} | ||
}) | ||
return status | ||
} | ||
|
||
module.exports = { | ||
addBanned, | ||
unBanned, | ||
BannedExpired, | ||
cekBannedUser | ||
} |
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,19 @@ | ||
const chalk = require('chalk') | ||
|
||
const color = (text, color) => { | ||
return !color ? chalk.green(text) : chalk.keyword(color)(text) | ||
} | ||
|
||
const bgcolor = (text, bgcolor) => { | ||
return !bgcolor ? chalk.green(text) : chalk.bgKeyword(bgcolor)(text) | ||
} | ||
|
||
const babyLog = (text, color) => { | ||
return !color ? chalk.yellow('[BABY] ') + chalk.green(text) : chalk.yellow('[BABY] ') + chalk.keyword(color)(text) | ||
} | ||
|
||
module.exports = { | ||
color, | ||
bgcolor, | ||
babyLog | ||
} |
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,57 @@ | ||
/** | ||
* Originally created by cwke | ||
* Reuploaded by Waxaranai | ||
* Recoded by SlavyanDesu | ||
* | ||
* GitHub is an open-source community, so why are you so triggered when someone shared some simple code? | ||
*/ | ||
|
||
const fs = require('fs') | ||
const packID = 'com.snowcorp.stickerly.android.stickercontentprovider b5e7275f-f1de-4137-961f-57becfad34f2' | ||
const playstore = 'https://play.google.com/store/apps/details?id=com.pubg.newstate&hl=in&gl=US' | ||
const itunes = 'https://apps.apple.com/us/app/pubg-mobile-3rd-anniversary/id1330123889' | ||
|
||
/** | ||
* @class Exif | ||
*/ | ||
module.exports = class Exif { | ||
/** | ||
* Create an EXIF file. | ||
* @param {String} packname | ||
* @param {String} authorname | ||
* @param {String} [filename=data] | ||
*/ | ||
create(packname, authorname, filename) { | ||
if (!filename) filename = 'data' | ||
const json = { | ||
'sticker-pack-id': packID, | ||
'sticker-pack-name': packname, | ||
'sticker-pack-publisher': authorname, | ||
'android-app-store-link': playstore, | ||
'ios-app-store-link': itunes | ||
} | ||
let len = JSON.stringify(json).length | ||
const f = Buffer.from([0x49, 0x49, 0x2A, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x57, 0x07, 0x00]) | ||
const code = [0x00, 0x00, 0x16, 0x00, 0x00, 0x00] | ||
if (len > 256) { | ||
len = len - 256 | ||
code.unshift(0x01) | ||
} else { | ||
code.unshift(0x00) | ||
} | ||
const fff = Buffer.from(code) | ||
const ffff = Buffer.from(JSON.stringify(json)) | ||
if (len < 16) { | ||
len = len.toString(16) | ||
len = '0' + len | ||
} else { | ||
len = len.toString(16) | ||
} | ||
const ff = Buffer.from(len, 'hex') | ||
const buffer = Buffer.concat([f, ff, fff, ffff]) | ||
fs.writeFile(`./sticker/${filename}.exif`, buffer, (err) => { | ||
if (err) return console.error(err) | ||
console.log('Success!') | ||
}) | ||
} | ||
} |
Oops, something went wrong.