Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require('discord.js');
- const client = new Discord.Client();
- const config = require('./auth.json');
- var amountfees = ['nothing', '0'];
- var strMatchList = ['yeezy 350', 'cactus plant', 'sacai', 'off white'];
- function getMatch(str, list) {
- var len = list.length;
- for (n = 0; n < len; n++) {
- s = list[n].toLowerCase();
- if (str.toLowerCase().includes(s)){
- return list[n];
- }
- }
- return null;
- }
- const request = require('request');
- const log = require('./logger');
- const config = {
- "webhook":"WEBHOOK", // Your webhook here
- "requestURL":"LINK", // Your product link here
- "refreshRate":1000
- }
- log("Starting...");
- function send() {
- let requestLoop = setInterval(function(){
- request({
- url: config.requestURL,
- method: "GET",
- timeout: 1000,
- followRedirect: true,
- maxRedirects: 10
- },function(error, response, body){
- if(error){
- console.log("You're banned, try using a VPN!")
- }
- request(opts);
- log("+1 View")
- });
- }, config.refreshRate);
- }
- send();
- const helpEmbed = new Discord.RichEmbed()
- .setColor('#fa709a')
- .setTitle('___**List of commands**___')
- /* .addField('!purge, amount', 'Deletes a certain amount of messages')
- .addField('!ban, user', 'Bans a specified member') */
- .addField('!ping', 'Returns the ping in milliseconds')
- .addField('!view (link)', 'Views an ebay link 200 times')
- .addField('!fees (number)', 'Calculates the selling fees of GOAT/Stockx/Ebay/Grailed')
- .addField('!shopifydelays (tasks) (proxies)', 'Calculates the recommended delays for Shopify websites')
- .setTimestamp()
- .setFooter('Juiced tools by matthew#1232', 'https://cdn.discordapp.com/attachments/582998102944907274/584911748650237962/twitter_icon.png');
- client.on("ready", () => {
- console.log(`Bot has started, with ${client.users.size} users, in ${client.channels.size} channels of ${client.guilds.size} servers.`);
- client.user.setActivity(`!help`);
- });
- client.on("guildCreate", guild => {
- console.log(`New guild joined: ${guild.name} (id: ${guild.id}). This guild has ${guild.memberCount} members!`);
- client.user.setActivity(`with ${client.guilds.size} servers`);
- });
- client.on("guildDelete", guild => {
- console.log(`I have been removed from: ${guild.name} (id: ${guild.id})`);
- client.user.setActivity(`with ${client.guilds.size} servers`);
- });
- client.on("message", async message => {
- var keywordmsg = message.content;
- var match = getMatch( message.content, strMatchList );
- if (match != null && message.channel.id == "589923197609181205"){
- message.channel.send('**Keyword matched!** @everyone');
- }
- // This event will run on every single message received, from any channel or DM.
- // Ignores bots
- if(message.author.bot) return;
- if(message.content.indexOf(config.prefix) !== 0) return;
- // Here we separate our "command" name, and our "arguments" for the command.
- // e.g. if we have the message "+say Is this the real life?" , we'll get the following:
- // command = say
- // args = ["Is", "this", "the", "real", "life?"]
- const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
- const command = args.shift().toLowerCase();
- // Let's go with a few common example commands! Feel free to delete or change those.
- if(command === "ping") {
- // Calculates ping between sending a message and editing it, giving a nice round-trip latency.
- // The second ping is an average latency between the bot and the websocket server (one-way, not round-trip)
- const m = await message.channel.send("Ping?");
- m.edit(`Pong! Latency is ${m.createdTimestamp - message.createdTimestamp}ms. API Latency is ${Math.round(client.ping)}ms`);
- }
- /*
- if(command === "say") {
- // makes the bot say something and delete the message. As an example, it's open to anyone to use.
- // To get the "message" itself we join the `args` back into a string with spaces:
- const sayMessage = args.join(" ");
- // Then we delete the command message (sneaky, right?). The catch just ignores the error with a cute smiley thing.
- message.delete().catch(O_o=>{});
- // And we get the bot to say the thing:
- message.channel.send(sayMessage);
- }
- */
- /*
- if(command === "kick") {
- // This command must be limited to mods and admins. In this example we just hardcode the role names.
- // Please read on Array.some() to understand this bit:
- // https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/some?
- if(!message.member.roles.some(r=>["ADMIN", "OWNER"].includes(r.name)) )
- return message.reply("**Sorry, you don't have permissions to use this!**");
- // Let's first check if we have a member and if we can kick them!
- // message.mentions.members is a collection of people that have been mentioned, as GuildMembers.
- // We can also support getting the member by ID, which would be args[0]
- let member = message.mentions.members.first() || message.guild.members.get(args[0]);
- if(!member)
- return message.reply("**Please mention a valid member of this server**");
- if(!member.kickable)
- return message.reply("**I cannot kick this user!**");
- // slice(1) removes the first part, which here should be the user mention or ID
- // join(' ') takes all the various parts to make it a single string.
- let reason = args.slice(1).join(' ');
- if(!reason) reason = "**No reason provided**";
- // Now, time for a swift kick in the nuts!
- await member.kick(reason)
- .catch(error => message.reply(`**Sorry ${message.author} I couldn't kick because of : ${error}**`));
- message.reply(`**${member.user.tag} has been kicked by ${message.author.tag} because: ${reason}**`);
- }
- */
- /* if(command === "ban") {
- if(!message.member.roles.some(r=>["Administrator"].includes(r.name)) )
- return message.reply("**Sorry, you don't have permissions to use this!**");
- let member = message.mentions.members.first();
- if(!member)
- return message.reply("**Please mention a valid member of this server**");
- if(!member.bannable)
- return message.reply("**I cannot ban this user!**");
- let reason = args.slice(1).join(' ');
- if(!reason) reason = "No reason provided";
- await member.ban(reason)
- .catch(error => message.reply(`Sorry ${message.author} I couldn't ban because of : ${error}`));
- message.reply(`**${member.user.tag} has been banned by ${message.author.tag} because: ${reason}**`);
- }
- if(command === "purge") {
- const deleteCount = parseInt(args[0], 10) + 1;
- if(!deleteCount || deleteCount < 1 || deleteCount > 100)
- return message.reply("**Please provide a number between 2 and 100 for the number of messages to delete**");
- const fetched = await message.channel.fetchMessages({limit: deleteCount});
- message.channel.bulkDelete(fetched)
- .catch(error => message.reply(`**Couldn't delete messages because of: ${error}**`));
- }
- */
- if (command === "shopifydelays") {
- amountdelays = message.content.split(" ");
- const delaysembed = new Discord.RichEmbed()
- .setColor('#fa709a')
- .setTitle('___**Recommended Shopify Delays for you**___')
- .addField('Restocks: ', amountdelays[1] * 10000 / amountdelays[2])
- .addField('Initial: ', amountdelays[1] * 3500 / amountdelays[2])
- .setTimestamp()
- .setFooter('Juiced tools by matthew#1232', 'https://cdn.discordapp.com/attachments/582998102944907274/584911748650237962/twitter_icon.png');
- console.log('Calculating delays of ' + amountdelays[1]);
- message.reply(delaysembed);
- }
- if (command === "help") {
- //List of commands
- return message.reply(helpEmbed);
- }
- // Calculates fees of certain websites
- if (command === "fees") {
- amountfees = message.content.split(" ");
- // making the embed
- const feesEmbed = new Discord.RichEmbed()
- .setColor('#fa709a')
- .setTitle('___**Fees of**___')
- .addField('Stockx ', '$' + Math.ceil(amountfees[1] * 88.75) / 100)
- .addField('Ebay ', '$' + Math.ceil(amountfees[1] * 90) / 100)
- .addField('Grailed ', '$' + Math.ceil(amountfees[1] * 91) / 100)
- .addField('Goat ', '$' + Math.ceil(amountfees[1] * 87.6) / 100)
- .setTimestamp()
- .setFooter('Juiced tools by matthew#1232', 'https://cdn.discordapp.com/attachments/582998102944907274/584911748650237962/twitter_icon.png');
- console.log('Calculating fees of ' + Math.ceil(amountfees[1]));
- message.reply(feesEmbed);
- }
- /* if (command === "mute") {
- let tomute = message.mentions.members.first() || message.guild.members.get(args[0]);
- if (!tomute){
- return message.reply("Couldn't find user");
- }
- if (tomute.hasPermission("MANAGE_MESSAGES")){
- return message.reply("**You do not have permissions to use this!**");
- }
- let muterole = message.guild.roles.find('name', "muted");
- if (!muterole){
- try{
- muterole = await message.guild.createRole({
- name: "muted",
- color: "#000000"
- }
- message.guild.channels.forEach(async (channel, id) => {
- await channel.overwritePermissions(muterole, {
- SEND_MESSAGES: false,
- ADD_REACTIONS: false
- }
- })
- } catch(e){
- console.log(e.stack);
- }
- }
- let mutetime = args[1];
- if(!mutetime){
- return message.reply("You didn't specifiy a time!");
- }
- await(tomute.addRole(muterole.id);
- message.reply(`<@${tomute.id}> has been muted for ${ms(mutetime)}`);
- setTimeout(function(){
- tomute.removeRole(muterole.id);
- message.channel.send('**<@${tomute.id}> has been unmuted**');
- }, ms(mutetime));
- }*/
- });
- client.login(config.token);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement