Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require('discord.js'); //połączenie bota z discordem
  2. const client = new Discord.Client(); //to też chyba
  3. const Booru = require('booru'); //dostęp do wyszukiwania w booru
  4. const YouTube = require('youtube-node'); //dostęp do wyszukiwania w yt
  5. var yt = new YouTube(); //to też coś do tego
  6. yt.setKey('AIzaSyDH6Sqbrk7JYOEGdr0IrqkvHdDLWZL4-Co'); //to też
  7. const ffmpeg = require('ffmpeg'); //to do vc
  8.  
  9. var vchannel;
  10.  
  11. client.on("ready", ()=>{
  12.     console.log("It's on uwu");
  13.    
  14. });
  15.  
  16. client.on(`guildMemberAdd`, member => {
  17.        
  18.     const channel = member.guild.channels.find(ch=>ch.id==='546306970345275397');
  19.        
  20.     if(!channel) return;
  21.         var wiadpow = [`Hey! Welcome to our server ${member}!!!`, `Hello! Welcome ${member}!!`, `Look who's here, it's ${member}!`, `Hello there ${member}!`, `Heeeeeello ${member}!`, `Nice to see you there ${member}!!!`]
  22.         channel.send(wiadpow[Math.floor(Math.random()*6)]);
  23.        
  24. });
  25.  
  26. client.on("message", (msg)=>{
  27.    
  28.    
  29.    
  30.     if(msg.content.toLowerCase().startsWith("hello") || msg.content.toLowerCase().startsWith("hey") || msg.content.toLowerCase().startsWith("howdy") || msg.content.toLowerCase().startsWith("hi") || msg.content.toLowerCase().startsWith("sup") || msg.content.toLowerCase().startsWith("heey") || msg.content.toLowerCase().startsWith("what's up") || msg.content.toLowerCase().startsWith("good seeing you")){
  31.        
  32.         if(msg.content.toLowerCase().includes("ruby") || msg.content.includes('<@552148708272111632>')){
  33.            
  34.             var powitania = [`Hello ${msg.author}`, `Hey ${msg.author}`, `Howdy ${msg.author}`, `Hello, how are you ${msg.author}?`, `Hi ${msg.author}`, `Sup ${msg.author}`, `What's up ${msg.author}?`, `Good seeing you ${msg.author}`];
  35.          
  36.            msg.channel.send(powitania[Math.floor(Math.random()*5)]);
  37.        }
  38.    }
  39.    else if(msg.content.toLowerCase().startsWith("bye") || msg.content.toLowerCase().startsWith("bye bye") || msg.content.toLowerCase().startsWith("goodbye")){
  40.      
  41.        if(msg.content.toLowerCase().includes("ruby") || msg.content.includes('<@552148708272111632>')){
  42.          
  43.            var pozegnania = [`Goodbye ${msg.author}`, `Bye bye ${msg.author}`, `Bye ${msg.author}`, `Bye then ${msg.author}`, `Nice talking with you ${msg.author}`, `It was nice talking with you ${msg.author}`, `It was nice seeing you ${msg.author}`]
  44.          
  45.            msg.channel.send(pozegnania[Math.floor(Math.random()*7)]);
  46.        }
  47.    }
  48.    else if(msg.content.toLowerCase().startsWith("goodnight")){
  49.      
  50.        if(msg.content.toLowerCase().includes("ruby") || msg.content.includes('<@552148708272111632>')){
  51.              
  52.            var noc = [`Goodnight ${msg.author}`, `Bye ${msg.author}, see you tomorrow!`, `Ahh, goodnight then! Bye~ ${msg.author}`, `Sleep well ${msg.author}!`]
  53.              
  54.            msg.channel.send(noc[Math.floor(Math.random()*4)]);
  55.        }
  56.    }
  57.    else if(msg.content.includes("413")){
  58.        msg.channel.send("https://i.imgur.com/zppP0Jo.png");
  59.    }
  60.    else if(msg.content.includes('<@552148708272111632>')){
  61.      
  62.        var ping = ["Always here for you", "Yes?", "What now?", "Yes? Need anything?", "Yeeees?", "Go make 'Ping mods 19 times in a row challenge', not 'Ping bot because why not' >:|", "If you need any help, mods are here to help!","If you need any help, admins are here to help!", "What is it?", "..."]
  63.      
  64.        msg.channel.send(ping[Math.floor(Math.random()*10)]);
  65.    }
  66. else if(msg.content.startsWith("rj!")){
  67.      
  68.      
  69.        if(msg.content.startsWith("rj!ytsearch")){
  70.          
  71.            var video = msg.content.split(" ");
  72.            video.shift();
  73.                              
  74.            var search = " ";
  75.          
  76.            for(var i =0; i < video.length; i++){
  77.                      
  78.                search += video[i];
  79.                search += " ";
  80.            }
  81.          
  82.            yt.search(search, 1, (error, result) => {
  83.  
  84.                    if (error) {
  85.                        msg.channel.send("Sorry, something went wrong..");
  86.                        console.log(error);
  87.                    }
  88.  
  89.                    else {
  90.                        msg.channel.send(`The video you searched for!: http://youtu.be/${result.items[0].id.videoId}`);
  91.                    }
  92.            });
  93.        }
  94.      
  95.        else if(msg.content.startsWith("rj!safeboorusearch")){
  96.          
  97.            var tagi = msg.content.split(" ");
  98.            tagi.shift();
  99.          
  100.                Booru.search("safebooru", tagi, {limit: 5, random: true})
  101.              
  102.            .then(images => {
  103.                var finished_string = "";
  104.                for(var i = 0; i < images.length; i++) {
  105.                finished_string += images[i].fileUrl;
  106.                finished_string += " ";
  107.            }
  108.          
  109.                msg.channel.send(`The images you searched for ;3 : ${  finished_string  }`);
  110.            })
  111.                .catch(err => {
  112.                  
  113.                console.log(err);
  114.                })
  115.        }
  116.      
  117.        else if(msg.content.startsWith("rj!furryboorusearch")){
  118.          
  119.            var tagi = msg.content.split(" ");
  120.            tagi.shift();
  121.          
  122.                Booru.search("furrybooru", tagi, {limit: 5, random: true})
  123.              
  124.            .then(images => {
  125.                var finished_string = "";
  126.                for(var i = 0; i < images.length; i++) {
  127.                finished_string += images[i].fileUrl;
  128.                finished_string += " ";
  129.            }
  130.          
  131.                msg.channel.send(`OwO wat diz? : ${  finished_string  }`);
  132.            })
  133.                .catch(err => {
  134.                  
  135.                console.log(err);
  136.                })
  137.        }
  138.      
  139.        else if(msg.content.startsWith("rj!konansearch")){
  140.          
  141.            var tagi = msg.content.split(" ");
  142.            tagi.shift();
  143.          
  144.                Booru.search("konan", tagi, {limit: 5, random: true})
  145.              
  146.            .then(images => {
  147.                var finished_string = "";
  148.                for(var i = 0; i < images.length; i++) {
  149.                finished_string += images[i].fileUrl;
  150.                finished_string += " ";
  151.            }
  152.          
  153.                msg.channel.send(`The images you searched for uwu: ${  finished_string  }`);
  154.            })
  155.                .catch(err => {
  156.                  
  157.                console.log(err);
  158.                })
  159.        }
  160.      
  161.        else if(msg.content.startsWith("rj!list")){
  162.              
  163.                msg.channel.send("Servers I'm on:")
  164.              
  165.                client.guilds.forEach((guild) => {
  166.              
  167.                msg.channel.send(" - " + guild.name)
  168.                })
  169.        }
  170.      
  171.        else if(msg.content.startsWith("rj!join")){
  172.          
  173.            var kanal = msg.content.split(" ");
  174.            kanal.shift();
  175.          
  176.            var nic = "";
  177.          
  178.            for(var i =0; i < kanal.length; i++){
  179.                      
  180.            nic += kanal[i];
  181.            }
  182.              
  183.            vchannel = msg.guild.channels.find(ch => ch.name == nic);
  184.           if(!vchannel) return msg.channel.send("There's no channel like that :(");
  185.          
  186.           vchannel.join().then(connection =>{
  187.              
  188.           console.log("Succesfully connected")
  189.           msg.channel.send("Connected! :D")
  190.                  
  191.           })
  192.                    .catch(err => {
  193.                  
  194.                    console.error(err);
  195.              
  196.                    })
  197.      
  198.        }
  199.      
  200.        else if(msg.content.startsWith("rj!leave")){
  201.                      
  202.           if(!vchannel)msg.channel.send("I'm not connected to a channel! :(");
  203.            vchannel.leave();
  204.             vchannel = 0;
  205.              
  206.                console.log("Succesfully left")
  207.                msg.channel.send("Left!")
  208.              
  209.          
  210.          
  211.                    .catch(err =>{
  212.                      
  213.                        console.error(err);
  214.                    })
  215.        }
  216.      
  217.        else if(msg.content.startsWith("rj!kick")){
  218.            const user = msg.mentions.users.first();
  219.          
  220.            if (user){
  221.              
  222.                const member = msg.guild.member(user);
  223.                  
  224.                    if(member){
  225.                        member.kick(`Kicked.`).then(()=>{
  226.                        msg.reply(` ${user.tag} was succesfully kicked! >:D`);
  227.                        })
  228.                      
  229.                        .catch(err=>{
  230.                            msg.reply(`I can't kick that user :pensive:`);
  231.                            console.error(err);
  232.                        })
  233.                    }
  234.                  
  235.                    else{
  236.                        msg.reply(`That user is not here!`);
  237.                    }
  238.            }
  239.          
  240.            else{
  241.                msg.reply(`you haven't mentioned anyone! :|`);
  242.            }
  243.        }
  244.        else if(msg.content.startsWith("rj!ban")){
  245.            const user = msg.mentions.users.first();
  246.          
  247.            if(user){
  248.                const member = msg.guild.member(user);
  249.              
  250.                if(member){
  251.                    member.ban({
  252.                    reason: 'J U S T I C E' })
  253.                  
  254.                    .then(()=>{
  255.                        msg.reply(` you just smashed ${user.tag} with banhammer! >:D`);
  256.                        })
  257.                        .catch(err=>{
  258.                            msg.reply(`I can't ban that user :pensive:`);
  259.                            console.error(err);
  260.                        })
  261.                }
  262.                else{
  263.                    msg.reply(`That user is not here!`);
  264.                }
  265.            }
  266.          
  267.            else{
  268.                msg.reply(`you haven't mentioned anyone :|`);
  269.            }
  270.        }
  271.      
  272.        else if(msg.content.startsWith("rj!help")){
  273.          
  274.            msg.channel.send("Info!: \n \n I respond to every hi, goodnight, goodbye, and ping! uwu (but please don't ping me too many times >:|) \n \n You can search for really great pics! Here's the list of Booru's: \n \n :black_small_square: Safebooru - use command ```rj!safeboorusearch``` [enter tags after command, separate them with space] \n \n :black_small_square: Furrybooru (this is nsfw bot) - use command ```rj!furryboorusearch``` [enter tags after command, separate them with space] \n \n :black_small_square: Konachan (sometimes drops nsfw)- use command ```rj!konansearch``` [enter tags after command, separate them with space] \n \n You can also search for videos on YouTube using command ```rj!ytsearch``` [enter the name of video after command] \n \n I can ban and kick members, so beware of banhammer >:D \n \n If I don't know a command, don't worry, I'll tell you!");
  275.        }
  276.  
  277.        else{
  278.            msg.channel.send("I don't know that command. Sorry :pensive:");
  279.            }
  280.      
  281. };
  282. })
  283. client.login("NTUyMTQ4NzA4MjcyMTExNjMy.D17Utg.B1JOoh5ntyagRpDZz6za2nKsD3A");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement