File size: 1,080 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
const { bot, setVar, getVars } = require('../lib/index')

bot(
  {
    pattern: 'setgreet ?(.*)',
    desc: 'Set personal message var',
    type: 'personal',
  },
  async (message, match) => {
    if (!match)
      return await message.send(`*Example : setgreet Hi this is a bot, My boss will reply soon*`)
    const vars = await setVar(
      {
        PERSONAL_MESSAGE: match,
      },
      message.id
    )
    return await message.send(`_Greet Message Updated_`)
  }
)

bot(
  {
    pattern: 'getgreet ?(.*)',
    desc: 'Get personal message var',
    type: 'personal',
  },
  async (message, match) => {
    const vars = await getVars(message.id)
    const msg = vars['PERSONAL_MESSAGE']
    if (!msg || msg == 'null') return await message.send(`*Greet Message not Set*`)
    return await message.send(msg)
  }
)

bot(
  {
    pattern: 'delgreet ?(.*)',
    desc: 'Delete personal message var',
    type: 'personal',
  },
  async (message, match) => {
    await setVar({ PERSONAL_MESSAGE: 'null' }, message.id)
    return await message.send(`_Greet Message Deleted_`)
  }
)