Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
7.9 kB
2
Indexable
Never
require('dotenv')
require('zeew')
const { Client, MessageEmbed } = require("discord.js");
const Discord = require('discord.js');
const keepAlive = require("./server");
const client = new Discord.Client();
const Zeew = require("zeew");
const sfw = Zeew.sfw("TOKEN");




var http = require('http');
http.createServer(function(req, res) {
  res.write("The bot is running 24/7!");
  res.end();
}).listen(8080);
client.on("ready", () => {
  console.log("The bot is ready to use, Enjoy!");
  presence();
});


client.on('message', message => {
  if (message.content === '!ping') {
    message.channel.send('Pong.');
  }
  else if (message.content.startsWith("¿metar")) {
    message.channel.send("https://www.smn.gob.ar/metar   ```we only have argentina metars```");
  }
  else if (message.content.startsWith("¿charts")) {
    message.channel.send("https://bit.ly/38ShDfP");
  }
  else if (message.content.startsWith("¿taf")) {
    message.channel.send("https://www.smn.gob.ar/taf  ```we only have argentina taf´s```");
  }
  else if (message.content.startsWith("¿notams")) {
    message.channel.send("http://ais.anac.gov.ar/notam ```we only have argentina notams ;(```");
  }
  else if (message.content.startsWith("¿server link")) {
    message.channel.send("```The server link:``` https://discord.gg/gPQQDWd");
  }
  else if (message.content === ("¿help")) {
    const embed = new MessageEmbed();
    embed.setTitle("Contact Berni#7500 at discord please!");
    
    message.channel.send(embed);
  }
  else if (message.content === ("¿commands")) {
    const embed = new MessageEmbed()
      .setTitle("Commands")
      .setDescription("¿metar\n\ ¿charts\n\ ¿taf\n\ ¿notams\n\ ¿help\n\ ¿rules\n\ ¿irlrole\n\ This command is for IRL pilots\n\ ¿botstatus")
      .setFooter("Aviation club bot, Created by Bernardo Paley")
      .setColor("0XDF013A")
    message.channel.send(embed);
    
  }
  else if (message.content === ("¿rules")) {
    const embed = new MessageEmbed()
      .setTitle("**RULES**")
      .setDescription(":green_circle: Be respectful with everybody\n\:green_circle: Be gentle with all members\n\ :green_circle: please notify the @moderator of any problem\n\ :green_circle: Use each channel for its respective theme\n\////////////////////////////////\n\ :red_circle: Sharing content very out of place to what the group refers to(BAN for 24 Hs.)\n\ :red_circle: There are channels to chat outside the scope of the group, it is not necessary to abuse!\n\ :red_circle:Insulting, attacking or carrying out any type of badly hurtful action towards any member of the server\n\ :red_circle: Perform any SPAM class(BAN for 24 Hs.)\n\ :red_circle: Abuse your role\n\ please send a message to @berni if you have a Doubt")
      .setColor("0X0404B4")
      .setFooter("Aviation club bot, Created by Bernardo Paley")
    message.channel.send(embed);
    
  }
  else if (message.content === ("¿irlrole")) {
    const embed = new MessageEmbed();
    embed.setTitle("Role for IRL pilots");
    embed.setDescription("If you are a IRL pilot and you want the respective role, please write a message to @berni with some evidence, we make that to be sure that you are a real pilot!")
    .setColor("0XDF013A")
    .setFooter("Aviation club bot, Created by Bernardo Paley")
    message.channel.send(embed);
  }
  else if (message.content === ("¿verification")) {
    const embed = new MessageEmbed();
    embed.setTitle("Verification");
    embed.setDescription("Hey! Hello! How are u? \n\ for verifying please visit the Channel #verification \n\ and send ¿verify ")
    .setColor("0XDF013A")
    .setFooter("Aviation club bot, Created by Bernardo Paley")
    message.channel.send(embed);
  }

  else if (message.content.startsWith("¿everyone")) {
    message.channel.send("@everyone")
  }
  else if (message.content.startsWith("¿botstatus")) {
    message.channel.send("Im online! Also you can check here: https://aviation-club-bot.bernipaley2007.repl.co ")
  }
  else if (message.content.startsWith("hi")) {
    message.channel.send("hey");
  }
  else if (message.content.startsWith("hello")) {
    message.channel.send("hey");
  }
  else if (message.content === ("¿Announcements")) {
    const embed = new MessageEmbed();
    embed.setTitle("Maintenance");
    embed.setDescription("Bot online check with ¿botstatus if you have an error")
    .setColor("0XDF013A")
    .setAuthor("From @Berni")
    .setFooter("Aviation club bot, Created by Bernardo Paley")
    message.channel.send(embed);
  }
    else if (message.content === ("¿irlrole")) {
    const embed = new MessageEmbed();
    embed.setTitle("Role for IRL pilots");
    embed.setDescription("If you are a IRL pilot and you want the respective role, please write a message to @berni with some evidence, we make that to be sure that you are a real pilot!")
    .setColor("0XDF013A")
    .setFooter("Aviation club bot, Created by Bernardo Paley")
    message.channel.send(embed);
  }
  else if (message.content === ("¿verify")) {
    const embed = new MessageEmbed();
    embed.setTitle("");
    embed.setDescription("Role Added")
    .setColor("0XDF013A")
    .setFooter("Aviation club bot, Created by Bernardo Paley")
    message.channel.send(embed);
  }
  else if (message.content === ("¿changelog")) {
    const embed = new MessageEmbed();
    embed.setTitle("Aviation club bot changelog");
    embed.setDescription("V0.5 \n\
    BASE BOT, COMMANDS LIKE ¿charts \n\
    V1.0 \n\
    COMMANDS LIKE ¿rules and verification command \n\
    V1.5 \n\
    Advise when the role was added!")
    .setColor("0XDF013A")
    .setFooter("Aviation club bot, Created by Bernardo Paley")
    message.channel.send(embed);
  }
  
   
});



function presence() {
  client.user.setPresence({
    status: "online",
    activity: {
      name: "X-Plane 11 | ¿help ¿commands",
      type: "PLAYING"
    }
  })}



 
  

 client.on('guildMemberAdd', (member) => {
         
          let channelID = '801642512556359721';
          if(member.guild.id != '801296849050796062') return;
          let embed = new Discord.MessageEmbed()
          .setTitle(`Member Joined`)
          .setDescription(`${member.user} Join the server! Please visit the #Rules and enjoy your stay!`)
          .setColor("RED")
          .setTimestamp()
          .setFooter("Aviation club bot, Created by Bernardo Paley")
          client.channels.cache.get(channelID).send(embed)
          
  })
  

 client.on('guildMemberRemove', (member) => {
         
          let channelID = '801642980431626250';
          if(member.guild.id != '801296849050796062') return;
          let embed = new Discord.MessageEmbed()
          .setTitle(`Member left`)
          .setDescription(`${member.user} Just take-off from the server, hope you enjoy your stay at Aviation Club`)
          .setColor("RED")
          .setTimestamp()
          .setFooter("Aviation club bot, Created by Bernardo Paley")
          client.channels.cache.get(channelID).send(embed)
  })
  client.on('message', async message => {
          if(message.author.bot) return;
          if(message.content.toLowerCase() === '¿verify' && message.channel.id === '801624128535920663')
          {
                const role = message.guild.roles.cache.get('801623868787785738');
                if(role) {
                try {
                       await message.member.roles.add(role);
                       console.log("Role added!");
                }
                catch(err) {
                        console.log(err);
                }
          }
          }
          
          
  });    
  
          

  client.on('guildMemberadd', member =>{

  });
  








keepAlive();
client.login(process.env.DISCORD_BOT_TOKEN);