Skip to content

Commit

Permalink
fix sticker and dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Kry9toN committed Jan 25, 2021
1 parent b30c508 commit f9c4930
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/command/notes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
description: 'Untuk menyimpan note atau catatan di group\nPenggunaan: !notes <save/remove> <key> <value>',
async execute (client, chat, pesan, args) {
if (!client.isGroup) return client.reply(pesan.error.group)
if (!client.isGmium && !client.isOwner) return client.reply(pesan.error.premium)
if (!client.isGmium) return client.reply(pesan.hanya.premium)
if (!client.isGroupAdmins) return client.reply(pesan.hanya.admin)
if (!client.isBotGroupAdmins) return client.reply(pesan.hanya.botAdmin)
const key = args[1]
Expand Down
10 changes: 5 additions & 5 deletions src/command/sticker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { exec } = require('child_process')
const { getRandom } = require('../utils/functions')
const ffmpeg = require('fluent-ffmpeg')
const fs = require('fs')
const { removeBackgroundclient } = require('remove.bg')
const { removeBackgroundFromImageFile } = require('remove.bg')

module.exports = {
name: 'sticker',
Expand All @@ -14,7 +14,7 @@ module.exports = {
description: 'Untuk menjadikan video atau gambar menjadi sticker\nPenggunaan: quoted gambar/vidio !sticker <rbg/nobg> rbg: remove background, nobg: no background on sticker, default sticker dengan background',
async execute (client, chat, pesan, args) {
if ((client.isMedia && !chat.message.videoMessage || client.isQuotedImage) && args[0] == 'nobg') {
if (!client.isPmium && !client.isOwner) return client.reply(pesan.error.premium)
if ((!client.isGroup && !client.isPmium) || (client.isGroup && !client.isGmium)) return client.reply(pesan.hanya.premium)
const encmedia = client.isQuotedImage ? JSON.parse(JSON.stringify(chat).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo : chat
const media = await client.downloadAndSaveMediaMessage(encmedia)
const ranw = getRandom('.webp')
Expand All @@ -40,7 +40,7 @@ module.exports = {
.toFormat('webp')
.save(ranw)
} else if ((client.isMedia && chat.message.videoMessage.seconds < 11 || client.isQuotedVideo && chat.message.extendedTextMessage.contextInfo.quotedMessage.videoMessage.seconds < 11) && args.length == 0) {
if (!client.isPmium && !client.isOwner) return client.reply(pesan.error.premium)
if ((!client.isGroup && !client.isPmium) || (client.isGroup && !client.isGmium)) return client.reply(pesan.hanya.premium)
const encmedia = client.isQuotedVideo ? JSON.parse(JSON.stringify(chat).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo : chat
const media = await client.downloadAndSaveMediaMessage(encmedia)
const ranw = getRandom('.webp')
Expand All @@ -67,14 +67,14 @@ module.exports = {
.toFormat('webp')
.save(ranw)
} else if ((client.isMedia || client.isQuotedImage) && args[0] == 'rbg') {
if (!client.isPmium && !client.isOwner) return client.reply(pesan.error.premium)
if ((!client.isGroup && !client.isPmium) || (client.isGroup && !client.isGmium)) return client.reply(pesan.hanya.premium)
const encmedia = client.isQuotedImage ? JSON.parse(JSON.stringify(chat).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo : chat
const media = await client.downloadAndSaveMediaMessage(encmedia)
const ranw = getRandom('.webp')
const ranp = getRandom('.png')
client.reply(pesan.tunggu)
const keyrmbg = process.env.KEY_REMOVEBG
await removeBackgroundclient.fromImageFile({ path: media, apiKey: keyrmbg, size: 'auto', type: 'auto', ranp }).then(res => {
await removeBackgroundFromImageFile({ path: media, apiKey: keyrmbg, size: 'auto', type: 'auto', ranp }).then(res => {
fs.unlinkSync(media)
const buffer = Buffer.from(res.base64img, 'base64')
fs.writeFileSync(ranp, buffer, (err) => {
Expand Down
4 changes: 2 additions & 2 deletions src/krypton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,12 @@ async function krypton () {
hanya: {
admin: '❌ Perintah ini hanya bisa di gunakan oleh admin group! ❌',
botAdmin: '❌ Perintah ini hanya bisa di gunakan ketika bot menjadi admin! ❌',
owner: '❌ Perintah hanya untuk owner/sudo! ❌'
owner: '❌ Perintah hanya untuk owner/sudo! ❌',
premium: '❌ Perintah hanya untuk pelanggan premium! ❌'
},
error: {
group: '❌ Perintah ini hanya bisa di gunakan dalam group! ❌',
args: '❌ Perintah anda salah! ❌',
premium: '❌ Perintah hanya untuk pelanggan premium! ❌'
}
}

Expand Down

0 comments on commit f9c4930

Please sign in to comment.