text: const Discord = require('discord.js');
  const client = new Discord.Client();
  require('discord-buttons')(client);
  const { readdirSync } = require('fs');
  const { join } = require('path');
  const config = require('./config.json');
  client.config = config;
  const disbut = require('discord-buttons');
  const bot = new Discord.Client({disableEveryone: true})
  const express = require('express');
  const app = express();
  const db = require('quick.db')
  const moment = require('moment');
  
  
  app.get('/', (req, res) => {
  	res.send(`.`);
  });
  app.listen(3000, () => {
  	console.log(`InteractionBot is Online`);
  });
  
  client.on("ready", () => {
  client.user.setActivity("i!help | @InteractionBot", { 
  type: "PLAYING"
  })
  })  
  
  
  
  client.on("error", console.error);
  
  
  client.commands = new Discord.Collection();
  client.cooldowns = new Discord.Collection();
  
  const commandFolders = readdirSync('./commands');
  
  for (const folder of commandFolders) {
  	const commandFiles = readdirSync(`./commands/${folder}`).filter(file => file.endsWith('.js'));
  	for (const file of commandFiles) {
  		const command = require(`./commands/${folder}/${file}`);
  		client.commands.set(command.name, command);
  	}
  }
  
  
  bot.on("ready", async () => {
      console.log(`${bot.user.username} is Online`)
  })
  
  client.on('message', async message => {
  
      if (message.author.bot) return;
  
  
  let prefix = i!;
  
  
      const escapeRegex = str => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
      const prefixRegex = new RegExp(`^(<@!?${client.user.id}>|${escapeRegex(prefix)})\\s*`);
  
      if(!prefixRegex.test(message.content)) return;
      const [, matchedPrefix] = message.content.match(prefixRegex);  
  
  	const args = message.content.toLowerCase().slice(matchedPrefix.length).trim().split(/ +/g);
  	const commandName = args.shift().toLowerCase();
  
  	const command = client.commands.get(commandName)
  		|| client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName));
  
  	if (!command) return;
  
  	if (command.permissions) {
  		const authorPerms = message.channel.permissionsFor(message.author);
  		if (!authorPerms || !authorPerms.has(command.permissions)) {
  			return message.reply('<a:error:868858590545473626> | You are Missing Permissions!');
  		}
  	}
  
  	if (command.args && !args.length) {
  		let reply = `<a:error:868858590545473626> | Please Provide a Valid Argument!`;
  
  		if (command.usage) {
  			reply += `\n<a:error:868858590545473626> | The Proper Usage is: \`${default_prefix}${command.name} ${command.usage}\``;
  		}
  
  		return message.channel.send(reply);
  	}
  
  const { cooldowns } = client;
  
  	if (!cooldowns.has(command.name)) {
  		cooldowns.set(command.name, new Discord.Collection());
  	}
  
  	const now = Date.now();
  	const timestamps = cooldowns.get(command.name);
  	const cooldownAmount = (command.cooldown || 5) * 1000;
  
  	if (timestamps.has(message.author.id)) {
  		const expirationTime = timestamps.get(message.author.id) + cooldownAmount;
  
  		if (now < expirationTime) {
  			const timeLeft = (expirationTime - now) / 1000;
  			return message.lineReplyNoMention(`<a:error:868858590545473626> | Please wait for more ${timeLeft.toFixed(1)} second(s) before Reusing the \`${command.name}\` command!`);
  		}
  	}
  
  	timestamps.set(message.author.id, now);
  	setTimeout(() => timestamps.delete(message.author.id), cooldownAmount);
  
  	try {
            command.run(client, message, args);
  			} catch (error) {
  		console.error(error);
  		message.reply(`<a:error:868858590545473626> | An Error Occured while Executing the Command!\nError: \`${error}\`\nPlease Report the Error Using \`i!bug-report\` or Try Again in a Few Seconds!`);
  	}
  
  })
  
  