Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require("discord.js");
- const Config = require("./config.json");
- const Token = require("./token.json");
- const fs = require("fs");
- const superagent = require("superagent");
- let config = require("./config.json")
- const bot = new Discord.Client();
- bot.commands = new Discord.Collection();
- fs.readdir("./commands/", (err, files) =>{
- if(err) console.log(err);
- let jsfile = files.filter(f => f.split(".").pop() === "js");
- if(jsfile.length <= 0 ){
- console.log("Could not find the command");
- return;
- }
- jsfile.forEach((f, i) =>{
- let props = require(`./commands/${f}`);
- console.log(`${f} has loaded and is now working!`);
- bot.commands.set(props.help.name, props);
- });
- });
- //${bot.guilds.size} servers!
- bot.on("ready", async () =>{
- console.log (`${bot.user.username} is online! It's running on ${bot.guilds.size} servers!`);
- //bot.user.setActivity(`S2help`, {type:"PLAYING"});
- })
- //start of joins
- bot.on("guildMemberAdd", async member => {
- // send a dm
- member.send("Hey there! My name is ***Staffy 2.0*** i am a Discord bot specified for ***Staffy's Suppport Server*** If you need help just do `S2help` and i will PM/DM you a list of commands :) Make sure to read our rules!!");
- });
- //end of joins
- bot.on("message", async message => {
- if(message.author.bot) return;
- if(message.channel.type === "dm") return;
- let prefixes = JSON.parse(fs.readFileSync("./prefixes.json", "utf8"));
- if(!prefixes[message.guild.id]){
- prefixes[message.guild.id] = {
- prefixes: config.prefix
- };
- }
- let prefix = prefixes[message.guild.id].prefixes;
- if(!message.content.startsWith(prefix)) return;
- let messageArray = message.content.split(" ");
- let cmd = messageArray[0];
- let args = messageArray.slice(1);
- let commandfile = bot.commands.get(cmd.slice(prefix.length));
- if(commandfile) commandfile.run(bot, message, args);
- //start of auto changing status boi
- function changing_status() {
- let status = ['Prefix: l. | l.help', 'Developed by Dond~#3473', 'I\'m Luci', 'Mention me!', 'With my myki\'s']
- let random = status[Math.floor(Math.random() * status.length)]
- bot.user.setActivity(random, {type: 'PLAYING'});
- }
- setInterval(changing_status, 5000);
- console.log(err)
- //end of auto changing status boi
- })
- bot.login(Token.token);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement