Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- client.on('message', message => {
- const args = message.content.slice(prefix.length).trim().split(/ +/);
- const command = args.shift().toLowerCase();
- if(message.channel.type === 'dm') return;
- let f = m1 => m1.author.id === message.author.id
- if(command === 'add') {
- if(!message.member.hasPermission('MANAGE_MESSAGES')) return;
- message.channel.send('what the word you want to add?.').then(m => {
- m.channel.awaitMessages(f, {max:1, time: 20000, errors:['time']}).then(m1 => {
- m1 = m1.first()
- let b = m1.content
- message.channel.send('what reply you want to be for this word?').then(m2 => {
- m2.channel.awaitMessages(f,{max:1, time: 20000, errors:['time']}).then(m3 => {
- m3 = m3.first()
- let rep = m3.content
- message.channel.send('added reply!!')
- db.set(`${b}_${message.guild.id}`, `${rep}`)
- }).catch(err => {message.channel.send('time is over!')})
- })
- }).catch(err => {message.channel.send('time is over!')})
- })
- }
- if(command === 'remove') {
- if(!message.member.hasPermission('MANAGE_MESSAGES')) return;
- message.channel.send("which word you want to remove?").then(r => {
- r.channel.awaitMessages(f,{max:1, time: 20000, errors:['time']}).then(f => {
- f = f.first()
- let ff = f.content
- if(!db.has(`${ff}_${message.guild.id}`)) return message.channel.send('no word was found with this tag!')
- message.channel.send('removed!!')
- db.delete(`${ff}_${message.guild.id}`)
- }).catch(err => {message.channel.send('time is over!')})
- })
- }
- })
- client.on('message', message =>{
- if(message.channel.type === 'dm') return;
- if(db.has(`${message.content}_${message.guild.id}`)) {
- message.channel.send(db.get(`${message.content}_${message.guild.id}`))
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement