This commit is contained in:
night0721 2021-07-13 11:17:39 +08:00
parent 91abc5839d
commit f5955160e3
90 changed files with 8485 additions and 3470 deletions

View file

@ -1,5 +1,6 @@
TOKEN = TOKEN =
MONGO = MONGO =
mongo =
CLIENT_SECRET = CLIENT_SECRET =
CLIENT_ID = CLIENT_ID =
PORT = PORT =

15
.eslintrc.js Normal file
View file

@ -0,0 +1,15 @@
module.exports = {
env: {
es6: true,
node: true,
},
extends: "eslint:recommended",
parserOptions: {
ecmaVersion: 2020,
sourceType: "module",
},
rules: {
indent: ["error", 2],
semi: ["error", "always"],
},
};

12
.gitignore vendored
View file

@ -1,14 +1,2 @@
node_modules/ node_modules/
/.env /.env
commands/CODM/
/dashboard/
/util/Data/aliases.json
/util/Data/attachments.json
/util/Data/builds.json
/util/Data/data.json
/util/Data/perk.json
/util/Data/skins.json
/util/Data/weapons.json
/util/functions/common.js
/util/bash.sh
/bot.js

3
.jshintrc Normal file
View file

@ -0,0 +1,3 @@
{
"esversion": 10
}

View file

@ -1,38 +1,41 @@
# cath.exe <img src = "https://cdn.discordapp.com/avatars/800966959268364288/36d6967911a31a638d65d1da472d2e14.png?size=1024" width = "45"> # cath.exe <img src = "https://cdn.discordapp.com/avatars/800966959268364288/36d6967911a31a638d65d1da472d2e14.png?size=1024" width = "45">
cath.exe is a CODM-theme based Discord Bot with many categories of commands like Moderation, Music and Economy. It is an open source project based on Project Lighthouse by path.exe, written in node.js(JavaScript), mainly using discord.js and mongoose module.<br><br>If you like this bot, feel free to **star** and **fork** the repository!<br> cath.exe is a CODM-theme based Discord Bot with many categories of commands like Moderation, Music and Economy. It is an open source project based on Project Lighthouse by path.exe, written in node.js(JavaScript), mainly using discord.js and mongoose module.<br><br>If you like this bot, feel free to **star** and **fork** the repository!<br>
Click [here](https://discord.com/oauth2/authorize?client_id=800966959268364288&permissions=4231314550&scope=bot%20applications.commands) to invite cath.exe Click [here](https://discord.com/oauth2/authorize?client_id=800966959268364288&permissions=4231314550&scope=bot%20applications.commands) to invite cath.exe
[![Discord](https://img.shields.io/discord/718762019586572341?color=46828d&label=Support&style=for-the-badge)](https://discord.gg/SbQHChmGcp) ![Support Server](https://img.shields.io/discord/718762019586572341?color=46828d&label=Support&style=for-the-badge)
![Repo Stars](https://img.shields.io/github/stars/night0721/cath.exe?color=46828d&style=for-the-badge) ![Repo Stars](https://img.shields.io/github/stars/night0721/cath.exe?color=46828d&style=for-the-badge)
# How to deploy the bot? <img src = "https://cdn.discordapp.com/emojis/740978278055280722.png" width = "40"> # How to deploy the bot? <img src = "https://cdn.discordapp.com/emojis/740978278055280722.png" width = "40">
1. Clone the repository 1. Clone the repository
```cmd ```cmd
git clone https://github.com/night0721/cath.exe git clone https://github.com/night0721/cath.exe
(or) (or)
gh repo clone night0721/cath.exe gh repo clone night0721/cath.exe
``` ```
or
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/night0721/cath.exe) ro
[![repl.it](https://repl.it/badge/github/night0721/cath.exe)](https://repl.it/github/night0721/cath.exe)
2.Create a .env file from <a href = "https://github.com/night0721/cath.exe/blob/main/.env.example">.env.example </a><br><br> 2.Create a .env file from <a href = "https://github.com/night0721/cath.exe/blob/main/.env.example">.env.example</a><br><br> 3. Create an application from [Discord Developer Portal](https://discord.com/developers/applications), then copy the
3. Create an application from [Discord Developer Portal](https://discord.com/developers/applications), then copy the
- Bot Token<br> - Bot Token<br>
- Application ID(Client ID)<br> - Application ID(Client ID)<br>
- Client Secret<br> - Client Secret<br><br>
<br>
4. Create a MongoDB Connection URI from [here](https://www.mongodb.com) <br><br> 4. Create a MongoDB Connection URI from [here](https://www.mongodb.com)<br><br>
5. Create 5 Webhooks in **Your Discord Server**: <br> 5. Create 5 Webhooks in**Your Discord Server**:<br>
- Server Log(Log new Server Added/Premium Server) <br>
- Error Log(Log Unhandled Rejection Error) <br> - Server Log(Log new Server Added/Premium Server)<br>
- Error Log(Log Unhandled Rejection Error)<br>
- Ready Log(Log when bot online)<br> - Ready Log(Log when bot online)<br>
- Command Log(Log command usage)<br> - Command Log(Log command usage)<br>
- DM Log(Log when someone send DM to Bot)<br><br> - DM Log(Log when someone send DM to Bot)<br><br><img src = "https://media.discordapp.net/attachments/838006493361471508/853217575986659328/unknown.png" width="300"><br>
<img src = "https://media.discordapp.net/attachments/838006493361471508/853217575986659328/unknown.png" width="300"><br>
6. Paste the IDs, Tokens and the Webhooks into the `.env` respectively<br><br> 6. Paste the IDs, Tokens and the Webhooks into the `.env` respectively<br><br>
7. After you have done the above steps, run the commands in your **Command Prompt** or **PowerShell** 7. After you have done the above steps, run the commands in your **Command Prompt** or **PowerShell**
```cmd ```cmd
npm install npm install
node index.js node index.js

View file

@ -1,20 +0,0 @@
const express = require("express");
const app = express();
const port = process.env.PORT || 3001;
const routes = require("./routes/routes");
const client = require("../bot");
client.on("ready", async () => {
var users = client.guilds.cache.reduce((a, b) => a + b.memberCount, 0);
var guilds = client.guilds.cache.size;
const caches = {
users: users,
guilds: guilds,
};
app.use("/api", routes);
app.use("/client", async (req, res) => {
res.status(200).send(caches);
});
app.listen(port, () => {
console.log(`Listen on PORT ${port}`);
});
});

View file

@ -1,8 +0,0 @@
const { cmds } = require("../../util/dist/cmds");
const commands = cmds();
const router = require("express").Router();
router.get("/", async (req, res) => {
res.status(200).send(commands);
});
module.exports = router;

View file

@ -1,4 +0,0 @@
const router = require("express").Router();
const cmds = require("./commands");
router.use("/commands", cmds);
module.exports = router;

14
app.js Normal file
View file

@ -0,0 +1,14 @@
const express = require("express");
const app = express();
const route1 = require("./api/api");
const cors = require("cors");
const port = process.env.PORT || 3001;
app.use(cors());
app.use(express.json());
app.use("/api", route1);
app.use("/", async (req, res) => {
res.send("");
});
app.listen(port, () => {
console.log(`Listen on PORT ${port}`);
});

109
bot.js Normal file
View file

@ -0,0 +1,109 @@
const {
Client,
Collection,
WebhookClient,
MessageEmbed,
} = require("discord.js");
const { GiveawaysManager } = require("discord-giveaways");
const fs = require("fs");
const config = require("./config.json");
require("dotenv").config();
const client = new Client({
allowedMentions: { parse: ["users", "roles"], repliedUser: true },
restTimeOffset: 0,
partials: ["MESSAGE", "CHANNEL", "REACTION", "GUILD_MEMBER"],
intents: ["GUILDS", "GUILD_MESSAGES", "GUILD_MEMBERS", "GUILD_PRESENCES"],
});
module.exports = client;
client.color = config.color;
client.author = "Cath Team";
client.invite = "https://discord.gg/SbQHChmGcp";
client.web = config.URL;
require("./util/dist/cmds").cmds();
require("./app");
require("./inlinereply");
require("./util/functions/economy")(client);
require("./util/dist/manager")(client);
client.CMDLog = new WebhookClient(
process.env.CMDLogID,
process.env.CMDLogToken
);
client.ReadyLog = new WebhookClient(
process.env.ReadyLogID,
process.env.ReadyLogToken
);
client.ServerLog = new WebhookClient(
process.env.ServerLogID,
process.env.ServerLogToken
);
client.ErrorLog = new WebhookClient(
process.env.ErrorLogID,
process.env.ErrorLogToken
);
process.on("unhandledRejection", async err => {
if (client.user) {
if (client.user.id === client.user.id) {
const embed = new MessageEmbed()
.setTitle("UnhandledRejection Error")
.setDescription(`\`\`\`ini\n${err.stack}\`\`\``)
.setTimestamp()
.setColor(client.color)
.setFooter(client.user.username);
client.ErrorLog.send(embed);
}
}
return console.log(err);
});
client.SuggestionLog = config.Suggestion;
client.ReportLog = config.Report;
client.DMLog = config.DM;
client.commands = new Collection();
client.aliases = new Collection();
client.events = new Collection();
client.snipes = [];
client.esnipes = new Collection();
client.hide = new Collection();
client.queue = new Map();
client.Timers = new Map();
client.cat = config.ca;
client.function = require("./util/functions/function");
client.data = require("./util/functions/mongoose");
client.err = require("./util/dist/err");
client.data
.connect(process.env.MONGO)
.then(() => console.log("Connected to MongoDB!"))
.catch(e => console.log(e));
client.owners = [
"452076196419600394",
"749692825402212494",
"766645910087139338",
"755476040029306952",
"534027706325532694",
"381442059111759883",
"556808365574193194",
];
client.currency = "<:cp:840231933933387797>";
client.path = [
"614423108388126731",
"767173194943168542",
"783633408738721834",
"718762019586572341",
"784052348561522730",
"840225563193114624",
"800396461229080619",
];
client.giveaways = new GiveawaysManager(client, {
storage: "./util/Data/giveaways.json",
updateCountdownEvery: 1000,
default: {
botsCanWin: false,
embedColor: client.color,
reaction: "🎉",
},
});
client.categories = fs.readdirSync("./commands/");
client.paths = fs.readdirSync("./cat/");
["command"].forEach(handler => {
require(`./util/command-handler`)(client);
});
client.login(process.env.TOKEN);

View file

@ -37,6 +37,17 @@ module.exports = {
if (!channel) return client.err(message, "Config", "set", 28); if (!channel) return client.err(message, "Config", "set", 28);
await client.data.setWelcome(message.guild.id, channel.id); await client.data.setWelcome(message.guild.id, channel.id);
message.channel.send(`Saved ${channel} as the welcome channel.`); message.channel.send(`Saved ${channel} as the welcome channel.`);
} else if (args[0].toLowerCase() === "level") {
if (args[1].toLowerCase() === "on" || args[1].toLowerCase() === "true") {
await client.data.setGLevel(message.guild.id, "true");
message.channel.send(`Levelling is enabled in this server now.`);
} else if (
args[1].toLowerCase() === "off" ||
args[1].toLowerCase() === "false"
) {
await client.data.setGLevel(message.guild.id, "false");
message.channel.send(`Levelling is disabled in this server now.`);
} else return client.err(message, "Config", "set", 45);
} else { } else {
return client.err(message, "Config", "set", 45); return client.err(message, "Config", "set", 45);
} }

View file

@ -16,7 +16,7 @@ module.exports = {
r => r.displayName.toLowerCase() === args.join(" ").toLocaleLowerCase() r => r.displayName.toLowerCase() === args.join(" ").toLocaleLowerCase()
) || ) ||
message.member; message.member;
const bal = await client.data.bal(user.id); const bal = await client.bal(user.id);
let embed = new MessageEmbed() let embed = new MessageEmbed()
.addField(`${client.currency} Balance`, `**${bal}**`) .addField(`${client.currency} Balance`, `**${bal}**`)
.setColor(client.color) .setColor(client.color)

View file

@ -15,7 +15,7 @@ module.exports = {
return client.err(message, "Economy", "bet", 7); return client.err(message, "Economy", "bet", 7);
} }
const amt = parseInt(args[0]); const amt = parseInt(args[0]);
if ((await client.data.bal(message.author.id)) < amt) { if ((await client.bal(message.author.id)) < amt) {
return client.err(message, "Economy", "bet", 20); return client.err(message, "Economy", "bet", 20);
} }
if (amt > max) { if (amt > max) {
@ -23,26 +23,27 @@ module.exports = {
} }
if (client.function.random() === true) { if (client.function.random() === true) {
const winamt = amt * 1; const winamt = amt * 1;
await client.data.add(message.author.id, winamt); await client.add(message.author.id, winamt, message);
await client.ADDBWin(message.author.id);
const abc = new MessageEmbed() const abc = new MessageEmbed()
.setColor("GREEN") .setColor("GREEN")
.setTimestamp() .setTimestamp()
.setTitle(`${message.author.username} wins a gamble game`) .setTitle(`${message.author.username} wins a gamble game`)
.setDescription( .setDescription(
`You win\n**${winamt}**${client.currency}\nYou now have **${ `You win\n**${winamt}**${client.currency}\nYou now have **${
parseInt(await client.data.bal(message.author.id)) - amt parseInt(await client.bal(message.author.id)) - amt
}**${client.currency}` }**${client.currency}`
); );
message.inlineReply(abc); message.inlineReply(abc);
} else { } else {
await client.data.rmv(message.author.id, amt); await client.rmv(message.author.id, amt);
const cba = new MessageEmbed() const cba = new MessageEmbed()
.setColor("RED") .setColor("RED")
.setTimestamp() .setTimestamp()
.setTitle(`${message.author.username} loses a gamble game`) .setTitle(`${message.author.username} loses a gamble game`)
.setDescription( .setDescription(
`You lost\n**${winamt}**${client.currency}\nYou now have **${ `You lost\n**${amt}**${client.currency}\nYou now have **${
parseInt(await client.data.bal(message.author.id)) - amt parseInt(await client.bal(message.author.id)) - amt
}**${client.currency}` }**${client.currency}`
); );
message.inlineReply(cba); message.inlineReply(cba);

View file

@ -5,14 +5,14 @@ module.exports = {
usage: "(Number)", usage: "(Number)",
description: "Play a blackjack game to win money", description: "Play a blackjack game to win money",
category: "Economy", category: "Economy",
timeout: 10000, //timeout: 10000,
run: async (client, message, args) => { run: async (client, message, args) => {
const money = parseInt(args[0]); const money = parseInt(args[0]);
const author = message.author; const author = message.author;
if (isNaN(money) || !money) { if (isNaN(money) || !money) {
return client.err(message, "Economy", "blackjack", 101); return client.err(message, "Economy", "blackjack", 101);
} }
if ((await client.data.bal(author.id)) < bet) { if ((await client.bal(author.id)) < bet) {
client.err(message, "Economy", "blackjack", 20); client.err(message, "Economy", "blackjack", 20);
} }
var numCardsPulled = 0; var numCardsPulled = 0;
@ -87,11 +87,11 @@ module.exports = {
deck.shuffle(); deck.shuffle();
async function bet(outcome) { async function bet(outcome) {
if (outcome === "win") { if (outcome === "win") {
client.data.add(author.id, money); await client.add(author.id, money, message);
//client.ADDbjWin(message.author.id); await client.ADDBJWin(message.author.id);
} }
if (outcome === "lose") { if (outcome === "lose") {
client.data.rmv(author.id, money); await client.rmv(author.id, money);
} }
} }
@ -135,12 +135,11 @@ module.exports = {
} }
const gambleEmbed = new Discord.MessageEmbed() const gambleEmbed = new Discord.MessageEmbed()
.setColor(cl) .setColor(cl || client.color)
.setTitle(message.author.username + `'s Blackjack game`) .setTitle(message.author.username + `'s Blackjack game`)
.addField("You", cardsMsg, true) .addField("You", cardsMsg, true)
.addField("cath.exe", dealerMsg, true) .addField("cath.exe", dealerMsg, true)
.addField(f, msg); .addField(f, msg);
message.channel.send(gambleEmbed); message.channel.send(gambleEmbed);
} }
@ -213,11 +212,7 @@ module.exports = {
dealer.score < 21 dealer.score < 21
) { ) {
gameOver = true; gameOver = true;
await endMsg( await endMsg(`Tie!`, `cath.exe had ${dealer.score.toString()}`, `RED`);
`Tie! UwU`,
`cath.exe had ${dealer.score.toString()}`,
`RED`
);
} }
} }
@ -254,7 +249,11 @@ module.exports = {
async function loop() { async function loop() {
if (gameOver) return; if (gameOver) return;
endMsg("To hit type `h`, for stand type `s`", `GoodLuck ;)`, `GRAY`); endMsg(
"To hit type `h`, for stand type `s`",
`GoodLuck ;)`,
client.color
);
let filter = m => m.author.id === message.author.id; let filter = m => m.author.id === message.author.id;
message.channel message.channel
@ -265,11 +264,17 @@ module.exports = {
}) })
.then(message => { .then(message => {
message = message.first(); message = message.first();
if (message.content === "h" || message.content === "hit") { if (
message.content.toLowerCase() === "h" ||
message.content.toLowerCase() === "hit"
) {
hit(); hit();
loop(); loop();
return; return;
} else if (message.content === "s" || message.content === "stand") { } else if (
message.content.toLowerCase() === "s" ||
message.content.toLowerCase() === "stand"
) {
stand(); stand();
loop(); loop();
return; return;

View file

@ -24,7 +24,7 @@ module.exports = {
const itemPrice = items.find( const itemPrice = items.find(
item => item.alias.toLowerCase() === itemToBuy item => item.alias.toLowerCase() === itemToBuy
).price; ).price;
if ((await client.data.bal(message.author.id)) < itemPrice) if ((await client.bal(message.author.id)) < itemPrice)
return client.err(message, "Economy", "buy", 20); return client.err(message, "Economy", "buy", 20);
const params = { const params = {
User: message.author.id, User: message.author.id,
@ -60,7 +60,7 @@ module.exports = {
.setColor("GREEN") .setColor("GREEN")
.setURL(client.web) .setURL(client.web)
); );
await client.data.rmv(message.author.id, itemPrice); await client.rmv(message.author.id, itemPrice);
}); });
}, },
}; };

View file

@ -22,7 +22,7 @@ module.exports = {
.setColor(client.color) .setColor(client.color)
.setFooter(`Made by ${client.author}`) .setFooter(`Made by ${client.author}`)
.setTimestamp(); .setTimestamp();
await client.data.add(message.author.id, money); await client.add(message.author.id, money, message);
return message.inlineReply(pre_embed); return message.inlineReply(pre_embed);
} else { } else {
money = 10000; money = 10000;
@ -38,7 +38,7 @@ module.exports = {
.setColor(client.color) .setColor(client.color)
.setFooter(`Made by ${client.author}`) .setFooter(`Made by ${client.author}`)
.setTimestamp(); .setTimestamp();
await client.data.add(message.author.id, money); await client.add(message.author.id, money, message);
return message.inlineReply(norm_embed); return message.inlineReply(norm_embed);
} }
} }

View file

@ -1,5 +1,4 @@
const { Client, Message, MessageEmbed } = require("discord.js"); const { Client, Message, MessageEmbed } = require("discord.js");
require("../../inlinereply");
module.exports = { module.exports = {
name: "drop", name: "drop",
usage: "{Channel} (Number)", usage: "{Channel} (Number)",
@ -12,7 +11,7 @@ module.exports = {
if (!coinsAmount) { if (!coinsAmount) {
return client.err(message, "Economy", "drop", 5); return client.err(message, "Economy", "drop", 5);
} }
if ((await client.data.bal(message.author.id)) < coinsAmount) { if ((await client.bal(message.author.id)) < coinsAmount) {
return client.err(message, "Economy", "drop", 20); return client.err(message, "Economy", "drop", 20);
} }
const filter = msg => const filter = msg =>
@ -21,11 +20,11 @@ module.exports = {
channel.send( channel.send(
`${message.author.username} has dropped a ${client.currency} bomb! Use ${p}claim to claim ${client.currency}!!` `${message.author.username} has dropped a ${client.currency} bomb! Use ${p}claim to claim ${client.currency}!!`
); );
client.data.rmv(message.author.id, parseInt(coinsAmount)); client.rmv(message.author.id, parseInt(coinsAmount));
channel.awaitMessages(filter, { max: 1, time: 60000 }).then(async msg => { channel.awaitMessages(filter, { max: 1, time: 60000 }).then(async msg => {
const id = msg.first().author.id; const id = msg.first().author.id;
const coinsToClaim = parseInt(coinsAmount); const coinsToClaim = parseInt(coinsAmount);
await client.data.add(id, coinsToClaim); await client.add(id, coinsToClaim, message);
msg msg
.first() .first()
.inlineReply( .inlineReply(

View file

@ -62,6 +62,7 @@ module.exports = {
if (data.Inventory[itemName] <= 0) { if (data.Inventory[itemName] <= 0) {
return client.err(message, "Economy", "gift", 23); return client.err(message, "Economy", "gift", 23);
} else { } else {
data.CP+=0
data.Inventory[itemName]--; data.Inventory[itemName]--;
message.channel.send( message.channel.send(
new MessageEmbed() new MessageEmbed()
@ -88,6 +89,7 @@ module.exports = {
} else { } else {
new inventory({ new inventory({
User: user.id, User: user.id,
CP: 0,
Inventory: { Inventory: {
[itemName]: 1, [itemName]: 1,
}, },

View file

@ -21,11 +21,11 @@ module.exports = {
if (isNaN(parsed)) return client.err(message, "Economy", "give", 7); if (isNaN(parsed)) return client.err(message, "Economy", "give", 7);
if (user.id === message.author.id) if (user.id === message.author.id)
return client.err(message, "Economy", "give", 2); return client.err(message, "Economy", "give", 2);
if (parsed > (await client.data.bal(message.author.id))) { if (parsed > (await client.bal(message.author.id))) {
return client.err(message, "Economy", "give", 20); return client.err(message, "Economy", "give", 20);
} }
await client.data.rmv(message.author.id, parsed); await client.rmv(message.author.id, parsed);
await client.data.add(user.id, parsed); await client.add(user.id, parsed, message);
message.channel.send( message.channel.send(
new MessageEmbed() new MessageEmbed()
.setColor(client.color) .setColor(client.color)
@ -33,7 +33,7 @@ module.exports = {
.setDescription( .setDescription(
`**${message.author.username}** has given **${ `**${message.author.username}** has given **${
user.username user.username
}** **${parsed.toLocaleString()}**${client.currrency}` }** **${parsed.toLocaleString()}**${client.currency}`
) )
); );
}, },

View file

@ -22,11 +22,20 @@ module.exports = {
) || ) ||
message.member; message.member;
inv.findOne({ User: user.id }, async (err, data) => { inv.findOne({ User: user.id }, async (err, data) => {
if (data) {
if (!data.Inventory) if (!data.Inventory)
return client.err(message, "Economy", "inventory", 25); return client.err(message, "Economy", "inv", 25);
if (data.Inventory === undefined) return client.err(message, "Economy", "inv", 25)
const mappedData = Object.keys(data.Inventory).map(key => { const mappedData = Object.keys(data.Inventory).map(key => {
if (data.Inventory[key] == 0) {
return;
}
return `\n**${key}** — ${data.Inventory[key]}`; return `\n**${key}** — ${data.Inventory[key]}`;
}); });
if (mappedData.length == 0) {
return client.err(message, "Economy", "inv", 25);
}
const c = util.chunk(mappedData, 5).map(x => x.join("\n")); const c = util.chunk(mappedData, 5).map(x => x.join("\n"));
const embed = new MessageEmbed() const embed = new MessageEmbed()
.setTimestamp() .setTimestamp()
@ -41,6 +50,8 @@ module.exports = {
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
}
else return client.err(message, "Economy", "inv", 25);
}); });
}, }
}; }

View file

@ -6,6 +6,7 @@ module.exports = {
timeout: 5000, timeout: 5000,
usage: "Check the leaderboard of a server", usage: "Check the leaderboard of a server",
category: "Economy", category: "Economy",
Level: true,
run: async (client, message, args) => { run: async (client, message, args) => {
const rawLeaderboard = await Levels.fetchLeaderboard(message.guild.id, 10); const rawLeaderboard = await Levels.fetchLeaderboard(message.guild.id, 10);
if (rawLeaderboard.length < 1) if (rawLeaderboard.length < 1)

View file

@ -0,0 +1,47 @@
const { Client, Message, MessageEmbed } = require("discord.js");
module.exports = {
name: "profile",
usage: "(User)",
description: "Check an user economy profile",
category: "Economy",
run: async (client, message, args, data, utils) => {
const user =
message.mentions.members.first() ||
message.guild.members.cache.get(args[0]) ||
message.guild.members.cache.find(
r =>
r.user.username.toLowerCase() === args.join(" ").toLocaleLowerCase()
) ||
message.guild.members.cache.find(
r => r.displayName.toLowerCase() === args.join(" ").toLocaleLowerCase()
) ||
message.member;
const bjwin = await client.bjWin(message.author.id);
const swin = await client.sWin(message.author.id);
const bwin = await client.bWin(message.author.id);
const cmdused = await client.cmdsUSED(message.author.id);
const bal = await client.bal(message.author.id);
const multi = await client.multi(message);
const game = new MessageEmbed()
.setFooter(
`Requested by ${message.author.tag}`,
message.author.displayAvatarURL({ dynamic: true, size: 4096 })
)
.setColor("7196ef")
.setTitle(`${user.displayName}'s profile`)
.addField(
"**Stats**\n",
`🃏 Blackjack wins: \`${bjwin}\`\n` +
`🎰 Slots wins: \`${swin}\`\n` +
`🕹 Bet wins: \`${bwin}\`\n` +
`Commands used: \`${cmdused}\`\n` +
`Totalwins: \`${bjwin + swin + bwin}\``,
true
)
.addField(
"**Balance**\n",
`💲CP: \`${bal}\`\n` + `Multiplier: \`${`1.${multi}x`}\``
);
message.inlineReply(game);
},
};

View file

@ -8,10 +8,9 @@ module.exports = {
run: async (client, message, args) => { run: async (client, message, args) => {
const max = 1000000; const max = 1000000;
const slots = [ const slots = [
"<:dumbcat:818913965353730068>", "<:blushca:852174555513618502>",
"<:nicecat:740978278055280722>", "<:abusecat:853501068074942464>",
"<:wah:836951911729987597>", "<:dumbcat:855462498550415362>",
"<:startledcat:836619417550061580>",
]; ];
const slotOne = slots[Math.floor(Math.random() * slots.length)]; const slotOne = slots[Math.floor(Math.random() * slots.length)];
const slotTwo = slots[Math.floor(Math.random() * slots.length)]; const slotTwo = slots[Math.floor(Math.random() * slots.length)];
@ -26,7 +25,7 @@ module.exports = {
if (isNaN(args[0])) return client.err(message, "Economy", "slots", 7); if (isNaN(args[0])) return client.err(message, "Economy", "slots", 7);
const amt = parseInt(args[0]); const amt = parseInt(args[0]);
if (amt > max) return client.err(message, "Economy", "slots", 101); if (amt > max) return client.err(message, "Economy", "slots", 101);
if ((await client.data.bal(message.author.id)) < amt) { if ((await client.bal(message.author.id)) < amt) {
return client.err(message, "Economy", "slots", 20); return client.err(message, "Economy", "slots", 20);
} }
if ( if (
@ -35,7 +34,8 @@ module.exports = {
(slotseven === sloteight && slotseven === slotnine) (slotseven === sloteight && slotseven === slotnine)
) { ) {
const winamt = Math.floor(Math.random() * 2 * amt); const winamt = Math.floor(Math.random() * 2 * amt);
await client.data.add(message.author.id, winamt); await client.add(message.author.id, winamt, message);
await client.ADDSWin(message.author.id);
const won = new MessageEmbed() const won = new MessageEmbed()
.setColor("GREEN") .setColor("GREEN")
.addField( .addField(
@ -53,13 +53,12 @@ module.exports = {
.setTitle(`${message.author.username} wins a slots game`) .setTitle(`${message.author.username} wins a slots game`)
.setDescription( .setDescription(
`You win\n**${winamt}**${client.currency}\nYou now have **${ `You win\n**${winamt}**${client.currency}\nYou now have **${
parseInt(await client.data.bal(message.author.id)) - amt parseInt(await client.bal(message.author.id)) - amt
}**${client.currency}` }**${client.currency}`
); );
message.inlineReply(won); message.inlineReply(won);
console.log(`Coins: ${await client.data.bal(message.author.id)}`);
} else { } else {
await client.data.rmv(message.author.id, amt); await client.rmv(message.author.id, amt);
const lost = new MessageEmbed() const lost = new MessageEmbed()
.setColor("RED") .setColor("RED")
.addField( .addField(
@ -77,7 +76,7 @@ module.exports = {
.setTitle(`${message.author.username} loses a slots game`) .setTitle(`${message.author.username} loses a slots game`)
.setDescription( .setDescription(
`You lost\n**${amt}**${client.currency}\nYou now have **${ `You lost\n**${amt}**${client.currency}\nYou now have **${
parseInt(await client.data.bal(message.author.id)) - amt parseInt(await client.bal(message.author.id)) - amt
}**${client.currency}` }**${client.currency}`
); );
message.inlineReply(lost); message.inlineReply(lost);

View file

@ -37,7 +37,7 @@ module.exports = {
new db({ new db({
User: message.author.id, User: message.author.id,
CP: 0, CP: 0,
Inventory: "", Inventory: {},
}).save(); }).save();
return client.err(message, "Economy", "steal", 20); return client.err(message, "Economy", "steal", 20);
} else if (data) { } else if (data) {
@ -49,7 +49,7 @@ module.exports = {
new db({ new db({
User: tryrob.id, User: tryrob.id,
CP: 0, CP: 0,
Inventory: "", Inventory: {},
}).save(); }).save();
return message.inlineReply( return message.inlineReply(
new MessageEmbed() new MessageEmbed()

View file

@ -1,5 +1,4 @@
const { Client, Message, MessageEmbed } = require("discord.js"); const { Client, Message, MessageEmbed } = require("discord.js");
require("../../inlinereply");
module.exports = { module.exports = {
name: "work", name: "work",
description: "Work to earn money", description: "Work to earn money",
@ -18,7 +17,9 @@ module.exports = {
]; ];
const earning = client.function.rndint(5000, 3000); const earning = client.function.rndint(5000, 3000);
const jobs = job[Math.floor(Math.random() * job.length)]; const jobs = job[Math.floor(Math.random() * job.length)];
await client.data.add(message.author.id, earning); await client.add(message.author.id, earning, message);
return message.inlineReply(`You worked as a ${jobs} and earned ${earning}`); return message.inlineReply(
`You worked as a **${jobs}** and earned **${earning}${client.currency}**`
);
}, },
}; };

21
commands/Fun/ascii.js Normal file
View file

@ -0,0 +1,21 @@
const { Client, Message, MessageEmbed } = require("discord.js");
module.exports = {
name: "ascii",
description: "Converts text into ASCII art",
category: "Fun",
/**
* @param {Client} client
* @param {Message} message
* @param {String[]} args
*/
run: async (client, message, args) => {
const figlet = require("figlet");
if (!args[0]) return client.err(message, "Fun", "ascii", 12);
let msg = args.slice(0).join(" ");
figlet.text(msg, async (err, data) => {
if (err) console.log(err);
if (data.length > 2000) return client.err(message, "Fun", "ascii", 54);
message.channel.send(`\`\`\`${data}\`\`\``);
});
},
};

102
commands/Fun/dino.js Normal file
View file

@ -0,0 +1,102 @@
const Discord = require("discord.js");
const ms = require("ms");
module.exports = {
name: "dinochrome",
aliases: ["dino"],
category: "Fun",
description: "Dinosaur in Chrome",
run: async (client, message, args) => {
let msg = await message.channel.send(`---------------🦖`);
let time = 1 * 1000;
setTimeout(function () {
msg.edit(`-----------🦖----`);
}, time);
time += 1.5 * 1000;
setTimeout(function () {
msg.edit(`----------🦖------`);
}, time);
time += 1.5 * 1000;
setTimeout(function () {
msg.edit(`--------🦖--------`);
}, time);
time += 1.5 * 1000;
setTimeout(function () {
msg.edit(`------🦖-----------`);
}, time);
time += 1.5 * 1000;
setTimeout(function () {
msg.edit(`-------🦖-----------`);
}, time);
time += 1.5 * 1000;
setTimeout(function () {
msg.edit(`---🌵-----🦖---------`);
}, time);
time += 1.5 * 1000;
setTimeout(function () {
msg.edit(`---🌵-🦖-------------`);
}, time);
time += 1.5 * 1000;
setTimeout(function () {
msg.edit(`🦖\n ---🌵--------------`);
}, time);
time += 1.5 * 1000;
setTimeout(function () {
msg.edit(`------🦖---🌵--------------`);
}, time);
time += 1.5 * 1000;
setTimeout(function () {
msg.edit(`----🦖-----🌵----------------`);
}, time);
time += 1.5 * 1000;
setTimeout(function () {
msg.edit(`-🌵🌵-----🦖-------🌵--------`);
}, time);
time += 1.5 * 1000;
setTimeout(function () {
msg.edit(`----🌵🌵-🦖----------🌵------`);
}, time);
time += 1.5 * 1000;
setTimeout(function () {
msg.edit(`🦖\n ---🌵🌵-------------🌵---`);
}, time);
time += 1.5 * 1000;
setTimeout(function () {
msg.edit(`-----🦖---🌵🌵-------------🌵--`);
}, time);
time += 1.5 * 1000;
setTimeout(function () {
msg.edit(`-------🦖-----🌵🌵-------------`);
}, time);
time += 1.5 * 1000;
setTimeout(function () {
msg.edit(`🎂----🦖--------🌵🌵-----------`);
}, time);
time += 1.5 * 1000;
setTimeout(function () {
msg.edit(`---🎂--🦖----------🌵🌵---------`);
}, time);
time += 1.5 * 1000;
setTimeout(function () {
msg.edit(`**Ⓜⓘⓢⓢⓘⓞⓝ Ⓒⓞⓜⓟⓛⓔⓣⓔⓓ !**\n ---🎂🦖----------🌵🌵-------------`);
}, time);
},
};

40
commands/Fun/emojify.js Normal file
View file

@ -0,0 +1,40 @@
module.exports = {
name: "emojify",
usage: "(Word)",
description: "Emojify a sentence",
run: async (client, message, args) => {
const mapping = {
" ": " ",
0: ":zero:",
1: ":one:",
2: ":two:",
3: ":three:",
4: ":four:",
5: ":five:",
6: ":six:",
7: ":seven:",
8: ":eight:",
9: ":nine:",
"!": ":grey_exclamation:",
"?": ":grey_question:",
"#": ":hash:",
"*": ":asterisk:",
};
"abcdefghijklmnopqrstuvwxyz".split("").forEach(c => {
mapping[c] = mapping[c.toUpperCase()] = ` :regional_indicator_${c}:`;
});
if (!args[0]) {
return client.err(message, "Fun", "emojify", 12);
}
message.channel.send(
args
.slice(0)
.join(" ")
.split("")
.map(c => mapping[c] || c)
.join("")
);
},
};

129
commands/Fun/hack.js Normal file
View file

@ -0,0 +1,129 @@
const { MessageEmbed } = require("discord.js");
module.exports = {
name: "hack",
description: "Hack a user",
usage: "(User)",
category: "Fun",
run: async (client, message, args) => {
let answers = [
"@yousuck.noob",
"@hesnoob.haha",
"@thisguy.suck",
"@paypal.removed",
"@noob.haha",
"@hacked.xyz",
"@susmate.com",
"@gmail.sus",
"@why-im.withyou",
"@someone-end.me",
"@isnoob.io",
"@username-is.noob",
"@hahaget.lost",
"@yahoo.sus",
"@botmail.zip",
"@gmail.com",
"@yahoo.com",
];
let passwords = [
"Disb****",
"disc******",
"pass**********",
"get****",
"mails***",
"endm****",
"gamer***********",
"asegeio*********",
"whys*******",
"Brot******",
"imwith*******",
"luckyyougotthispasswordlolnocencor",
"starb*******",
"egghunt2***",
"secr*****",
];
let ips = [
"10.313.523.502.00.1",
"25.537.753.462.29.2",
"21.175.866.974.07.08",
"32.653.587.825.35.5",
"12.172.764.781.22.8",
"91.723.242.452.09.3",
"92.743.116.896.85.6",
"84.091.000.853.54.7",
"51.071.124.129.12.0",
];
const answer = answers[Math.floor(Math.random() * answers.length)];
const passwrd = passwords[Math.floor(Math.random() * passwords.length)];
const ip = ips[Math.floor(Math.random() * ips.length)];
const taggedUser = message.mentions.users.first();
if (!taggedUser) {
return client.err(message, "Fun", "hack", 1);
}
message.channel.send(`Hacking ${taggedUser.username}...`);
message.channel.send("Status: ■□□□□□□□□□□ 0%").then(msg => {
client.function.sleep(100);
msg.edit("Status: ■■□□□□□□□□□ 7%: Hacking Email...");
client.function.sleep(600);
msg.edit(
`Status: ■■■□□□□□□□□ 8%:\n \`Email: ${taggedUser.username}@yousuck.noob\`\n \`Password: ${passwrd}\` `
);
client.function.sleep(600);
msg.edit("Status: ■■□□□□□□□□□ 9%: Logging in to the Email...");
client.function.sleep(2000);
msg.edit("Status: ■■■□□□□□□□□ 12%: Turning off the antivirus");
client.function.sleep(1000);
msg.edit("Status: ■■■■□□□□□□ 14%: Downloading SYNAPSE X");
client.function.sleep(100);
msg.edit("Status: ■■■□□□□□□□□ 17%: Deleting Captcha...");
client.function.sleep(100);
msg.edit("Status: ■■□□□□□□□□□ 20%: Deleting Paypal account...");
client.function.sleep(10);
msg.edit("Status: ■■■□□□□□□□□ 21%");
client.function.sleep(12);
msg.edit("Status: ■■■■□□□□□□□ 22%");
client.function.sleep(100);
msg.edit("Status: ■■■■■□□□□□□ 24%: Paypal account deleted");
client.function.sleep(1000);
msg.edit("Status: ■■■■□□□□□□ 29%: Hacking is almost ready...");
client.function.sleep(80);
msg.edit("Status: ■■■□□□□□□□□ 31%");
client.function.sleep(80);
msg.edit("Status: ■■■■□□□□□□□ 36%");
client.function.sleep(40);
msg.edit("Status: ■■■■■□□□□□□ 41%");
client.function.sleep(60);
msg.edit("Status: ■■■■□□□□□□□ 47%");
client.function.sleep(50);
msg.edit("Status: ■■■■■■□□□□□ 53%");
client.function.sleep(3000);
msg.edit(
`Status: ■■■■■■■□□□□ 58%: Email password changed so ${taggedUser.username} can not login`
);
client.function.sleep(500);
msg.edit("Status: ■■■■■■□□□□□ 66%");
client.function.sleep(60);
msg.edit("Status: ■■■■■□□□□□□ 74%");
client.function.sleep(20);
msg.edit(`Status: ■■■■■□□□□□□ 79%: IP address found: ${ip}`);
client.function.sleep(83);
msg.edit("Status: ■■■■■■□□□□ 80%");
client.function.sleep(50);
msg.edit("Status: ■■■■■■■□□□ 85%");
client.function.sleep(14);
msg.edit("Status: ■■■■■■■■■□□ 93%");
client.function.sleep(70);
msg.edit("Status: ■■■■■■■■■■□ 97%");
client.function.sleep(90);
msg.edit("Status: ■■■■■■■■■■■ 100%").then(() => {
const embed = new MessageEmbed()
.setDescription(`${taggedUser} has been hacked!`)
.addField("Email", `${taggedUser.username}${answer}`)
.addField("Password", `${passwrd}`)
.addField("IP address", `${ip}`)
.setFooter(`Made by ${client.author}`)
.setColor("020203a");
message.channel.send(embed);
});
});
},
};

View file

@ -8,7 +8,7 @@ module.exports = {
category: "Fun", category: "Fun",
run: async (client, message, args) => { run: async (client, message, args) => {
if (playing.has(message.channel.id)) if (playing.has(message.channel.id))
return message.reply("Only one game may be occurring per channel."); return message.inlineReply("Only one game may be occurring per channel.");
playing.add(message.channel.id); playing.add(message.channel.id);
try { try {
const { body } = await get("https://emilia-api.xyz/api/hangman").set( const { body } = await get("https://emilia-api.xyz/api/hangman").set(
@ -55,7 +55,7 @@ module.exports = {
}); });
//m.delete(); //m.delete();
if (!guess.size) { if (!guess.size) {
await message.reply("Sorry, time is up!"); await message.inlineReply("Sorry, time is up!");
break; break;
} }
const choice = guess.first().content.toLowerCase(); const choice = guess.first().content.toLowerCase();

45
commands/Fun/obama.js Normal file
View file

@ -0,0 +1,45 @@
const o = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠛⠛⠛⠉⠉⠉⠋⠛⠛⠛⠻⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿";
const b = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠛⠉⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠉⠙⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿";
const a = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠋⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠈⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿";
const m = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠏⠄⠄⠄⠄⠄⠄⠄⠂⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠈⠹⣿⣿⣿⣿⣿⣿⣿";
const a2 = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⠛⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠠⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠘⢻⣿⣿⣿⣿⣿";
const aa = "⣿⣿⣿⣿⣿⣿⣿⣿⠃⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⠄⢠⠄⠄⡀⠄⠄⢀⠂⠄⠄⠄⠄⠄⠄⠄⠄⠄⡁⠄⠄⢛⣿⣿⣿⣿";
const ab = "⣿⣿⣿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠐⡈⢔⠸⣐⢕⢕⢵⢰⢱⢰⢐⢤⡡⡢⣕⢄⢢⢠⠄⠄⠄⠄⠄⠄⠙⣿⣿⣿";
const ac = "⣿⣿⣿⣿⣿⣿⣿⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⡁⠂⠅⢕⠌⡎⡎⣎⢎⢮⢮⣳⡳⣝⢮⢺⢜⢕⢕⢍⢎⠪⡐⠄⠁⠄⠸⣿⣿";
const ad = "⣿⣿⣿⣿⣿⣿⠏⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠐⠄⠄⢅⠣⡡⡣⣣⡳⡵⣝⡮⣗⣗⡯⣗⣟⡮⡮⣳⣣⣳⢱⢱⠱⣐⠄⠂⠄⢿⣿";
const ae = "⣿⣿⣿⣿⣿⣿⠄⠄⠄⠄⠄⠄⠄⠂⠄⠄⠄⠄⠄⠄⢂⢈⠢⡱⡱⡝⣮⣿⣟⣿⣽⣷⣿⣯⣿⣷⣿⣿⣿⣾⣯⣗⡕⡇⡇⠄⠂⡀⢹⣿";
const af = "⣿⣿⣿⣿⣿⡟⠄⠄⠄⠄⠄⠄⠂⠄⠄⠄⠄⠄⠄⠐⢀⢂⢕⢸⢨⢪⢳⡫⣟⣿⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡺⡮⡣⡣⠠⢂⠒⢸⣿";
const ag = "⣿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠠⠐⠄⡂⠆⡇⣗⣝⢮⢾⣻⣞⣿⣿⣿⣿⣿⣿⣿⣿⢿⣽⣯⡯⣺⢸⢘⠨⠔⡅⢨⣿";
const ah = "⣿⣿⠋⠉⠙⠃⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠁⠄⠄⠄⡂⡪⡪⡪⡮⡮⡯⣻⣽⣾⣿⣿⣿⣟⣿⣿⣿⣽⣿⣿⡯⣯⡺⡸⡰⡱⢐⡅⣼⣿";
const ai = "⣿⠡⡀⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠠⠈⠆⠱⠑⠝⠜⠕⡝⡝⣞⢯⢿⣿⣿⡿⣟⣿⣿⣿⡿⡿⣽⣷⣽⡸⡨⡪⣂⠊⣿⣿";
const aj = "⣿⠡⠄⡨⣢⠐⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠐⠍⡓⣗⡽⣝⠽⠍⠅⠑⠁⠉⠘⠘⠘⠵⡑⢜⢀⢀⢉⢽";
const ak = "⣿⠁⠠⢱⢘⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠈⠈⠱⣁⠜⡘⠌⠄⠄⡪⣳⣟⡮⢅⠤⠠⠄⠄⣀⣀⡀⡀⠄⠈⡂⢲⡪⡠⣿";
const al = "⣿⡇⠨⣺⢐⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⡀⠄⠄⠄⠤⡠⡢⢒⠦⠠⠄⠄⠄⡸⢽⣟⢮⠢⡂⡐⠄⡈⡀⠤⡀⠄⠑⢄⠨⢸⡺⣐⣿";
const am = "⣿⣿⠈⠕⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⡂⡪⡐⡥⢤⣰⣰⣰⡴⡮⠢⠂⠄⠄⡊⢮⢺⢕⢵⢥⡬⣌⣒⡚⣔⢚⢌⢨⢚⠌⣾⡪⣾⣿";
const an = "⣿⣿⣆⠄⡀⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⡑⢕⢕⡯⡷⣕⢧⢓⢭⠨⡀⠄⡂⠨⡨⣪⡳⣝⢝⡽⣻⣻⣞⢽⣲⢳⢱⢡⠱⠨⣟⢺⣿⣿";
const ao = "⣿⣿⣿⡆⠄⡅⠇⡄⠄⠄⠄⠄⠄⠄⠄⠐⠨⢪⢹⢽⢽⣺⢝⠉⠁⠁⠄⠄⠄⢌⢎⡖⡯⡎⡗⢝⠜⣶⣯⣻⢮⡻⣟⣳⡕⠅⣷⣿⣿⣿";
const ap = "⣿⣿⣿⣿⣶⣶⣿⣷⠄⠄⠄⠄⠄⠄⠄⠄⠈⠔⡑⠕⠝⠄⡀⠄⠄⠊⢆⠂⠨⡪⣺⣮⣿⡾⡜⣜⡜⣄⠙⢞⣿⢿⡿⣗⢝⢸⣾⣿⣿⣿";
const aq = "⣿⣿⣿⣿⣿⣿⣿⣿⠄⠄⠄⠄⠄⡀⠄⠄⠄⠄⢀⠄⠠⠄⠠⠄⠄⠄⠄⠄⠄⠊⠺⡹⠳⡙⡜⡓⡭⡺⡀⠄⠣⡻⡹⡸⠨⣣⣿⣿⣿⣿";
const ar = "⣿⣿⣿⣿⣿⣿⣿⣿⠄⠄⠄⠄⠄⠠⠄⠄⣂⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢄⠤⡤⡄⡆⡯⡢⡣⡣⡓⢕⠽⣄⠄⠨⡂⢌⣼⣿⣿⣿⣿⣿";
const a_ = "⣿⣿⣿⣿⣿⣿⣿⣿⡆⠄⠄⠄⠄⠈⠆⠄⠸⡂⠄⠄⠄⢀⠄⢀⠈⠄⠂⠁⠙⠝⠼⠭⠣⠣⠣⠑⠌⠢⠣⡣⡠⡘⣰⣱⣿⣿⣿⣿⣿⣿";
const at = "⣿⣿⣿⣿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠄⢑⠄⠈⡱⠄⢘⠄⡀⠨⢐⣧⣳⣷⣶⣦⣤⣴⣶⣶⣶⡶⠄⡠⡢⡕⣜⠎⡮⣣⣿⣿⣿⣿⣿⣿⣿";
const au = "⣿⣿⣿⣿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠄⠄⠢⠄⠨⠄⠄⠣⡀⠄⢀⢀⢙⠃⡿⢿⠿⡿⡿⢟⢋⢔⡱⣝⢜⡜⡪⡪⣵⣿⣿⣿⣿⣿⣿⣿⣿";
const av = "⣿⣿⣿⣿⣿⣿⣿⣿⡁⠄⠄⠄⠄⠄⠄⠄⠅⠄⠡⠄⠄⠡⢀⢂⠢⡡⠡⠣⡑⣏⢯⡻⡳⣹⡺⡪⢎⠎⡆⢣⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿";
const aw = "⣿⣿⣿⣿⣿⣿⣿⣿⣇⠄⠄⠄⠄⠄⠄⠄⠐⠄⠄⠁⠄⢈⠄⢂⠕⡕⡝⢕⢎⢎⢮⢎⢯⢺⢸⢬⠣⢃⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿";
const ax = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⡀⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠠⠨⡐⠌⢆⢇⢧⢭⣣⡳⣵⢫⣳⢱⠱⢑⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿";
const ay = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣆⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠁⡊⢌⢢⢡⢣⢪⡺⡪⡎⡎⡎⡚⣨⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿";
const az = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⡀⠄⠄⠄⠄⠄⠄⠄⠄⠄⠕⡅⢗⢕⡳⡭⣳⢕⠕⡱⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿";
const ba = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠄⠄⠄⠄⠄⠄⠄⠄⠄⠌⠄⠑⠩⢈⢂⣱⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿";
const bb = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⡀⢄⠄⣀⠄⡀⣀⢠⢄⣖⣖⣞⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿";
const bc = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⣱⡐⡕⡕⡽⣝⣟⣮⣾⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿";
module.exports = {
name: "obama",
category: "Utilities",
description: "Obama",
run: async (client, message, args) => {
message.inlineReply(
`${o}\n${b}\n${a}\n${m}\n${a2}\n${aa}\n${ab}\n${ac}\n${ad}\n${ae}\n${af}\n${ag}\n${ah}\n${ai}\n${aj}\n${ak}\n${al}\n${am}\n${an}\n${ao}\n${ap}\n${aq}\n${ar}\n${a_}\n${at}\n${au}\n${av}\n${aw}\n${ax}\n${ay}\n${az}\n${ba}\n${bb}\n${bc}`
);
},
};

91
commands/Fun/rps.js Normal file
View file

@ -0,0 +1,91 @@
const { MessageEmbed } = require("discord.js");
module.exports = {
name: "rps",
aliases: ["rockpapersscissors"],
description: "Play a rock paper scissors game",
category: "Fun",
run: async (client, message, args) => {
let embed = new MessageEmbed()
.setTitle("RPS GAME")
.setAuthor(
message.author.tag,
message.author.displayAvatarURL({ dynamic: true })
)
.setDescription(
"```Add a reaction to one of these emojis to play the game!```"
)
.setColor(client.color)
.setFooter(`Made by ${client.author}`)
.setTimestamp();
let msg = await message.channel.send(embed);
await msg.react("✊");
await msg.react("✂");
await msg.react("📄");
const filter = (reaction, user) => {
return (
["✊", "✂", "📄"].includes(reaction.emoji.name) &&
user.id === message.author.id
);
};
const choices = ["✊", "✂", "📄"];
const me = choices[Math.floor(Math.random() * choices.length)];
msg
.awaitReactions(filter, { max: 1, time: 60000, error: ["time"] })
.then(async collected => {
const reaction = collected.first();
if (
(me === "✊" && reaction.emoji.name === "✂") ||
(me === "📄" && reaction.emoji.name === "✊") ||
(me === "✂" && reaction.emoji.name === "📄")
) {
const reaction = collected.first();
let result = new MessageEmbed()
.setTitle("You lost!")
.setColor("RED")
.setFooter(`Made by ${client.author}`)
.setTimestamp()
.setAuthor(
message.author.tag,
message.author.displayAvatarURL({ dynamic: true })
)
.addField("Your choice", `${reaction.emoji.name}`)
.addField("My choice", `${me}`);
await msg.edit("", result);
} else if (me === reaction.emoji.name) {
const reaction = collected.first();
let result = new MessageEmbed()
.setTitle("Tie!")
.setColor("GREY")
.setFooter(`Made by ${client.author}`)
.setTimestamp()
.setAuthor(
message.author.tag,
message.author.displayAvatarURL({ dynamic: true })
)
.addField("Your choice", `${reaction.emoji.name}`)
.addField("My choice", `${me}`);
await msg.edit("", result);
} else {
const reaction = collected.first();
let result = new MessageEmbed()
.setTitle("You won!")
.setColor("GREEN")
.setFooter(`Made by ${client.author}`)
.setTimestamp()
.setAuthor(
message.author.tag,
message.author.displayAvatarURL({ dynamic: true })
)
.addField("Your choice", `${reaction.emoji.name}`)
.addField("My choice", `${me}`);
await msg.edit("", result);
}
})
.catch(r => {
console.log(r);
message.inlineReply(
"Your game has lost since you didn't response in time"
);
});
},
};

31
commands/Fun/ship.js Normal file
View file

@ -0,0 +1,31 @@
const block = "⬛";
const heart = "🟥";
const { MessageEmbed } = require("discord.js");
module.exports = {
name: "ship",
aliases: ["love", "loverate", "shipping"],
description: "Ship to you an user",
usage: "(Text) (Text)",
category: "Fun",
run: async (client, message, args) => {
const msg = await message.channel.send("Shipping...");
const user1 = args[0];
const user2 = args[1];
if (!user1) return client.err(message, "Fun", "ship", 12);
if (!user2) return client.err(message, "Fun", "ship", 12);
let loveEmbed = new MessageEmbed()
.setColor("dd2e44")
.setFooter(`Shipped by ${message.author.tag}`)
.setTimestamp()
.setTitle(`💘 | Shipping ${user1} and ${user2} | 💘`)
.setDescription(`🔻 | ${user1} \n${ship()}\n🔺 | ${user2}`);
msg.edit("", loveEmbed);
},
};
function ship() {
const hearts = Math.floor(Math.random() * 100);
const hearte = hearts / 10;
const str = `${heart.repeat(hearte)}${block.repeat(10 - hearte)} ${hearts}%`;
return str;
}

View file

@ -0,0 +1,33 @@
const levels = {
0: 0.0,
1: 0.5,
2: 1.0,
3: 2.0,
};
module.exports = {
name: "bassboost",
aliases: ["bb", "bassboost"],
description: "Set filter/bassboost level",
category: "Music",
usage: "(Number)",
Premium: true,
run: async (client, message, args) => {
const player = message.client.manager.get(message.guild.id);
if (!player) return client.err(message, "Music", "bassboost", 34);
const { channel } = message.member.voice;
if (!channel) return client.err(message, "Music", "bassboost", 35);
if (channel.id !== player.voiceChannel)
return client.err(message, "Music", "bassboost", 55);
let level = "0";
if (args.length && args[0].toLowerCase() in levels)
level = args[0].toLowerCase();
const bands = new Array(3)
.fill(null)
.map((_, i) => ({ band: i, gain: levels[level] }));
player.setEQ(...bands);
return message.inlineReply(
`The player's bassboost level has been set to ${level}`
);
},
};

View file

@ -1,30 +0,0 @@
const { Client, Message, MessageEmbed } = require("discord.js");
module.exports = {
name: "disconnect",
aliases: ["dc"],
description: "Leave The Voice Channel",
category: "Music",
run: async (client, message, args) => {
let channel = message.member.voice.channel;
if (!channel) return client.err(message, "Music", "leave", 35);
if (!message.guild.me.voice.channel)
return client.err(message, "Music", "leave", 41);
try {
await message.guild.me.voice.channel.leave();
} catch (error) {
await message.guild.me.voice.kick(message.guild.me.id);
}
const Embed = new MessageEmbed()
.setAuthor("Left Voice Channel", client.user.displayAvatarURL())
.setColor("GREEN")
.setTitle(
`By user: ${message.author.tag}`,
message.author.displayAvatarURL({ dynamic: true })
)
.setDescription("🎶 Left The Voice Channel.")
.setTimestamp();
return message.channel.send(Embed);
},
};

View file

@ -1,21 +1,22 @@
const { Client, Message, MessageEmbed } = require("discord.js");
module.exports = { module.exports = {
name: "loop", name: "loop",
aliases: ["repeat"],
description: "Music loop", description: "Music loop",
category: "Music", category: "Music",
run: async (client, message, args) => { run: async (client, message, args) => {
const serverQueue = message.client.queue.get(message.guild.id); const player = message.client.manager.get(message.guild.id);
if (serverQueue) { if (!player) return client.err(message, "Music", "loop", 34);
serverQueue.loop = !serverQueue.loop; const { channel } = message.member.voice;
return message.channel.send({ if (!channel) return client.err(message, "Music", "loop", 35);
embed: { if (channel.id !== player.voiceChannel)
color: "GREEN", return client.err(message, "Music", "loop", 55);
description: `🔁 **|** Loop is ${ if (args.length && /queue/i.test(args[0])) {
serverQueue.loop === true ? "enabled" : "disabled" player.setQueueRepeat(!player.queueRepeat);
}`, const queueRepeat = player.queueRepeat ? "enabled" : "disabled";
}, return message.inlineReply(`Queue repeat is ${queueRepeat}`);
});
} }
return client.err(message, "Music", "loop", 34); player.setTrackRepeat(!player.trackRepeat);
const trackRepeat = player.trackRepeat ? "enabled" : "disabled";
return message.inlineReply(`Queue repeat is ${trackRepeat}`);
}, },
}; };

View file

@ -1,30 +1,23 @@
const { Client, Message, MessageEmbed } = require("discord.js"); const { MessageEmbed } = require("discord.js");
const lyricsFinder = require("lyrics-finder"); const lyricsFinder = require("lyrics-finder");
const splitlyrics = require("../../util/pagination/pagination"); const splitlyrics = require("../../util/pagination/pagination");
module.exports = { module.exports = {
name: "lyrics", name: "lyrics",
description: "Get lyrics for the currently playing song", description: "Get lyrics for the currently playing song",
category: "Music", category: "Music",
usage: "(Song)",
run: async (client, message, args) => { run: async (client, message, args) => {
const queue = message.client.queue.get(message.guild.id);
if (!queue) return client.err(message, "Music", "lyrics", 34);
let lyrics = null; let lyrics = null;
try { try {
lyrics = await lyricsFinder(queue.songs[0].title, ""); lyrics = await lyricsFinder(args.slice(0).join(" "), "");
if (!lyrics) if (!lyrics)
lyrics = `**No lyrics are found for ${queue.songs[0].title}.**`; lyrics = `**No lyrics are found for ${args.slice(0).join(" ")}.**`;
} catch (error) { } catch (error) {
lyrics = `**No lyrics are found for ${queue.songs[0].title}.**`; lyrics = `**No lyrics are found for ${args.slice(0).join(" ")}.**`;
} }
const splittedLyrics = splitlyrics.chunk(lyrics, 1024); const splittedLyrics = splitlyrics.chunk(lyrics, 1024);
let lyricsEmbed = new MessageEmbed() let lyricsEmbed = new MessageEmbed()
.setAuthor( .setAuthor(`Lyrics`)
`${queue.songs[0].title} — Lyrics`,
"https://i.imgur.com/qHPXWxN.gif"
)
.setThumbnail(queue.songs[0].img)
.setColor("YELLOW") .setColor("YELLOW")
.setDescription(splittedLyrics[0]) .setDescription(splittedLyrics[0])
.setFooter(`Page 1 of ${splittedLyrics.length}.`) .setFooter(`Page 1 of ${splittedLyrics.length}.`)

View file

@ -1,20 +1,114 @@
const { Client, Message, MessageEmbed } = require("discord.js"); const { MessageEmbed } = require("discord.js");
module.exports = { module.exports = {
name: "nowplaying", name: "nowplaying",
description: "To show the music which is currently playing in this server", aliases: ["np"],
description: "Show now playing music info",
category: "Music", category: "Music",
run: async (client, message, args) => { run: async (client, message, args) => {
const serverQueue = message.client.queue.get(message.guild.id); try {
if (!serverQueue) return client.err(message, "Music", "nowplaying", 34); function format(millis) {
let song = serverQueue.songs[0]; try {
let thing = new MessageEmbed() var h = Math.floor(millis / 3600000),
.setAuthor("Now Playing", "https://i.imgur.com/qHPXWxN.gif") m = Math.floor(millis / 60000),
.setThumbnail(song.img) s = ((millis % 60000) / 1000).toFixed(0);
.setColor("client.color") if (h < 1)
.addField("Name:", `**${song.title}**`, true) return (
.addField("Duration:", `**${song.duration}**`, true) (m < 10 ? "0" : "") +
.addField("Requested by:", `**${song.req.tag}**`, true) m +
.setFooter(`Views:${song.views} | ${song.ago}`); ":" +
return message.channel.send(thing); (s < 10 ? "0" : "") +
s +
" | " +
Math.floor(millis / 1000) +
" Seconds"
);
else
return (
(h < 10 ? "0" : "") +
h +
":" +
(m < 10 ? "0" : "") +
m +
":" +
(s < 10 ? "0" : "") +
s +
" | " +
Math.floor(millis / 1000) +
" Seconds"
);
} catch (e) {
console.log(e);
}
}
function createBar(player) {
try {
if (!player.queue.current)
return `**"[""▇""—".repeat(size - 1)}]**\n**00:00:00 / 00:00:00**`;
let current =
player.queue.current.duration !== 0
? player.position
: player.queue.current.duration;
let total = player.queue.current.duration;
let size = 15;
let bar =
String("|") +
String("▇").repeat(Math.round(size * (current / total))) +
String("—").repeat(size - Math.round(size * (current / total))) +
String("|");
return `**${bar}**\n**${
new Date(player.position).toISOString().substr(11, 8) +
" / " +
(player.queue.current.duration == 0
? " ◉ LIVE"
: new Date(player.queue.current.duration)
.toISOString()
.substr(11, 8))
}**`;
} catch (e) {
console.log(e);
}
}
const player = message.client.manager.get(message.guild.id);
if (!player.queue.current)
return client.err(message, "Music", "nowplaying", 37);
return message.channel.send(
new MessageEmbed()
.setAuthor(
`Current song playing:`,
message.client.user.displayAvatarURL({
dynamic: true,
})
)
.setThumbnail(
`https://img.youtube.com/vi/${player.queue.current.identifier}/mqdefault.jpg`
)
.setURL(player.queue.current.uri)
.setColor("GREEN")
.setTitle(`🎶 **${player.queue.current.title}** 🎶`)
.addField(
`🕰️ Duration: `,
`\`${format(player.queue.current.duration)}\``,
true
)
.addField(`🎼 Song By: `, `\`${player.queue.current.author}\``, true)
.addField(
`🔢 Queue length: `,
`\`${player.queue.length} Songs\``,
true
)
.addField(`🎛️ Progress: `, createBar(player))
.setFooter(
`Requested by: ${player.queue.current.requester.tag}`,
player.queue.current.requester.displayAvatarURL({
dynamic: true,
})
)
);
} catch (e) {
console.log(e);
return client.err(message, "Music", "nowplaying", 999);
}
}, },
}; };

View file

@ -1,24 +1,18 @@
const { Client, Message, MessageEmbed } = require("discord.js");
module.exports = { module.exports = {
name: "pause", name: "pause",
description: "To pause the current music in the server", aliases: ["ps"],
description: "Pauses the current playing music",
category: "Music", category: "Music",
run: async (client, message, args) => { run: async (client, message, args) => {
const serverQueue = message.client.queue.get(message.guild.id); const player = message.client.manager.get(message.guild.id);
if (serverQueue && serverQueue.playing) { if (!player) return client.err(message, "Music", "pause", 34);
serverQueue.playing = false; const { channel } = message.member.voice;
try { if (!channel) return client.err(message, "Music", "pause", 35);
serverQueue.connection.dispatcher.pause(); if (channel.id !== player.voiceChannel)
} catch (error) { return client.err(message, "Music", "pause", 55);
message.client.queue.delete(message.guild.id); if (player.paused)
return client.err(message, "Music", "pause", 36); return message.inlineReply("The player is already paused");
} player.pause(true);
let xd = new MessageEmbed() return message.inlineReply("The player is paused");
.setDescription(`⏸ Paused the music for ${message.author.username}`)
.setColor("YELLOW")
.setTitle("Music has been paused.");
return message.channel.send(xd);
}
return client.err(message, "Music", "pause", 34);
}, },
}; };

View file

@ -1,199 +1,144 @@
const { Client, Message, MessageEmbed, Util } = require("discord.js"); const Discord = require("discord.js");
const ytdl = require("ytdl-core");
const ytdlDiscord = require("discord-ytdl-core");
const yts = require("yt-search");
const scdl = require("soundcloud-downloader").default;
const config = require("../../config.json");
module.exports = { module.exports = {
name: "play", name: "play",
description: "Play songs",
usage: "(YouTube_URL)/(Song Name)",
aliases: ["p"], aliases: ["p"],
description: "Plays your favourite music from YouTube or Spotify",
usage: "(Song/Song URL)",
category: "Music", category: "Music",
BotPerm: ["CONNECT", "SPEAK"],
run: async (client, message, args) => { run: async (client, message, args) => {
let channel = message.member.voice.channel; try {
const { channel } = message.member.voice;
if (!channel) return client.err(message, "Music", "play", 35); if (!channel) return client.err(message, "Music", "play", 35);
var searchString = args.join(" "); if (!args.length) return client.err(message, "Music", "play", 0);
if (!searchString) return client.err(message, "Music", "play", 0); const player = message.client.manager.create({
const url = args[0] ? args[0].replace(/<(.+)>/g, "$1") : ""; guild: message.guild.id,
var serverQueue = message.client.queue.get(message.guild.id); voiceChannel: channel.id,
textChannel: message.channel.id,
let songInfo; selfDeafen: true,
let song; });
if ( if (player.state !== "CONNECTED") player.connect();
url.match(/^(https?:\/\/)?(www\.)?(m\.)?(youtube\.com|youtu\.?be)\/.+$/gi) const search = args.join(" ");
) { let res;
try { try {
songInfo = await ytdl.getInfo(url); res = await player.search(search, message.author);
if (!songInfo) return client.err(message, "Music", "play", 42); if (res.loadType === "LOAD_FAILED") {
song = { if (!player.queue.current) player.destroy();
id: songInfo.videoDetails.videoId, throw res.exception;
title: songInfo.videoDetails.title, }
url: songInfo.videoDetails.video_url, } catch (e) {
img: songInfo.player_response.videoDetails.thumbnail.thumbnails[0]
.url,
duration: songInfo.videoDetails.lengthSeconds,
ago: songInfo.videoDetails.publishDate,
views: String(songInfo.videoDetails.viewCount).padStart(10, " "),
req: message.author,
};
} catch (error) {
console.log(e); console.log(e);
return client.err(message, "Music", "play", 999); return client.err(message, "Music", "play", 999);
} }
} else if (url.match(/^https?:\/\/(soundcloud\.com)\/(.*)$/gi)) { switch (res.loadType) {
try { case "NO_MATCHES":
songInfo = await scdl.getInfo(url); if (!player.queue.current) player.destroy();
if (!songInfo) return client.err(message, "Music", "play", 43); return message.inlineReply("No result is found");
song = { case "TRACK_LOADED":
id: songInfo.permalink, const playmusic = new Discord.MessageEmbed()
title: songInfo.title, .setColor("#00f70c")
url: songInfo.permalink_url,
img: songInfo.artwork_url,
ago: songInfo.last_modified,
views: String(songInfo.playback_count).padStart(10, " "),
duration: Math.ceil(songInfo.duration / 1000),
req: message.author,
};
} catch (e) {
console.error(e);
return client.err(message, "Music", "play", 999);
}
} else {
try {
var searched = await yts.search(searchString);
if (searched.videos.length === 0)
return client.err(message, "Music", "play", 44);
songInfo = searched.videos[0];
song = {
id: songInfo.videoId,
title: Util.escapeMarkdown(songInfo.title),
views: String(songInfo.views).padStart(10, " "),
url: songInfo.url,
ago: songInfo.ago,
duration: songInfo.duration.toString(),
img: songInfo.image,
req: message.author,
};
} catch (e) {
console.error(e);
return client.err(message, "Music", "play", 999);
}
}
if (serverQueue) {
serverQueue.songs.push(song);
let thing = new MessageEmbed()
.setAuthor( .setAuthor(
"Song has been added to queue", `Enqueuing:`,
"https://i.imgur.com/qHPXWxN.gif" message.client.user.displayAvatarURL({
dynamic: true,
})
) )
.setThumbnail(song.img) .setDescription(`${res.tracks[0].title}`)
.setColor("YELLOW") .setTimestamp();
.addField("Name:", `**${song.title}**`, true) player.queue.add(res.tracks[0]);
.addField("Duration:", `**${song.duration}**`, true) if (!player.playing && !player.paused && !player.queue.size)
.addField("Requested by:", `**${song.req.tag}**`, true) player.play();
.setFooter(`Views:${song.views} | ${song.ago}`); return message.channel.send(playmusic);
return message.channel.send(thing); case "PLAYLIST_LOADED":
} player.queue.add(res.tracks);
const playlist = new Discord.MessageEmbed()
.setColor("#00f70c")
.setAuthor(
`Enqueuing playlist:`,
message.client.user.displayAvatarURL({
dynamic: true,
})
)
.setDescription(
`${res.playlist.name}\` with ${res.tracks.length} tracks`
)
.setTimestamp();
if (
!player.playing &&
!player.paused &&
player.queue.totalSize === res.tracks.length
)
player.play();
return message.channel.send(playlist);
case "SEARCH_RESULT":
let max = 5,
collected,
filter = m =>
m.author.id === message.author.id &&
/^(\d+|end)$/i.test(m.content);
if (res.tracks.length < max) max = res.tracks.length;
const queueConstruct = { const results = res.tracks
textChannel: message.channel, .slice(0, max)
voiceChannel: channel, .map(
connection: null, (track, index) =>
songs: [], `${++index} - ` + `[${track.title}](${track.uri})`
volume: 80, )
playing: true, .join("\n");
loop: false,
};
message.client.queue.set(message.guild.id, queueConstruct);
queueConstruct.songs.push(song);
const play = async song => {
const queue = message.client.queue.get(message.guild.id);
if (!song) {
message.guild.me.voice.channel.leave(); //If you want your bot stay in vc 24/7 remove this line :D
message.client.queue.delete(message.guild.id);
return client.err(message, "Music", "play", 40);
}
let stream;
let streamType;
const searchResult = new Discord.MessageEmbed()
.setColor("#00f70c")
.setTitle("Search Results: ")
.setDescription(results)
.addField(
"Cancel Search: ",
"Type end or any other number to cancel the search",
true
)
.setTimestamp();
message.channel.send(searchResult);
try { try {
if (song.url.includes("soundcloud.com")) { collected = await message.channel.awaitMessages(filter, {
try { max: 1,
stream = await scdl.downloadFormat( time: 30e3,
song.url, errors: ["time"],
scdl.FORMATS.OPUS,
config.soundcloud
);
} catch (error) {
stream = await scdl.downloadFormat(
song.url,
scdl.FORMATS.MP3,
config.soundcloud
);
streamType = "unknown";
}
} else if (song.url.includes("youtube.com")) {
stream = await ytdlDiscord(song.url, {
filter: "audioonly",
quality: "highestaudio",
highWaterMark: 1 << 25,
opusEncoded: true,
}); });
streamType = "opus"; } catch (e) {
stream.on("error", function (er) { if (!player.queue.current) player.destroy();
if (er) { return message.inlineReply(
if (queue) { "You didn't provide a selection. Cancelled"
queue.songs.shift();
play(queue.songs[0]);
return client.err(message, "Music", "play", 999);
}
}
});
}
} catch (error) {
if (queue) {
queue.songs.shift();
play(queue.songs[0]);
}
}
queue.connection.on("disconnect", () =>
message.client.queue.delete(message.guild.id)
); );
const dispatcher = queue.connection
.play(stream, { type: streamType })
.on("finish", () => {
const shiffed = queue.songs.shift();
if (queue.loop === true) {
queue.songs.push(shiffed);
} }
play(queue.songs[0]); const first = collected.first().content;
});
dispatcher.setVolumeLogarithmic(queue.volume / 100); if (first.toLowerCase() === "end") {
let thing = new MessageEmbed() if (!player.queue.current) player.destroy();
.setAuthor(`Playing song`, "https://i.imgur.com/qHPXWxN.gif") return message.channel.send("Cancelled selection");
.setThumbnail(song.img) }
.setColor("client.color")
.addField("Name:", `**${song.title}**`, true)
.addField("Duration:", `**${song.duration}**`, true)
.addField("Requested by:", `**${song.req.tag}**`, true)
.setFooter(`Views:${song.views} | ${song.ago}`);
queue.textChannel.send(thing);
};
try { const index = Number(first) - 1;
const connection = await channel.join(); if (index < 0 || index > max - 1)
queueConstruct.connection = connection; return message.inlineReply(
play(queueConstruct.songs[0]); `The number that you provided too small or too big (1-${max})`
} catch (error) { );
const track = res.tracks[index];
player.queue.add(track);
const trackadd = new Discord.MessageEmbed()
.setColor("#00f70c")
.setAuthor(
`Added To Queue`,
message.client.user.displayAvatarURL({
dynamic: true,
})
)
.setDescription(`[${track.title}](${track.uri})`)
.addField(`Requested By : `, `${track.requester}`, true);
if (!player.playing && !player.paused && !player.queue.size)
player.play();
return message.channel.send(trackadd);
}
} catch (e) {
console.log(e); console.log(e);
message.client.queue.delete(message.guild.id);
await channel.leave();
return client.err(message, "Music", "play", 39);
} }
}, },
}; };

View file

@ -1,196 +0,0 @@
const { Client, Message, MessageEmbed, Util } = require("discord.js");
const yts = require("yt-search");
const ytdlDiscord = require("discord-ytdl-core");
var ytpl = require("ytpl");
const scdl = require("soundcloud-downloader").default;
const config = require("../../config.json");
module.exports = {
name: "playlist",
description: "Play songs",
usage: "(YouTube Playlist URL)/(Playlist Name)",
category: "Music",
BotPerm: ["CONNECT", "SPEAK"],
run: async (client, message, args) => {
const channel = message.member.voice.channel;
if (!channel) return client.err(message, "Music", "playlist", 35);
const url = args[0] ? args[0].replace(/<(.+)>/g, "$1") : "";
var searchString = args.join(" ");
if (!searchString || !url)
return client.err(message, "Music", "playlist", 0);
if (url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)) {
try {
const playlist = await ytpl(url.split("list=")[1]);
if (!playlist) return client.err(messgae, "Music", "playlist", 404);
const videos = await playlist.items;
for (const video of videos) {
await handleVideo(video, message, channel, true);
}
return message.channel.send({
embed: {
color: "GREEN",
description: `✅ **|** Playlist: **\`${videos[0].title}\`** has been added to the queue`,
},
});
} catch (e) {
console.error(e);
return client.err(message, "Music", "playlist", 999);
}
} else {
try {
var searched = await yts.search(searchString);
if (searched.playlists.length === 0)
return client.err(message, "Music", "playlist", 38);
var songInfo = searched.playlists[0];
let listurl = songInfo.listId;
const playlist = await ytpl(listurl);
const videos = await playlist.items;
for (const video of videos) {
// eslint-disable-line no-await-in-loop
await handleVideo(video, message, channel, true); // eslint-disable-line no-await-in-loop
}
let thing = new MessageEmbed()
.setAuthor(
"Playlist has been added to queue",
"https://i.imgur.com/qHPXWxN.gif"
)
.setThumbnail(songInfo.thumbnail)
.setColor("GREEN")
.setDescription(
`✅ **|** Playlist: **\`${songInfo.title}\`** has been added \`${songInfo.videoCount}\` video to the queue.`
);
return message.channel.send(thing);
} catch (e) {
console.log(e);
return client.err(message, "Music", "playlist", 999);
}
}
async function handleVideo(video, message, channel, playlist = false) {
const serverQueue = message.client.queue.get(message.guild.id);
const song = {
id: video.id,
title: Util.escapeMarkdown(video.title),
views: video.views ? video.views : "-",
ago: video.ago ? video.ago : "-",
duration: video.duration,
url: `https://www.youtube.com/watch?v=${video.id}`,
img: video.thumbnail,
req: message.author,
};
if (!serverQueue) {
const queueConstruct = {
textChannel: message.channel,
voiceChannel: channel,
connection: null,
songs: [],
volume: 80,
playing: true,
loop: false,
};
message.client.queue.set(message.guild.id, queueConstruct);
queueConstruct.songs.push(song);
try {
var connection = await channel.join();
queueConstruct.connection = connection;
play(message.guild, queueConstruct.songs[0]);
} catch (e) {
console.log(e);
message.client.queue.delete(message.guild.id);
return client.err(message, "Music", "playlist", 39);
}
} else {
serverQueue.songs.push(song);
if (playlist) return;
let thing = new MessageEmbed()
.setAuthor(
"Song has been added to queue",
"https://i.imgur.com/qHPXWxN.gif"
)
.setThumbnail(song.img)
.setColor("YELLOW")
.addField("Name:", `**${song.title}**`, true)
.addField("Duration:", `**${song.duration}**`, true)
.addField("Requested by:", `**${song.req.tag}**`, true)
.setFooter(`Views:${song.views} | ${song.ago}`);
return message.channel.send(thing);
}
return;
}
async function play(guild, song) {
const serverQueue = message.client.queue.get(message.guild.id);
if (!song) {
message.guild.me.voice.channel.leave();
message.client.queue.delete(message.guild.id);
return client.err(message, "Music", "playlist", 40);
}
let stream;
let streamType;
try {
if (song.url.includes("soundcloud.com")) {
try {
stream = await scdl.downloadFormat(
song.url,
scdl.FORMATS.OPUS,
config.soundcloud
);
} catch (error) {
stream = await scdl.downloadFormat(
song.url,
scdl.FORMATS.MP3,
config.soundcloud
);
streamType = "unknown";
}
} else if (song.url.includes("youtube.com")) {
stream = await ytdlDiscord(song.url, {
filter: "audioonly",
quality: "highestaudio",
highWaterMark: 1 << 25,
opusEncoded: true,
});
streamType = "opus";
stream.on("error", function (er) {
if (er) {
if (serverQueue) {
serverQueue.songs.shift();
play(serverQueue.songs[0]);
return client.err(message, "Music", "playlist", 999);
}
}
});
}
} catch (error) {
if (serverQueue) {
console.log(error);
serverQueue.songs.shift();
play(serverQueue.songs[0]);
}
}
serverQueue.connection.on("disconnect", () =>
message.client.queue.delete(message.guild.id)
);
const dispatcher = serverQueue.connection
.play(stream, { type: streamType })
.on("finish", () => {
const shiffed = serverQueue.songs.shift();
if (serverQueue.loop === true) {
serverQueue.songs.push(shiffed);
}
play(guild, serverQueue.songs[0]);
});
dispatcher.setVolume(serverQueue.volume / 100);
let thing = new MessageEmbed()
.setAuthor("Playing music", "https://i.imgur.com/qHPXWxN.gif")
.setThumbnail(song.img)
.setColor("BLUE")
.addField("Name:", `**${song.title}**`, true)
.addField("Duration:", `**${song.duration}**`, true)
.addField("Requested by:", `**${song.req.tag}**`, true)
.setFooter(`Views:${song.views} | ${song.ago}`);
serverQueue.textChannel.send(thing);
}
},
};

View file

@ -1,47 +1,44 @@
const { Client, Message, MessageEmbed } = require("discord.js"); const { MessageEmbed } = require("discord.js");
const util = require("../../util/pagination/pagination");
module.exports = { module.exports = {
name: "queue", name: "queue",
description: "To show the songs queue", description: "To show the songs queue",
aliases: ["q"], aliases: ["q"],
category: "Music", category: "Music",
BotPerm: ["MANAGE_MESSAGES", "ADD_REACTIONS"],
run: async (client, message, args) => { run: async (client, message, args) => {
const queue = message.client.queue.get(message.guild.id); const player = message.client.manager.get(message.guild.id);
if (!queue) return client.err(message, "Music", "queue", 34); if (!player) return client.err(message, "Music", "queue", 34);
const que = queue.songs.map( const queue = player.queue;
(t, i) => `\`${++i}.\` | [\`${t.title}\`](${t.url}) - [<@${t.req.id}>]`
);
const chunked = util.chunk(que, 10).map(x => x.join("\n"));
const embed = new MessageEmbed() const embed = new MessageEmbed()
.setAuthor("Songs Queue", "https://i.imgur.com/qHPXWxN.gif") .setAuthor(
.setThumbnail(message.guild.iconURL()) message.author.tag,
.setColor("client.color") message.author.displayAvatarURL({ dynamic: true })
.setDescription(chunked[0])
.addField(
"Now Playing",
`[${queue.songs[0].title}](${queue.songs[0].url})`,
true
) )
.addField("Text Channel", queue.textChannel, true) .setTitle(`Queue for ${message.guild.name}`)
.addField("Voice Channel", queue.voiceChannel, true) .setTimestamp()
.setFooter( .setColor("RANDOM");
`Currently Server Volume is ${queue.volume} | Page 1 of ${chunked.length}.` const multiple = 10;
); const page = args.length && Number(args[0]) ? Number(args[0]) : 1;
if (queue.songs.length === 1) const end = page * multiple;
embed.setDescription( const start = end - multiple;
`**No songs to play next. Add songs by \`\`${await client.prefix( const tracks = queue.slice(start, end);
message if (queue.current)
)}play <song_name>\`\`**` embed.addField(
"Current",
`[${queue.current.title}](${queue.current.uri})`
); );
try { if (!tracks.length)
const queueMsg = await message.channel.send(embed); embed.setDescription(
if (chunked.length > 1) `No tracks in ${page > 1 ? `page ${page}` : "the queue"}.`
await util.pagination(queueMsg, message.author, chunked); );
} catch (e) { else
console.log(e); embed.setDescription(
return client.err(message, "Music", "queue", 999); tracks
} .map((track, i) => `${start + ++i} - [${track.title}](${track.uri})`)
.join("\n")
);
const maxPages = Math.ceil(queue.length / multiple);
embed.setFooter(`Page ${page > maxPages ? maxPages : page} of ${maxPages}`);
return message.inlineReply(embed);
}, },
}; };

View file

@ -1,30 +0,0 @@
const { Client, Message, MessageEmbed } = require("discord.js");
module.exports = {
name: "remove",
description: "Remove song from the queue",
usage: "(Number)",
aliases: ["rm"],
category: "Music",
run: async (client, message, args) => {
const queue = message.client.queue.get(message.guild.id);
if (!queue) return client.err(message, "Music", "remove", 37);
if (!args.length) return client.err(message, "Music", "remove", 101);
if (isNaN(args[0])) return client.err(message, "Music", "remove", 7);
if (queue.songs.length == 1)
return client.err(message, "Music", "remove", 37);
if (args[0] > queue.songs.length)
return client.err(message, "Music", "remove", 101);
try {
const embed = new MessageEmbed()
.setColor(client.color)
.setDescription(`❌ **|** Removed: **${song[0].title}** from the queue`)
.setTimestamp(`Made by ${client.author}`);
const song = queue.songs.splice(args[0] - 1, 1);
message.inlineReply(embed);
message.react("✅");
} catch (e) {
console.log(e);
return client.err(message, "Music", "remove", 999);
}
},
};

View file

@ -1,24 +1,17 @@
const { Client, Message, MessageEmbed } = require("discord.js");
module.exports = { module.exports = {
name: "resume", name: "resume",
description: "To resume the paused music", description: "Pauses the current playing music",
aliases: ["continue"],
category: "Music", category: "Music",
run: async (client, message, args) => { run: async (client, message, args) => {
const serverQueue = message.client.queue.get(message.guild.id); const player = message.client.manager.get(message.guild.id);
if (serverQueue && !serverQueue.playing) { if (!player) return client.err(message, "Music", "resume", 34);
serverQueue.playing = true; const { channel } = message.member.voice;
serverQueue.connection.dispatcher.resume(); if (!channel) return client.err(message, "Music", "resume", 35);
let xd = new MessageEmbed() if (channel.id !== player.voiceChannel)
.setDescription(`▶ Resumed the music for ${message.author.username}`) return client.err(message, "Music", "resume", 55);
.setColor("YELLOW") if (player.paused == false)
.setAuthor( return message.inlineReply("The player is already playing");
"Music has been resumed.", player.pause(false);
"https://i.imgur.com/qHPXWxN.gif" return message.inlineReply("The player is resumed");
);
return message.channel.send(xd);
}
return client.err(message, "Music", "resume", 34);
}, },
}; };

103
commands/Music/seek.js Normal file
View file

@ -0,0 +1,103 @@
const { MessageEmbed } = require("discord.js");
module.exports = {
name: "seek",
description: "seek the current playing music",
category: "Music",
usage: "(Number)",
run: async (client, message, args) => {
try {
function createBar(player) {
try {
if (!player.queue.current)
return `**[""🔘""▬".repeat(size - 1)}]**\n**00:00:00 / 00:00:00**`;
let current =
player.queue.current.duration !== 0
? player.position
: player.queue.current.duration;
let total = player.queue.current.duration;
let size = 15;
let bar =
String("| ") +
String("🔘").repeat(Math.round(size * (current / total))) +
String("▬").repeat(size - Math.round(size * (current / total))) +
String(" |");
return `**${bar}**\n**${
new Date(player.position).toISOString().substr(11, 8) +
" / " +
(player.queue.current.duration == 0
? " ◉ LIVE"
: new Date(player.queue.current.duration)
.toISOString()
.substr(11, 8))
}**`;
} catch (e) {
console.log(e);
}
}
function format(millis) {
try {
var h = Math.floor(millis / 3600000),
m = Math.floor(millis / 60000),
s = ((millis % 60000) / 1000).toFixed(0);
if (h < 1)
return (
(m < 10 ? "0" : "") +
m +
":" +
(s < 10 ? "0" : "") +
s +
" | " +
Math.floor(millis / 1000) +
" Seconds"
);
else
return (
(h < 10 ? "0" : "") +
h +
":" +
(m < 10 ? "0" : "") +
m +
":" +
(s < 10 ? "0" : "") +
s +
" | " +
Math.floor(millis / 1000) +
" Seconds"
);
} catch (e) {
console.log(e);
}
}
const player = message.client.manager.get(message.guild.id);
if (
Number(args[0]) < 0 ||
Number(args[0]) >= player.queue.current.duration / 1000
)
return message.channel.send(
new MessageEmbed()
.setColor("RED")
.setTitle(
` Error | You may seek from \`0\` - \`${player.queue.current.duration}\``
)
.setAuthor(
message.author.tag,
message.author.displayAvatarURL({ dynamic: true })
)
.setTimestamp()
.setFooter(`Made by ${client.author}`)
);
player.seek(Number(args[0]) * 1000);
return message.channel.send(
new MessageEmbed()
.setTitle(`Seeked song to: ${format(Number(args[0]) * 1000)}`)
.addField(`Progress: `, createBar(player))
.setColor("GREEN")
);
} catch (e) {
console.log(e);
return client.err(message, "Music", "seek", 999);
}
},
};

View file

@ -1,24 +0,0 @@
const { Client, Message, MessageEmbed } = require("discord.js");
module.exports = {
name: "shuffle",
description: "Shuffle queue",
category: "Music",
run: async (client, message, args) => {
const serverQueue = message.client.queue.get(message.guild.id);
if (!serverQueue) return client.err(message, "Music", "shuffle", 37);
try {
let songs = serverQueue.songs;
for (let i = songs.length - 1; i > 1; i--) {
let j = 1 + Math.floor(Math.random() * i);
[songs[i], songs[j]] = [songs[j], songs[i]];
}
serverQueue.songs = songs;
message.client.queue.set(message.guild.id, serverQueue);
message.react("✅");
} catch (error) {
message.guild.me.voice.channel.leave();
message.client.queue.delete(message.guild.id);
return client.err(message, "Music", "shuffle", 36);
}
},
};

View file

@ -1,32 +1,18 @@
const { Client, Message, MessageEmbed } = require("discord.js");
module.exports = { module.exports = {
name: "skip", name: "skip",
description: "To skip the current music", aliases: ["sk"],
description: "Skips the current playing music",
category: "Music", category: "Music",
run: async (client, message, args) => { run: async (client, message, args) => {
const channel = message.member.voice.channel; const player = message.client.manager.get(message.guild.id);
if (!player) return client.err(message, "Music", "skip", 34);
const { channel } = message.member.voice;
if (!channel) return client.err(message, "Music", "skip", 35); if (!channel) return client.err(message, "Music", "skip", 35);
const serverQueue = message.client.queue.get(message.guild.id); if (channel.id !== player.voiceChannel)
if (!serverQueue) return client.err(message, "Music", "skip", 34); return client.err(message, "Music", "skip", 55);
if (!serverQueue.connection) return; if (!player.queue.current) return client.err(message, "Music", "skip", 34);
if (!serverQueue.connection.dispatcher) return; const { title } = player.queue.current;
if (serverQueue && !serverQueue.playing) { player.stop();
serverQueue.playing = true; return message.inlineReply(`**${title}** was skipped`);
serverQueue.connection.dispatcher.resume();
let xd = new MessageEmbed()
.setDescription(`▶ Skipped the music for ${message.author.username}`)
.setColor("YELLOW")
.setTitle("Music has been skipped");
return message.channel.send(xd).catch(err => console.log(err));
}
try {
serverQueue.connection.dispatcher.end();
} catch (error) {
serverQueue.voiceChannel.leave();
message.client.queue.delete(message.guild.id);
return client.err(message, "Music", "skip", 36);
}
message.react("✅");
}, },
}; };

View file

@ -1,41 +0,0 @@
const { Client, Message, MessageEmbed } = require("discord.js");
module.exports = {
name: "skipto",
description: "Skip to the selected queue number",
usage: "(Number)",
category: "Music",
run: async (client, message, args) => {
if (!args.length || isNaN(args[0]))
return client.err(message, "Music", "skipto", 101);
const queue = message.client.queue.get(message.guild.id);
if (!queue) return client.err(message, "Music", "skipto", 37);
if (args[0] > queue.songs.length)
return client.err(message, "Music", "skipto", 101);
queue.playing = true;
if (queue.loop) {
for (let i = 0; i < args[0] - 2; i++) {
queue.songs.push(queue.songs.shift());
}
} else {
queue.songs = queue.songs.slice(args[0] - 2);
}
try {
queue.connection.dispatcher.end();
} catch (error) {
queue.voiceChannel.leave();
message.client.queue.delete(message.guild.id);
return client.err(message, "Music", "skipto", 36);
}
queue.textChannel
.send({
embed: {
color: "GREEN",
description: `${message.author} ⏭ skipped ${args[0] - 1} songs`,
},
})
.catch(console.error);
message.react("✅");
},
};

View file

@ -1,24 +1,17 @@
const { Client, Message, MessageEmbed } = require("discord.js");
module.exports = { module.exports = {
name: "stop", name: "stop",
aliases: ["dc"],
description: "To stop the music and clear the queue", description: "To stop the music and clear the queue",
category: "Music", category: "Music",
run: async (client, message, args) => { run: async (client, message, args) => {
const channel = message.member.voice.channel; const player = message.client.manager.get(message.guild.id);
if (!player) return client.err(message, "Music", "stop", 34);
const { channel } = message.member.voice;
if (!channel) return client.err(message, "Music", "stop", 35); if (!channel) return client.err(message, "Music", "stop", 35);
const serverQueue = message.client.queue.get(message.guild.id); if (channel.id !== player.voiceChannel)
if (!serverQueue) return client.err(message, "Music", "stop", 34); return client.err(message, "Music", "stop", 55);
if (!serverQueue.connection) return; player.destroy();
if (!serverQueue.connection.dispatcher) return;
try {
serverQueue.connection.dispatcher.end();
} catch (error) {
message.guild.me.voice.channel.leave();
message.client.queue.delete(message.guild.id);
return client.err(message, "Music", "stop", 36);
}
message.client.queue.delete(message.guild.id);
serverQueue.songs = [];
message.react("✅"); message.react("✅");
return message.inlineReply("The player has been destroyed");
}, },
}; };

View file

@ -1,30 +1,25 @@
const { Client, Message, MessageEmbed } = require("discord.js");
module.exports = { module.exports = {
name: "volume", name: "volume",
description: "To change the server song queue volume", description: "To change the server song queue volume",
usage: "(Number)", usage: "(Number)",
aliases: ["vol"], aliases: ["vol", "v"],
category: "Music", category: "Music",
description: "Set volume level of the music",
run: async (client, message, args) => { run: async (client, message, args) => {
const channel = message.member.voice.channel; const player = message.client.manager.get(message.guild.id);
if (!player) return client.err(message, "Music", "volume", 34);
if (!args.length)
return message.inlineReply(`The player volume is \`${player.volume}\``);
const { channel } = message.member.voice;
if (!channel) return client.err(message, "Music", "volume", 35); if (!channel) return client.err(message, "Music", "volume", 35);
const serverQueue = message.client.queue.get(message.guild.id); if (channel.id !== player.voiceChannel)
if (!serverQueue) return client.err(message, "Music", "volume", 34); return client.err(message, "Music", "volume", 55);
if (!serverQueue.connection) const volume = Number(args[0]);
return client.err(message, "Music", "volume", 34); if (!volume || volume < 1 || volume > 100 || isNaN(volume))
if (!args[0])
return message.channel.send(
`The current volume is: **${serverQueue.volume}**`
);
if (isNaN(args[0])) return client.err(message, "Music", "volume", 101);
if (parseInt(args[0]) > 150 || args[0] < 0)
return client.err(message, "Music", "volume", 101); return client.err(message, "Music", "volume", 101);
serverQueue.volume = args[0]; player.setVolume(volume);
serverQueue.connection.dispatcher.setVolumeLogarithmic(args[0] / 100); return message.inlineReply(
let xd = new MessageEmbed() `The player's volume has been set to \`${volume}\`.`
.setDescription(`Tuned the volume to: **${args[0] / 1}/100**`) );
.setAuthor("Server Volume Manager", "https://i.imgur.com/qHPXWxN.gif")
.setColor("client.color");
return message.channel.send(xd);
}, },
}; };

View file

@ -10,7 +10,7 @@ module.exports = {
const acceptQuery = const acceptQuery =
args.slice(1).join(" ") || `They didn't leave any message.`; args.slice(1).join(" ") || `They didn't leave any message.`;
if (!MessageID) return message.reply("Please specify a valid ID"); if (!MessageID) return message.inlineReply("Please specify a valid ID");
try { try {
const suggestionChannel = message.guild.channels.cache.get( const suggestionChannel = message.guild.channels.cache.get(
client.SuggestionLog client.SuggestionLog

View file

@ -9,7 +9,7 @@ module.exports = {
if (!args[0] || isNaN(args[0])) if (!args[0] || isNaN(args[0]))
return message.channel.send("Number of coins?"); return message.channel.send("Number of coins?");
const user = message.mentions.members.first() || message.author; const user = message.mentions.members.first() || message.author;
client.data.add(user.id, parseInt(args[0])); client.add(user.id, parseInt(args[0]), message);
message.react("<a:a_yes:808683134786863124>"); message.react("<a:a_yes:808683134786863124>");
}, },
}; };

View file

@ -10,7 +10,7 @@ module.exports = {
const denyQuery = const denyQuery =
args.slice(1).join(" ") || `They didn't leave any message.`; args.slice(1).join(" ") || `They didn't leave any message.`;
if (!MessageID) return message.reply("Please specify a valid ID"); if (!MessageID) return message.inlineReply("Please specify a valid ID");
try { try {
const suggestionChannel = message.guild.channels.cache.get( const suggestionChannel = message.guild.channels.cache.get(
client.SuggestionLog client.SuggestionLog

58
commands/Owner/edit.js Normal file
View file

@ -0,0 +1,58 @@
const { Client, Message, MessageEmbed } = require("discord.js");
module.exports = {
name: "edit",
/**
* @param {Client} client
* @param {Message} message
* @param {String[]} args
*/
run: async (client, message, args) => {
const embed = new MessageEmbed()
.setAuthor(
"Ń1ght and Cath Nation",
message.guild.iconURL({ dynamic: true, size: 4096 })
)
.setColor(client.color)
.setDescription(
"*Welcome to Ń1ght and Cath Nation*.\n**Please get a role below by reacting!**\n**[Invite](https://discord.com/api/oauth2/authorize?client_id=800966959268364288&permissions=4231314550&scope=bot%20applications.commands) | [Support](https://discord.gg/SbQHChmGcp) | [YouTube](https://youtube.com/c/Kirito01) | [Website](https://www.cath.gq)**"
)
.addFields(
{
name: "Gold<:gold:841194046419370024>",
value: "<@&841200768706543636>",
inline: true,
},
{
name: "Platinum<:platinum:841194040165924865>",
value: "<@&840536973126270976>",
inline: true,
},
{
name: "Updates<:Update:841196992385253408>",
value: "<@&841200845885538325>",
inline: true,
},
{
name: "Announcements<:announce_dark:841195615458951168>",
value: "<@&841026716181069824>",
inline: false,
},
{
name: "YouTube<:YouTube:841186450497339412>",
value: "<@&841026772790673448>",
inline: true,
}
)
.setThumbnail(client.user.displayAvatarURL())
.setURL(client.web)
.setFooter(
"Ń1ght#0001",
message.author.displayAvatarURL({ dynamic: true, size: 4096 })
)
.setTimestamp();
const ch = message.guild.channels.cache.get(message.channel.id);
const msgs = await ch.messages.fetch(args[0]);
msgs.edit("", embed);
},
};

View file

@ -6,7 +6,7 @@ module.exports = {
const embed = new MessageEmbed() const embed = new MessageEmbed()
.setAuthor( .setAuthor(
"Ń1ght and Cath Nation", "Ń1ght and Cath Nation",
"https://images-ext-2.discordapp.net/external/JyjN4pXpaLIaSOSszAR9dyp03Hf3ouzjUb8kRa0OFiE/%3Fsize%3D2048/https/cdn.discordapp.com/icons/718762019586572341/c35c387563c7527f056276f2a16f526b.webp" message.guild.iconURL({ dynamic: true, size: 4096 })
) )
.setColor(client.color) .setColor(client.color)
.setDescription( .setDescription(
@ -43,7 +43,7 @@ module.exports = {
.setURL(client.web) .setURL(client.web)
.setFooter( .setFooter(
"Ń1ght#0001", "Ń1ght#0001",
"https://images-ext-2.discordapp.net/external/JyjN4pXpaLIaSOSszAR9dyp03Hf3ouzjUb8kRa0OFiE/%3Fsize%3D2048/https/cdn.discordapp.com/icons/718762019586572341/c35c387563c7527f056276f2a16f526b.webp" message.author.displayAvatarURL({ dynamic: true, size: 4096 })
) )
.setTimestamp(); .setTimestamp();
message.channel.send(embed); message.channel.send(embed);

View file

@ -9,7 +9,7 @@ module.exports = {
if (!args[0] || isNaN(args[0])) if (!args[0] || isNaN(args[0]))
return message.channel.send("Number of coins?"); return message.channel.send("Number of coins?");
const user = message.mentions.members.first() || message.author; const user = message.mentions.members.first() || message.author;
client.data.rmv(user.id, parseInt(args[0])); await client.rmv(user.id, parseInt(args[0]));
message.react("<a:a_yes:808683134786863124>"); message.react("<a:a_yes:808683134786863124>");
}, },
}; };

32
commands/Owner/test.js Normal file
View file

@ -0,0 +1,32 @@
// const { Client, Message, MessageEmbed } = require("discord.js");
// const db = require("../../models/bot");
// module.exports = {
// name: "test",
// Owner: true,
// /**
// * @param {Client} client
// * @param {Message} message
// * @param {String[]} args
// */
// run: async (client, message, args) => {
// db.findOne({ Bot: client.user.id }, async (err, data) => {
// let cmdstatus;
// if (!data) {
// return;
// } else {
// data.Commands.map(x => {
// const arr = Object.values(x.commands);
// const finded = arr.find(a => a.name == args[0].toLowerCase());
// if (!finded) return;
// else cmdstatus = finded.status;
// });
// data.Commands.commands.status = false;
// if (cmdstatus === true) {
// cmdstatus = false;
// await db.findOneAndUpdate({ Bot: client.user.id }, data);
// }
// }
// });
// },
// };

View file

@ -27,7 +27,6 @@ module.exports = {
collector.stop("fulfilled"); collector.stop("fulfilled");
}); });
const chan = client.channels.cache.get(Suggestion);
collector.on("end", (collected, reason) => { collector.on("end", (collected, reason) => {
if (reason === "fulfilled") { if (reason === "fulfilled") {
const msss = collected.map(msg => { const msss = collected.map(msg => {
@ -52,7 +51,7 @@ module.exports = {
} }
}); });
} catch (err) { } catch (err) {
message.channel.send(`Please enable your DM allowance`); console.log(err);
} }
}, },
}; };

View file

@ -1,7 +1,7 @@
const { Client, Message, MessageEmbed, Util } = require("discord.js"); const { Client, Message, MessageEmbed, Util } = require("discord.js");
module.exports = { module.exports = {
name: "emojiadd", name: "emojiadd",
usage: "(Link/Photo)", usage: "(Link/Photo) (Name)",
aliases: ["addemoji"], aliases: ["addemoji"],
description: "Show an emoji URL or add the emoji to the server", description: "Show an emoji URL or add the emoji to the server",
category: "Utilities", category: "Utilities",

View file

@ -15,7 +15,7 @@ module.exports = {
page = 0, page = 0,
reactions = ["◀️", "⏪", "⏩", "▶️"]; reactions = ["◀️", "⏪", "⏩", "▶️"];
if (!snipes) if (!snipes)
return message.reply( return message.inlineReply(
`No snipes have been found for the channel \`${channel.name}\`` `No snipes have been found for the channel \`${channel.name}\``
); );

View file

@ -0,0 +1,30 @@
const { MessageEmbed } = require("discord.js");
module.exports = {
name: "messageinfo",
run: async (client, message, args) => {
try {
if (!args[0]) return client.err(message, "Utilities", "Fun", 27);
await message.channel.messages.fetch(args[0]).catch(err => {
return message.inlineReply("Message not found in this channel..");
});
const msg = await message.channel.messages.cache.get(args[0]);
console.log(msg);
const hasImage = msg.attachments.size && msg.attachments.first().width;
const embed = new MessageEmbed()
.setColor(msg.member ? msg.member.displayHexColor : client.color)
.setImage(hasImage ? msg.attachments.first().url : null)
.setAuthor(
msg.author.tag,
msg.author.displayAvatarURL({ format: "png", dynamic: true })
)
.addField("Content", msg.content)
.setTimestamp(msg.createdAt)
.addField("ID", msg.id)
.setFooter(`Made by ${client.author}`)
.addField("Jump", `[Click Here to Jump](${msg.url})`);
return message.inlineReply(embed);
} catch (err) {
console.log(err);
}
},
};

View file

@ -132,7 +132,7 @@ module.exports = {
} }
}); });
} catch { } catch {
return message.reply("please let me send DM to you."); return message.inlineReply("please let me send DM to you.");
} }
}, },
}; };

View file

@ -0,0 +1,28 @@
const { MessageEmbed } = require("discord.js");
module.exports = {
name: "ping",
description: "Check bot latency to Discord API",
run: async (client, message, args) => {
const msg = await message.channel.send("Pinging...");
const messageping = msg.createdTimestamp - message.createdTimestamp;
const Embed = new MessageEmbed()
.setTitle("🏓 Pong!")
.setAuthor(
`${message.author.username}`,
message.author.displayAvatarURL()
)
.setDescription(
`📨 • **Message Latency** \`${Math.floor(
messageping
)}ms\`\n🛰️ • **Bot Latency** \`${Math.round(client.ws.ping)}ms\``
)
.setColor(
messageping < 350
? "GREEN"
: messageping < 500 && messageping > 350
? "YELLOW"
: "RED"
);
msg.edit("", Embed);
},
};

View file

@ -1,75 +1,24 @@
const { Client, Message, MessageEmbed } = require("discord.js"); const { MessageEmbed } = require("discord.js");
const { Suggestion } = require("../../config.json");
module.exports = { module.exports = {
name: "poll", name: "poll",
description: "Join a poll for develop of this bot", description: "Start a poll in a channel",
category: "Utilities", category: "Utilities",
Owner: true,
run: async (client, message, args) => { run: async (client, message, args) => {
const questions = [ let pollDescription = `
"Which statistic of gun you want to see?", ${message.author} asks: ${args.slice(1).join(" ")}
//"question 2" `;
]; const channel = message.mentions.channels.first();
let collectCounter = 0; if (!channel) return client.err(message, "Utilities", "poll", 28);
let endCounter = 0; if (!pollDescription) return client.err(message, "Utilities", "poll", 12);
const filter = m => m.author.id === message.author.id; let embedPoll = new MessageEmbed()
message.reply("check your dm."); .setTitle(`${message.author.username} made a poll`)
const appStart = await message.author.send( .setDescription(pollDescription)
new MessageEmbed() .setFooter(`Made by ${client.author}`)
.setAuthor(message.author.username, message.author.displayAvatarURL())
.setDescription(questions[collectCounter++])
.setFooter(client.user.username)
.setTimestamp() .setTimestamp()
); .setColor("GREEN");
const channel = appStart.channel; let msgEmbed = await channel.send(embedPoll);
await msgEmbed.react("👍");
const collector = channel.createMessageCollector(filter); await msgEmbed.react("👎");
collector.on("collect", () => {
if (collectCounter < questions.length) {
channel.send(
new MessageEmbed()
.setAuthor(
message.author.username,
message.author.displayAvatarURL()
)
.setDescription(questions[collectCounter++])
.setFooter(client.user.username)
.setTimestamp()
);
} else {
channel.send(
new MessageEmbed()
.setTitle("SUCCESS!")
.setDescription("You have joined the poll.")
.setColor("GREEN")
);
collector.stop("fulfilled");
}
});
const appsChannel = client.channels.cache.get(Suggestion);
collector.on("end", (collected, reason) => {
if (reason === "fulfilled") {
let index = 1;
const mapedResponses = collected
.map(msg => {
return `${questions[endCounter++]}**\n->** ${msg.content}`;
})
.join("\n\n");
appsChannel.send(
new MessageEmbed()
.setAuthor(
message.author.tag,
message.author.displayAvatarURL({ dynamic: true })
)
.setTitle("New Apllication")
.setDescription(mapedResponses)
.setColor("ORANGE")
.setTimestamp()
);
}
});
}, },
}; };

View file

@ -7,6 +7,7 @@ module.exports = {
usage: "{User}", usage: "{User}",
timeout: 5000, timeout: 5000,
category: "Utilities", category: "Utilities",
Level: true,
run: async (client, message, args) => { run: async (client, message, args) => {
if (!message.guild) return; if (!message.guild) return;
if (message.author.bot) return; if (message.author.bot) return;

View file

@ -1,5 +1,4 @@
const { Client, Message, MessageEmbed } = require("discord.js"); const { Client, Message, MessageEmbed } = require("discord.js");
require("../../inlinereply");
module.exports = { module.exports = {
name: "report", name: "report",

View file

@ -9,7 +9,7 @@ module.exports = {
.setTitle(`Icon of ${message.guild.name}`) .setTitle(`Icon of ${message.guild.name}`)
.setURL(client.web) .setURL(client.web)
.setTimestamp() .setTimestamp()
.setFooter(`Requested by ${message.authpr.tag}`) .setFooter(`Requested by ${message.author.tag}`)
.setImage(message.guild.iconURL({ dynamic: true, size: 2048 })); .setImage(message.guild.iconURL({ dynamic: true, size: 2048 }));
message.inlineReply(Embed); message.inlineReply(Embed);
}, },

View file

@ -69,6 +69,9 @@ module.exports = {
)} ${moment(message.guild.createdTimestamp).format("LL")} ${moment( )} ${moment(message.guild.createdTimestamp).format("LL")} ${moment(
message.guild.createdTimestamp message.guild.createdTimestamp
).fromNow()}`, ).fromNow()}`,
`** Community Features:** ${
message.guild.features.join(", ") || "No Community Features!"
}`,
"\u200b", "\u200b",
]) ])
.addField("Statistics", [ .addField("Statistics", [

View file

@ -1,12 +1,12 @@
{ {
"prefix": "C.", "prefix": "C.",
"mongo": "mongodb://127.0.0.1:27017/cath", "mongo": "mongodb://127.0.0.1:27017/test",
"URL": "https://cath.gq/", "URL": "https://cath.gq/",
"color": "02023a", "color": "02023a",
"soundcloud": "dmDh7QSlmGpzH9qQoH1YExYCGcyYeYYC", "ca": "**[Invite](https://discord.com/api/oauth2/authorize?client_id=800966959268364288&permissions=mongodb+srv://cath_exe:SKS_2021@cath-exe.iolb7.mongodb.net/Data4231314550&scope=bot%20applications.commands) | [Support](https://discord.gg/SbQHChmGcp) | [YouTube](https://youtube.com/Kirito01) | [Website](https://www.cath.gq)**",
"ca": "**[Invite](https://discord.com/api/oauth2/authorize?client_id=800966959268364288&permissions=4231314550&scope=bot%20applications.commands) | [Support](https://discord.gg/SbQHChmGcp) | [YouTube](https://youtube.com/Kirito01) | [Website](https://www.cath.gq)**",
"cat": "**[Invite](https://discord.com/api/oauth2/authorize?client_id=800966959268364288&permissions=4231314550&scope=bot%20applications.commands) | [Support](https://discord.gg/SbQHChmGcp) | [YouTube](https://youtube.com/Kirito01) | [Website](https://www.cath.gq)**\n\n", "cat": "**[Invite](https://discord.com/api/oauth2/authorize?client_id=800966959268364288&permissions=4231314550&scope=bot%20applications.commands) | [Support](https://discord.gg/SbQHChmGcp) | [YouTube](https://youtube.com/Kirito01) | [Website](https://www.cath.gq)**\n\n",
"Suggestion": "853319776034226186", "Suggestion": "853319776034226186",
"Report": "853319776034226186", "Report": "853319776034226186",
"Welcome": "837913442228371456" "Welcome": "837913442228371456",
"DM": "850434924536135690"
} }

View file

@ -1,10 +1,12 @@
const Levels = require("discord-xp"); const Levels = require("discord-xp");
const client = require("../bot"); const client = require("../bot");
const users = require("../models/users"); require("dotenv").config();
Levels.setURL(require("../config.json").mongo); Levels.setURL(process.env.MONGO);
client.on("message", async message => { client.on("message", async message => {
if (!message.guild) return; if (!message.guild) return;
if (message.author.bot) return; if (message.author.bot) return;
const guild = await client.data.getGuild(message.guild.id);
if (guild.Level == false) return;
const user = await client.data.getUser(message.author.id); const user = await client.data.getUser(message.author.id);
var max = 30; var max = 30;
if (user) { if (user) {
@ -15,7 +17,6 @@ client.on("message", async message => {
} }
} }
const randomAmountOfXp = client.function.rndint(10, max); const randomAmountOfXp = client.function.rndint(10, max);
if (client.xp.includes(message.guild.id)) return;
const hasLeveledUp = await Levels.appendXp( const hasLeveledUp = await Levels.appendXp(
message.author.id, message.author.id,
message.guild.id, message.guild.id,

View file

@ -0,0 +1,447 @@
// const Discord = require("discord.js");
// const Guild = require("../models/guilds");
// const client = require("../bot");
// let types = {
// text: "Text Channel",
// voice: "Voice Channel",
// null: "No Type",
// news: "News Channel",
// store: "Store Channel",
// category: "Category",
// };
// client.on("channelCreate", async channel => {
// send_log(
// client,
// channel.guild,
// "GREEN",
// "Channel Created",
// `Channel Name: \`${channel.name}\`\nChannel ID: \`${
// channel.id
// }\`\nChannel Type: \`${types[channel.type]}\`\nChannel Position: \`${
// channel.rawPosition
// }\``
// );
// });
// client.on("channelDelete", async channel => {
// send_log(
// client,
// channel.guild,
// "RED",
// "Channel Deleted",
// `Channel Name: \`${channel.name}\`\nChannel ID: \`${
// channel.id
// }\`\nChannel Type: \`${types[channel.type]}\`\nChannel Position: \`${
// channel.rawPosition
// }\``
// );
// });
// client.on("channelPinsUpdate", async (channel, time) => {
// send_log(
// client,
// channel.guild,
// "YELLOW",
// "Channel Pins Update",
// `Channel Name: \`${channel.name}\`\nChannel ID: \`${
// channel.id
// }\`\nPinned at \`${time.toLocaleString()}\``,
// "https://i.stack.imgur.com/d1JEp.png"
// );
// });
// client.on("channelUpdate", function (oldChannel, newChannel) {
// let newCat = newChannel.parent ? newChannel.parent.name : "NO PARENT";
// let guildChannel = newChannel.guild;
// if (!guildChannel || !guildChannel.available) return;
// if (oldChannel.name != newChannel.name) {
// send_log(
// client,
// oldChannel.guild,
// "YELLOW",
// "Channel Updated - Name",
// `Channel Name: \`${oldChannel.name}\`\nChannel Id: \`${oldChannel.id}\`\n\n` +
// `Channel Name: \`${newChannel.name}\`\nChannel Id: \`${newChannel.id}\``
// );
// } else if (oldChannel.type != newChannel.type) {
// send_log(
// client,
// oldChannel.guild,
// "YELLOW",
// "Channel Updated - Type",
// `Channel Name: \`${oldChannel.name}\`\nChannel Id: \`${
// oldChannel.id
// }\`\nChannelTYPE: \`${types[oldChannel.type]}\`\n\n` +
// `Channel Name: \`${newChannel.name}\`\nChannel Id: \`${
// newChannel.id
// }\`\nChannelTYPE: \`${types[newChannel.type]}\``
// );
// } else if (oldChannel.topic != newChannel.topic) {
// send_log(
// client,
// oldChannel.guild,
// "YELLOW",
// "Channel UPDATED - TOPIC",
// `Channel Name: \`${oldChannel.name}\`\nChannel Id: \`${oldChannel.id}\`\nChannelTOPIC: \`${oldChannel.topic}\`\n\n` +
// `Channel Name: \`${newChannel.name}\`\nChannel Id: \`${newChannel.id}\`\nChannelTOPIC: \`${newChannel.topic}\``
// );
// }
// });
// client.on("emojiCreate", function (emoji) {
// send_log(
// client,
// emoji.guild,
// "GREEN",
// "EMOJI CREATED",
// `EMOJI: ${emoji}\nEMOJINAME: ${emoji.name}\nEMOJIID: ${emoji.id}\nEMOJIURL: ${emoji.url}`
// );
// });
// client.on("emojiDelete", function (emoji) {
// send_log(
// client,
// emoji.guild,
// "RED",
// "EMOJI DELETED",
// `EMOJI: ${emoji}\nEMOJINAME: ${emoji.name}\nEMOJIID: ${emoji.id}\nEMOJIURL: ${emoji.url}`
// );
// });
// client.on("emojiUpdate", function (oldEmoji, newEmoji) {
// if (oldEmoji.name !== newEmoji.name) {
// send_log(
// client,
// oldEmoji.guild,
// "ORANGE",
// "EMOJI NAME CHANGED",
// `__Emoji: ${newEmoji}__ \n\n**Before:** \`${oldEmoji.name}\`\n**After:** \`${newEmoji.name}\`\n**Emoji ID:** \`${newEmoji.id}\``
// );
// }
// });
// client.on("guildBanAdd", function (guild, user) {
// send_log(
// client,
// guild,
// "RED",
// "USER BANNED",
// `User: ${user} (\`${user.id}\`)\n\`${user.tag}\``,
// user.user.displayAvatarURL({ dynamic: true })
// );
// });
// client.on("guildBanRemove", function (guild, user) {
// send_log(
// client,
// guild,
// "YELLOW",
// "USER UNBANNED",
// `User: ${user} (\`${user.id}\`)\n\`${user.tag}\``,
// user.user.displayAvatarURL({ dynamic: true })
// );
// });
// client.on("guildMemberAdd", function (member) {
// send_log(
// member.guild,
// client,
// "GREEN",
// "MEMBER JOINED",
// `Member: ${member.user} (\`${member.user.id}\`)\n\`${member.user.tag}\``,
// member.user.displayAvatarURL({ dynamic: true })
// );
// });
// client.on("guildMemberRemove", function (member) {
// send_log(
// client,
// member.guild,
// "RED",
// "MEMBER LEFT",
// `Member: ${member.user} (\`${member.user.id}\`)\n\`${member.user.tag}\``,
// member.user.displayAvatarURL({ dynamic: true })
// );
// });
// client.on("guildMembersChunk", function (members, guild) {
// send_log(
// guild,
// client,
// "RED",
// "MEMBER CHUNK / RAID - " + members.length + " Members",
// members.map(
// (user, index) => `${index}) - ${user} - ${user.tag} - \`${user.id}\``
// )
// );
// });
// client.on("guildMemberUpdate", function (oldMember, newMember) {
// let options = {};
// if (options[newMember.guild.id]) {
// options = options[newMember.guild.id];
// }
// // Add default empty list
// if (typeof options.excludedroles === "undefined")
// options.excludedroles = new Array([]);
// if (typeof options.trackroles === "undefined") options.trackroles = true;
// const oldMemberRoles = oldMember.roles.cache.keyArray();
// const newMemberRoles = newMember.roles.cache.keyArray();
// const oldRoles = oldMemberRoles
// .filter(x => !options.excludedroles.includes(x))
// .filter(x => !newMemberRoles.includes(x));
// const newRoles = newMemberRoles
// .filter(x => !options.excludedroles.includes(x))
// .filter(x => !oldMemberRoles.includes(x));
// const rolechanged = newRoles.length || oldRoles.length;
// if (rolechanged) {
// let roleadded = "";
// if (newRoles.length > 0) {
// for (let i = 0; i < newRoles.length; i++) {
// if (i > 0) roleadded += ", ";
// roleadded += `<@&${newRoles[i]}>`;
// }
// }
// let roleremoved = "";
// if (oldRoles.length > 0) {
// for (let i = 0; i < oldRoles.length; i++) {
// if (i > 0) roleremoved += ", ";
// roleremoved += `<@&${oldRoles[i]}>`;
// }
// }
// let text = `${roleremoved ? `❌ ROLE REMOVED: \n${roleremoved}` : ""}${
// roleadded ? `✅ ROLE ADDED:\n${roleadded}` : ""
// }`;
// send_log(
// client,
// oldMember.guild,
// `${roleadded ? "GREEN" : "RED"}`,
// "Member Roles Changed",
// `Member: ${newMember.user}\nUser: \`${oldMember.user.tag}\`\n\n${text}`
// );
// }
// });
// client.on("messageDelete", function (message) {
// if (message.channel.type !== "text") return;
// send_log(
// client,
// message.guild,
// "ORANGE",
// "Message Deleted",
// `
// **Author : ** <@${message.author.id}> - *${message.author.tag}*
// **Date : ** ${message.createdAt}
// **Channel : ** <#${message.channel.id}> - *${message.channel.name}*
// **Deleted Message : **
// \`\`\`
// ${message.content.replace(/`/g, "'")}
// \`\`\`
// **Attachment URL : **
// ${message.attachments.map(x => x.proxyURL)}
// `
// );
// });
// client.on("messageDeleteBulk", function (message) {
// send_log(
// client,
// message.guild,
// "RED",
// message.length + " Message Deleted BULK",
// `${message.length} Messages delete in: ${message.channel}`
// );
// });
// client.on("messageUpdate", function (oldMessage, newMessage) {
// if (oldMessage.author.bot) return;
// if (oldMessage.channel.type !== "text") return;
// if (newMessage.channel.type !== "text") return;
// if (oldMessage.content === newMessage.content) return;
// send_log(
// client,
// oldMessage.guild,
// "YELLOW",
// "Message Updated",
// `
// **Author : ** <@${newMessage.member.user.id}> - *${newMessage.member.user.tag}*
// **Date : ** ${newMessage.createdAt}
// **Channel : ** <#${newMessage.channel.id}> - *${newMessage.channel.name}*
// **Orignal Message : **
// \`\`\`
// ${oldMessage.content.replace(/`/g, "'")}
// \`\`\`
// **Updated Message : **
// \`\`\`
// ${newMessage.content.replace(/`/g, "'")}
// \`\`\``
// );
// });
// client.on("roleCreate", function (role) {
// send_log(
// client,
// role.guild,
// "GREEN",
// "ROLE CREATED"`ROLE: ${role}\nROLENAME: ${role.name}\nROLEID: ${role.id}\nHEXCOLOR: ${role.hexColor}\nPOSITION: ${role.position}`
// );
// });
// client.on("roleDelete", function (role) {
// send_log(
// client,
// role.guild,
// "RED",
// "ROLE DELETED"`ROLE: ${role}\nROLENAME: ${role.name}\nROLEID: ${role.id}\nHEXCOLOR: ${role.hexColor}\nPOSITION: ${role.position}`
// );
// });
// client.on("roleUpdate", function (oldRole, newRole) {
// let perms = {
// 1: "CREATE_INSTANT_INVITE",
// 2: "KICK_MEMBERS",
// 4: "BAN_MEMBERS",
// 8: "ADMINISTRATOR",
// 16: "MANAGE_CHANNELS",
// 32: "MANAGE_GUILD",
// 64: "ADD_REACTIONS",
// 128: "VIEW_AUDIT_LOG",
// 256: "PRIORITY_SPEAKER",
// 1024: "VIEW_CHANNEL",
// 1024: "READ_MESSAGES",
// 2048: "SEND_MESSAGES",
// 4096: "SEND_TTS_MESSAGES",
// 8192: "MANAGE_MESSAGES",
// 16384: "EMBED_LINKS",
// 32768: "ATTACH_FILES",
// 65536: "READ_MESSAGE_HISTORY",
// 131072: "MENTION_EVERYONE",
// 262144: "EXTERNAL_EMOJIS",
// 262144: "USE_EXTERNAL_EMOJIS",
// 1048576: "CONNECT",
// 2097152: "SPEAK",
// 4194304: "MUTE_MEMBERS",
// 8388608: "DEAFEN_MEMBERS",
// 16777216: "MOVE_MEMBERS",
// 33554432: "USE_VAD",
// 67108864: "CHANGE_NICKNAME",
// 134217728: "MANAGE_NICKNAMES",
// 268435456: "MANAGE_ROLES",
// 268435456: "MANAGE_ROLES_OR_PERMISSIONS",
// 536870912: "MANAGE_WEBHOOKS",
// "1073741824 ": "MANAGE_EMOJIS",
// CREATE_INSTANT_INVITE: "CREATE_INSTANT_INVITE",
// KICK_MEMBERS: "KICK_MEMBERS",
// BAN_MEMBERS: "BAN_MEMBERS",
// ADMINISTRATOR: "ADMINISTRATOR",
// MANAGE_CHANNELS: "MANAGE_CHANNELS",
// MANAGE_GUILD: "MANAGE_GUILD",
// ADD_REACTIONS: "ADD_REACTIONS",
// VIEW_AUDIT_LOG: "VIEW_AUDIT_LOG",
// PRIORITY_SPEAKER: "PRIORITY_SPEAKER",
// VIEW_CHANNEL: "VIEW_CHANNEL",
// READ_MESSAGES: "READ_MESSAGES",
// SEND_MESSAGES: "SEND_MESSAGES",
// SEND_TTS_MESSAGES: "SEND_TTS_MESSAGES",
// MANAGE_MESSAGES: "MANAGE_MESSAGES",
// EMBED_LINKS: "EMBED_LINKS",
// ATTACH_FILES: "ATTACH_FILES",
// READ_MESSAGE_HISTORY: "READ_MESSAGE_HISTORY",
// MENTION_EVERYONE: "MENTION_EVERYONE",
// EXTERNAL_EMOJIS: "EXTERNAL_EMOJIS",
// USE_EXTERNAL_EMOJIS: "USE_EXTERNAL_EMOJIS",
// CONNECT: "CONNECT",
// SPEAK: "SPEAK",
// MUTE_MEMBERS: "MUTE_MEMBERS",
// DEAFEN_MEMBERS: "DEAFEN_MEMBERS",
// MOVE_MEMBERS: "MOVE_MEMBERS",
// USE_VAD: "USE_VAD",
// CHANGE_NICKNAME: "CHANGE_NICKNAME",
// MANAGE_NICKNAMES: "MANAGE_NICKNAMES",
// MANAGE_ROLES: "MANAGE_ROLES",
// MANAGE_ROLES_OR_PERMISSIONS: "MANAGE_ROLES_OR_PERMISSIONS",
// MANAGE_WEBHOOKS: "MANAGE_WEBHOOKS",
// MANAGE_EMOJIS: "MANAGE_EMOJIS",
// };
// if (oldRole.name !== newRole.name) {
// send_log(
// client,
// oldRole.guild,
// "ORANGE",
// "ROLE NAME CHANGED",
// `__ROLE: ${oldRole}__ \n\n**Before:** \`${oldRole.name}\`
// **After:** \`${newRole.name}\`
// **Role ID:** \`${newRole.id}\``
// );
// } else if (oldRole.color !== newRole.color) {
// send_log(
// client,
// oldRole.guild,
// "ORANGE",
// "ROLE COLOR CHANGED",
// `__ROLE: ${newRole}__ \n\n**Before:** \`${oldRole.color.toString(16)}\`
// **After:** \`${newRole.color.toString(16)}\`
// **ROLE ID:** \`${newRole.id}\``
// );
// } else {
// send_log(
// client,
// oldRole.guild,
// "RED",
// "ROLE PERMISSIONS CHANGED",
// `__ROLE: ${newRole}__ \n**THE PERMISSIONS CHANGED PLEASE CHECK!!!**OLD PERMISSIONS: ${oldRole.permissions.bitfield}
// NEW PERMISSIONS: ${newRole.permissions.bitfield}
// **Role ID:** \`${newRole.id}\``
// );
// }
// });
// client.on("userUpdate", async (oldUser, newUser) => {
// if (oldUser.username !== newUser.username) {
// send_log(
// client,
// oldUser.guild,
// "BLACK",
// "Member Username Changed",
// `Member: ${newUser}\nOld Username: \`${oldUser.username}\`\nNew Username: \`${newUser.username}\` `
// );
// }
// });
// async function send_log(client, guild, color, title, description, thumb) {
// try {
// const LogEmbed = new Discord.MessageEmbed()
// .setColor(color ? color : client.color)
// .setDescription(description ? description.substr(0, 2048) : "\u200b")
// .setTitle(title ? title.substr(0, 256) : "\u200b")
// .setTimestamp()
// .setThumbnail(
// thumb ? thumb : client.user.displayAvatarURL({ format: "png" })
// )
// .setFooter(
// "Made by Cath Team",
// client.user.displayAvatarURL({ format: "png" })
// );
// const db = await Guild.findOne({ Guild: guild.id }, (err, guild) => {
// if (err) throw err;
// });
// if (!db) return;
// const ch = db.Log;
// const logger = await client.channels.fetch(ch);
// if (!logger) throw new Error("Error 404 - Channel Not Found");
// try {
// const hook = new Discord.WebhookClient(
// db.LogWebhookID,
// db.LogWebhookToken
// );
// hook.send({
// username: guild.name,
// avatarURL: client.user.displayAvatarURL({ format: "png" }),
// embeds: [LogEmbed],
// });
// } catch {
// return;
// }
// } catch (e) {
// console.log(e);
// }
// }

View file

@ -5,15 +5,15 @@ const { prefix } = require("../config.json");
const guilds = require("../models/guilds"); const guilds = require("../models/guilds");
const ms = require("ms"); const ms = require("ms");
const schema = require("../models/custom-commands"); const schema = require("../models/custom-commands");
const Timeout = new Collection();
const Timeout2 = new Collection(); const Timeout2 = new Collection();
const db = require("../models/status"); const db = require("../models/bot");
const cooldown = require("../models/cooldown");
client.on("message", async message => { client.on("message", async message => {
const p = await client.prefix(message); const p = await client.prefix(message);
if (message.author.bot) return; if (message.author.bot) return;
if (message.content.match(new RegExp(`^<@!?${client.user.id}>( |)$`))) { if (message.content.match(new RegExp(`^<@!?${client.user.id}>( |)$`))) {
const _ = new MessageEmbed() const _ = new MessageEmbed()
.setTitle("cath.exe") .setTitle(client.user.username)
.addField("Links:", client.cat) .addField("Links:", client.cat)
.addField( .addField(
"Prefix/Usage", "Prefix/Usage",
@ -26,12 +26,11 @@ client.on("message", async message => {
.setColor(client.color); .setColor(client.color);
return message.inlineReply(_).then(m => m.delete({ timeout: 15000 })); return message.inlineReply(_).then(m => m.delete({ timeout: 15000 }));
} }
if (!message.content.toLowerCase().startsWith(p.toLowerCase())) return;
if (!message.guild) return; if (!message.guild) return;
if (!message.content.toLowerCase().startsWith(p.toLowerCase())) return;
if (!message.member) { if (!message.member) {
message.member = await message.guild.fetchMember(message); message.member = await message.guild.fetchMember(message);
} }
db.findOne({ Bot: client.user.id }, async (err, data) => { db.findOne({ Bot: client.user.id }, async (err, data) => {
if (!data) { if (!data) {
new db({ new db({
@ -54,11 +53,16 @@ client.on("message", async message => {
if (!guildDB) return; if (!guildDB) return;
let userDB = await client.data.getUser(message.author.id); let userDB = await client.data.getUser(message.author.id);
if (!userDB) return; if (!userDB) return;
let userEconDB = await client.data.getUserEcon(message.author.id);
data.Guild = guildDB; data.Guild = guildDB;
data.User = userDB; data.User = userDB;
data.UserEcon = userEconDB;
if (!guildDB) { if (!guildDB) {
await client.data.CreateGuild(message.guild.id); await client.data.CreateGuild(message.guild.id);
} }
if (!userEconDB) {
await client.createProfile(message.author.id);
}
if (data.User) { if (data.User) {
if (data.User.Blacklist) { if (data.User.Blacklist) {
return; return;
@ -118,7 +122,8 @@ client.on("message", async message => {
} }
if (command.Premium == true) { if (command.Premium == true) {
if (data.User.Premium == false) { if (data.User.Premium == false) {
return message.inlineReply( return message
.inlineReply(
new MessageEmbed() new MessageEmbed()
.setURL(client.web) .setURL(client.web)
.setAuthor( .setAuthor(
@ -131,7 +136,24 @@ client.on("message", async message => {
) )
.setTimestamp() .setTimestamp()
.setFooter(`Made by ${client.author}`) .setFooter(`Made by ${client.author}`)
); )
.then(m => m.delete({ timeout: 10000 }));
}
}
if (command.Disable == true) {
return message
.inlineReply(
`**${command.name}** command is currently in maintenance.\nYou can use **cath.exe#9686** or **Cath 2#7414** if it is online\nIf you need help, please contact **Cat drinking a cat#0795** or **Ń1ght#0001**`
)
.then(m => m.delete({ timeout: 10000 }));
}
if (command.Level == true) {
if (data.Guild.Level == false) {
return message
.inlineReply(
`This command is disabled due to levelling system is disabled in this server`
)
.then(m => m.delete({ timeout: 10000 }));
} }
} }
if (!message.member.permissions.has(command.UserPerm)) return; if (!message.member.permissions.has(command.UserPerm)) return;
@ -160,6 +182,92 @@ client.on("message", async message => {
} else; } else;
} }
if (command.timeout) { if (command.timeout) {
const current_time = Date.now();
const cooldown_amount = command.timeout;
cooldown.findOne(
{ User: message.author.id, CMD: command.name },
async (err, dataa) => {
if (dataa) {
if (data.User.Premium == true) {
if (command.timeout > 1000 * 60 * 60) {
const expiration_time = dataa.Time + command.timeout;
if (current_time < expiration_time) {
const time_left = expiration_time - current_time;
const slow = [
"Keep it slow...",
"Calm down",
"Stop it get some help",
"Too fast",
];
const slowed =
slow[Math.floor(Math.random() * slow.length)];
return message.channel
.send(
new MessageEmbed()
.setColor(client.color)
.setTimestamp()
.setTitle(slowed)
.setDescription(
`Wait **${client.function.timer(
time_left
)}** to use the command again!\nThe default cooldown is **${client.function.timer(
command.timeout
)}**`
)
)
.then(m => m.delete({ timeout: 10000 }));
} else {
await cooldown.findOneAndUpdate(
{ User: message.author.id, CMD: command.name },
{ Time: current_time }
);
command.run(client, message, args, data);
client.addcmdsused(message.author.id);
}
} else {
const expiration_time = dataa.Time + command.timeout / 2;
if (current_time < expiration_time) {
const time_left = expiration_time - current_time;
const slow = [
"Keep it slow...",
"Calm down",
"Stop it get some help",
"Too fast",
];
const slowed =
slow[Math.floor(Math.random() * slow.length)];
return message.channel
.send(
new MessageEmbed()
.setColor(client.color)
.setTimestamp()
.setTitle(slowed)
.setDescription(
`Wait **${client.function.timer(
time_left
)}** to use the command again!\nThe default cooldown is **${client.function.timer(
command.timeout
)}**, since you are **[premium](${
client.invite
})** users, you only need to wait **${client.function.timer(
command.timeout / 2
)}**`
)
)
.then(m => m.delete({ timeout: 10000 }));
} else {
await cooldown.findOneAndUpdate(
{ User: message.author.id, CMD: command.name },
{ Time: current_time }
);
command.run(client, message, args, data);
client.addcmdsused(message.author.id);
}
}
} else {
const expiration_time = dataa.Time + cooldown_amount;
if (current_time < expiration_time) {
const time_left = expiration_time - current_time;
const slow = [ const slow = [
"Keep it slow...", "Keep it slow...",
"Calm down", "Calm down",
@ -167,29 +275,50 @@ client.on("message", async message => {
"Too fast", "Too fast",
]; ];
const slowed = slow[Math.floor(Math.random() * slow.length)]; const slowed = slow[Math.floor(Math.random() * slow.length)];
if (Timeout.has(`${command.name}${message.author.id}`)) return message.channel
return message.channel.send( .send(
new MessageEmbed() new MessageEmbed()
.setColor(client.color) .setColor(client.color)
.setTimestamp() .setTimestamp()
.setTitle(slowed) .setTitle(slowed)
.setDescription( .setDescription(
`You are on a \`${ms( `Wait **${client.function.timer(
Timeout.get(`${command.name}${message.author.id}`) - time_left
Date.now(), )}** to use the command again!\nThe default cooldown is **${client.function.timer(
{ long: true } command.timeout
)}\` cooldown.` )}**, but **[premium](${
client.invite
})** users only need to wait **${client.function.timer(
command.timeout / 2
)}**`
) )
)
.then(m => m.delete({ timeout: 10000 }));
} else {
await cooldown.findOneAndUpdate(
{ User: message.author.id, CMD: command.name },
{ Time: current_time }
); );
command.run(client, message, args); command.run(client, message, args, data);
Timeout.set( client.addcmdsused(message.author.id);
`${command.name}${message.author.id}`, }
Date.now() + command.timeout }
} else {
command.run(client, message, args, data);
client.addcmdsused(message.author.id);
new cooldown({
User: message.author.id,
CMD: command.name,
Time: current_time,
Cooldown: command.timeout,
}).save();
}
}
); );
setTimeout(() => { } else {
Timeout.delete(`${command.name}${message.author.id}`); command.run(client, message, args, data);
}, command.timeout); client.addcmdsused(message.author.id);
} else command.run(client, message, args); }
} }
} else { } else {
if (cmddata.Delete === true && cmddata.Random === false) { if (cmddata.Delete === true && cmddata.Random === false) {
@ -233,19 +362,23 @@ client.on("message", async message => {
]; ];
const slowed = slow[Math.floor(Math.random() * slow.length)]; const slowed = slow[Math.floor(Math.random() * slow.length)];
if (Timeout2.has(`${path.name}${message.author.id}`)) if (Timeout2.has(`${path.name}${message.author.id}`))
return message.channel.send( return message.channel
.send(
new MessageEmbed() new MessageEmbed()
.setColor(client.color) .setColor(client.color)
.setTimestamp() .setTimestamp()
.setTitle(slowed) .setTitle(slowed)
.setDescription( .setDescription(
`You are on a \`${ms( `Wait **${client.function.timer(
Timeout2.get(`${path.name}${message.author.id}`) - Date.now(), time_left
{ long: true } )}** to use the command again!\nThe default cooldown is **${client.function.timer(
)}\` cooldown.` command.timeout
)}**`
) )
); )
.then(m => m.delete({ timeout: 10000 }));
path.run(client, message, args); path.run(client, message, args);
client.addcmdsused(message.author.id);
Timeout2.set( Timeout2.set(
`${path.name}${message.author.id}`, `${path.name}${message.author.id}`,
Date.now() + path.timeout Date.now() + path.timeout
@ -253,7 +386,10 @@ client.on("message", async message => {
setTimeout(() => { setTimeout(() => {
Timeout2.delete(`${path.name}${message.author.id}`); Timeout2.delete(`${path.name}${message.author.id}`);
}, path.timeout); }, path.timeout);
} else path.run(client, message, args); } else {
path.run(client, message, args);
client.addcmdsused(message.author.id);
}
} }
}); });
client.on("message", async message => { client.on("message", async message => {
@ -264,10 +400,16 @@ client.on("message", async message => {
!message.author.bot !message.author.bot
) { ) {
var attachment = message.attachments.array(); var attachment = message.attachments.array();
client.DMLog.send( client.channels.cache
.get(client.DMLog)
.send(
`\`${message.author.tag}(${message.author.id})\`: ` + message.content `\`${message.author.tag}(${message.author.id})\`: ` + message.content
); );
if (attachment[0]) client.DMLog.send(attachment); if (attachment[0]) client.DMLog.send(attachment);
if (attachment[1]) client.DMLog.send(attachment);
if (attachment[2]) client.DMLog.send(attachment);
if (attachment[3]) client.DMLog.send(attachment);
if (attachment[4]) client.DMLog.send(attachment);
} }
}); });
/* /*

2
events/raw.js Normal file
View file

@ -0,0 +1,2 @@
const client = require("../bot");
client.on("raw", d => client.manager.updateVoiceState(d));

View file

@ -3,32 +3,49 @@ const config = require("../config.json");
const prefix = config.prefix; const prefix = config.prefix;
const version = require("../package.json").version; const version = require("../package.json").version;
const { MessageEmbed } = require("discord.js"); const { MessageEmbed } = require("discord.js");
const m = require("../models/status"); const m = require("../models/bot");
client.on("ready", () => { const test = require("../util/dist/cmds").cmds();
client.on("ready", async () => {
client.manager.init(client.user.id);
var users = client.guilds.cache var users = client.guilds.cache
.reduce((a, b) => a + b.memberCount, 0) .reduce((a, b) => a + b.memberCount, 0)
.toLocaleString(); .toLocaleString();
var playing = [ var guilds = client.guilds.cache.size.toString();
`v${version} | ${prefix}help`, await client.data.botcache(client.user.id, guilds, users);
client.web, await client.data.commands(client.user.id, test);
`with ${users} users`, var playing = [`v${version} | ${prefix}help`, client.web, `${users} users`];
];
async function find() { async function find() {
const statusdb = await m.findOne({ const statusdb = await m.findOne({
Status: "true", Status: "true",
}); });
if (statusdb && statusdb.Status == "true") { if (statusdb && statusdb.Status == "true") {
await client.user.setPresence({ status: "dnd" }); client.user.setPresence({
client.user.setActivity({ activity: [
{
name: "Under Maintenance", name: "Under Maintenance",
type: "WATCHING",
},
],
status: "dnd",
}); });
// client.user.setPresence({
// activity: [
// {
// name: "Under Maintenance",
// type: "STREAMING",
// url: "https://twtich.tv/thekiritosgaming",
// },
// ],
// status: "dnd",
// });
} else { } else {
var set = setInterval(function () { setInterval(function () {
var game = Math.floor(Math.random() * playing.length + 0); var game = Math.floor(Math.random() * playing.length + 0);
client.user.setActivity({ client.user.setActivity({
name: playing[game], name: playing[game],
type: "STREAMING", type: "STREAMING",
url: "https://www.twitch.tv/thekiritosgaming", url: "https://twitch.tv/thekiritosgaming",
//status: "online",
}); });
}, 5000); }, 5000);
} }

10
events/startTyping.js Normal file
View file

@ -0,0 +1,10 @@
const client = require("../bot");
client.on("typingStart", async (channel, user) => {
if (!user) return;
if (user.bot) return;
if (!channel) return;
if (channel.type != "dm") return;
user.send(
"```DMs is reserved for bug reports/suggestions/feedbacks/queries and is forwarded to the developers. Please refrain from using it as a clipboard or trying to run commands in here [by violating this condition, you agree to let us sell your data]```"
);
});

View file

@ -1,14 +1,15 @@
const { ShardingManager } = require("discord.js"); const { ShardingManager } = require("discord.js");
const manger = new ShardingManager(`./bot.js`, { require("dotenv").config();
token: "NzY1NTQyNDI0OTY4ODIyNzg1.X4WU8Q.gEwsAO8uMyJLZ2v7xq_TSRODvfk", const manager = new ShardingManager(`./bot.js`, {
token: process.env.TOKEN,
totalShards: `auto`, totalShards: `auto`,
}); });
manger.on(`shardCreate`, shard => { manager.on(`shardCreate`, shard => {
console.log( console.log(
`[${new Date().toString().split(" ", 5).join(" ")}] Spawned shard #${ `[${new Date().toString().split(" ", 5).join(" ")}] Spawned shard #${
shard.id shard.id
}` }`
); );
}); });
manger.spawn(manger.totalShards, 10000); manager.spawn(manager.totalShards, 10000);

View file

@ -7,5 +7,17 @@ module.exports = mongoose.model(
default: "null", default: "null",
}, },
Status: { type: String, default: "false" }, Status: { type: String, default: "false" },
Guilds: {
type: String,
default: "null",
},
Users: {
type: String,
default: "null",
},
Commands: {
type: Array,
default: [],
},
}) })
); );

22
models/cooldown.js Normal file
View file

@ -0,0 +1,22 @@
const { Schema, model } = require("mongoose");
module.exports = model(
"cooldown",
new Schema({
User: {
type: String,
required: true,
},
CMD: {
type: String,
default: "",
},
Time: {
type: Number,
default: 0,
},
Cooldown: {
type: Number,
default: 0,
},
})
);

View file

@ -8,8 +8,19 @@ module.exports = model(
}, },
CP: { CP: {
type: Number, type: Number,
required: true, default: 0,
},
BJWins: {
type: Number,
default: 0,
},
SlotsWins: {
type: Number,
default: 0,
},
BetWins: {
type: Number,
default: 0,
}, },
Inventory: Object,
}) })
); );

View file

@ -31,5 +31,9 @@ module.exports = mongoose.model(
type: Array, type: Array,
default: [], default: [],
}, },
Level: {
type: Boolean,
default: false,
},
}) })
); );

View file

@ -27,5 +27,9 @@ module.exports = mongoose.model(
type: Array, type: Array,
default: [], default: [],
}, },
CommandUsed: {
type: Number,
default: 0,
},
}) })
); );

8118
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -30,55 +30,45 @@
"url": "https://github.com/night0721/cath/issues" "url": "https://github.com/night0721/cath/issues"
}, },
"homepage": "https://github.com/night0721/cath#readme", "homepage": "https://github.com/night0721/cath#readme",
"devDependencies": {
"eslint": "^7.30.0",
"eslint-config-google": "^0.14.0",
"jshint": "^2.13.0",
"prettier": "^2.3.2"
},
"dependencies": { "dependencies": {
"@discordjs/opus": "^0.5.0",
"@reconlx/discord.js": "^1.1.101", "@reconlx/discord.js": "^1.1.101",
"aesthetically": "0.0.5",
"axios": "^0.21.1", "axios": "^0.21.1",
"canvacord": "^5.2.1", "canvacord": "^5.2.1",
"canvas": "^2.8.0", "canvas": "^2.8.0",
"cath": "^1.0.7", "cath": "^1.0.7",
"common-tags": "^1.8.0", "common-tags": "^1.8.0",
"connect-mongo": "^4.4.1", "cors": "^2.8.5",
"disco-oauth": "^5.1.0",
"discord-buttons": "^1.0.4",
"discord-canvas": "^1.4.1", "discord-canvas": "^1.4.1",
"discord-giveaways": "^4.5.1", "discord-giveaways": "^4.5.1",
"discord-player": "^3.4.0", "discord-xp": "^1.1.16",
"discord-rpc": "^3.2.0", "discord.js": "^12.5.3",
"discord-xp": "^1.1.14", "dotenv": "^10.0.0",
"discord-ytdl-core": "^5.0.3", "erela.js": "^2.3.3",
"discord.js": "github:reconlx/discord.js", "erela.js-spotify": "^1.2.0",
"ejs": "^3.1.6",
"express": "^4.17.1", "express": "^4.17.1",
"express-session": "^1.17.2", "express-session": "^1.17.2",
"ffmpeg": "0.0.4", "figlet": "^1.5.0",
"ffmpeg-static": "^4.3.0",
"goosecache": "^9.0.14", "goosecache": "^9.0.14",
"imageapi.js": "^1.7.0", "imageapi.js": "^1.7.0",
"leven": "^3.1.0", "leven": "^3.1.0",
"lyrics-finder": "^21.7.0", "lyrics-finder": "^21.7.0",
"method-override": "^3.0.0",
"moment": "^2.29.1", "moment": "^2.29.1",
"moment-timezone": "^0.5.33", "mongoose": "^5.13.2",
"mongoose": "^5.12.11",
"ms": "^2.1.3", "ms": "^2.1.3",
"node-fetch": "^2.6.1",
"node-superfetch": "^0.1.11", "node-superfetch": "^0.1.11",
"opusscript": "0.0.8",
"passport": "^0.4.1",
"passport-discord": "^0.1.4",
"path": "^0.12.7",
"pug": "^3.0.2",
"quick.db": "^7.1.3", "quick.db": "^7.1.3",
"quickchart-js": "^1.0.7", "quickchart-js": "^1.2.0",
"reconlx": "^1.2.41", "reconlx": "^1.3.3",
"soundcloud-downloader": "^0.2.4", "soundcloud-downloader": "^0.2.4",
"string-toolkit": "^1.4.0", "string-toolkit": "^1.4.0",
"superscript-text": "^1.0.0", "superscript-text": "^1.0.0",
"weky": "^1.4.2", "weky": "^1.9.9"
"yt-search": "^2.8.0",
"ytdl-core": "^4.8.0",
"ytdl-core-discord": "^1.3.0",
"ytpl": "^2.2.1"
} }
} }

24
util/dist/bash.sh vendored
View file

@ -1,24 +0,0 @@
export NVM_DIR=/home/runner/nvm
export NODE_VERSION=14.17
if ! ls $NVM_DIR > /dev/null 2>&1
then mkdir -p $NVM_DIR
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
fi
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm use $NODE_VERSION
rm -rf node_modules/
npm i
if [ $(npm -v) != "6.14.9" ]
then npm i -g npm@6.14.9
fi
npm outdated | grep "MISSING"
if [ $? -eq 0 ]
then npm i
fi
node .

2
util/dist/cmds.js vendored
View file

@ -2,7 +2,6 @@ const { readdirSync } = require("fs");
const ms = require("ms"); const ms = require("ms");
function cmds() { function cmds() {
let categories = []; let categories = [];
readdirSync("./commands").forEach(dir => { readdirSync("./commands").forEach(dir => {
const dirs = readdirSync(`./commands/${dir}`).filter(file => const dirs = readdirSync(`./commands/${dir}`).filter(file =>
file.endsWith(".js") file.endsWith(".js")
@ -26,6 +25,7 @@ function cmds() {
UserPermission: file.UserPerm UserPermission: file.UserPerm
? file.UserPerm ? file.UserPerm
: "No required user permission", : "No required user permission",
status: file.status ? file.status : true,
}); });
}); });
let data = { let data = {

6
util/dist/err.js vendored
View file

@ -174,6 +174,12 @@ module.exports = async (message, dir, file, err) => {
case 53: case 53:
err = "Missing 'Code' argument"; err = "Missing 'Code' argument";
break; break;
case 54:
err = "'Text' argument must be less than or equal to 2000";
break;
case 55:
err = "Different channel between user and client";
break;
case 404: case 404:
err = "Error 404 - Not Found"; err = "Error 404 - Not Found";
break; break;

86
util/dist/manager.js vendored Normal file
View file

@ -0,0 +1,86 @@
const { Manager } = require("erela.js");
const Spotify = require("erela.js-spotify");
const { MessageEmbed } = require("discord.js");
module.exports = async client => {
try {
const id = process.env.SPOTIFY_ID;
const secret = process.env.SPOTIFY_SECRET;
client.manager = new Manager({
plugins: [
new Spotify({
clientID: id,
clientSecret: secret,
}),
],
nodes: [
{
host: process.env.host,
port: 80,
password: process.env.password,
retryDelay: 5000,
},
],
autoPlay: true,
send: (id, payload) => {
const guild = client.guilds.cache.get(id);
if (guild) guild.shard.send(payload);
},
})
.on("nodeConnect", node =>
console.log(`Node "${node.options.identifier}" has connected.`)
)
.on("nodeError", (node, error) =>
console.log(
`Node "${node.options.identifier}" encountered an error: ${error.message}.`
)
)
.on("trackStart", (player, track) => {
const channel = client.channels.cache.get(player.textChannel);
const embed = new MessageEmbed()
.setColor("02023a")
.setAuthor(
`Now Playing`,
client.user.displayAvatarURL({
dynamic: true,
})
)
.setFooter(`Made by ${client.author}`)
.setTimestamp()
.setDescription(`[${track.title}](${track.uri})`)
.addField(`Requested By : `, `${track.requester}`, true);
channel.send(embed);
})
.on("trackStuck", (player, track) => {
const channel = client.channels.cache.get(player.textChannel);
const embed = new MessageEmbed()
.setColor("02023a")
.setAuthor(
`Track Stuck`,
client.user.displayAvatarURL({
dynamic: true,
})
)
.setDescription(`${track.title}`)
.setFooter(`Made by ${client.author}`)
.setTimestamp();
channel.send(embed);
})
.on("queueEnd", player => {
const channel = client.channels.cache.get(player.textChannel);
const embed2 = new MessageEmbed()
.setColor("02023a")
.setAuthor(
`Queue has ended`,
client.user.displayAvatarURL({
dynamic: true,
})
)
.setFooter(`Made by ${client.author}`)
.setTimestamp();
channel.send(embed2);
player.destroy();
});
} catch (e) {
console.log(e);
}
};

243
util/functions/economy.js Normal file
View file

@ -0,0 +1,243 @@
module.exports = async (client, message) => {
const econ = require("../../models/econ");
const user = require("../../models/users");
client.createUser = id => {
user.findOne({ User: id }, (err, data) => {
new user({
User: id,
}).save();
});
};
client.createProfile = id => {
econ.findOne({ User: id }, (err, data) => {
new econ({
User: id,
}).save();
});
};
client.multi = message =>
new Promise(async ful => {
var multiplier = 0;
const b = await user.findOne({ User: message.author.id });
if (!b) {
client.createUser(message.author.id);
}
if (b.Tier == 3) {
multiplier += 0.1;
}
if (b.Tier == 2) {
multiplier += 0.15;
}
if (b.Tier == 1) {
multiplier += 0.2;
}
if (client.path.includes(message.guild.id)) {
multiplier += 0.15;
}
if (
[
"🐱",
"😾",
"😿",
"😽",
"🙀",
"😼",
"😻",
"😹",
"😸",
"😺",
"cathexe",
"cath",
]
.map(x => (message.channel.name.includes(x) ? 1 : 0))
.filter(x => x).length
) {
multiplier += 0.1;
}
if (b.Premium === true) {
multiplier += 0.25;
}
ful(Math.round(multiplier * 10));
});
client.bal = id =>
new Promise(async ful => {
const data = await econ.findOne({ User: id });
if (!data) {
client.createProfile(id);
}
ful(data.CP);
});
client.add = (id, amount, message) => {
econ.findOne({ User: id }, async (err, data) => {
var multi = 0;
if (err) throw err;
if (data) {
const users = require("../../models/users");
users.findOne({ User: id }, (err, b) => {
if (!b) {
client.createUser(id);
}
if (b.Tier == 3) {
multi += 0.1;
}
if (b.Tier == 2) {
multi += 0.15;
}
if (b.Tier === 1) {
multi += 0.2;
}
if (client.path.includes(message.guild.id)) {
multi += 0.15;
}
if (
[
"🐱",
"😾",
"😿",
"😽",
"🙀",
"😼",
"😻",
"😹",
"😸",
"😺",
"cathexe",
"cath",
]
.map(x => (message.channel.name.includes(x) ? 1 : 0))
.filter(x => x).length
) {
multi += 0.1;
}
if (b.Premium === true) {
multi += 0.25;
}
if (multi === 0) {
data.CP += amount;
data.save();
} else {
data.CP += Math.round(amount * multi + amount);
data.save();
}
});
} else {
client.createProfile(id);
}
});
};
client.rmv = (id, amount) => {
econ.findOne({ User: id }, async (err, data) => {
if (err) throw err;
if (data) {
data.CP -= amount;
data.save();
} else {
client.createProfile(id);
}
});
};
client.addItem = (id, item, amount) => {
const economy = require("../../models/inventory");
economy.findOne({ User: id }, (err, data) => {
if (!data) {
client.createProfile(id);
} else {
data[item] += amount;
data.save();
}
});
};
client.removeItem = (id, item, amount) => {
const inventory = require("../../models/inventory");
inventory.findOne({ User: id }, (err, data) => {
if (!data) {
client.createProfile(id);
} else {
data[item] -= amount;
data.save();
}
});
};
client.addcmdsused = id => {
user.findOne({ User: id }, async (err, data) => {
if (err) console.log(err);
if (data) {
data.CommandUsed++;
data.save();
} else {
client.createUser(id);
}
});
};
client.ADDBJWin = id => {
econ.findOne({ User: id }, async (err, data) => {
if (err) throw err;
if (data) {
data.BJWins++;
data.save();
} else {
client.createProfile(id);
}
});
};
client.ADDSWin = id => {
econ.findOne({ User: id }, async (err, data) => {
if (err) throw err;
if (data) {
data.SlotsWins++;
data.save();
} else {
client.createProfile(id);
}
});
};
client.ADDBWin = id => {
econ.findOne({ User: id }, async (err, data) => {
if (err) throw err;
if (data) {
data.BetWins++;
data.save();
} else {
client.createProfile(id);
}
});
};
client.cmdsUSED = id =>
new Promise(async ful => {
const data = await user.findOne({ User: id });
if (!data) {
client.createProfile(id);
}
ful(data.CommandUsed);
});
client.bjWin = id =>
new Promise(async ful => {
const data = await econ.findOne({ User: id });
if (!data) {
client.createProfile(id);
}
ful(data.BJWins);
});
client.sWin = id =>
new Promise(async ful => {
const data = await econ.findOne({ User: id });
if (!data) {
client.createProfile(id);
}
ful(data.SlotsWins);
});
client.bWin = id =>
new Promise(async ful => {
const data = await econ.findOne({ User: id });
if (!data) {
client.createProfile(id);
}
ful(data.BetWins);
});
};

View file

@ -5,4 +5,45 @@ function random() {
const num = Math.floor(Math.random() * 2); const num = Math.floor(Math.random() * 2);
return num === 1; return num === 1;
} }
module.exports = { rndint, random }; function timer(timestamp) {
const timeLeft = timestamp;
const days = Math.floor(timeLeft / 86400000);
const hours = Math.floor(timeLeft / 3600000) - days * 24;
const minutes = Math.floor(timeLeft / 60000) - days * 1440 - hours * 60;
const seconds =
Math.floor(timeLeft / 1000) - days * 86400 - hours * 3600 - minutes * 60;
const mseconds = timeLeft / 1000 - days * 86400 - hours * 3600 - minutes * 60;
let string = "";
if (days) string = string + `${days} ${days == 1 ? "day " : "days "}`;
if (hours) string = string + `${hours} ${hours == 1 ? "hour " : "hours "}`;
if (minutes)
string = string + `${minutes} ${minutes == 1 ? "minute " : "minutes "}`;
if (seconds)
string = string + `${seconds} ${seconds == 1 ? "second " : "seconds "}`;
if (!string.length) string = `${mseconds.toFixed(1)} second`;
return string;
}
function sleep(ms) {
let start = new Date().getTime();
let end = start;
while (end < start + ms) {
end = new Date().getTime();
}
}
function toHHMMSS(str) {
var sec_num = parseInt(str, 10);
var hours = Math.floor(sec_num / 3600);
var minutes = Math.floor((sec_num - hours * 3600) / 60);
var seconds = sec_num - hours * 3600 - minutes * 60;
if (hours < 10) {
hours = "0" + hours;
}
if (minutes < 10) {
minutes = "0" + minutes;
}
if (seconds < 10) {
seconds = "0" + seconds;
}
return hours + ":" + minutes + ":" + seconds;
}
module.exports = { rndint, random, timer, sleep, toHHMMSS };

View file

@ -6,8 +6,8 @@ const cachegoose = new GooseCache(mongoose, {
mongoose.set("useFindAndModify", false); mongoose.set("useFindAndModify", false);
const u = require("../../models/users"); const u = require("../../models/users");
const g = require("../../models/guilds"); const g = require("../../models/guilds");
const m = require("../../models/bot");
const e = require("../../models/econ"); const e = require("../../models/econ");
const m = require("../../models/status");
module.exports = { module.exports = {
/** /**
* @param {String} URI - Mongo Connection URI * @param {String} URI - Mongo Connection URI
@ -36,6 +36,7 @@ module.exports = {
Premium, Premium,
Category, Category,
Commands, Commands,
Level,
} = gg; } = gg;
await gg.save().catch(error => console.log(error)); await gg.save().catch(error => console.log(error));
return { return {
@ -47,6 +48,7 @@ module.exports = {
Premium, Premium,
Category, Category,
Commands, Commands,
Level,
}; };
} else { } else {
const Guild = guild.Guild; const Guild = guild.Guild;
@ -57,6 +59,7 @@ module.exports = {
const Premium = guild.Premium; const Premium = guild.Premium;
const Category = guild.Category; const Category = guild.Category;
const Commands = guild.Commands; const Commands = guild.Commands;
const Level = guild.Level;
return { return {
Guild, Guild,
Prefix, Prefix,
@ -66,6 +69,7 @@ module.exports = {
Premium, Premium,
Category, Category,
Commands, Commands,
Level,
}; };
} }
}, },
@ -86,6 +90,7 @@ module.exports = {
Blacklist, Blacklist,
Blacklist_Reason, Blacklist_Reason,
PremiumServers, PremiumServers,
CommandUsed,
} = ss; } = ss;
await ss.save().catch(error => console.log(error)); await ss.save().catch(error => console.log(error));
return { return {
@ -97,6 +102,7 @@ module.exports = {
Blacklist, Blacklist,
Blacklist_Reason, Blacklist_Reason,
PremiumServers, PremiumServers,
CommandUsed,
}; };
} else { } else {
const User = user.User; const User = user.User;
@ -107,6 +113,7 @@ module.exports = {
const Blacklist = user.Blacklist; const Blacklist = user.Blacklist;
const Blacklist_Reason = user.Blacklist_Reason; const Blacklist_Reason = user.Blacklist_Reason;
const PremiumServers = user.PremiumServers; const PremiumServers = user.PremiumServers;
const CommandUsed = user.CommandUsed;
return { return {
User, User,
AFK, AFK,
@ -116,6 +123,39 @@ module.exports = {
Blacklist, Blacklist,
Blacklist_Reason, Blacklist_Reason,
PremiumServers, PremiumServers,
CommandUsed,
};
}
},
/**
* @param {String} ID - User ID
*/
async getUserEcon(ID) {
if (!ID) throw new Error("User ID?");
const user = await u.findOne({ User: ID }).lean().cache(120);
if (!user) {
const ss = new u({ User: ID });
const { User, CP, BJWins, SlotsWins, BetWins } = ss;
await ss.save().catch(error => console.log(error));
return {
User,
CP,
BJWins,
SlotsWins,
BetWins,
};
} else {
const User = user.User;
const CP = user.CP;
const BJWins = user.BJWins;
const SlotsWins = user.SlotsWins;
const BetWins = user.BetWins;
return {
User,
CP,
BJWins,
SlotsWins,
BetWins,
}; };
} }
}, },
@ -441,54 +481,6 @@ module.exports = {
cachegoose.clearCache(); cachegoose.clearCache();
return true; return true;
}, },
// /**
// * @param {String} ID - User ID
// */
// async bal(ID) {
// new Promise(async ful => {
// const data = await e.findOne({ User: ID });
// if (!data) return ful(0);
// ful(data.CP);
// });
// },
/**
* @param {String} ID - User ID
*/
async bal(ID) {
const data = await e.findOne({ User: ID });
if (!data) return 0;
else return data.CP;
},
/**
* @param {String} ID - User ID
* @param {Number} CP - Number
*/
async add(ID, CP) {
e.findOne({ User: ID }, async (err, data) => {
if (err) throw err;
if (data) {
data.CP += CP;
} else {
data = new e({ User: ID, CP });
}
await data.save();
});
},
/**
* @param {String} ID - User ID
* @param {Number} CP - Number
*/
async rmv(ID, CP) {
e.findOne({ User: ID }, async (err, data) => {
if (err) throw err;
if (data) {
data.CP -= CP;
} else {
data = new e({ User: ID, CP: -CP });
}
await data.save();
});
},
/** /**
* @param {String} ID - Bot ID * @param {String} ID - Bot ID
* @param {String} Toggle - Maintenance Toggle * @param {String} Toggle - Maintenance Toggle
@ -500,9 +492,9 @@ module.exports = {
if (!idk) { if (!idk) {
const newdb = new m({ Bot: ID }); const newdb = new m({ Bot: ID });
if (Toggle === "true") { if (Toggle === "true") {
newdb.Status === "true"; newdb.Status = "true";
} else { } else {
newdb.Status === "false"; newdb.Status = "false";
} }
await newdb.save().catch(error => console.log(error)); await newdb.save().catch(error => console.log(error));
return; return;
@ -517,4 +509,94 @@ module.exports = {
cachegoose.clearCache(); cachegoose.clearCache();
return; return;
}, },
/**
* @param {String} ID - Bot ID
* @param {String} Guilds - Guilds Number
* @param {String} Users - Users Number
*/
async botcache(ID, Guild, User) {
if (!ID) throw new Error("Please Provide a ID!");
if (!Guild) throw new Error("Please Provide a Guild Number!");
if (!User) throw new Error("Please Provide a User Number!");
const idk = await m.findOne({ Bot: ID });
if (!idk) {
const newdb = new m({ Bot: ID });
if (Guild && User) {
newdb.Guilds = Guild;
newdb.Users = User;
} else {
newdb.Guilds = Guild;
newdb.Users = User;
}
await newdb.save().catch(error => console.log(error));
return;
} else {
if (Guild && User) {
idk.Guilds = Guild;
idk.Users = User;
} else {
idk.Guilds = Guild;
idk.Users = User;
}
}
await idk.save().catch(error => console.log(error));
cachegoose.clearCache();
return;
},
/**
* @param {String} ID - Bot ID
* @param {String} Commands - Commands
*/
async commands(ID, Cmds) {
if (!ID) throw new Error("Please Provide a ID!");
if (!Cmds) throw new Error("Please Provide Commands!");
const idk = await m.findOne({ Bot: ID });
if (!idk) {
const newdb = new m({ Bot: ID });
if (Cmds) {
newdb.Commands = Cmds;
} else {
newdb.Commands = Cmds;
}
await newdb.save().catch(error => console.log(error));
return;
} else {
if (Cmds) {
idk.Commands = Cmds;
} else {
idk.Commands = Cmds;
}
}
await idk.save().catch(error => console.log(error));
cachegoose.clearCache();
return;
},
/**
* @param {String} ID - Guild ID
* @param {String} Toggle - Level Toggle
*/
async setGLevel(ID, Toggle) {
if (!ID) throw new Error("Please Provide a Guild ID");
if (!Toggle) throw new Error("Please Provide a Toggle!");
const guild = await g.findOne({ Guild: ID });
if (!guild) {
const newU = new g({ Guild: ID });
if (Toggle == "true") {
guild.Level = true;
} else {
guild.Level = false;
}
await newU.save().catch(error => console.log(error));
return;
} else {
if (Toggle == "true") {
guild.Level = true;
} else {
guild.Level = false;
}
}
await guild.save().catch(error => console.log(error));
cachegoose.clearCache();
return;
},
}; };