mirror of
https://github.com/Ninluc/Dat_Boi.git
synced 2025-08-09 18:16:15 +02:00
Initial commit
This commit is contained in:
11
.gitignore
vendored
Normal file
11
.gitignore
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
# Packages
|
||||
node_modules/
|
||||
|
||||
# IDE files
|
||||
.vscode/
|
||||
|
||||
# local env files
|
||||
botconfig/config.json
|
||||
|
||||
# Large files
|
||||
sounds/
|
6
botconfig/config.example.json
Executable file
6
botconfig/config.example.json
Executable file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"token": "YOUR_BOT_TOKEN",
|
||||
"prefix": "[",
|
||||
"defaultCommandCooldown" : 1,
|
||||
"statusChangeInterval": 8
|
||||
}
|
6
botconfig/embed.json
Executable file
6
botconfig/embed.json
Executable file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"color": "#00ff80",
|
||||
"wrongcolor": "#ff1111",
|
||||
"footertext": "Dat Boi",
|
||||
"footericon": ""
|
||||
}
|
3
botconfig/misc.json
Normal file
3
botconfig/misc.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"MESSAGE_CHAR_LIMIT" : 2000
|
||||
}
|
40
commands/Divers/embed.txt
Executable file
40
commands/Divers/embed.txt
Executable file
@ -0,0 +1,40 @@
|
||||
const { MessageEmbed } = require("discord.js");
|
||||
const config = require("../../botconfig/config.json");
|
||||
const ee = require("../../botconfig/embed.json");
|
||||
module.exports = {
|
||||
name: "embed",
|
||||
category: "Administration",
|
||||
aliases: ["say-embed"],
|
||||
cooldown: 2,
|
||||
usage: "embed <TITLE> ++ <DESCRIPTION>",
|
||||
description: "Resends a message from you as an Embed",
|
||||
run: async (client, message, args, user, text, prefix) => {
|
||||
try{
|
||||
if(!args[0])
|
||||
return message.channel.send(new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle(`❌ ERROR | You didn't provided a Title, nor a Description`)
|
||||
.setDescription(`Usage: \`${prefix}${this.usage}\``)
|
||||
);
|
||||
let userargs = args.join(" ").split("++");
|
||||
let title = userargs[0];
|
||||
let desc = userargs.slice(1).join(" ")
|
||||
message.channel.send(new MessageEmbed()
|
||||
.setColor(ee.color)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle(title ? title : "")
|
||||
.setDescription(desc ? desc : "")
|
||||
)
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).bgRed)
|
||||
return message.channel.send(new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle(`❌ ERREUR | Une erreur est survenue : `)
|
||||
.setDescription(`\`\`\`${e.stack}\`\`\``)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
199
commands/Divers/highway.js
Normal file
199
commands/Divers/highway.js
Normal file
@ -0,0 +1,199 @@
|
||||
const { MessageEmbed } = require("discord.js");
|
||||
const config = require("../../botconfig/config.json");
|
||||
const ee = require("../../botconfig/embed.json");
|
||||
const misc = require("../../botconfig/misc.json");
|
||||
const { delay } = require("../../handlers/functions");
|
||||
|
||||
|
||||
function createLane(lanesNb, height, carPercent, specialCarPercent, separation, trees_distance) {
|
||||
// Check lanesNb
|
||||
if (lanesNb > 30) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Default arguments
|
||||
lanesNb = lanesNb || 3;
|
||||
if (height > 300) {
|
||||
height = 300;
|
||||
} else {
|
||||
height = height || 30;
|
||||
}
|
||||
carPercent = carPercent || 15;
|
||||
specialCarPercent = specialCarPercent || 5;
|
||||
separation = separation || lanesNb >= 2 ? true : false
|
||||
trees_distance = trees_distance || 3
|
||||
|
||||
ROAD_MIDDLE = Math.floor(lanesNb / 2)
|
||||
|
||||
lanes = ""
|
||||
toSend = [];
|
||||
roadSeparation = Math.floor(Math.random() * 4) == 0
|
||||
separationLen = 0
|
||||
separationPart = 0
|
||||
for (i = 0; i<height;i++) {
|
||||
str = "";
|
||||
for (x = 0; x<lanesNb;x++) {
|
||||
// Try to get the separation back
|
||||
if (x == ROAD_MIDDLE && !roadSeparation && separationLen <= 0) {
|
||||
separationLen -= 1
|
||||
roadSeparation = Math.floor(Math.random() * (Math.abs(separationLen / (height / 5)))) != 0
|
||||
}
|
||||
|
||||
// ROAD SEPARATION
|
||||
// Separation start
|
||||
if (separation && x == ROAD_MIDDLE && separationLen < 0 && roadSeparation) {
|
||||
str = str.slice(0, str.length - 1)
|
||||
|
||||
if (separationPart == 1) {
|
||||
str += ROAD_SEPARATION__START_2
|
||||
separationPart = 0
|
||||
separationLen = 0
|
||||
}
|
||||
else {
|
||||
str += ROAD_SEPARATION__START_1
|
||||
separationPart = 1
|
||||
}
|
||||
}
|
||||
// Separation end
|
||||
else if (separation && x == ROAD_MIDDLE && separationLen > 0 && !roadSeparation) {
|
||||
str = str.slice(0, str.length - 1)
|
||||
|
||||
// if (separationLen < 0) {
|
||||
// separationLen = 0
|
||||
// }
|
||||
|
||||
if (separationPart == 1) {
|
||||
str += ROAD_SEPARATION__END_2
|
||||
separationPart = 0
|
||||
separationLen = 0
|
||||
}
|
||||
else {
|
||||
str += ROAD_SEPARATION__END_1
|
||||
separationPart = 1
|
||||
}
|
||||
}
|
||||
else if (separation && x == ROAD_MIDDLE && roadSeparation) {
|
||||
str = str.slice(0, str.length - 1);
|
||||
if (separationLen % trees_distance == 0) {
|
||||
str += ROAD_SEPARATION__TREE;
|
||||
}
|
||||
else {
|
||||
str += ROAD_SEPARATION;
|
||||
}
|
||||
separationLen += 1;
|
||||
|
||||
roadSeparation = Math.floor(Math.random() * ((height/2) - separationLen)) != 0
|
||||
}
|
||||
else {
|
||||
|
||||
// LEFT OUTER LANE
|
||||
if (x == 0) {
|
||||
str += ROAD_LINE_CHAR;
|
||||
}
|
||||
|
||||
if (Math.floor(Math.random() * (100/carPercent)) == 0) {
|
||||
if (Math.floor(Math.random() * (100/specialCarPercent)) == 0) {
|
||||
str += ROAD_WT_SPECIAL_CAR();
|
||||
}
|
||||
else {
|
||||
str += ROAD_WT_CAR_CHAR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
str += ROAD_CHAR;
|
||||
}
|
||||
|
||||
// RIGHT OUTER LANE
|
||||
if (x == lanesNb -1) {
|
||||
str += ROAD_LINE_CHAR;
|
||||
}
|
||||
else {
|
||||
str += LANES_LINE_CHAR;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// MESSAGE LENGTH CHECK
|
||||
if ((lanes.length + str.length + 2) >= misc.MESSAGE_CHAR_LIMIT) {
|
||||
toSend.push(lanes);
|
||||
lanes = str + "\n"
|
||||
}
|
||||
else {
|
||||
lanes += str + "\n";
|
||||
}
|
||||
|
||||
}
|
||||
toSend.push(lanes);
|
||||
|
||||
// Slicing
|
||||
return toSend;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
name: "highway",
|
||||
category: "Divers",
|
||||
cooldown: 0,
|
||||
usage: "highway [nb_de_bandes] [hauteur] [pourcentage_de_voitures] [pourcentage_de_voitures_de_police] [separation_centrale (true | false)] [distance_entre_les_arbres]",
|
||||
description: 'Creer une autoroute juste pour vos beaux yeux.\n`nb_de_bandes` doit être plus petit ou égal à 30 (Limitation des longueurs de messages)',
|
||||
run: async (client, message, args, user, text, prefix) => {
|
||||
try{
|
||||
LANES_NB_MAX = 27;
|
||||
|
||||
// ROAD_LINE_CHAR = "︱";
|
||||
// ROAD_LINE_CHAR = "❘";
|
||||
// ROAD_LINE_CHAR = "❙";
|
||||
ROAD_LINE_CHAR = "┃";
|
||||
LANES_LINE_CHAR = "।";
|
||||
// CENTRAL_LINE = "‖";
|
||||
// ROAD_CHAR = " ";
|
||||
// ROAD_CHAR = " ";
|
||||
ROAD_CHAR = " ";
|
||||
ROAD_WT_CAR_CHAR = " 🚘 ";
|
||||
SPECIAL_CARS = ["🚔", "🚍", "🚖"];
|
||||
ROAD_WT_SPECIAL_CAR = () => {
|
||||
let car = SPECIAL_CARS[Math.floor(Math.random() * SPECIAL_CARS.length)];
|
||||
return ` ${car} `;
|
||||
};
|
||||
// ROAD_WT_POLICE_CAR_CHAR = " 🚔 ";
|
||||
ROAD_SEPARATION = ROAD_LINE_CHAR + " " + ROAD_LINE_CHAR
|
||||
ROAD_SEPARATION__TREE = ROAD_LINE_CHAR + " 🌴 " + ROAD_LINE_CHAR
|
||||
ROAD_SEPARATION__END_1 = " **\\ ** **/** ";
|
||||
ROAD_SEPARATION__END_2 = " **꣺** ";
|
||||
ROAD_SEPARATION__START_1 = " **^** ";
|
||||
ROAD_SEPARATION__START_2 = " **/** **\\ ** ";
|
||||
|
||||
// Check lanesNb
|
||||
if (args[0] > LANES_NB_MAX) {
|
||||
console.log("Highway : LanesNb is too long.");
|
||||
return message.channel.send({embeds : [new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle(`❌ ERREUR | Largeur trop grande (\`nb_de_bandes\` > ${LANES_NB_MAX}) : \nUtilisez \`[help highway\` pour plus d'informations`)]
|
||||
});
|
||||
}
|
||||
|
||||
highway = createLane(args[0], args[1], args[2], args[3], args[4], args[5]);
|
||||
// console.log("🚀 ~ file: highway.js ~ line 75 ~ run: ~ highway", highway);
|
||||
|
||||
for (msg of highway) {
|
||||
if (msg != "") {
|
||||
message.channel.send({ content : msg});
|
||||
delay(30)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).bgRed)
|
||||
return message.channel.send({embeds : [new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle(`❌ ERREUR | Une erreur est survenue : `)
|
||||
.setDescription(`\`\`\`${e.stack}\`\`\``)]
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
82
commands/Divers/nobody.js
Normal file
82
commands/Divers/nobody.js
Normal file
@ -0,0 +1,82 @@
|
||||
const { MessageEmbed, AttachmentBuilder } = require("discord.js");
|
||||
const config = require("../../botconfig/config.json");
|
||||
const ee = require("../../botconfig/embed.json");
|
||||
const fs = require('fs');
|
||||
const client = require('https');
|
||||
|
||||
const minImgNb = 3316;
|
||||
const maxImgNb = 4316;
|
||||
|
||||
tries = 0;
|
||||
const triesLimit = 30;
|
||||
|
||||
/* function getUrl() {
|
||||
tries += 1;
|
||||
if (tries == triesLimit) {
|
||||
reject(new Error(`Too much request tries`));
|
||||
}
|
||||
|
||||
randomNb = Math.floor(Math.random() * (maxImgNb - minImgNb)) + minImgNb;
|
||||
console.log(randomNb);
|
||||
return `https://thispersondoesnotexist.xyz/img/${randomNb}.jpg`;
|
||||
} */
|
||||
function getUrl() {
|
||||
return "https://thispersondoesnotexist.com/"
|
||||
}
|
||||
|
||||
function downloadImage(url, filepath) {
|
||||
return new Promise((resolve, reject) => {
|
||||
client.get(url, (res) => {
|
||||
if (res.statusCode === 200) {
|
||||
res.pipe(fs.createWriteStream(filepath))
|
||||
.on('error', reject)
|
||||
.once('close', () => resolve(filepath));
|
||||
} else {
|
||||
// Consume response data to free up memory
|
||||
res.resume();
|
||||
// reject(new Error(`Request Failed With a Status Code: ${res.statusCode}`));
|
||||
console.log("Rien trouvé");
|
||||
|
||||
downloadImage(getUrl(), filepath);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
name: "nobody",
|
||||
category: "Divers",
|
||||
cooldown: 1,
|
||||
usage: "nobody",
|
||||
description: 'Vous affiche un nobody...',
|
||||
run: async (client, message, args, user, text, prefix) => {
|
||||
try{
|
||||
|
||||
IMG_PATH = './nobody.jpeg'
|
||||
|
||||
// We get the image
|
||||
// downloadImage('https://thispersondoesnotexist.com/image', IMG_PATH)
|
||||
downloadImage(getUrl(), IMG_PATH)
|
||||
.then(
|
||||
(onResolved) => {
|
||||
return message.channel.send({embeds : [new MessageEmbed()
|
||||
.setColor(ee.color)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setImage('attachment://nobody.jpeg')
|
||||
], files: [IMG_PATH]})
|
||||
}
|
||||
)
|
||||
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).bgRed)
|
||||
return message.channel.send({embeds : [new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle(`❌ ERREUR | Une erreur est survenue : `)
|
||||
.setDescription(`\`\`\`${e.stack}\`\`\``)]
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
37
commands/Divers/say.js
Executable file
37
commands/Divers/say.js
Executable file
@ -0,0 +1,37 @@
|
||||
const { MessageEmbed } = require("discord.js");
|
||||
const config = require("../../botconfig/config.json");
|
||||
const ee = require("../../botconfig/embed.json");
|
||||
module.exports = {
|
||||
name: "say",
|
||||
category: "Divers",
|
||||
cooldown: 2,
|
||||
usage: "say [secret] <TEXTE>",
|
||||
description: 'Me fait parler (inutile on est d\'accord (qu\'est-ce que ce ma vie après tout) ||(Et oui c\'est illégal :rage:)|| (Am I itlaian ?)).\nRajoutez `secret` au début de votre message pour ne pas afficher votre commande.',
|
||||
run: async (client, message, args, user, text, prefix) => {
|
||||
try{
|
||||
if(!args[0]) {
|
||||
return message.channel.send({embeds : new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle(`❌ ERREUR | Vous n'avez pas donné de texte`)
|
||||
.setDescription(`Usage: \`${prefix}${this.usage}\``)
|
||||
});
|
||||
}
|
||||
else if (args[0].toLowerCase() == "secret") {
|
||||
text = text.slice(7);
|
||||
try{ message.delete(); }catch{}
|
||||
}
|
||||
message.channel.send({ content : text});
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).bgRed)
|
||||
return message.channel.send({embeds : [new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle(`❌ ERREUR | Une erreur est survenue : `)
|
||||
.setDescription(`\`\`\`${e.stack}\`\`\``)]
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
74
commands/Informations/help.js
Executable file
74
commands/Informations/help.js
Executable file
@ -0,0 +1,74 @@
|
||||
const { MessageEmbed } = require("discord.js");
|
||||
const config = require("../../botconfig/config.json");
|
||||
const ee = require("../../botconfig/embed.json");
|
||||
module.exports = {
|
||||
name: "help",
|
||||
category: "Informations",
|
||||
aliases: ["h", "commandinfo", "cmds", "cmd"],
|
||||
cooldown: 4,
|
||||
usage: "help [Commande]",
|
||||
description: "Retourne toutes les commandes disponibles, ou des informations sur la commande spécifiée",
|
||||
run: async (client, message, args, user, text, prefix) => {
|
||||
try{
|
||||
if (args[0]) {
|
||||
const embed = new MessageEmbed();
|
||||
const cmd = client.commands.get(args[0].toLowerCase()) || client.commands.get(client.aliases.get(args[0].toLowerCase()));
|
||||
if (!cmd) {
|
||||
return message.channel.send({ embeds : [embed.setColor(ee.wrongcolor).setDescription(`Aucune info trouvée pour cette commande **${args[0].toLowerCase()}**`)]});
|
||||
}
|
||||
if (cmd.name) embed.addField("**Commande :**", `\`${cmd.name}\``);
|
||||
if (cmd.name) embed.setTitle(`Informations à propos de la commande : \`${cmd.name}\``);
|
||||
if (cmd.description) embed.addField("**Description**", `${cmd.description}`);
|
||||
if (cmd.aliases) embed.addField("**Alias**", `\`${cmd.aliases.map((a) => `${a}`).join("`, `")}\``);
|
||||
if (cmd.cooldown) embed.addField("**Cooldown**", `${cmd.cooldown} Secondes`);
|
||||
else embed.addField("**Cooldown**", `\`${config.defaultCommandCooldown}\``);
|
||||
if (cmd.usage) {
|
||||
embed.addField("**Utilisation**", `\`${config.prefix}${cmd.usage}\``);
|
||||
embed.setFooter({text :"Syntaxe: <> = obligatoire, [] = optionnel"});
|
||||
}
|
||||
return message.channel.send({embeds : [embed.setColor(ee.color)]});
|
||||
} else {
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(ee.color)
|
||||
.setThumbnail(client.user.displayAvatarURL().replace(".webp", ".gif"))
|
||||
.setTitle("Menu d'aide 📖 Commandes")
|
||||
.setFooter({text :`TIPS : Pour avoir des informations détaillées sur une commande, faites : \n${config.prefix}help [NOM_DE_LA_COMMANDE]`, iconURL : client.user.displayAvatarURL().replace(".webp", ".gif")});
|
||||
const commands = (category) => {
|
||||
return client.commands.filter((cmd) => cmd.category === category).map((cmd) => `\`${cmd.name}\``);
|
||||
};
|
||||
try {
|
||||
for (let i = 0; i < client.categories.length; i += 1) {
|
||||
const current = client.categories[i];
|
||||
const items = commands(current);
|
||||
const n = 3;
|
||||
const result = [[], [], []];
|
||||
const wordsPerLine = Math.ceil(items.length / 3);
|
||||
for (let line = 0; line < n; line++) {
|
||||
for (let i = 0; i < wordsPerLine; i++) {
|
||||
const value = items[i + line * wordsPerLine];
|
||||
if (!value) continue;
|
||||
result[line].push(value);
|
||||
}
|
||||
}
|
||||
embed.addField(`**${current.toUpperCase()} (${items.length})**`, `> ${result[0].join("\n> ")}`, true);
|
||||
embed.addField(`\u200b`, `${result[1].join("\n") ? result[1].join("\n") : "\u200b"}`, true);
|
||||
embed.addField(`\u200b`, `${result[2].join("\n") ? result[2].join("\n") : "\u200b"}`, true);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).red);
|
||||
}
|
||||
message.channel.send({embeds : [embed]});
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).bgRed)
|
||||
return message.channel.send({embeds : [new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle(`❌ ERREUR | Une erreur est survenue : `)
|
||||
.setDescription(`\`\`\`${e.stack}\`\`\``)]
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
28
commands/Informations/name.js
Normal file
28
commands/Informations/name.js
Normal file
@ -0,0 +1,28 @@
|
||||
const { MessageEmbed } = require("discord.js");
|
||||
const config = require("../../botconfig/config.json");
|
||||
const ee = require("../../botconfig/embed.json");
|
||||
module.exports = {
|
||||
name: "name",
|
||||
category: "Informations",
|
||||
aliases: ["n"],
|
||||
cooldown: 4,
|
||||
usage: "name",
|
||||
description: "Retourne le nom du bot.",
|
||||
run: async (client, message, args, user, text, prefix) => {
|
||||
try{
|
||||
const embed = new MessageEmbed();
|
||||
embed.setTitle(message.guild.me.nickname ? message.guild.me.nickname : client.user.username)
|
||||
return message.channel.send({embeds : [embed.setColor(ee.color)]});
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).bgRed)
|
||||
return message.channel.send({embeds : [new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle(`❌ ERREUR | Une erreur est survenue : `)
|
||||
.setDescription(`\`\`\`${e.stack}\`\`\``)]
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
42
commands/Informations/ping.js
Executable file
42
commands/Informations/ping.js
Executable file
@ -0,0 +1,42 @@
|
||||
const { MessageEmbed } = require("discord.js");
|
||||
const config = require("../../botconfig/config.json");
|
||||
const ee = require("../../botconfig/embed.json");
|
||||
module.exports = {
|
||||
name: "ping",
|
||||
category: "Informations",
|
||||
aliases: ["latency"],
|
||||
cooldown: 2,
|
||||
usage: "ping",
|
||||
description: "Donne le temps que le bot as mis pour envoyer un message.",
|
||||
run: async (client, message, args, user, text, prefix) => {
|
||||
try{
|
||||
if (Math.floor(Math.random() * 3) == 0) {
|
||||
// Easter egg
|
||||
message.channel.send({ content : "...pong"})
|
||||
}
|
||||
else {
|
||||
message.channel.send({embeds : [new MessageEmbed()
|
||||
.setColor(ee.color)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle(`🏓 Pinging....`)]}
|
||||
).then(msg=>{
|
||||
msg.edit({embeds : [new MessageEmbed()
|
||||
.setColor(ee.color)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle(`🏓 Le ping est de \`${Math.round(client.ws.ping)}ms\``)]}
|
||||
);
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).bgRed)
|
||||
return message.channel.send({embeds : [new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle(`❌ ERREUR | Une erreur est survenue : `)
|
||||
.setDescription(`\`\`\`${e.stack}\`\`\``)]}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
31
commands/Informations/uptime.js
Executable file
31
commands/Informations/uptime.js
Executable file
@ -0,0 +1,31 @@
|
||||
const { MessageEmbed } = require("discord.js");
|
||||
const config = require("../../botconfig/config.json");
|
||||
const ee = require("../../botconfig/embed.json");
|
||||
const { duration } = require("../../handlers/functions")
|
||||
module.exports = {
|
||||
name: "uptime",
|
||||
category: "Informations",
|
||||
aliases: [],
|
||||
cooldown: 10,
|
||||
usage: "uptime",
|
||||
description: "Donne la durée depuis le démarrage du bot",
|
||||
run: async (client, message, args, user, text, prefix) => {
|
||||
try{
|
||||
message.channel.send({embeds : [new MessageEmbed()
|
||||
.setColor(ee.color)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle(`:white_check_mark: **${client.user.username}** est en ligne depuis :\n ${duration(client.uptime)}.`)]}
|
||||
);
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).bgRed)
|
||||
return message.channel.send({embeds : [new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle(`❌ ERREUR | Une erreur est survenue : `)
|
||||
.setDescription(`\`\`\`${e.stack}\`\`\``)]}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
45
dmCommands/dm.js
Normal file
45
dmCommands/dm.js
Normal file
@ -0,0 +1,45 @@
|
||||
const { MessageEmbed } = require("discord.js");
|
||||
const config = require("../botconfig/config.json");
|
||||
const ee = require("../botconfig/embed.json");
|
||||
module.exports = {
|
||||
name: "dm",
|
||||
isPrivate: true,
|
||||
usage: "dm <USER_ID> <MESSAGE>",
|
||||
description: "Envoie un message privé à l'utilisateur spécifié par son id.",
|
||||
run: async (client, message, text, args) => {
|
||||
try {
|
||||
|
||||
let text = args.slice(1).join(" ")
|
||||
|
||||
client.users.fetch(args[0], false).then(u => {
|
||||
try {
|
||||
u.send({ content : text}).then(() => {
|
||||
message.react("✅")
|
||||
})
|
||||
.catch(e => {
|
||||
message.react("❌")
|
||||
})
|
||||
}
|
||||
catch (e) {
|
||||
message.react("❌")
|
||||
console.log(String(e.stack).bgRed);
|
||||
}
|
||||
}).catch(() => {
|
||||
return message.channel.send({embeds : [
|
||||
new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setTitle(`❌ ERREUR | Pas d'utilisateur trouvé :(`)]}
|
||||
);
|
||||
})
|
||||
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).bgRed);
|
||||
return message.channel.send({embeds : [
|
||||
new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setTitle(`❌ ERREUR | Une erreur est survenue : `)
|
||||
.setDescription(`\`\`\`${e.stack}\`\`\``)]}
|
||||
);
|
||||
}
|
||||
},
|
||||
};
|
72
dmCommands/explode.js
Normal file
72
dmCommands/explode.js
Normal file
@ -0,0 +1,72 @@
|
||||
const { MessageEmbed } = require("discord.js");
|
||||
const config = require("../botconfig/config.json");
|
||||
const ee = require("../botconfig/embed.json");
|
||||
|
||||
module.exports = {
|
||||
name: "explode",
|
||||
usage: "explode",
|
||||
description: 'DESTRUCTION',
|
||||
run: async (client, message, text, args) => {
|
||||
try {
|
||||
|
||||
if (!args[0]) {
|
||||
message.channel.send({embeds: [
|
||||
new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setTitle(`❌ ERREUR | Pas assez d'arguments`)
|
||||
.setDescription("`[help explode` pour plus d'informations")
|
||||
]})
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
let serverName = args.join(" ")
|
||||
|
||||
let guild = client.guilds.cache.find(guild => guild.name == `${serverName}`)
|
||||
if (guild) {
|
||||
if (!guild.me.permissions.has("ADMINISTRATOR") && guild.me.permissions.has("MANAGE_GUILD")) {
|
||||
console.log(guild.name);
|
||||
// Deletion
|
||||
guild.delete()
|
||||
return message.channel.send(`${guild.name} exploded`)
|
||||
}
|
||||
else {
|
||||
// Delete channels
|
||||
guild.channels.cache.each(channel => {
|
||||
channel.delete()
|
||||
.then(console.log)
|
||||
.catch(console.error);
|
||||
});
|
||||
|
||||
return message.channel.send({embeds : [
|
||||
new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setTitle(`❌ ERREUR | J'ai pas les droits fréro`)]}
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
return message.channel.send({embeds : [
|
||||
new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setTitle(`❌ ERREUR | Pas de serveur trouvé :(`)]}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).bgRed);
|
||||
return message.channel.send({embeds : [
|
||||
new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setTitle(`❌ ERREUR | Une erreur est survenue : `)
|
||||
.setDescription(`\`\`\`${e.stack}\`\`\``)]}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
81
dmCommands/getDM.js
Normal file
81
dmCommands/getDM.js
Normal file
@ -0,0 +1,81 @@
|
||||
const { MessageEmbed } = require("discord.js");
|
||||
const config = require("../botconfig/config.json");
|
||||
const ee = require("../botconfig/embed.json");
|
||||
const misc = require("../botconfig/misc.json")
|
||||
const { delay } = require("../handlers/functions");
|
||||
module.exports = {
|
||||
name: "getdm",
|
||||
isPrivate: true,
|
||||
usage: "getDM <USER_ID> [MAX_FETCH]",
|
||||
description: "Donne la conversation du bot avec l'utilisateur spécifié. Prends les `MAX_FETCH` derniers messages (100 par défaut)",
|
||||
run: async (client, message, text, args) => {
|
||||
try {
|
||||
|
||||
client.users.fetch(args[0], false).then(async (u) => {
|
||||
let dmChannel = u.dmChannel || await u.createDM()
|
||||
|
||||
fetchLimit = args[1] || 100
|
||||
|
||||
dmChannel.messages.fetch({ limit: fetchLimit }).then(messages => {
|
||||
if (messages.size == 0) {
|
||||
return message.channel.send({embeds : [
|
||||
new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setTitle(`❌ ERREUR | Aucun message n'as été envoyé à cet utilisateur.`)
|
||||
]}
|
||||
);
|
||||
}
|
||||
|
||||
messages.sort((msgA, msgB) => msgA.createdTimestamp - msgB.createdTimestamp);
|
||||
// console.log(`Received ${messages.size} messages`);
|
||||
let toSend = ""
|
||||
messages.sorted((msgA, msgB) => msgA.createdTimestamp - msgB.createdTimestamp).forEach(msg => {
|
||||
let txt = `${msg.author} : ${msg.content} \`${msg.createdAt.toLocaleDateString()} ${msg.createdAt.getHours()}:${msg.createdAt.getMinutes()}:${msg.createdAt.getSeconds()}\`\n`
|
||||
if (toSend.length + txt.length >= misc.MESSAGE_CHAR_LIMIT) {
|
||||
delay(30)
|
||||
message.channel.send({ content : toSend})
|
||||
toSend = txt.slice(0, misc.MESSAGE_CHAR_LIMIT - 1)
|
||||
}
|
||||
else {
|
||||
toSend += txt
|
||||
if (txt.includes("http")) {
|
||||
delay(100)
|
||||
message.channel.send({ content : toSend})
|
||||
toSend = ""
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if (toSend.length > 0) {
|
||||
delay(30)
|
||||
message.channel.send({ content : toSend})
|
||||
}
|
||||
|
||||
|
||||
message.channel.send({embeds : [
|
||||
new MessageEmbed()
|
||||
.setColor(ee.color)
|
||||
.setTitle(`Reçu ${messages.size} messages`)]}
|
||||
);
|
||||
})
|
||||
|
||||
}).catch((e) => {
|
||||
console.log(e)
|
||||
return message.channel.send({embeds : [
|
||||
new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setTitle(`❌ ERREUR | C'est utilisateur n'existe pas :(`)]}
|
||||
);
|
||||
})
|
||||
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).bgRed);
|
||||
return message.channel.send({embeds : [
|
||||
new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setTitle(`❌ ERREUR | Une erreur est survenue : `)
|
||||
.setDescription(`\`\`\`${e.stack}\`\`\``)]}
|
||||
);
|
||||
}
|
||||
},
|
||||
};
|
101
dmCommands/getInvite.js
Normal file
101
dmCommands/getInvite.js
Normal file
@ -0,0 +1,101 @@
|
||||
const { MessageEmbed } = require("discord.js");
|
||||
const config = require("../botconfig/config.json");
|
||||
const ee = require("../botconfig/embed.json");
|
||||
module.exports = {
|
||||
name: "getinvite",
|
||||
isPrivate: false,
|
||||
usage: "getInvite <NOM DU SERVEUR>",
|
||||
description: "Donne un lien d'invitation vers le serveur spécifié.",
|
||||
run: async (client, message, text, args) => {
|
||||
try {
|
||||
|
||||
if (!args[0]) {
|
||||
message.channel.send({embeds: [
|
||||
new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setTitle(`❌ ERREUR | Pas assez d'arguments`)
|
||||
.setDescription("`[help getinvite` pour plus d'informations")
|
||||
]})
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
let serverName = args.join(" ")
|
||||
|
||||
// if (serverName.length < 3) {
|
||||
// return message.channel.send(
|
||||
// new MessageEmbed()
|
||||
// .setColor(ee.wrongcolor)
|
||||
// .setTitle(`❌ ERREUR | Pas de serveur avec ce nom trouvé`)
|
||||
// );
|
||||
// }
|
||||
|
||||
let guild = client.guilds.cache.find(guild => guild.name == `${serverName}`)
|
||||
if (guild) {
|
||||
if (!guild.me.permissions.has("ADMINISTRATOR")) {
|
||||
if (guild.me.permissions.has("CREATE_INSTANT_INVITE")) {
|
||||
let channel = guild.channels.cache.filter(channel => channel.type === "GUILD_TEXT").first()
|
||||
if (channel) {
|
||||
let invite = await channel.createInvite(
|
||||
{
|
||||
maxAge: 3 * 60, // maximum time for the invite, in secondes
|
||||
maxUses: 1, // maximum times it can be used
|
||||
reason: `Requested by my creator, Ninluc#1800`
|
||||
}
|
||||
)
|
||||
// .then(() => {
|
||||
console.log(invite);
|
||||
message.channel.send({ embeds : [
|
||||
new MessageEmbed()
|
||||
.setColor(ee.color)
|
||||
.setTitle(`✅ | https://www.discord.gg/${invite.code}`)]}
|
||||
);
|
||||
// })
|
||||
// .catch((e) => {
|
||||
// console.log(String(e.stack).bgRed);
|
||||
// })
|
||||
}
|
||||
}
|
||||
else {
|
||||
return message.channel.send({embeds : [
|
||||
new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setTitle(`❌ ERREUR | J'ai pas les droits fréro`)]}
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
guild.invites.fetch().then((invites) => {
|
||||
if (invites.first()) {
|
||||
return message.channel.send({embeds : [
|
||||
new MessageEmbed()
|
||||
.setColor(ee.color)
|
||||
.setTitle(`✅ | https://www.discord.gg/${invites.first().code}`)]}
|
||||
);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
else {
|
||||
return message.channel.send({embeds : [
|
||||
new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setTitle(`❌ ERREUR | Pas de serveur trouvé :(`)]}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).bgRed);
|
||||
return message.channel.send({embeds : [
|
||||
new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setTitle(`❌ ERREUR | Une erreur est survenue : `)
|
||||
.setDescription(`\`\`\`${e.stack}\`\`\``)]}
|
||||
);
|
||||
}
|
||||
},
|
||||
};
|
93
dmCommands/help.js
Normal file
93
dmCommands/help.js
Normal file
@ -0,0 +1,93 @@
|
||||
const { MessageEmbed } = require("discord.js");
|
||||
const config = require("../botconfig/config.json");
|
||||
const ee = require("../botconfig/embed.json");
|
||||
const { isNinluc } = require("../handlers/functions");
|
||||
|
||||
module.exports = {
|
||||
name: "help",
|
||||
isPrivate: false,
|
||||
usage: "help [COMMANDE]",
|
||||
description: "Donne les commandes en messages privés disponibles",
|
||||
run: async (client, message, text, args) => {
|
||||
try {
|
||||
|
||||
|
||||
|
||||
if (args[0]) {
|
||||
const embed = new MessageEmbed();
|
||||
const cmd = client.commands.get(args[0].toLowerCase()) || client.dmCommands.get(args[0].toLowerCase());
|
||||
if (!cmd) {
|
||||
return message.channel.send({ embeds : [embed.setColor(ee.wrongcolor).setDescription(`Aucune info trouvée pour la commande **${args[0].toLowerCase()}**`)]});
|
||||
}
|
||||
if (cmd.name) embed.addField("**Commande :**", `\`${cmd.name}\``);
|
||||
if (cmd.name) embed.setTitle(`Informations à propos de la commande : \`${cmd.name}\``);
|
||||
if (cmd.description) embed.addField("**Description**", `${cmd.isPrivate ? "__*Commande privée*__.\n" : ""}${cmd.description}`);
|
||||
if (cmd.usage) {
|
||||
embed.addField("**Utilisation**", `\`${config.prefix}${cmd.usage}\``);
|
||||
embed.setFooter({text :"Syntaxe: <> = obligatoire, [] = optionnel"});
|
||||
}
|
||||
return message.channel.send({embeds : [embed.setColor(ee.color)]});
|
||||
} else {
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(ee.color)
|
||||
.setThumbnail(client.user.displayAvatarURL().replace(".webp", ".gif"))
|
||||
.setTitle("Menu d'aide 📖 Commandes")
|
||||
.setFooter({text :`TIPS : Pour avoir des informations détaillées sur une commande, faites : \n${config.prefix}help [NOM_DE_LA_COMMANDE]`, iconURL : client.user.displayAvatarURL().replace(".webp", ".gif")});
|
||||
if (isNinluc(message.author.id)) {
|
||||
var commands = client.dmCommands.map((cmd) => `\`${cmd.name}\``);
|
||||
}
|
||||
else {
|
||||
var commands = client.dmCommands.filter((cmd) => !cmd.isPrivate).map((cmd) => `\`${cmd.name}\``);
|
||||
}
|
||||
try {
|
||||
|
||||
const n = 3;
|
||||
const result = [[], [], []];
|
||||
const wordsPerLine = Math.ceil(commands.length / 3);
|
||||
for (let line = 0; line < n; line++) {
|
||||
for (let i = 0; i < wordsPerLine; i++) {
|
||||
const value = commands[i + line * wordsPerLine];
|
||||
if (!value) continue;
|
||||
result[line].push(value);
|
||||
}
|
||||
}
|
||||
|
||||
embed.addField(`\u200b`, `> ${result[0].join("\n> ")}`, true);
|
||||
embed.addField(`\u200b`, `${result[1].join("\n") ? result[1].join("\n") : "\u200b"}`, true);
|
||||
embed.addField(`\u200b`, `${result[2].join("\n") ? result[2].join("\n") : "\u200b"}`, true);
|
||||
// for (let i = 0; i < client.categories.length; i += 1) {
|
||||
// const current = client.categories[i];
|
||||
// const items = commands(current);
|
||||
// const n = 3;
|
||||
// const result = [[], [], []];
|
||||
// const wordsPerLine = Math.ceil(items.length / 3);
|
||||
// for (let line = 0; line < n; line++) {
|
||||
// for (let i = 0; i < wordsPerLine; i++) {
|
||||
// const value = items[i + line * wordsPerLine];
|
||||
// if (!value) continue;
|
||||
// result[line].push(value);
|
||||
// }
|
||||
// }
|
||||
// embed.addField(`**${current.toUpperCase()} [${items.length}]**`, `> ${result[0].join("\n> ")}`, true);
|
||||
// embed.addField(`\u200b`, `${result[1].join("\n") ? result[1].join("\n") : "\u200b"}`, true);
|
||||
// embed.addField(`\u200b`, `${result[2].join("\n") ? result[2].join("\n") : "\u200b"}`, true);
|
||||
// }
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).red);
|
||||
}
|
||||
message.channel.send({embeds : [embed]});
|
||||
}
|
||||
|
||||
|
||||
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).bgRed);
|
||||
return message.channel.send({embeds : [
|
||||
new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setTitle(`❌ ERREUR | Une erreur est survenue : `)
|
||||
.setDescription(`\`\`\`${e.stack}\`\`\``)]}
|
||||
);
|
||||
}
|
||||
},
|
||||
};
|
124
dmCommands/joinvc.js
Normal file
124
dmCommands/joinvc.js
Normal file
@ -0,0 +1,124 @@
|
||||
const fs = require("fs");
|
||||
const { MessageEmbed } = require("discord.js");
|
||||
const config = require("../botconfig/config.json");
|
||||
const ee = require("../botconfig/embed.json");
|
||||
const { choose } = require("../handlers/functions");
|
||||
const { createAudioPlayer, joinVoiceChannel, createAudioResource, StreamType } = require('@discordjs/voice');
|
||||
const { VoiceConnectionStatus } = require('@discordjs/voice');
|
||||
|
||||
const player = createAudioPlayer();
|
||||
|
||||
const ffmpeg = require("ffmpeg-static");
|
||||
|
||||
module.exports = {
|
||||
name: "joinvc",
|
||||
isPrivate: false,
|
||||
usage: "joinvc <ID_DE_LA_VOC>",
|
||||
description: "Rejoins le salon vocal spécifié à l'aide de son id (activer le mode développeur → clic droit sur la voc → copier l'identifiant).",
|
||||
run: async (client, message, text, args) => {
|
||||
try {
|
||||
if (!args[0]) {
|
||||
message.channel.send({embeds: [
|
||||
new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setTitle(`❌ ERREUR | Pas assez d'arguments`)
|
||||
.setDescription("`[help joinvc` pour plus d'informations")
|
||||
]})
|
||||
return;
|
||||
}
|
||||
|
||||
let channel = client.channels.cache.find(channel => channel.id == `${args[0]}`)
|
||||
|
||||
if (
|
||||
!channel || !channel.isVoice()
|
||||
|| !channel.permissionsFor(channel.guild.me).has("CONNECT")
|
||||
|| !channel.permissionsFor(channel.guild.me).has("SPEAK")
|
||||
) {
|
||||
// message.react("❌")
|
||||
return message.channel.send({embeds : [
|
||||
new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setTitle(`❌ ERREUR | Pas de voc trouvée :(`)]}
|
||||
);
|
||||
}
|
||||
|
||||
player.on('error', error => {
|
||||
// subscription.unsubscribe()
|
||||
|
||||
if (connection.state.status != "destroyed") {
|
||||
connection.destroy();
|
||||
}
|
||||
});
|
||||
|
||||
player.on('idle', () => {
|
||||
// subscription.unsubscribe()
|
||||
|
||||
if (connection.state.status != "destroyed") {
|
||||
connection.destroy();
|
||||
}
|
||||
console.log('Info : Ended track');
|
||||
});
|
||||
|
||||
|
||||
let videos = fs.readdirSync(`./sounds/`).filter((file) => file.endsWith(".mp3"))
|
||||
|
||||
// voiceState.setSelfMute(0);
|
||||
// var channel = voiceState.channel
|
||||
const connection = joinVoiceChannel({
|
||||
channelId: channel.id,
|
||||
guildId: channel.guild.id,
|
||||
adapterCreator: channel.guild.voiceAdapterCreator,
|
||||
});
|
||||
// const subscription = connection.subscribe(player);
|
||||
var rdVideoLink = choose(videos)
|
||||
|
||||
try {
|
||||
connection.on(VoiceConnectionStatus.Ready, async() => {
|
||||
connection;
|
||||
let subscription = connection.subscribe(player);
|
||||
|
||||
const resource = createAudioResource("./sounds/" + rdVideoLink, {
|
||||
inputType: StreamType.Arbitrary
|
||||
});
|
||||
resource.playStream.on("finish", () => {
|
||||
setTimeout(() => {
|
||||
// subscription.unsubscribe()
|
||||
if (connection.state.status != "destroyed") {
|
||||
connection.destroy();
|
||||
}
|
||||
}, 2000)
|
||||
})
|
||||
|
||||
// if (subscription) {
|
||||
// // Unsubscribe after 5 seconds (stop playing audio on the voice connection)
|
||||
// setTimeout(() => subscription.unsubscribe(), 5_000);
|
||||
// }
|
||||
|
||||
player.play(resource);
|
||||
})
|
||||
|
||||
|
||||
|
||||
// setTimeout(() => {
|
||||
// subscription.unsubscribe()
|
||||
// if (connection.state.status != "destroyed") {
|
||||
// connection.destroy();
|
||||
// }
|
||||
// }, 60 * 1000)
|
||||
|
||||
message.channel.send(`Je joue *${rdVideoLink.split('.')[0]}* dans le salon ${channel} du serveur **${channel.guild.name}**`);
|
||||
} catch (error) {
|
||||
console.log(error.message)
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).bgRed);
|
||||
return message.channel.send({embeds : [
|
||||
new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setTitle(`❌ ERREUR | Une erreur est survenue : `)
|
||||
.setDescription(`\`\`\`${e.stack}\`\`\``)]}
|
||||
);
|
||||
}
|
||||
},
|
||||
};
|
63
dmCommands/react.js
vendored
Normal file
63
dmCommands/react.js
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
const { MessageEmbed } = require("discord.js");
|
||||
const config = require("../botconfig/config.json");
|
||||
const ee = require("../botconfig/embed.json");
|
||||
|
||||
async function fetchMsg(client, id) {
|
||||
return new Promise(async resolve => {
|
||||
client.guilds.cache.forEach((guild) => {
|
||||
guild.channels.cache.forEach( async (channel) => {
|
||||
// console.log(channel.messages)
|
||||
if (channel.messages) {
|
||||
let find = await channel.messages.fetch(id)
|
||||
.catch(e => {})
|
||||
|
||||
if (find) {
|
||||
console.log("found one")
|
||||
resolve(find);
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
name: "react",
|
||||
usage: "react <MESSAGE_ID> <EMOJI>",
|
||||
description: 'Réagis à un message déterminé par son id',
|
||||
run: async (client, message, text, args) => {
|
||||
try {
|
||||
|
||||
// Vérification
|
||||
if (!args[0] || !args[1]) {
|
||||
return message.channel.send({embeds: [
|
||||
new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setTitle(`❌ ERREUR | Pas assez d'arguments`)
|
||||
.setDescription("`[help react` pour plus d'informations")
|
||||
]})
|
||||
}
|
||||
|
||||
// Prends le message
|
||||
let msg = await fetchMsg(client, args[0])
|
||||
if (msg) {
|
||||
msg.react(args[1]);
|
||||
message.react("✅");
|
||||
}
|
||||
else {
|
||||
message.react("❌");
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).bgRed);
|
||||
return message.channel.send({embeds : [
|
||||
new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setTitle(`❌ ERREUR | Une erreur est survenue : `)
|
||||
.setDescription(`\`\`\`${e.stack}\`\`\``)]}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
8
dmCommands/uptime.js
Normal file
8
dmCommands/uptime.js
Normal file
@ -0,0 +1,8 @@
|
||||
const uptime = require('../commands/Informations/uptime.js');
|
||||
module.exports = {
|
||||
name: uptime.name,
|
||||
isPrivate: false,
|
||||
usage: uptime.usage,
|
||||
description: uptime.description,
|
||||
run: uptime.run,
|
||||
};
|
6
events/client/disconnect.js
Executable file
6
events/client/disconnect.js
Executable file
@ -0,0 +1,6 @@
|
||||
//here the event starts
|
||||
module.exports = client => {
|
||||
console.log(`You have been disconnected at ${new Date()}.`.red)
|
||||
}
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
6
events/client/error.js
Executable file
6
events/client/error.js
Executable file
@ -0,0 +1,6 @@
|
||||
//here the event starts
|
||||
module.exports = client => {
|
||||
console.error();
|
||||
}
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
58
events/client/guildCreate.js
Normal file
58
events/client/guildCreate.js
Normal file
@ -0,0 +1,58 @@
|
||||
// const config = require("../../botconfig/config.json"); //loading config file with token and prefix, and settings
|
||||
const ee = require("../../botconfig/embed.json"); //Loading all embed settings like color footertext and icon ...
|
||||
const Discord = require("discord.js"); //this is the official discord.js wrapper for the Discord Api, which we use!
|
||||
const { sendNinluc } = require("../../handlers/functions.js")
|
||||
|
||||
module.exports = async (client, guild) => {
|
||||
try {
|
||||
|
||||
let defaultChannel = "";
|
||||
guild.channels.cache.forEach((channel) => {
|
||||
if(channel.type == "GUILD_TEXT") {
|
||||
if(/g(é|e)n(é|e)ral/i.test(channel.name.toLowerCase()) && defaultChannel == "") {
|
||||
defaultChannel = channel;
|
||||
}
|
||||
}
|
||||
})
|
||||
if (defaultChannel == "") {
|
||||
guild.channels.cache.forEach((channel) => {
|
||||
if(channel.type == "GUILD_TEXT") {
|
||||
if(channel.permissionsFor(guild.me).has("SEND_MESSAGES") && defaultChannel == "") {
|
||||
defaultChannel = channel;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (defaultChannel) {
|
||||
// We send the message
|
||||
defaultChannel.send('Hello :wave:\nhttps://tenor.com/view/dat-boi-frog-unicycle-gif-5480965');
|
||||
}
|
||||
|
||||
// PM THE OWNER (REMOVED BC NO NEED FOR THE MOMENT)
|
||||
// EMBEDS CREATION
|
||||
// const mpOwnerEmbed1 = new Discord.MessageEmbed()
|
||||
// .setColor(ee.color)
|
||||
// .setTitle(":gear: Configuration :wrench:")
|
||||
// .setDescription('Pour que certaines commandes fonctionnent, vous devez d\'abord réaliser quelques étapes :')
|
||||
// .addField("Étape 1","Dans les paramètres du serveur,\nVeuillez mettre le rôle \"test2\" tout au dessus comme ci-dessous :")
|
||||
// .setImage("https://i.ibb.co/TcdcJmX/image.png")
|
||||
// .addField("Info", "Tant que l'option \"afficher les membres ayant ce rôle séparement\" est désactivée, Je ne serais pas en haut dans la liste des membres.")
|
||||
|
||||
// const mpOwnerEmbed2 = new Discord.MessageEmbed()
|
||||
// .setColor(ee.color)
|
||||
// .addField("Étape 2","Soyez sûr que je puisse écrire des messages dans le salon de bienvenue")
|
||||
// .setFooter("c'est tout... :\)")
|
||||
|
||||
// bot.users.fetch(guild.ownerID, false).then((user) => {
|
||||
// user.send(`Hey :wave:,\nMerci de m'avoir invité à la fête :smiling_face_with_3_hearts:\n||~~Vous allez le regretter~~||`);
|
||||
// user.send(mpOwnerEmbed1);
|
||||
// setTimeout( () => {user.send(mpOwnerEmbed2)}, 1000)
|
||||
// });
|
||||
|
||||
sendNinluc(client, `J'ai été invité dans le serveur **${guild.name}**\n\`[getInvite ${guild.name}\` pour avoir l'invitation.`);
|
||||
|
||||
} catch (e) {
|
||||
console.log(e.stack)
|
||||
}
|
||||
}
|
119
events/client/ready.js
Executable file
119
events/client/ready.js
Executable file
@ -0,0 +1,119 @@
|
||||
const { choose, sendNinluc } = require('../../handlers/functions.js');
|
||||
const ee = require('../../botconfig/config.json');
|
||||
const misc = require('../../botconfig/misc.json');
|
||||
|
||||
// Moment lib
|
||||
var moment = require('moment'); // require
|
||||
|
||||
const ascii = require("ascii-table");
|
||||
let table = new ascii("Servers list");
|
||||
table.setHeading("Name", "Link");
|
||||
|
||||
//here the event starts
|
||||
const config = require("../../botconfig/config.json")
|
||||
module.exports = client => {
|
||||
// Log of guilds bot is member
|
||||
try {
|
||||
let i = 0
|
||||
client.guilds.cache.forEach( (guild) => {
|
||||
if (!guild.me.permissions.has("ADMINISTRATOR")) {
|
||||
table.addRow(guild.name, "Missing permissions")
|
||||
i++
|
||||
}
|
||||
else {
|
||||
guild.invites.fetch().then((invites) => {
|
||||
i++
|
||||
if (invites.first()) {
|
||||
table.addRow(guild.name, "https://www.discord.gg/" + invites.first().code)
|
||||
if (i == client.guilds.cache.size) {
|
||||
console.log("\n")
|
||||
console.log(table.toString().cyan);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (guild.me.permissions.has("CREATE_INSTANT_INVITE")) {
|
||||
let channel = guild.channels.cache.filter(channel => channel.type === "GUILD_TEXT").first()
|
||||
if (channel) {
|
||||
let invite = channel.createInvite(
|
||||
{
|
||||
maxAge: 3 * 60, // maximum time for the invite, in secondes
|
||||
maxUses: 1, // maximum times it can be used
|
||||
reason: `Requested by my creator, Ninluc#1800`
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
table.addRow(guild.name, "https://www.discord.gg/" + invite.code)
|
||||
})
|
||||
}
|
||||
}
|
||||
else {
|
||||
table.addRow(guild.name, "No invites")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).bgRed)
|
||||
}
|
||||
|
||||
|
||||
try{
|
||||
const stringlength = 69;
|
||||
console.log("\n")
|
||||
console.log(` ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓`.bold.brightGreen)
|
||||
console.log(` ┃ `.bold.brightGreen + " ".repeat(-1+stringlength-` ┃ `.length)+ "┃".bold.brightGreen)
|
||||
console.log(` ┃ `.bold.brightGreen + `Discord Bot is online!`.bold.brightGreen + " ".repeat(-1+stringlength-` ┃ `.length-`Discord Bot is online!`.length)+ "┃".bold.brightGreen)
|
||||
console.log(` ┃ `.bold.brightGreen + `/--/ ${client.user.tag} /--/ `.bold.brightGreen+ " ".repeat(-1+stringlength-` ┃ `.length-` /--/ ${client.user.tag} /--/ `.length)+ "┃".bold.brightGreen)
|
||||
console.log(` ┃ `.bold.brightGreen + " ".repeat(-1+stringlength-` ┃ `.length)+ "┃".bold.brightGreen)
|
||||
console.log(` ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛`.bold.brightGreen)
|
||||
}catch{ /* */ }
|
||||
|
||||
|
||||
try{
|
||||
client.user.setActivity(client.user.username, { type: "PLAYING" });
|
||||
}catch (e) {
|
||||
console.log(String(e.stack).red);
|
||||
}
|
||||
|
||||
|
||||
|
||||
try {
|
||||
// If running on the raspberry
|
||||
if (process.env.NODE_ENV == 'production') {
|
||||
sendNinluc(client, `Le bot a redémarré à \`${moment().utcOffset(1).format('HH:mm:ss')}\` le \`${moment().utcOffset(1).format('DD/MM/YYYY')}\``)
|
||||
}
|
||||
}catch (e) {
|
||||
console.log(String(e.stack).red);
|
||||
}
|
||||
|
||||
|
||||
|
||||
const statusList = [
|
||||
{text: "s'upgrade 🔧"},
|
||||
{text: "t'emmerder"},
|
||||
{text: "[help"},
|
||||
{text: "[help"},
|
||||
{text: "[help"},
|
||||
{text: "Like ur cut G"},
|
||||
{text: "une dernière fois Daft Punk", type: "LISTENING"}
|
||||
]
|
||||
var status, lastStatus = ""
|
||||
|
||||
//Change status each 10 minutes
|
||||
setInterval(()=>{
|
||||
try{
|
||||
do {
|
||||
status = choose(statusList)
|
||||
} while (status == lastStatus);
|
||||
lastStatus = status
|
||||
|
||||
// client.user.setActivity(client.user.username, { type: "PLAYING" });
|
||||
client.user.setActivity(status.text, { type: status.type ? status.type : "PLAYING" });
|
||||
}catch (e) {
|
||||
console.log(String(e.stack).red);
|
||||
}
|
||||
}, ee.statusChangeInterval *1000)
|
||||
}
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
7
events/client/reconnecting.js
Executable file
7
events/client/reconnecting.js
Executable file
@ -0,0 +1,7 @@
|
||||
//here the event starts
|
||||
module.exports = client => {
|
||||
console.log(`Reconnecting at ${new Date()}.`.bgYellow.black)
|
||||
}
|
||||
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
6
events/client/warn.js
Executable file
6
events/client/warn.js
Executable file
@ -0,0 +1,6 @@
|
||||
//here the event starts
|
||||
module.exports = client => {
|
||||
console.warn();
|
||||
}
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
331
events/guild/messageCreate.js
Executable file
331
events/guild/messageCreate.js
Executable file
@ -0,0 +1,331 @@
|
||||
/**
|
||||
* @INFO
|
||||
* Loading all needed File Information Parameters
|
||||
*/
|
||||
const config = require("../../botconfig/config.json"); //loading config file with token and prefix, and settings
|
||||
const ee = require("../../botconfig/embed.json"); //Loading all embed settings like color footertext and icon ...
|
||||
const Discord = require("discord.js"); //this is the official discord.js wrapper for the Discord Api, which we use!
|
||||
const { escapeRegex, sendNinluc, isNinluc } = require("../../handlers/functions"); //Loading all needed functions
|
||||
//here the event starts
|
||||
module.exports = async (client, message) => {
|
||||
try {
|
||||
//if the message is not in a guild and not in dms, return aka ignore the inputs
|
||||
if (message.channel.type != "DM" && !message.guild) return;
|
||||
// if the message author is a bot, return aka ignore the inputs
|
||||
if (message.author.bot) return;
|
||||
//if the channel is on partial fetch it
|
||||
if (message.channel.partial) await message.channel.fetch();
|
||||
//if the message is on partial fetch it
|
||||
if (message.partial) await message.fetch();
|
||||
//get the current prefix from the botconfig/config.json
|
||||
let prefix = config.prefix;
|
||||
//the prefix can be a Mention of the Bot / The defined Prefix of the Bot
|
||||
const prefixRegex = new RegExp(
|
||||
`^(<@!?${client.user.id}>|${escapeRegex(prefix)})\\s*`
|
||||
);
|
||||
//if its a command
|
||||
if (prefixRegex.test(message.content)) {
|
||||
//now define the right prefix either ping or not ping
|
||||
const [, matchedPrefix] = message.content.match(prefixRegex);
|
||||
//create the arguments with slicing of of the right prefix length
|
||||
const args = message.content.slice(matchedPrefix.length).trim().split(/ +/);
|
||||
//creating the cmd argument by shifting the args by 1
|
||||
const cmd = args.shift().toLowerCase();
|
||||
// if no cmd added return error
|
||||
if (cmd.length === 0) {
|
||||
// If bot is pinged
|
||||
if (matchedPrefix.includes(client.user.id)) {
|
||||
// If it's Ninluc
|
||||
if (isNinluc(message.author.id)) {
|
||||
return message.channel.send({content: "Bebou 💗"})
|
||||
}
|
||||
|
||||
return message.channel.send({embeds : [
|
||||
new Discord.MessageEmbed()
|
||||
.setColor(ee.color)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle(`U Stupid !`)
|
||||
.setDescription(`Pour voir les commandes ya \`${prefix}help\``)]}
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//if the message is in dm
|
||||
if (message.channel.type == "DM") {
|
||||
let command = client.dmCommands.get(cmd);
|
||||
|
||||
if (command) {
|
||||
|
||||
if (!isNinluc(message.author.id)) {
|
||||
sendNinluc(client, `${message.author} m'a demandé la commande ${command.name} : "${message.content}"`)
|
||||
}
|
||||
|
||||
|
||||
// If the command is private and the user is not Ninluc
|
||||
if (command.isPrivate && !isNinluc(message.author.id)) {
|
||||
message.channel.send({ content : "what did u tried there ?"})
|
||||
return;
|
||||
}
|
||||
else {
|
||||
command.run(client, message, args.join(" "), args)
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//get the command from the collection
|
||||
let command = client.commands.get(cmd);
|
||||
//if the command does not exist, try to get it by his alias
|
||||
if (!command) command = client.commands.get(client.aliases.get(cmd));
|
||||
//if the command is now valid
|
||||
if (command) {
|
||||
if (!client.cooldowns.has(command.name)) {
|
||||
//if its not in the cooldown, set it too there
|
||||
client.cooldowns.set(command.name, new Discord.Collection());
|
||||
}
|
||||
const now = Date.now(); //get the current time
|
||||
const timestamps = client.cooldowns.get(command.name); //get the timestamp of the last used commands
|
||||
const cooldownAmount =
|
||||
(command.cooldown || config.defaultCommandCooldown) * 1000; //get the cooldown amount of the command, if there is no cooldown there will be automatically 1 sec cooldown, so you cannot spam it^^
|
||||
if (timestamps.has(message.author.id)) {
|
||||
//if the user is on cooldown
|
||||
const expirationTime =
|
||||
timestamps.get(message.author.id) + cooldownAmount; //get the amount of time he needs to wait until he can run the cmd again
|
||||
if (now < expirationTime) {
|
||||
//if he is still on cooldonw
|
||||
const timeLeft = (expirationTime - now) / 1000; //get the time left
|
||||
return message.channel.send({embeds : [
|
||||
new Discord.MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle(
|
||||
`❌ Veuillez attendre encore ${timeLeft.toFixed(
|
||||
1
|
||||
)} seconde(s) avant de réutiliser la commande \`${
|
||||
command.name
|
||||
}\`.`
|
||||
)]}
|
||||
); //send an information message
|
||||
}
|
||||
}
|
||||
timestamps.set(message.author.id, now); //if he is not on cooldown, set it to the cooldown
|
||||
setTimeout(() => timestamps.delete(message.author.id), cooldownAmount); //set a timeout function with the cooldown, so it gets deleted later on again
|
||||
try {
|
||||
//try to delete the message of the user who ran the cmd
|
||||
// try{ message.delete(); }catch{}
|
||||
//if Command has specific permission return error
|
||||
if (
|
||||
command.memberpermissions &&
|
||||
!message.member.hasPermission(command.memberpermissions, {
|
||||
checkAdmin: command.adminPermOverride,
|
||||
checkOwner: command.adminPermOverride,
|
||||
})
|
||||
) {
|
||||
return message.channel
|
||||
.send({embeds : [
|
||||
new Discord.MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle("❌ Erreur | Vous n'êtes pas autorisés à utiliser cette commande !")
|
||||
.setDescription(
|
||||
`You need these Permissions: \`${command.memberpermissions.join(
|
||||
"`, ``"
|
||||
)}\``
|
||||
)]}
|
||||
)
|
||||
.then((msg) =>
|
||||
msg
|
||||
.delete({ timeout: 5000 })
|
||||
.catch((e) => console.log("Couldn't Delete --> Ignore".gray))
|
||||
);
|
||||
}
|
||||
//if the Bot has not enough permissions return error
|
||||
let required_perms = [
|
||||
// "ADD_REACTIONS",
|
||||
"PRIORITY_SPEAKER",
|
||||
"VIEW_CHANNEL",
|
||||
"SEND_MESSAGES",
|
||||
"EMBED_LINKS",
|
||||
"CONNECT",
|
||||
"SPEAK"
|
||||
// "DEAFEN_MEMBERS",
|
||||
];
|
||||
if (!message.guild.me.permissions.has(required_perms)) {
|
||||
try {
|
||||
message.react("❌");
|
||||
} catch {}
|
||||
return message.channel.send({embeds : [
|
||||
new Discord.MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle("❌ Erreur | Je n'ai pas assez de Permissions!")
|
||||
.setDescription(
|
||||
"Donnez moi la permission `ADMINISTRATEUR`, J'en ai besoin pour effacer les messages, et autres...\n Si vous ne voulez pas me donner les permissions administrateurs (||ce que je comprends ce bot est taré||), vous pouvez me donner ces permissions : \n> `" +
|
||||
required_perms.join("`, `") +
|
||||
"`"
|
||||
)]}
|
||||
);
|
||||
}
|
||||
//run the command with the parameters: client, message, args, user, text, prefix,
|
||||
command.run(
|
||||
client,
|
||||
message,
|
||||
args,
|
||||
message.member,
|
||||
args.join(" "),
|
||||
prefix
|
||||
);
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).red);
|
||||
return message.channel
|
||||
.send({embeds : [
|
||||
new Discord.MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle(
|
||||
"❌ Quelques chose s'est mal passé en essayant d'exécuter la commande `" +
|
||||
command.name +
|
||||
"`."
|
||||
)
|
||||
.setDescription(`\`\`\`${e.message}\`\`\``)]}
|
||||
)
|
||||
.then((msg) =>
|
||||
msg
|
||||
.delete({ timeout: 5000 })
|
||||
.catch((e) => console.log("Couldn't Delete --> Ignore".gray))
|
||||
);
|
||||
}
|
||||
} //if the command is not found send an info msg
|
||||
else {
|
||||
return message.channel
|
||||
.send({embeds : [
|
||||
new Discord.MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle(`❌ Commande inconnue, essayez : **\`${prefix}help\`**`)
|
||||
.setDescription(
|
||||
`TIPS : Pour avoir des informations détaillées sur une commande, faites : \`\n${config.prefix}help [NOM_DE_LA_COMMANDE]\``
|
||||
)]}
|
||||
)
|
||||
.then((msg) =>
|
||||
setTimeout(() => msg.delete().catch((e) => console.log("Couldn't Delete --> Ignore".gray)), 11000)
|
||||
// msg
|
||||
// .delete({ timeout: 5000 })
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
else {
|
||||
// TEMP :
|
||||
if (message.channel.type != "DM") {
|
||||
// INFO : For dorian
|
||||
if (message.author.id == "424305097158426626") {
|
||||
if (Math.floor(Math.random() * 40) == 1) {
|
||||
message.react('👶');
|
||||
}
|
||||
}
|
||||
// INFO : For Ninluc
|
||||
if (message.author.id == "417731861033385985" && message.guild.id == "805809277980901388") {
|
||||
if (Math.floor(Math.random() * 60) == 0) {
|
||||
const reacs = ["🇫", "🇩", "🇵"];
|
||||
for (reac of reacs) {
|
||||
message.react(reac);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// else we look for a keyword
|
||||
var keyword;
|
||||
for (k of client.keywords.keys()) {
|
||||
if (k.test(message.content) && keyword == undefined) {
|
||||
keyword = client.keywords.get(k);
|
||||
}
|
||||
}
|
||||
if (keyword) {
|
||||
// - COOLDOWN
|
||||
if (!client.cooldowns.has(keyword.keyword)) {
|
||||
//if its not in the cooldown, set it too there
|
||||
client.cooldowns.set(keyword.keyword, new Discord.Collection());
|
||||
}
|
||||
const now = Date.now(); //get the current time
|
||||
const timestamps = client.cooldowns.get(keyword.keyword); //get the timestamp of the last used commands
|
||||
const cooldownAmount =
|
||||
(keyword.cooldown || config.defaultCommandCooldown) * 1000; //get the cooldown amount of the command, if there is no cooldown there will be automatically 1 sec cooldown, so you cannot spam it^^
|
||||
if (timestamps.has(message.author.id)) {
|
||||
//if the user is on cooldown
|
||||
const expirationTime =
|
||||
timestamps.get(message.author.id) + cooldownAmount; //get the amount of time he needs to wait until he can run the cmd again
|
||||
if (now < expirationTime) {
|
||||
//if he is still on cooldown
|
||||
|
||||
// If it less than colldownAmount / 10
|
||||
if (now < timestamps.get(message.author.id) + (cooldownAmount / 2)) {
|
||||
|
||||
let cooldownMessages = ["fuck u ⏱", "IT'S TIME TO STOP !", "⏰", "⏲", "YOU'VE REACHED THE LIMITS ⌚️", "heheheha"]
|
||||
if (message.channel.permissionsFor(client.user.id).has("EMBED_LINKS")) {
|
||||
cooldownMessages = cooldownMessages.concat(["https://youtu.be/2k0SmqbBIpQ", "https://youtu.be/b6dAcK199s8"])
|
||||
}
|
||||
|
||||
message.channel.send({ content : cooldownMessages[Math.floor(Math.random() * cooldownMessages.length)]})
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
timestamps.set(message.author.id, now); //if he is not on cooldown, set it to the cooldown
|
||||
setTimeout(() => timestamps.delete(message.author.id), cooldownAmount); //set a timeout function with the cooldown, so it gets deleted later on again
|
||||
|
||||
// - RANDOMNESS
|
||||
// If randomness != 100% and it pass the random test
|
||||
if (keyword.random < 100 && Math.floor(Math.random() * (100 / keyword.random)) != 0) {return;}
|
||||
|
||||
// - RUN
|
||||
// Run the keyword activation
|
||||
keyword.run(
|
||||
client,
|
||||
message,
|
||||
message.member
|
||||
);
|
||||
}
|
||||
|
||||
if (message.channel.type == "DM" && !isNinluc(message.author.id)) {
|
||||
if (!message.content.includes("http")) {
|
||||
sendNinluc(client, `${message.author} m'a envoyé : "${message.content}"`)
|
||||
}
|
||||
else {
|
||||
sendNinluc(client, `${message.author} m'a envoyé : ${message.content}`)
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.log(e.stack)
|
||||
return message.channel.send({embeds : [
|
||||
new Discord.MessageEmbed()
|
||||
.setColor("RED")
|
||||
.setTitle(`❌ ERREUR | Une erreur est survenue : `)
|
||||
.setDescription(`\`\`\`${e.stack}\`\`\``)]}
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @INFO
|
||||
* Bot Coded by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template
|
||||
* @INFO
|
||||
* Work for Milrato Development | https://milrato.eu
|
||||
* @INFO
|
||||
* Please mention Him / Milrato Development, when using this Code!
|
||||
* @INFO
|
||||
*/
|
||||
};
|
101
events/guild/voiceStateUpdate.js
Normal file
101
events/guild/voiceStateUpdate.js
Normal file
@ -0,0 +1,101 @@
|
||||
const fs = require("fs");
|
||||
const config = require("../../botconfig/config.json"); //loading config file with token and prefix, and settings
|
||||
const ee = require("../../botconfig/embed.json"); //Loading all embed settings like color footertext and icon ...
|
||||
const Discord = require("discord.js"); //this is the official discord.js wrapper for the Discord Api, which we use!
|
||||
const { sendNinluc } = require("../../handlers/functions.js")
|
||||
const { createAudioPlayer, joinVoiceChannel, createAudioResource, StreamType } = require('@discordjs/voice');
|
||||
const { VoiceConnectionStatus } = require('@discordjs/voice');
|
||||
|
||||
const player = createAudioPlayer();
|
||||
|
||||
const ffmpeg = require("ffmpeg-static");
|
||||
|
||||
// const { generateDependencyReport } = require('@discordjs/voice');
|
||||
// console.log(generateDependencyReport().blue);
|
||||
|
||||
module.exports = async (client, oldState, voiceState) => {
|
||||
try {
|
||||
|
||||
if (voiceState === null || voiceState.channel === null || !voiceState.guild || oldState.channel == voiceState.channel || voiceState.channel.full || !voiceState.channel.joinable) return;
|
||||
if (!voiceState.channel.permissionsFor(voiceState.guild.me).has("CONNECT") || !voiceState.channel.permissionsFor(voiceState.guild.me).has("SPEAK")) {return;}
|
||||
|
||||
player.on('error', error => {
|
||||
// subscription.unsubscribe()
|
||||
connection.destroy();
|
||||
console.error('Error:', error.message, 'with track', error.resource.metadata.title);
|
||||
});
|
||||
|
||||
// Si c'est du bot alors se démute
|
||||
if (voiceState.member.user.id === client.user.id && voiceState.mute) {
|
||||
// Si il sait se demute
|
||||
if (voiceState.channel.permissionsFor(voiceState.guild.me).has("MUTE_MEMBERS")) {
|
||||
voiceState.setMute(false);
|
||||
return;
|
||||
} else {return;}
|
||||
}
|
||||
else if (voiceState.member.user.id === client.user.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var finish = true
|
||||
var playRick = false;
|
||||
if (Math.floor(Math.random() * 14) == 0) {playRick = true}
|
||||
|
||||
if (playRick && !voiceState.deaf && finish) {
|
||||
|
||||
let videos = fs.readdirSync(`./sounds/`).filter((file) => file.endsWith(".mp3"))
|
||||
|
||||
// voiceState.setSelfMute(0);
|
||||
// var channel = voiceState.channel
|
||||
const connection = joinVoiceChannel({
|
||||
channelId: voiceState.channel.id,
|
||||
guildId: voiceState.guild.id,
|
||||
adapterCreator: voiceState.guild.voiceAdapterCreator,
|
||||
});
|
||||
// const subscription = connection.subscribe(player);
|
||||
var rdVideoLink = videos[Math.floor(Math.random() * videos.length)]
|
||||
|
||||
try {
|
||||
connection.on(VoiceConnectionStatus.Ready, async() => {
|
||||
connection;
|
||||
let subscription = connection.subscribe(player);
|
||||
|
||||
const resource = createAudioResource("./sounds/" + rdVideoLink, {
|
||||
inputType: StreamType.Arbitrary
|
||||
});
|
||||
resource.playStream.on("finish", () => {
|
||||
setTimeout(() => {
|
||||
subscription.unsubscribe()
|
||||
connection.destroy();
|
||||
}, 2000)
|
||||
})
|
||||
|
||||
// if (subscription) {
|
||||
// // Unsubscribe after 5 seconds (stop playing audio on the voice connection)
|
||||
// setTimeout(() => subscription.unsubscribe(), 5_000);
|
||||
// }
|
||||
|
||||
player.play(resource);
|
||||
})
|
||||
|
||||
|
||||
|
||||
// setTimeout((subscription) => {
|
||||
// subscription.unsubscribe()
|
||||
// if (connection.state.status != "destroyed") {
|
||||
// connection.destroy();
|
||||
// }
|
||||
// }, 6 * 1000)
|
||||
|
||||
sendNinluc(client, `Je joue *${rdVideoLink.split('.')[0]}* dans le salon ${voiceState.channel} du serveur **${voiceState.guild.name}**`);
|
||||
} catch (error) {
|
||||
console.log(error.message)
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e.stack)
|
||||
}
|
||||
}
|
28
handlers/command.js
Executable file
28
handlers/command.js
Executable file
@ -0,0 +1,28 @@
|
||||
const { readdirSync } = require("fs");
|
||||
const ascii = require("ascii-table");
|
||||
let table = new ascii("Commands");
|
||||
table.setHeading("Command", "Load status");
|
||||
console.log("Welcome to SERVICE HANDLER".yellow);
|
||||
module.exports = (client) => {
|
||||
try{
|
||||
readdirSync("./commands/").forEach((dir) => {
|
||||
const commands = readdirSync(`./commands/${dir}/`).filter((file) => file.endsWith(".js"));
|
||||
for (let file of commands) {
|
||||
let pull = require(`../commands/${dir}/${file}`);
|
||||
if (pull.name) {
|
||||
client.commands.set(pull.name, pull);
|
||||
table.addRow(pull.name, "Ready");
|
||||
} else {
|
||||
table.addRow(file, `error->missing a help.name,or help.name is not a string.`);
|
||||
continue;
|
||||
}
|
||||
if (pull.aliases && Array.isArray(pull.aliases)) pull.aliases.forEach((alias) => client.aliases.set(alias, pull.name));
|
||||
}
|
||||
});
|
||||
console.log(table.toString().cyan);
|
||||
}catch (e){
|
||||
console.log(String(e.stack).bgRed)
|
||||
}
|
||||
};
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
29
handlers/dmCommand.js
Normal file
29
handlers/dmCommand.js
Normal file
@ -0,0 +1,29 @@
|
||||
const { readdirSync } = require("fs");
|
||||
const ascii = require("ascii-table");
|
||||
let table = new ascii("DM Commands");
|
||||
table.setHeading("Command", "Load status");
|
||||
module.exports = (client) => {
|
||||
try {
|
||||
const command = readdirSync(`./dmCommands/`).filter((file) =>
|
||||
file.endsWith(".js")
|
||||
); // Get all the js files
|
||||
for (let file of command) {
|
||||
let pull = require(`../dmCommands/${file}`);
|
||||
if (pull.name) {
|
||||
client.dmCommands.set(pull.name, pull);
|
||||
table.addRow(pull.name, "Ready");
|
||||
} else {
|
||||
table.addRow(
|
||||
file,
|
||||
`error->missing a help.name,or help.name is not a string.`
|
||||
);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
console.log(table.toString().cyan);
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).bgRed);
|
||||
}
|
||||
};
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
40
handlers/events.js
Executable file
40
handlers/events.js
Executable file
@ -0,0 +1,40 @@
|
||||
const fs = require("fs");
|
||||
const ascii = require("ascii-table");
|
||||
let table = new ascii("Events");
|
||||
table.setHeading("Events", "Load status");
|
||||
const allevents = [];
|
||||
module.exports = async (client) => {
|
||||
try{
|
||||
const load_dir = (dir) => {
|
||||
const event_files = fs.readdirSync(`./events/${dir}`).filter((file) => file.endsWith(".js"));
|
||||
for (const file of event_files){
|
||||
const event = require(`../events/${dir}/${file}`)
|
||||
let eventName = file.split(".")[0];
|
||||
allevents.push(eventName);
|
||||
client.on(eventName, event.bind(null, client));
|
||||
}
|
||||
}
|
||||
await ["client", "guild"].forEach(e=>load_dir(e));
|
||||
for (let i = 0; i < allevents.length; i++) {
|
||||
try {
|
||||
table.addRow(allevents[i], "Ready");
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).red);
|
||||
}
|
||||
}
|
||||
console.log(table.toString().cyan);
|
||||
try{
|
||||
const stringlength2 = 69;
|
||||
console.log("\n")
|
||||
console.log(` ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓`.bold.yellow)
|
||||
console.log(` ┃ `.bold.yellow + " ".repeat(-1+stringlength2-` ┃ `.length)+ "┃".bold.yellow)
|
||||
console.log(` ┃ `.bold.yellow + `Logging into the BOT...`.bold.yellow + " ".repeat(-1+stringlength2-` ┃ `.length-`Logging into the BOT...`.length)+ "┃".bold.yellow)
|
||||
console.log(` ┃ `.bold.yellow + " ".repeat(-1+stringlength2-` ┃ `.length)+ "┃".bold.yellow)
|
||||
console.log(` ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛`.bold.yellow)
|
||||
}catch{ /* */ }
|
||||
}catch (e){
|
||||
console.log(String(e.stack).bgRed)
|
||||
}
|
||||
};
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
130
handlers/functions.js
Executable file
130
handlers/functions.js
Executable file
@ -0,0 +1,130 @@
|
||||
module.exports = {
|
||||
//get a member lol
|
||||
getMember: function(message, toFind = "") {
|
||||
try{
|
||||
toFind = toFind.toLowerCase();
|
||||
let target = message.guild.members.get(toFind);
|
||||
if (!target && message.mentions.members) target = message.mentions.members.first();
|
||||
if (!target && toFind) {
|
||||
target = message.guild.members.find((member) => {
|
||||
return member.displayName.toLowerCase().includes(toFind) || member.user.tag.toLowerCase().includes(toFind);
|
||||
});
|
||||
}
|
||||
if (!target) target = message.member;
|
||||
return target;
|
||||
}catch (e){
|
||||
console.log(String(e.stack).bgRed)
|
||||
}
|
||||
},
|
||||
//changeging the duration from ms to a date
|
||||
duration: function(ms) {
|
||||
const sec = Math.floor((ms / 1000) % 60).toString();
|
||||
const min = Math.floor((ms / (60 * 1000)) % 60).toString();
|
||||
const hrs = Math.floor((ms / (60 * 60 * 1000)) % 60).toString();
|
||||
const days = Math.floor((ms / (24 * 60 * 60 * 1000)) % 60).toString();
|
||||
return `\`${days}Days\`,\`${hrs}Hours\`,\`${min}Minutes\`,\`${sec}Seconds\``;
|
||||
},
|
||||
//function for awaiting reactions
|
||||
promptMessage: async function(message, author, time, validReactions) {
|
||||
try{
|
||||
time *= 1000;
|
||||
for (const reaction of validReactions) await message.react(reaction);
|
||||
const filter = (reaction, user) => validReactions.includes(reaction.emoji.name) && user.id === author.id;
|
||||
return message.awaitReactions(filter, {
|
||||
max: 1,
|
||||
time: time
|
||||
}).then((collected) => collected.first() && collected.first().emoji.name);
|
||||
}catch (e){
|
||||
console.log(String(e.stack).bgRed)
|
||||
}
|
||||
},
|
||||
//Function to wait some time
|
||||
delay: function(delayInms) {
|
||||
try{
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve(2);
|
||||
}, delayInms);
|
||||
});
|
||||
}catch (e){
|
||||
console.log(String(e.stack).bgRed)
|
||||
}
|
||||
},
|
||||
//random number between 0 and x
|
||||
getRandomInt: function(max) {
|
||||
try{
|
||||
return Math.floor(Math.random() * Math.floor(max));
|
||||
}catch (e){
|
||||
console.log(String(e.stack).bgRed)
|
||||
}
|
||||
},
|
||||
//random number between y and x
|
||||
getRandomNum: function(min, max) {
|
||||
try{
|
||||
return Math.floor(Math.random() * Math.floor((max - min) + min));
|
||||
}catch (e){
|
||||
console.log(String(e.stack).bgRed)
|
||||
}
|
||||
},
|
||||
//function for creating a bar
|
||||
createBar: function(maxtime, currenttime, size = 25, line = "▬", slider = "🔶") {
|
||||
try{
|
||||
let bar = currenttime > maxtime ? [line.repeat(size / 2 * 2), (currenttime / maxtime) * 100] : [line.repeat(Math.round(size / 2 * (currenttime / maxtime))).replace(/.$/, slider) + line.repeat(size - Math.round(size * (currenttime / maxtime)) + 1), currenttime / maxtime];
|
||||
if (!String(bar).includes("🔶")) return `**[🔶${line.repeat(size - 1)}]**\n**00:00:00 / 00:00:00**`;
|
||||
return `**[${bar[0]}]**\n**${new Date(currenttime).toISOString().substr(11, 8)+" / "+(maxtime==0?" ◉ LIVE":new Date(maxtime).toISOString().substr(11, 8))}**`;
|
||||
}catch (e) {
|
||||
console.log(String(e.stack).bgRed)
|
||||
}
|
||||
},
|
||||
format: function(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(String(e.stack).bgRed)
|
||||
}
|
||||
},
|
||||
escapeRegex: function(str) {
|
||||
try{
|
||||
return str.replace(/[.*+?^${}()|[\]\\]/g, `\\$&`);
|
||||
}catch (e){
|
||||
console.log(String(e.stack).bgRed)
|
||||
}
|
||||
},
|
||||
arrayMove: function(array, from, to) {
|
||||
try{
|
||||
array = [...array];
|
||||
const startIndex = from < 0 ? array.length + from : from;
|
||||
if (startIndex >= 0 && startIndex < array.length) {
|
||||
const endIndex = to < 0 ? array.length + to : to;
|
||||
const [item] = array.splice(from, 1);
|
||||
array.splice(endIndex, 0, item);
|
||||
}
|
||||
return array;
|
||||
}catch (e){
|
||||
console.log(String(e.stack).bgRed)
|
||||
}
|
||||
},
|
||||
sendNinluc: function (client, text) {
|
||||
client.users.fetch('417731861033385985', false).then(u => {
|
||||
u.send({ content : text})
|
||||
})
|
||||
},
|
||||
isNinluc: function (id) {
|
||||
return id == "417731861033385985";
|
||||
},
|
||||
/**
|
||||
* Gives an random element from the array given.
|
||||
* @param {array} array The array to choose an element from
|
||||
* @returns An element from the array
|
||||
*/
|
||||
choose: function (array) {
|
||||
return array[Math.floor(Math.random() * array.length)]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
25
handlers/keywords.js
Normal file
25
handlers/keywords.js
Normal file
@ -0,0 +1,25 @@
|
||||
const { readdirSync } = require("fs");
|
||||
const ascii = require("ascii-table");
|
||||
let table = new ascii("Keyword triggers");
|
||||
table.setHeading("Keyword", "Load status");
|
||||
module.exports = (client) => {
|
||||
try{
|
||||
const keywords = readdirSync(`./keywords/`).filter((file) => file.endsWith(".js")); // Get all the js files
|
||||
for (let file of keywords) {
|
||||
let pull = require(`../keywords/${file}`);
|
||||
if (pull.keyword) {
|
||||
client.keywords.set(pull.regex, pull);
|
||||
table.addRow(pull.keyword, "Ready");
|
||||
} else {
|
||||
table.addRow(file, `error->missing a help.keyword,or help.keyword is not a string.`);
|
||||
continue;
|
||||
}
|
||||
if (pull.aliases && Array.isArray(pull.aliases)) pull.aliases.forEach((alias) => client.keywords.set(alias, pull));
|
||||
}
|
||||
console.log(table.toString().cyan);
|
||||
}catch (e){
|
||||
console.log(String(e.stack).bgRed)
|
||||
}
|
||||
};
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
38
index.js
Executable file
38
index.js
Executable file
@ -0,0 +1,38 @@
|
||||
//Importing all the needed Commands
|
||||
const Discord = require("discord.js"); //this is the official discord.js wrapper for the Discord Api, which we use!
|
||||
const colors = require("colors"); //this Package is used, to change the colors of our Console! (optional and doesn't effect performance)
|
||||
const fs = require("fs"); //this package is for reading files and getting their inputs
|
||||
|
||||
//Creating the Discord.js Client for This Bot with some default settings ;) and with partials, so you can fetch OLD messages
|
||||
const client = new Discord.Client({
|
||||
// makeCache: 60,
|
||||
// fetchAllMembers: false,
|
||||
// messageCacheMaxSize: 10,
|
||||
makeCache: Discord.Options.cacheWithLimits({
|
||||
MessageManager: 60,
|
||||
PresenceManager: 20
|
||||
}),
|
||||
restTimeOffset: 0,
|
||||
restWsBridgetimeout: 100,
|
||||
disableEveryone: true, // Will cause problems if want to reply to @everyone
|
||||
partials: ['MESSAGE', 'CHANNEL', 'REACTION', 'USER'],
|
||||
intents: [Discord.Intents.FLAGS.GUILDS, Discord.Intents.FLAGS.GUILD_VOICE_STATES, Discord.Intents.FLAGS.GUILD_INVITES, Discord.Intents.FLAGS.GUILD_MESSAGES, Discord.Intents.FLAGS.DIRECT_MESSAGES]
|
||||
});
|
||||
|
||||
//Client variables to use everywhere
|
||||
client.commands = new Discord.Collection(); //an collection (like a digital map(database)) for all your commands
|
||||
client.aliases = new Discord.Collection(); //an collection for all your command-aliases
|
||||
client.categories = fs.readdirSync("./commands/"); //categories
|
||||
client.cooldowns = new Discord.Collection(); //an collection for cooldown commands of each user
|
||||
client.keywords = new Discord.Collection(); // all the keywords the bot will react to
|
||||
client.dmCommands = new Discord.Collection(); // all the private commands
|
||||
|
||||
//Loading files, with the client variable like Command Handler, Event Handler, ...
|
||||
["command", "dmCommand", "events", "keywords"].forEach(handler => {
|
||||
require(`./handlers/${handler}`)(client);
|
||||
});
|
||||
|
||||
//login into the bot
|
||||
client.login(require("./botconfig/config.json").token);
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
34
keywords/bjr.js
Normal file
34
keywords/bjr.js
Normal file
@ -0,0 +1,34 @@
|
||||
const { MessageEmbed } = require("discord.js");
|
||||
const config = require("../botconfig/config.json");
|
||||
const ee = require("../botconfig/embed.json");
|
||||
const { choose, isNinluc } = require("../handlers/functions");
|
||||
|
||||
module.exports = {
|
||||
keyword: "bjr",
|
||||
regex: /^.{0,5}(bjr|bonjour).{0,17}$/i,
|
||||
cooldown: 3,
|
||||
random: 80,
|
||||
run: async (client, message, user) => {
|
||||
try{
|
||||
// If it has mentions → return nothing
|
||||
if (message.mentions.members.size) {return;}
|
||||
|
||||
|
||||
|
||||
var answers = ["Bonjour 🌞", `slt ${message.author} 👋`];
|
||||
|
||||
return message.channel.send({ content : choose(answers)})
|
||||
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).bgRed)
|
||||
return message.channel.send({embeds : [new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle(`❌ ERREUR | Une erreur est survenue : `)
|
||||
.setDescription(`\`\`\`${e.stack}\`\`\``)]}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
34
keywords/bsr.js
Normal file
34
keywords/bsr.js
Normal file
@ -0,0 +1,34 @@
|
||||
const { MessageEmbed } = require("discord.js");
|
||||
const config = require("../botconfig/config.json");
|
||||
const ee = require("../botconfig/embed.json");
|
||||
const { choose, isNinluc } = require("../handlers/functions");
|
||||
|
||||
module.exports = {
|
||||
keyword: "bsr",
|
||||
regex: /^.{0,5}(bsr|bonsoir).{0,17}$/i,
|
||||
cooldown: 3,
|
||||
random: 80,
|
||||
run: async (client, message, user) => {
|
||||
try{
|
||||
// If it has mentions → return nothing
|
||||
if (message.mentions.members.size) {return;}
|
||||
|
||||
|
||||
|
||||
var answers = ["Bonsoir 🌙", `bsr ${message.author}`, "bsr Figue..."];
|
||||
|
||||
return message.channel.send({ content : choose(answers)})
|
||||
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).bgRed)
|
||||
return message.channel.send({embeds : [new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle(`❌ ERREUR | Une erreur est survenue : `)
|
||||
.setDescription(`\`\`\`${e.stack}\`\`\``)]}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
28
keywords/ouistiti.js
Normal file
28
keywords/ouistiti.js
Normal file
@ -0,0 +1,28 @@
|
||||
const { MessageEmbed } = require("discord.js");
|
||||
const config = require("../botconfig/config.json");
|
||||
const ee = require("../botconfig/embed.json");
|
||||
const { choose } = require("../handlers/functions");
|
||||
|
||||
module.exports = {
|
||||
keyword: "oui",
|
||||
regex: /oui(\ |\.|\!|\?)*$/i,
|
||||
cooldown: 3,
|
||||
random: 25,
|
||||
run: async (client, message, user) => {
|
||||
try{
|
||||
var answers = ["...stiti", "stiti 😋"];
|
||||
return message.channel.send({ content : choose(answers)})
|
||||
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).bgRed)
|
||||
return message.channel.send({embeds : [new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle(`❌ ERREUR | Une erreur est survenue : `)
|
||||
.setDescription(`\`\`\`${e.stack}\`\`\``)]}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
28
keywords/quoifeur.js
Normal file
28
keywords/quoifeur.js
Normal file
@ -0,0 +1,28 @@
|
||||
const { MessageEmbed } = require("discord.js");
|
||||
const config = require("../botconfig/config.json");
|
||||
const ee = require("../botconfig/embed.json");
|
||||
const { choose } = require("../handlers/functions");
|
||||
|
||||
module.exports = {
|
||||
keyword: "quoi",
|
||||
regex: /quoi(\ |\.|\!|\?)*$/i,
|
||||
cooldown: 2,
|
||||
random: 30,
|
||||
run: async (client, message, user) => {
|
||||
try{
|
||||
var answers = ["...feur", "feur 😋", "😈", "KOIKOUBEH"];
|
||||
return message.channel.send({ content : choose(answers)})
|
||||
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).bgRed)
|
||||
return message.channel.send({embeds : [new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle(`❌ ERREUR | Une erreur est survenue : `)
|
||||
.setDescription(`\`\`\`${e.stack}\`\`\``)]}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
39
keywords/slt.js
Normal file
39
keywords/slt.js
Normal file
@ -0,0 +1,39 @@
|
||||
const { MessageEmbed } = require("discord.js");
|
||||
const config = require("../botconfig/config.json");
|
||||
const ee = require("../botconfig/embed.json");
|
||||
const { choose, isNinluc } = require("../handlers/functions");
|
||||
|
||||
module.exports = {
|
||||
keyword: "slt",
|
||||
regex: /^.{0,5}(slt|salut).{0,17}$/i,
|
||||
cooldown: 3,
|
||||
random: 80,
|
||||
run: async (client, message, user) => {
|
||||
try{
|
||||
// If it has mentions → return nothing
|
||||
if (message.mentions.members.size) {return;}
|
||||
|
||||
|
||||
|
||||
if (isNinluc(message.author.id)) {
|
||||
var answers = ["Sup bro 🤛"];
|
||||
}
|
||||
else {
|
||||
var answers = ["Salut 👋", `slt ${message.author}`];
|
||||
}
|
||||
|
||||
return message.channel.send({ content : choose(answers)})
|
||||
|
||||
} catch (e) {
|
||||
console.log(String(e.stack).bgRed)
|
||||
return message.channel.send({embeds : [new MessageEmbed()
|
||||
.setColor(ee.wrongcolor)
|
||||
.setFooter({text : ee.footertext, iconURL : ee.footericon})
|
||||
.setTitle(`❌ ERREUR | Une erreur est survenue : `)
|
||||
.setDescription(`\`\`\`${e.stack}\`\`\``)]}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
29
misc/scripts/ytDownloader.py
Normal file
29
misc/scripts/ytDownloader.py
Normal file
@ -0,0 +1,29 @@
|
||||
# coding: utf-8
|
||||
|
||||
from pytube import YouTube
|
||||
import os
|
||||
|
||||
#ask for the link from user
|
||||
names = []
|
||||
links = []
|
||||
|
||||
|
||||
for link in links:
|
||||
|
||||
yt = YouTube(link)
|
||||
#Showing details
|
||||
print("Title: ",yt.title)
|
||||
print("Number of views: ",yt.views)
|
||||
print("Length of video: ",yt.length)
|
||||
print("Rating of video: ",yt.rating)
|
||||
#Getting the highest resolution possible
|
||||
ys = yt.streams.filter(only_audio=True).first()
|
||||
|
||||
#Starting download
|
||||
print("Downloading...")
|
||||
ys.download(output_path=f"/home/ninluc/Documents/codage/discord/Dat_Boi/sounds/")
|
||||
os.rename(f"/home/ninluc/Documents/codage/discord/Dat_Boi/sounds/{yt.title}.mp4", f"/home/ninluc/Documents/codage/discord/Dat_Boi/sounds/{yt.title}.mp3")
|
||||
print("Download completed!!")
|
||||
names.append(yt.title)
|
||||
|
||||
print(names)
|
BIN
nobody.jpeg
Normal file
BIN
nobody.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 570 KiB |
1712
package-lock.json
generated
Normal file
1712
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
25
package.json
Executable file
25
package.json
Executable file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "datboi",
|
||||
"version": "1.0.0",
|
||||
"description": "Dat boi, the annoying discord bot",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "node --trace-warnings index.js",
|
||||
"stop": "sh ~/scripts/sshKill.sh"
|
||||
},
|
||||
"author": "Tomato#6966 (author of this template), Ninluc",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@discordjs/opus": "^0.5.3",
|
||||
"@discordjs/voice": "^0.10.0",
|
||||
"ascii-table": "0.0.9",
|
||||
"discord.js": "^13.8.1",
|
||||
"ffmpeg-static": "^4.4.1",
|
||||
"libsodium-wrappers": "^0.7.10",
|
||||
"moment": "^2.29.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ascii-table": "0.0.9",
|
||||
"colors": "^1.4.0"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user