Skip to content

Commit

Permalink
Merge branch 'ShirokamiRyzen:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
NeofetchNpc authored Dec 7, 2024
2 parents d9bea60 + 72209bf commit df596b8
Show file tree
Hide file tree
Showing 62 changed files with 462 additions and 872 deletions.
34 changes: 16 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
FROM node:21
FROM node:18

RUN apt-get update && \
apt-get install -y \
ffmpeg \
imagemagick \
webp && \
apt-get upgrade -y && \
rm -rf /var/lib/apt/lists/*

WORKDIR /app
# Set working directory
WORKDIR /usr/src/app

COPY package*.json ./
# Copy package files and install dependencies
COPY package.json ./
RUN npm install

# Install dependensi Node.js
RUN npm install --prefer-offline --no-audit --progress=false
# Install system dependencies
RUN apt-get update && \
apt-get install -y ffmpeg imagemagick webp && \
apt-get upgrade -y && \
rm -rf /var/lib/apt/lists/*

# Copy semua file proyek ke dalam container
# Copy the rest of the application files
COPY . .

# Expose port 3000
EXPOSE 5100
# Expose the required port
EXPOSE 3000

# Command untuk menjalankan aplikasi
CMD ["node", "index.js"]
# Command to run the application
CMD ["node", "index.js"]
154 changes: 0 additions & 154 deletions config.example.js

This file was deleted.

24 changes: 11 additions & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
version: '3.8'

version: "3.9"
services:
app:
container_name: nao-bot
web:
build: .
ports:
- "5100:5100"
- "8000:5000"
volumes:
- .:/app
- ./sessions:/app/sessions #NOTE: Sebelum mount silahkan buat folder 'sessions' dahulu
- /app/node_modules
- /database.json:/app/database.json
environment:
NODE_ENV: production
command: "node index.js"
restart: unless-stopped
- .:/code
- logvolume01:/var/log
links:
- redis
redis:
image: redis
volumes:
logvolume01: {}
49 changes: 21 additions & 28 deletions handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { fileURLToPath } from 'url'
import path, { join } from 'path'
import { unwatchFile, watchFile, readFileSync } from 'fs'
import chalk from 'chalk'
const printMessage = (await import('./lib/print.js')).default
import knights from 'knights-canvas'
import fetch from 'node-fetch'

/**
* @type {import('@adiwajshing/baileys')}
Expand Down Expand Up @@ -158,14 +158,10 @@ export async function handler(chatUpdate) {
}
if (opts['nyimak'])
return
if (!m.fromMe && opts['self'])
return
if (opts['pconly'] && m.chat.endsWith('g.us'))
return
if (opts['gconly'] && !m.chat.endsWith('g.us'))
return
if (opts['owneronly'] && !m.chat.startsWith(`${global.nomorown}`))
return
if (opts['swonly'] && m.chat !== 'status@broadcast')
return
if (typeof m.text !== 'string')
Expand All @@ -175,7 +171,7 @@ export async function handler(chatUpdate) {
const isMods = isOwner || global.mods.map(v => v.replace(/[^0-9]/g, '') + '@s.whatsapp.net').includes(m.sender)
const isPrems = isROwner || db.data.users[m.sender].premiumTime > 0
if (!isOwner && !m.fromMe && opts['self']) return;
if (opts['queque'] && m.text && !(isMods || isPrems)) {
if (m.text && !(isMods || isPrems)) {
let queque = this.msgqueque, time = 1000 * 5
const previousID = queque[queque.length - 1]
queque.push(m.id || m.key.id)
Expand Down Expand Up @@ -301,10 +297,6 @@ export async function handler(chatUpdate) {
fail('owner', m, this)
continue
}
if (plugin.disable && !(isROwner || isOwner)) { // Bot number
fail('disable', m, this)
continue
}
if (plugin.rowner && !isROwner) { // Real Owner
fail('rowner', m, this)
continue
Expand Down Expand Up @@ -342,11 +334,12 @@ export async function handler(chatUpdate) {
m.isCommand = true
let xp = 'exp' in plugin ? parseInt(plugin.exp) : 17 // XP Earning per command
if (xp > 200)
m.reply('Ngecit -_-') // Hehehe
// m.reply('Ngecit -_-') // Hehehe
console.log("ngecit -_-");
else
m.exp += xp
if (!isPrems && plugin.limit && global.db.data.users[m.sender].limit < plugin.limit * 1) {
this.reply(m.chat, `[❗] Limit harian kamu telah habis, ketik *${usedPrefix}claimlimit* untuk refill\n\natau\nbypass limit dengan berdonasi, ketik *${usedPrefix}donasi*`, m)
this.reply(m.chat, `[❗] Limit harian kamu telah habis, silahkan beli melalui *${usedPrefix}buy limit*`, m)
continue // Limit habis
}
if (plugin.level > _user.level) {
Expand Down Expand Up @@ -406,15 +399,15 @@ export async function handler(chatUpdate) {
}
}
if (m.limit)
m.reply(+m.limit + ' Limit terpakai')
m.reply(+m.limit + ' Limit kamu terpakai ✔️')
}
break
}
}
} catch (e) {
console.error(e)
} finally {
if (opts['queque'] && m.text) {
if (m.text) {
const quequeIndex = this.msgqueque.indexOf(m.id || m.key.id)
if (quequeIndex !== -1)
this.msgqueque.splice(quequeIndex, 1)
Expand Down Expand Up @@ -455,7 +448,7 @@ export async function handler(chatUpdate) {
}
}
try {
if (!opts['noprint']) await printMessage(m, this)
if (!opts['noprint']) await (await import(`./lib/print.js`)).default(m, this)
} catch (e) {
console.log(m, m.quoted, e)
}
Expand Down Expand Up @@ -574,7 +567,7 @@ export async function deleteUpdate(message) {
Terdeteksi @${participant.split`@`[0]} telah menghapus pesan.
Untuk mematikan fitur ini, ketik
*.enable delete*
Untuk menghapus pesan yang dikirim oleh Bot, reply pesan dengan perintah
*.delete*`, msg)
this.copyNForward(msg.chat, msg).catch(e => console.log(e, msg))
Expand All @@ -585,24 +578,24 @@ Untuk menghapus pesan yang dikirim oleh Bot, reply pesan dengan perintah

global.dfail = (type, m, conn) => {
let msg = {
rowner: '*DEVELOPER ONLY* • COMMAND INI HANYA UNTUK DEVELOPER BOT',
disable: '*DISABLED* • COMMAND INI TELAH DIMATIKAN OLEH OWNER',
owner: '*OWNER ONLY* • COMMAND INI HANYA UNTUK OWNER BOT',
mods: '*MODERATOR ONLY* • COMMAND INI HANYA UNTUK MODERATOR',
premium: '*PREMIUM ONLY* • COMMAND INI HANYA UNTUK PREMIUM USER',
group: '*GROUP CHAT* • COMMAND INI HANYA BISA DIGUNAKAN DIDALAM GRUP',
private: '*PRIVATE CHAT* • COMMAND INI HANYA BISA DIGUNAKAN DI PRIVATE CHAT',
admin: '*ADMIN ONLY* • COMMAND INI HANYA UNTUK ADMIN GRUP',
botAdmin: '*BOT ADMIN ONLY* • COMMAND INI HANYA UNTUK ADMIN BOT',
unreg: 'Halo Kak 👋\nAnda harus mendaftar ke database dulu sebelum menggunakan fitur ini\n\n➞ Ketik .register untuk mendaftar',
restrict: '*RESTRICT* • RESTRICT BELUM DINYALAKAN DI GRUP INI',
rowner: '*ONLY DEVELOPER* • COMMAND INI HANYA UNTUK DEVELOPER BOT',
owner: '*ONLY OWNER* • COMMAND INI HANYA UNTUK OWNER BOT',
mods: '*ONLY MODERATOR* • COMMAND INI HANYA UNTUK MODERATOR BOT',
premium: '*ONLY PREMIUM* • COMMAND INI HANYA UNTUK PREMIUM USER',
group: '*GROUP CHAT* • COMMAND INI HANYA BISA DIPAKAI DIDALAM GROUP',
private: '*PRIVATE CHAT* • COMMAND INI HANYA BISA DIPAKAI DIPRIVAT CHAT',
admin: '*ONLY ADMIN* • COMMAND INI HANYA UNTUK ADMIN GROUP',
botAdmin: '*ONLY BOT ADMIN* • COMMAND INI HANYA BISA DIGUNAKAN KETIKA BOT MENJADI ADMIN',
unreg: '*YOU ARE NOT REGISTERED YET* • KETIK .daftar UNTUK BISA MENGGUNAKAN FITUR INI',
restrict: '*RESTRICT* • RESTRICT BELUM DINYALAKAN DICHAAT INI',
}[type]
if (msg) return conn.reply(m.chat, msg, m)
}


let file = global.__filename(import.meta.url, true)
watchFile(file, async () => {
unwatchFile(file)
console.log(chalk.redBright("Update 'handler.js'"))
if (global.reloadHandler) console.log(await global.reloadHandler())
})
})
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ console.log('🐾 Starting...');

var isRunning = false;

/**
* Start a js file
* @param {String} file `path/to/file`
*/
function start(file) {
if (isRunning) return;
isRunning = true;
Expand All @@ -35,7 +39,7 @@ function start(file) {
console.log('[✅RECEIVED]', data);
switch (data) {
case 'reset':
p.kill();
p.kill(); // Change here
isRunning = false;
start(file);
break;
Expand Down Expand Up @@ -72,4 +76,4 @@ function start(file) {
}
}

start('main.js');
start('main.js');
Loading

0 comments on commit df596b8

Please sign in to comment.