Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const {
- Client,
- WebhookClient,
- MessageEmbed,
- Role,
- } = require("discord.js-selfbot-v13");
- const { createWorker } = require("tesseract.js");
- const { getColorFromURL } = require("color-thief-node");
- const { OtakudesuInstance } = require("otakudesu-scraper");
- const rgbToHex = require("rgb-hex");
- const mongoose = require("mongoose");
- const jsonFruit = require("./fruits.json");
- const cron = require("node-cron");
- const fs = require("fs");
- const PrettyError = require("pretty-error");
- require("dotenv").config();
- const pe = new PrettyError();
- const client = new Client({
- // syncStatus: false,
- checkUpdate: false,
- });
- const webhookClient = new WebhookClient({ url: process.env.WEBHOOK });
- let arrFruitsNama = [];
- (async () => {
- for (let i = 0; i < jsonFruit.length; i++) {
- const obj = jsonFruit[i];
- arrFruitsNama.push(obj.nama);
- }
- })();
- client.on("ready", async () => {
- // require('./server');
- console.log(`${client.user.username} is ready!`);
- try {
- await mongoose.connect(process.env.MONGO);
- console.log("Mongodb Success Connected To Database");
- } catch (err) {
- //console.error(`Error ` + err.message);
- // return `Error ` + err;
- }
- client.user.setSamsungActivity("com.YoStarEN.AzurLane", "START");
- // const guild = client.guilds.cache;
- // const guild1 = guild.get("1021954822116749332");
- // const invite = guild1.invites.create("1114380738528301137", {
- // maxAge: 0,
- // maxUses: 100000,
- // });
- return;
- });
- let send = false;
- let sendTry = 0;
- let time = -769171800;
- let cekIni = 0;
- client.on("messageCreate", async (msg) => {
- const guild = client.guilds.cache;
- // if (msg.author.id === client.user.id) { return }
- if (msg.author.id === "819362961239703562" && msg.content === "!status") {
- let totalSeconds = client.uptime / 1000;
- let days = Math.floor(totalSeconds / 86400);
- totalSeconds %= 86400;
- let hours = Math.floor(totalSeconds / 3600);
- totalSeconds %= 3600;
- let minutes = Math.floor(totalSeconds / 60);
- let seconds = Math.floor(totalSeconds % 60);
- let time = Math.floor(client.readyTimestamp / 1000);
- msg.reply(
- "im good :)\nPing: " +
- Math.round(client.ws.ping) +
- "ms\nUptime : " +
- days +
- "d " +
- hours +
- "h " +
- minutes +
- "m " +
- seconds +
- "s\n<t:" +
- time +
- ":F> | <t:" +
- time +
- ":R>"
- );
- }
- if (msg.channelId === "1037758983315931136") {
- try {
- let before = 0;
- let after = 0;
- let timeExe = 0;
- let men = [];
- before = +new Date();
- before /= 1000;
- const embedRaw = msg.embeds[0];
- let cek = embedRaw.fields[0].name;
- cek = cek.toLowerCase();
- let typeStock = "Unknwon";
- //depreacte
- // const arrCek = ["Mirage", "Normal"];
- // for (let i = 0; i < arrCek.length; i++) {
- // const obj = arrCek[i];
- // if (!cek.includes(obj) && i === 1) {
- // return;
- // } else if (cek.includes(obj)) {
- // typeStock = obj;
- // break;
- // } else {
- // continue;
- // }
- // }
- if (!cek.includes("normal")) {
- console.log(1);
- return;
- }
- typeStock = "Normal";
- //deprecated
- // typeStock = cek;
- // if (typeStock === "Unknwon" || typeStock === "Mirage") {
- // return;
- // }
- //cek kalok waktu nya gak pas
- if (!send) {
- // console.log(`bukan saatnya`);
- return;
- }
- const guild1 = guild.get("1036669101122277387"); //guild validation
- const channelok = guild1.channels.cache.get("1187729967484772413"); //ch validation
- let msgraw = await channelok.messages.fetch({ limit: 1 });
- msgraw = msgraw.entries().next().value[1];
- let msgfix = msgraw.content;
- let split1 = msgfix.split("\n");
- //cek kalok di validation nya rusak
- if (split1[0] != "stockbuah") {
- const guild1 = guild.get("1021954822116749332"); //guild shin
- const channel1 = guild1.channels.cache.get(
- "1189178957371818035"
- ); //ch shin
- channel1.send(
- `<@819362961239703562>\n[ERR] msg validation salah di <#1187729967484772413>\n${msgraw.url}\n`
- );
- console.log(`salah msg`);
- return;
- }
- let split2 = split1[1].split(",");
- let arrCheck = [];
- let rawFruit = embedRaw.fields[0].value.replaceAll("\n", "");
- let arrayFruit = [];
- for (let i = 0; i < jsonFruit.length; i++) {
- const obj = jsonFruit[i];
- if (rawFruit.includes(obj.fruit)) {
- arrayFruit.push(
- `- ${obj.emoji} ${obj.roleId} <a:arrow:1190522163829153852> <:beli:1190521869586145352>${obj.harga}`
- );
- arrCheck.push(obj.nama);
- if (!men.includes(obj.rolerank)) {
- men.push(obj.rolerank);
- }
- }
- continue;
- }
- //cek kalok stock nya sama ap gak
- let send2 = false;
- for (let i = 0; i < split2.length; i++) {
- let dariMsg = split2[i];
- if (
- !arrCheck.includes(dariMsg) &&
- arrFruitsNama.includes(dariMsg)
- ) {
- send2 = true;
- break;
- }
- }
- //cek kalok send nya false dan sendtry nya kurang dari 10 atau sma dengan 10
- if (!send2 && sendTry <= 10) {
- sendTry++;
- console.log(4);
- return;
- }
- cekIni++;
- if (cekIni > 1) {
- send = false;
- cekIni = 0;
- console.log("cekini");
- return;
- }
- send = false;
- sendTry = 0;
- let str = arrCheck.toString();
- let menFix = men.join(" , ");
- const sendMsg = await channelok.send(`stockbuah\n${str}\n`);
- let jadi = arrayFruit.join("\n");
- await webhookClient.send({
- content: `## ${typeStock} Fruit Stock\n${jadi}\n${menFix}\n<a:clock:1191357614920052797>**Next Stock In <t:${time}:R>!**\n## Credit To [RyuShin.store <a:emofix:1191299526527569930>](https://discord.gg/mCFt5ppBqW)`,
- flags: "SUPPRESS_EMBEDS",
- });
- after = +new Date();
- after /= 1000;
- timeExe = after - before;
- await sendMsg.edit(
- `stockbuah\n${str}\ntotal time : ${timeExe}s\n${msg.url}\n`
- );
- return;
- } catch (error) {
- const guild1 = guild.get("1021954822116749332");
- const channel = guild1.channels.cache.get("1189178957371818035"); //1189178957371818035
- // console.log(channel);
- channel.send(
- `<@819362961239703562>\n\`\`\`\n ${error.message} \`\`\`\n ${msg.url}\n`
- );
- return;
- }
- }
- if (msg.channelId === "1114380738528301137") {
- try {
- await msg.crosspost();
- } catch (err) {
- console.error(err.message);
- }
- }
- if (msg.author.id === "819362dqdw961239703562") {
- let fruits = require("./fruit.json");
- let arr = [];
- let arrFruits = [
- "Chop-Chop",
- "Spring-Spring",
- "Bomb-Bomb",
- "Smoke-Smoke",
- "Spike-Spike",
- "Flame-Flame",
- "Bird-Bird: Falcon",
- "Ice-Ice",
- "Sand-Sand",
- "Dark-Dark",
- "Diamond-Diamond",
- "Light-Light",
- "Rubber-Rubber",
- "Barrier-Barrier",
- "Ghost-Ghost",
- "Magma-Magma",
- "Quake-Quake",
- "Buddha-Buddha",
- "Love-Love",
- "Spider-Spider",
- "Sound-Sound",
- "Bird-Bird: Phoenix",
- "Portal-Portal",
- "Rumble-Rumble",
- "Paw-Paw",
- "Blizzard-Blizzard",
- "Gravity-Gravity",
- "Mammoth-Mammoth",
- "T-Rex-T-Rex",
- "Dough-Dough",
- "Shadow-Shadow",
- "Venom-Venom",
- "Control-Control",
- "Spirit-Spirit",
- "Dragon-Dragon",
- "Leopard-Leopard",
- "Kitsune-Kitsune",
- ];
- for (let i = 0; i < arrFruits.length; i++) {
- const fruit = arrFruits[i];
- const buah = fruits[i];
- // msg.guild.roles.cache.find((r) => r.name === fruit);
- msg.guild.roles.cache.forEach((role) => {
- if (role.name === fruit) {
- const data = {
- fruit: buah.fruit,
- nama: buah.nama,
- emoji: buah.emoji,
- harga: buah.harga,
- rank: buah.rank,
- roleId: `<@&${role.id}>`,
- rolerank: buah.rolerank,
- color: buah.color,
- };
- arr.push(data);
- } else {
- return;
- }
- });
- // console.log(fruit);
- }
- // arrFruits.includes(role.name);
- const push = JSON.stringify(arr);
- fs.writeFile("fruits.json", push, function (err) {
- if (err) throw err;
- console.log("Saved!");
- });
- // msg.reply(`data ${arr.toString()}`);
- }
- return;
- });
- // async function checkNotif() {
- // const otaku = new OtakudesuInstance();
- // const web = new WebhookClient({ url: process.env.WEB });
- // console.log("Anime Notif On");
- // (async () => {
- // try {
- // let f = false;
- // do {
- // f = false;
- // const data = await anime.find();
- // for (const object of data) {
- // if (object.name === "Unknown" || object.id < 1) continue;
- // console.log(object.name);
- // let eps = Number(object.eps);
- // eps++;
- // let urlDown = object.urlDownload.replaceAll("epseps", eps);
- // let check = await otaku.getDownloadsByUrl(urlDown);
- // if (check.length === 0) continue;
- // console.log(checkk);
- // let resMKVRaw = [];
- // let resMp4Raw = [];
- // let resDown;
- // for (const url of check) {
- // const checkRes = ["720p", "1080p"];
- // resDown = url.resolution;
- // resDown = resDown.split(" ");
- // if (!checkRes.includes(resDown[1])) continue;
- // for (const object of url.links) {
- // const fileHost = object.name;
- // if (
- // resDown[0].includes("Mp4") &&
- // (fileHost.includes("ODFiles") ||
- // fileHost.includes("GoFile"))
- // ) {
- // resMp4Raw.push(
- // `[${resDown[1]} ${fileHost}](${object.url})`
- // );
- // }
- // if (
- // resDown[0].includes("MKV") &&
- // (fileHost.includes("ODFiles") ||
- // fileHost.includes("GoFile"))
- // ) {
- // resMKVRaw.push(
- // `[${resDown[1]} ${fileHost}](${object.url})`
- // );
- // }
- // }
- // }
- // eps = String(eps);
- // const newReq = await anime.findOneAndUpdate(
- // { id: object.id },
- // { eps: eps }
- // );
- // const resMKV = resMKVRaw.join("\n");
- // const resMp4 = resMp4Raw.join("\n");
- // let downloadLinks = [];
- // if (resMKVRaw.length != 0) {
- // downloadLinks.push({ name: "MKV", value: resMKV });
- // }
- // if (resMp4Raw.length != 0) {
- // downloadLinks.push({ name: "MP4", value: resMp4 });
- // }
- // if (downloadLinks.length === 0) {
- // downloadLinks = [
- // { name: "MP4", value: "Download Links Not Found" },
- // { name: "MKV", value: "Download Links Not Found" },
- // ];
- // }
- // await send(newReq, eps, downloadLinks);
- // }
- // await sleep(1000 * 10);
- // f = true;
- // } while (f === true);
- // async function send(anime, eps, down) {
- // let urlDown = anime.urlDownload.replaceAll("epseps", eps);
- // const embed = new MessageEmbed()
- // .setAuthor({
- // name: "Otakudesu.cam",
- // url: "https://otakudesu.cam/",
- // iconURL:
- // "https://media.discordapp.net/attachments/1023214623249399888/1194471430964920410/Logo-1.png",
- // })
- // .setColor(`0x${anime.color}`)
- // .setDescription(
- // `[${anime.name}](${anime.url})\nEps : ${eps}/${anime.toEps}\n\n${anime.desc}`
- // )
- // .setImage(anime.imgUrl)
- // .setTitle(`${anime.name}\nEpisode ${eps}`)
- // .setURL(urlDown)
- // .setFields(down);
- // await web.send({
- // username: anime.namePfp,
- // avatarURL: anime.imgPfp,
- // content: anime.roleId,
- // embeds: [embed],
- // });
- // }
- // function sleep(ms) {
- // return new Promise((resolve) => setTimeout(resolve, ms));
- // }
- // } catch (err) {
- // console.log(`Error : ` + err);
- // }
- // })();
- // }
- //set ke 0
- //yang pas di 00 F:\Desktop\Bot\momo self\New folder\pas di 00.txt
- //
- (async () => {
- cron.schedule(
- "0 12 * * *",
- () => {
- nodeCron();
- },
- {
- scheduled: true,
- timezone: "Asia/Makassar",
- }
- );
- cron.schedule(
- "0 00 * * *",
- () => {
- nodeCron();
- },
- {
- scheduled: true,
- timezone: "Asia/Makassar",
- }
- );
- cron.schedule(
- "0 4 * * *",
- () => {
- nodeCron();
- },
- {
- scheduled: true,
- timezone: "Asia/Makassar",
- }
- );
- cron.schedule(
- "0 16 * * *",
- () => {
- nodeCron();
- },
- {
- scheduled: true,
- timezone: "Asia/Makassar",
- }
- );
- cron.schedule(
- "0 8 * * *",
- () => {
- nodeCron();
- },
- {
- scheduled: true,
- timezone: "Asia/Makassar",
- }
- );
- cron.schedule(
- "0 20 * * *",
- () => {
- nodeCron();
- },
- {
- scheduled: true,
- timezone: "Asia/Makassar",
- }
- );
- })();
- async function nodeCron() {
- send = true;
- sendTry = 0;
- cekIni = 0;
- let get = new Date(+new Date());
- get = Math.round(get / 1000);
- time = get + 3600 * 4;
- }
- client.login(process.env.TOKEN);
- // client.on("message", message => {
- // if (message.content.startsWith(prefix + "ping")) {
- // message.channel.send('Pong! <:Pingsock:433019097005948938>');
- // } else if (message.content.startsWith(prefix + "avatar")) {
- // message.reply(message.author.avatarURL);
- // }
- // });
- // const ch = tempVars("ch");
- // const mem = tempVars("mem");
- // const name = mem.displayName;
- // const { MessageEmbed, WebhookClient } = require('discord.js');
- // const avatar = mem.displayAvatarURL({ dynamic: true });
- // require('dotenv').config()
- // const embed = new MessageEmbed()
- // .setDescription('## Notes\n- RyuShin.store **tidak akan bertanggung jawab** atas transaksi yang dilakukan dichannel ini\n- Jika ingin lebih aman, alangkah baiknya bisa memakai jasa MM(Middle Man) kami di<#1150064429292068964>')
- // .setColor(0xff0000);
- // send()
- // async function send() {
- // try {
- // await webhookClient.send({
- // content: null,
- // username: name,
- // avatarURL: avatar,
- // embeds: [embed],
- // threadId: ch.id,
- // });
- // ch.lastMessage.pin();
- // Actions.endActions(cache);
- // } catch (error) {
- // console.log(error.message)
- // }
- // }
- // const guild = await client.guilds.fetch('906426036772818954');
- // const channel = guild.channels.fetch('1037758983315931136');
- // const msg = await channel.messages.fetch({ limit: 100 });
- // const msg2 = await msg.channel.messages.fetch('1154024196695916574');
- // console.log(msg2);
- // const guild = await client.guilds.fetch('906426036772818954');
- // const channel = await guild.channels.fetch('1037758983315931136');
- // // await messages.channel.fetch({ limit: 100 });
- // const msg = await channel.messages.fetch({ limit: 100 });
- // const msg2 = await msg.channel.messages.fetch('1154024196695916574');
- // console.log(msg);
Advertisement
Add Comment
Please, Sign In to add comment