mirror of
https://github.com/Ninluc/Dat_Boi.git
synced 2025-08-09 23:26:13 +02:00
Initial commit
This commit is contained in:
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 */
|
Reference in New Issue
Block a user