Skip to content

Commit

Permalink
feat: bad words filter
Browse files Browse the repository at this point in the history
  • Loading branch information
SlavyanDesu committed Feb 17, 2023
1 parent 25a58d5 commit 15bd5cf
Show file tree
Hide file tree
Showing 24 changed files with 975 additions and 1,583 deletions.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module.exports = {
'env': {
'commonjs': true,
'es2021': true,
'node': true
},
Expand Down
15 changes: 4 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
# Modules directory
node_modules

# Session file
*.data.json

# Debug file
logs

# Local folder
.node-persist
_IGNORE_*
database

# Temp folder
temp
temp
**.data.json
**.node-persist**
**_IGNORE_**
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) SlavyanDesu
Copyright (c) 2023 SlavyanDesu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
Edit the required value in `config.json`.
```json
{
"ownerBot": "62812xxxxxxxx@c.us",
"ownerBot": "62812xxxxxxxx@c.us",
"prefix": ".",
"nao": "SAUCENAO-API-KEY",
"authorStick": "@SlavyanDesu",
Expand All @@ -65,6 +65,9 @@ Edit the required value in `config.json`.
`authorStick`: name of the author sticker pack.
`packStick`: name of the sticker pack.

## 🗣️ Changing Language
Replace all of `eng` to `ind` for Bahasa Indonesia.

## 🛠️ Installing the FFmpeg
* Download one of the available versions of FFmpeg by clicking [this link](https://www.gyan.dev/ffmpeg/builds/).
* Extract the file to `C:\` path.
Expand Down
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"ownerBot": "62xxxxxxx@c.us",
"ownerBot": "62xxxxxxx@c.us",
"prefix": ".",
"nao": "api-key",
"authorStick": "@SlavyanDesu",
Expand Down
1 change: 1 addition & 0 deletions database/group/badwords.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
28 changes: 14 additions & 14 deletions function/afk.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ const fs = require('fs-extra')

/**
* Add AFK user.
* @param {string} userId
* @param {string} time
* @param {string} reason
* @param {object} _dir
* @param {string} userId
* @param {string} time
* @param {string} reason
* @param {object} _dir
*/
const addAfkUser = (userId, time, reason, _dir) => {
const obj = { id: userId, time: time, reason: reason }
Expand All @@ -15,8 +15,8 @@ const addAfkUser = (userId, time, reason, _dir) => {

/**
* Check if user is on AFK state.
* @param {string} userId
* @param {object} _dir
* @param {string} userId
* @param {object} _dir
* @returns {boolean}
*/
const checkAfkUser = (userId, _dir) => {
Expand All @@ -31,8 +31,8 @@ const checkAfkUser = (userId, _dir) => {

/**
* Get user AFK reason.
* @param {string} userId
* @param {object} _dir
* @param {string} userId
* @param {object} _dir
* @returns {string}
*/
const getAfkReason = (userId, _dir) => {
Expand All @@ -49,8 +49,8 @@ const getAfkReason = (userId, _dir) => {

/**
* Get user AFK time.
* @param {string} userId
* @param {object} _dir
* @param {string} userId
* @param {object} _dir
* @returns {string}
*/
const getAfkTime = (userId, _dir) => {
Expand All @@ -67,8 +67,8 @@ const getAfkTime = (userId, _dir) => {

/**
* Get user AFK ID.
* @param {string} userId
* @param {object} _dir
* @param {string} userId
* @param {object} _dir
* @returns {string}
*/
const getAfkId = (userId, _dir) => {
Expand All @@ -85,8 +85,8 @@ const getAfkId = (userId, _dir) => {

/**
* Get user AFK index position.
* @param {string} userId
* @param {object} _dir
* @param {string} userId
* @param {object} _dir
* @returns {number}
*/
const getAfkPosition = (userId, _dir) => {
Expand Down
10 changes: 5 additions & 5 deletions function/daily.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ const fs = require('fs-extra')

/**
* Add user daily limit.
* @param {string} userId
* @param {string} dir
* @param {object} _dir
* @param {string} userId
* @param {string} dir
* @param {object} _dir
*/
const addLimit = (userId, _dir) => {
const obj = { id: userId, time: Date.now() }
Expand All @@ -14,8 +14,8 @@ const addLimit = (userId, _dir) => {

/**
* Get user time left.
* @param {string} userId
* @param {object} _dir
* @param {string} userId
* @param {object} _dir
* @returns {number}
*/
const getLimit = (userId, _dir) => {
Expand Down
34 changes: 17 additions & 17 deletions function/level.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ const fs = require('fs-extra')

/**
* Get user ID from db.
* @param {string} userId
* @param {object} _dir
* @param {string} userId
* @param {object} _dir
* @returns {string}
*/
const getLevelingId = (userId, _dir) => {
Expand All @@ -23,12 +23,12 @@ const getLevelingId = (userId, _dir) => {
} else {
return _dir[pos].id
}
}
}

/**
* Get user level from db.
* @param {string} userId
* @param {object} _dir
* @param {string} userId
* @param {object} _dir
* @returns {number}
*/
const getLevelingLevel = (userId, _dir) => {
Expand All @@ -52,8 +52,8 @@ const getLevelingLevel = (userId, _dir) => {

/**
* Get user XP from db.
* @param {string} userId
* @param {object} _dir
* @param {string} userId
* @param {object} _dir
* @returns {number}
*/
const getLevelingXp = (userId, _dir) => {
Expand All @@ -77,9 +77,9 @@ const getLevelingXp = (userId, _dir) => {

/**
* Add user level to db.
* @param {string} userId
* @param {number} amount
* @param {object} _dir
* @param {string} userId
* @param {number} amount
* @param {object} _dir
*/
const addLevelingLevel = (userId, amount, _dir) => {
let position = null
Expand All @@ -96,9 +96,9 @@ const addLevelingLevel = (userId, amount, _dir) => {

/**
* Add user XP to db.
* @param {string} userId
* @param {number} amount
* @param {object} _dir
* @param {string} userId
* @param {number} amount
* @param {object} _dir
*/
const addLevelingXp = (userId, amount, _dir) => {
let position = null
Expand All @@ -115,8 +115,8 @@ const addLevelingXp = (userId, amount, _dir) => {

/**
* Get user rank.
* @param {string} userId
* @param {object} _dir
* @param {string} userId
* @param {object} _dir
* @returns {number}
*/
const getUserRank = (userId, _dir) => {
Expand Down Expand Up @@ -144,7 +144,7 @@ const xpGain = new Set()

/**
* Check is user exist in set.
* @param {string} userId
* @param {string} userId
* @returns {boolean}
*/
const isGained = (userId) => {
Expand All @@ -153,7 +153,7 @@ const isGained = (userId) => {

/**
* Add user in set and delete it when it's 1 minute.
* @param {string} userId
* @param {string} userId
*/
const addCooldown = (userId) => {
xpGain.add(userId)
Expand Down
24 changes: 12 additions & 12 deletions function/limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ const fs = require('fs-extra')

/**
* Check limit.
* @param {string} userId
* @param {object} _dir
* @param {number} limitCount
* @param {boolean} isPremium
* @param {boolean} isOwner
* @param {string} userId
* @param {object} _dir
* @param {number} limitCount
* @param {boolean} isPremium
* @param {boolean} isOwner
* @returns {boolean}
*/
const isLimit = (userId, _dir, limitCount, isPremium, isOwner) => {
Expand All @@ -33,10 +33,10 @@ const isLimit = (userId, _dir, limitCount, isPremium, isOwner) => {

/**
* Add limit to user.
* @param {string} userId
* @param {object} _dir
* @param {boolean} isPremium
* @param {boolean} isOwner
* @param {string} userId
* @param {object} _dir
* @param {boolean} isPremium
* @param {boolean} isOwner
*/
const addLimit = (userId, _dir, isPremium, isOwner) => {
if (isPremium || isOwner) return false
Expand All @@ -54,9 +54,9 @@ const addLimit = (userId, _dir, isPremium, isOwner) => {

/**
* Get user's limit.
* @param {string} userId
* @param {object} _dir
* @param {number} limitCount
* @param {string} userId
* @param {object} _dir
* @param {number} limitCount
* @returns {number}
*/
const getLimit = (userId, _dir, limitCount) => {
Expand Down
10 changes: 5 additions & 5 deletions function/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { color } = require('../tools')

/**
* Returns an array of files.
* @param {*} dirPath
* @param {*} dirPath
* @param {string[]} [arrayOfFiles]
* @returns {string[]}
*/
Expand All @@ -19,11 +19,11 @@ const getAllDirFiles = (dirPath, arrayOfFiles) => {
}
})
return arrayOfFiles
}
}

/**
* Uncache a changes.
* @param {*} module
* @param {*} module
*/
const uncache = (module = '.') => {
return new Promise((resolve, reject) => {
Expand All @@ -38,8 +38,8 @@ const uncache = (module = '.') => {

/**
* Delete file cache.
* @param {*} module
* @param {*} call
* @param {*} module
* @param {*} call
*/
const nocache = (module, call = () => {}) => {
console.log(color('[WATCH]', 'orange'), color(`=> '${module}'`, 'yellow'), 'file is now being watched by me!')
Expand Down
22 changes: 11 additions & 11 deletions function/premium.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ const toMs = require('ms')

/**
* Add premium user.
* @param {string} userId
* @param {string} expired
* @param {object} _dir
* @param {string} userId
* @param {string} expired
* @param {object} _dir
*/
const addPremiumUser = (userId, expired, _dir) => {
const obj = { id: userId, expired: Date.now() + toMs(expired) }
Expand All @@ -15,8 +15,8 @@ const addPremiumUser = (userId, expired, _dir) => {

/**
* Get premium user index position.
* @param {string} userId
* @param {object} _dir
* @param {string} userId
* @param {object} _dir
* @returns {Number}
*/
const getPremiumPosition = (userId, _dir) => {
Expand All @@ -33,8 +33,8 @@ const getPremiumPosition = (userId, _dir) => {

/**
* Get premium user expired.
* @param {string} userId
* @param {object} _dir
* @param {string} userId
* @param {object} _dir
* @returns {Number}
*/
const getPremiumExpired = (userId, _dir) => {
Expand All @@ -51,8 +51,8 @@ const getPremiumExpired = (userId, _dir) => {

/**
* Check if is user premium.
* @param {string} userId
* @param {object} _dir
* @param {string} userId
* @param {object} _dir
* @returns {boolean}
*/
const checkPremiumUser = (userId, _dir) => {
Expand All @@ -67,7 +67,7 @@ const checkPremiumUser = (userId, _dir) => {

/**
* Constantly checking premium.
* @param {object} _dir
* @param {object} _dir
*/
const expiredCheck = (_dir) => {
setInterval(() => {
Expand All @@ -87,7 +87,7 @@ const expiredCheck = (_dir) => {

/**
* Get all premium user ID.
* @param {object} _dir
* @param {object} _dir
* @returns {string[]}
*/
const getAllPremiumUser = (_dir) => {
Expand Down
Loading

0 comments on commit 15bd5cf

Please sign in to comment.