Sir_Spaceboi

Untitled

Feb 25th, 2021
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. bot.on("message", async(message) => {
  2.  
  3.   const botID = bot.user.id
  4.  
  5.   const args = message.content.slice(prefix.length).split(/ +/);
  6.   const commandName = args.shift().toLowerCase();
  7.  
  8.   const command = bot.commands.get(commandName) || bot.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName));
  9.   const guild = bot.guild
  10.  
  11.   const errorEm = new Discord.MessageEmbed()
  12.     .setTitle('⛔ Error!')
  13.     .setDescription(`An error oocured whilst trying to exectue the command; **${commandName}**. The error has been logged to the bot console. If this error persists, contact support!`)
  14.     .setColor(0xed4253)
  15.  
  16.  
  17.   if (message.content.includes(botID)) {
  18.     message.channel.send('My prefix for this server is `%`!')
  19.   }
  20.  
  21.   if (message.channel.name === '🔴-report' && !message.author.bot) {
  22.     message.channel.send('<@&805229920925646938> \n Your report will be dealt with shortly. Reminder that no one should communicate within this channel unless they are reporting. Check the pinned messages for further rules and information. Thank you!').then(() => message.react('🔔'));
  23.   }
  24.  
  25.   if (!message.content.startsWith(prefix) || message.author.bot) return;
  26.  
  27.   if (!command) return;
  28.  
  29.   try {
  30.     command.execute(message, args, bot, config);
  31.   } catch (error) {
  32.     console.error(error)
  33.     message.reply(errorEm)
  34.   }
  35.  
  36.   if(message.channel.parentID !== '756890395392081985') return;
  37.     bot.ticketTranscript.findOne({ Channel : message.channel.id }, async(err, data) => {
  38.         if(err) throw err;
  39.         if(data) {
  40.            console.log('there is data')
  41.            data.Content.push(`${message.author.tag} : ${message.content}`)
  42.         } else {
  43.             console.log('there is no data')
  44.             data = new bot.ticketTranscript({ Channel : message.channel.id, Content: `${message.author.tag} : ${message.content}`})
  45.         }
  46.         await data.save()
  47.             .catch(err =>  console.log(err))
  48.         console.log('data is saved ')
  49.     })
  50. })
Advertisement
Add Comment
Please, Sign In to add comment