Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require("discord.js");
- const bot = new Discord.Client();
- const config = require("./config.json");
- var prefix = config.prefix
- function magic8Ball() {
- var rand = [':8ball: Absolutly.', ':8ball: Absolutly not.', ':8ball: It is true.', ':8ball: Impossible.', ':8ball: Of course.', ':8ball: I do not think so.', ':8ball: It is true.', ':8ball: It is not true.', ':8ball: I am very undoubtful of that.',
- ':8ball: I am very doubtful of that.', ':8ball: Sources point to no.', ':8ball: Theories prove it.', ':8ball: Reply hazy try again', ':8ball: Ask again later', ':8ball: Better not tell you now', ':8ball: Cannot predict now', ':8ball: Concentrate and ask again'
- ];
- return rand[Math.floor(Math.random() * rand.length)];
- };
- bot.on("ready", () => {
- console.log(`Hi Gamma! I've initiated with ${bot.users.size} users, in ${bot.guilds.size} guild(s)`);
- bot.user.setGame(`j!help | ${bot.guilds.size} Guilds!`);
- });
- bot.on("message", async message => {
- if (message.author.bot) return;
- if (message.content.indexOf(config.prefix) !== 0) return;
- const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
- const command = args.shift().toLowerCase();
- client.on("guildMemberAdd", (member) => {
- newUsers.set(member.id, member.user);
- });
- client.on("message", (message) => {
- if (message.content.startsWith("ping")) {
- message.channel.send("pong!");
- }
- });
- client.on("guildMemberAdd", (member) => {
- const guild = member.guild;
- if (!newUsers[guild.id]) newUsers[guild.id] = new Discord.Collection();
- newUsers[guild.id].set(member.id, member.user);
- if (newUsers[guild.id].size > 1) {
- const userlist = newUsers[guild.id].map(u => u.toString()).join(" ");
- guild.channels.get(guild.id).send("Welcome!\n" + userlist);
- newUsers[guild.id].clear();
- }
- });
- client.on("guildMemberRemove", (member) => {
- const guild = member.guild;
- if (newUsers[guild.id].has(member.id)) newUsers.delete(member.id);
- });
- if (command === "say") {
- const sayMessage = args.join(" ");
- message.delete().catch(Kek => {});
- message.channel.send(sayMessage);
- };
- if (command === "invite") {
- message.channel.send ("Here ya go! https://discordapp.com/oauth2/authorize?client_id=381649594783891476&scope=bot&permissions=268561478");
- console.log("Sent invite link.")
- };
- if(command === "ping") {
- // Calculates ping between sending a message and editing it, which gives the time in milliseconds
- const m = await message.channel.send("Calculating...");
- m.edit(`:ping_pong: Pong! Latency is ${m.createdTimestamp - message.createdTimestamp}ms. API Latency is ${Math.round(bot.ping)}ms);
- }
- if (command === "youtube") {
- message.channel.send("Try this on for size! https://youtube.com/GammaRayTheBestEvahhhh");
- console.log("Sent Channel Link.")
- }
- if (command === "dab") {
- message.channel.send(`<o/ ${message.author} has been dabbed on`);
- console.log("Dabbed on someone.");
- }
- if (command === "help") {
- message.channel.send("Here's a list of commands!")
- message.channel.send("**j!8ball <Question>** Gives a response to a question just as a Magic Eight Ball would!")
- message.channel.send("**j!say <Words>** Takes any text after the j!say command, and repeats it back!")
- message.channel.send("**j!youtube** Sends Gamma's Youtube link!")
- message.channel.send("**j!invite** Sends the invite link for me in chat so you can invite me to your servers!")
- message.channel.send("**j!Dab** Dabs on you!")
- message.channel.send("*Pg. 1/1*")
- console.log("Opened help menu");
- };
- if (command === "8ball") {
- message.channel.send(magic8Ball()) }});
- bot.login(config.token);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement