Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Guru322 authored Jul 25, 2023
1 parent ccdd0d4 commit e21560d
Showing 1 changed file with 28 additions and 38 deletions.
66 changes: 28 additions & 38 deletions plugins/econ-levelup.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { canLevelUp, xpRange } from '../lib/levelling.js';

import { canLevelUp, xpRange } from '../lib/levelling.js'
let handler = async (m, { conn }) => {
let name = conn.getName(m.sender)
let pp = await conn.profilePictureUrl(m.sender, 'image').catch(_ => 'https://i.imgur.com/whjlJSf.jpg')
let user = global.db.data.users[m.sender]
let name = conn.getName(m.sender);
let pp = await conn.profilePictureUrl(m.sender, 'image').catch(_ => 'https://i.imgur.com/whjlJSf.jpg');
let user = global.db.data.users[m.sender];
let background = 'https://i.ibb.co/4YBNyvP/images-76.jpg'; // Fixed background URL

if (!canLevelUp(user.level, user.exp, global.multiplier)) {
let { min, xp, max } = xpRange(user.level, global.multiplier)
let { min, xp, max } = xpRange(user.level, global.multiplier);
let txt = `
β”Œβ”€β”€β”€βŠ· *LEVEL*
β–’ Number : *${name}*
Expand All @@ -14,50 +16,38 @@ let handler = async (m, { conn }) => {
β–’ Role : *${user.role}*
└──────────────
You lack *${max - user.exp}* of *XP* to level up
`.trim()
try {
let imgg = API('fgmods', '/api/rank', {
username: name,
xp: user.exp - min,
exp: xp,
avatar: pp,
level: user.level,
background: 'https://i.ibb.co/CsNgBYw/qiyana.jpg'
}, 'apikey')

conn.sendFile(m.chat, imgg, 'level.jpg', txt, m)
} catch (e) {
m.reply(txt)
}
}
let before = user.level * 1
while (canLevelUp(user.level, user.exp, global.multiplier)) user.level++
if (before !== user.level) {
user.role = global.rpg.role(user.level).name
Hey there, ${name}! You're not ready to level up just yet. It seems like you need to munch up *${max - user.exp}* more XP to level up and reach new heights! Keep going, and the bots will be singing your praises soon! πŸš€
`.trim();

try {
let imgg = `https://wecomeapi.onrender.com/rankup-image?username=${encodeURIComponent(name)}&currxp=${user.exp - min}&needxp=${xp}&level=${user.level}&rank=${encodeURIComponent(pp)}&avatar=${encodeURIComponent(pp)}&background=${encodeURIComponent(background)}`;
conn.sendFile(m.chat, imgg, 'level.jpg', txt, m);
} catch (e) {
m.reply(txt);
}
} else {
let str = `
β”Œβ”€βŠ· *LEVEL UP*
β–’ Previous level : *${before}*
β–’ current level : *${user.level}*
β–’ Previous level : *${user.level - 1}*
β–’ Current level : *${user.level}*
β–’ Role : *${user.role}*
└──────────────
*_The more you interact with the bots, the higher your level will be_*
`.trim()
Woo-hoo, ${name}! You've soared to new heights and reached level ${user.level}! πŸŽ‰ Time to celebrate! 🎊
Your newfound power will strike fear into the hearts of trolls, and the bots will bow before your command! Keep up the incredible work, and who knows what epic adventures await you next! 🌟
`.trim();

try {
let img = API('fgmods', '/api/levelup', {
avatar: pp
}, 'apikey')
conn.sendFile(m.chat, img, 'levelup.jpg', str, m)
let img = `https://wecomeapi.onrender.com/levelup-image?avatar=${encodeURIComponent(pp)}`;
conn.sendFile(m.chat, img, 'levelup.jpg', str, m);
} catch (e) {
m.reply(str)
m.reply(str);
}
}
}

handler.help = ['levelup']
handler.tags = ['econ']
handler.command = ['nivel', 'lvl', 'levelup', 'level']
handler.help = ['levelup'];
handler.tags = ['econ'];
handler.command = ['nivel', 'lvl', 'levelup', 'level'];

export default handler

0 comments on commit e21560d

Please sign in to comment.