File size: 3,986 Bytes
bb69f9b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
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())
  }
)