lyfe1 / plugins /_menu.js
Ayanokojix23's picture
hello world
bb69f9b
const bot = require('../lib/events')
const {
addSpace,
textToStylist,
getUptime,
getRam,
getDate,
getPlatform,
} = require('../lib/')
bot.addCommand(
{
pattern: 'help ?(.*)',
dontAddCommandList: true,
},
async (message, match, ctx) => {
const sorted = ctx.commands.sort((a, b) => {
if (a.name && b.name) {
return a.name.localeCompare(b.name)
}
return 0
})
const [date, time] = getDate()
let CMD_HELP = `โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
สŸแด‡แด แด€ษดแด›แด‡ส€
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
โ”‚ Prefix : ${ctx.PREFIX}
โ”‚ User : ${message.pushName}
โ”‚ Time : ${time}
โ”‚ Day : ${date.toLocaleString('en', { weekday: 'long' })}
โ”‚ Date : ${date.toLocaleDateString('hi')}
โ”‚ Version : ${ctx.VERSION}
โ”‚ Plugins : ${ctx.pluginsCount}
โ”‚ Ram : ${getRam()}
โ”‚ Uptime : ${getUptime('t')}
โ”‚ Platform : ${getPlatform()}
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
`
sorted.map(async (command, i) => {
if (command.dontAddCommandList === false && command.pattern !== undefined) {
CMD_HELP += `โ”‚ ${i + 1} ${addSpace(i + 1, sorted.length)}${textToStylist(
command.name.toUpperCase(),
'mono'
)}\n`
}
})
CMD_HELP += `โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€`
return await message.send('```' + CMD_HELP + '```')
}
)
bot.addCommand(
{
pattern: 'list ?(.*)',
dontAddCommandList: true,
},
async (message, match, ctx) => {
let msg = ''
const sorted = ctx.commands.sort((a, b) => {
if (a.name && b.name) {
return a.name.localeCompare(b.name)
}
return 0
})
sorted.map(async (command, index) => {
if (command.dontAddCommandList === false && command.pattern !== undefined) {
msg += `${index + 1} ${command.name}\n${command.desc}\n\n`
}
})
await message.send('```' + msg.trim() + '```')
}
)
bot.addCommand(
{
pattern: 'menu ?(.*)',
dontAddCommandList: true,
},
async (message, match, ctx) => {
const commands = {}
ctx.commands.map(async (command, index) => {
if (command.dontAddCommandList === false && command.pattern !== undefined) {
let cmdType = command.type.toLowerCase()
if (!commands[cmdType]) commands[cmdType] = []
let isDiabled = command.active === false
let cmd = command.name.trim()
commands[cmdType].push(isDiabled ? cmd + ' [disabled]' : cmd)
}
})
const [date, time] = getDate()
let msg = `\`\`\`โ•ญโ•โ•โ• LEVANTER โ•โ•โ•โŠท
โ”ƒโƒโ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
โ”ƒโƒโ”‚ Prefix : ${ctx.PREFIX}
โ”ƒโƒโ”‚ User : ${message.pushName}
โ”ƒโƒโ”‚ Time : ${time}
โ”ƒโƒโ”‚ Day : ${date.toLocaleString('en', { weekday: 'long' })}
โ”ƒโƒโ”‚ Date : ${date.toLocaleDateString('hi')}
โ”ƒโƒโ”‚ Version : ${ctx.VERSION}
โ”ƒโƒโ”‚ Plugins : ${ctx.pluginsCount}
โ”ƒโƒโ”‚ Ram : ${getRam()}
โ”ƒโƒโ”‚ Uptime : ${getUptime('t')}
โ”ƒโƒโ”‚ Platform : ${getPlatform()}
โ”ƒโƒโ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
โ•ฐโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โŠท\`\`\`\n`
if (match && commands[match]) {
msg += ` โ•ญโ”€โ ${textToStylist(match.toLowerCase(), 'smallcaps')} โ\n`
for (const plugin of commands[match])
msg += ` โ”‚ ${textToStylist(plugin.toUpperCase(), 'mono')}\n`
msg += ` โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€`
return await message.send(msg)
}
for (const command in commands) {
msg += ` โ•ญโ”€โ ${textToStylist(command.toLowerCase(), 'smallcaps')} โ\n`
for (const plugin of commands[command])
msg += ` โ”‚ ${textToStylist(plugin.toUpperCase(), 'mono')}\n`
msg += ` โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n`
}
await message.send(msg.trim())
}
)