2024-08-12 05:13:32 -04:00
|
|
|
const { getMessage } = require('../util/lang.js')
|
2024-07-28 02:37:31 -04:00
|
|
|
module.exports = {
|
|
|
|
execute: (c) => {
|
2024-09-12 00:26:36 -04:00
|
|
|
let subcmd
|
|
|
|
if (c.args.length >= 1) subcmd = c.args.splice(0, 1)[0].toLowerCase()
|
2024-07-28 02:37:31 -04:00
|
|
|
switch (subcmd) {
|
|
|
|
case 'add': {
|
|
|
|
const rate = +(c.args.splice(0, 1)[0])
|
|
|
|
const command = c.args.join(' ')
|
|
|
|
if (rate < 20) {
|
|
|
|
c.reply({
|
|
|
|
text: getMessage(c.lang, 'command.cloop.error.tooShort')
|
|
|
|
})
|
2024-07-27 02:39:18 -04:00
|
|
|
}
|
2024-07-28 02:37:31 -04:00
|
|
|
c.bot.addCloop(command, rate)
|
|
|
|
c.reply({
|
|
|
|
translate: getMessage(c.lang, 'command.cloop.success.add'),
|
|
|
|
color: c.colors.secondary,
|
|
|
|
with: [
|
|
|
|
{
|
|
|
|
text: command,
|
|
|
|
color: c.colors.primary
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: rate + '',
|
|
|
|
color: c.colors.primary
|
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
break
|
|
|
|
}
|
|
|
|
case 'remove': {
|
|
|
|
const index = +c.args[0]
|
|
|
|
c.bot.removeCloop(c.args[0])
|
|
|
|
c.reply({
|
|
|
|
translate: getMessage(c.lang, 'command.cloop.success.remove'),
|
|
|
|
color: c.colors.secondary,
|
|
|
|
with: [
|
|
|
|
{
|
|
|
|
text: index + '',
|
|
|
|
color: c.colors.primary
|
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
break
|
|
|
|
}
|
|
|
|
case 'list':
|
2024-08-24 10:15:39 -04:00
|
|
|
c.bot.cloops.forEach((item, i) => {
|
2024-07-28 02:37:31 -04:00
|
|
|
c.reply({
|
|
|
|
translate: getMessage(c.lang, 'command.cloop.list'),
|
|
|
|
color: c.colors.secondary,
|
|
|
|
with: [
|
|
|
|
{
|
2024-08-22 07:34:39 -04:00
|
|
|
text: i.toString(),
|
2024-07-28 02:37:31 -04:00
|
|
|
color: c.colors.primary
|
|
|
|
},
|
|
|
|
{
|
2024-08-22 07:34:39 -04:00
|
|
|
text: item.command,
|
2024-07-28 02:37:31 -04:00
|
|
|
color: c.colors.primary
|
|
|
|
},
|
|
|
|
{
|
2024-08-22 07:34:39 -04:00
|
|
|
text: item.rate + '',
|
2024-07-28 02:37:31 -04:00
|
|
|
color: c.colors.primary
|
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
2024-08-22 07:34:39 -04:00
|
|
|
})
|
2024-07-28 02:37:31 -04:00
|
|
|
break
|
|
|
|
case 'clear':
|
|
|
|
c.bot.clearCloops()
|
|
|
|
c.reply({
|
|
|
|
text: getMessage(c.lang, 'command.cloop.success.clear'),
|
|
|
|
color: c.colors.secondary
|
|
|
|
})
|
|
|
|
break
|
|
|
|
default:
|
|
|
|
c.reply({
|
|
|
|
translate: getMessage(c.lang, 'command.cloop.error.subcommand'),
|
|
|
|
color: c.colors.secondary,
|
|
|
|
with: [
|
|
|
|
{
|
|
|
|
text: `${c.prefix}help cloop`,
|
|
|
|
color: c.colors.primary
|
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
consoleIndex: true,
|
|
|
|
level: 1
|
2024-07-27 02:39:18 -04:00
|
|
|
}
|