Update discord.js dependency to version 14 (#116)
* Update discord.js in package.json to v14.16.3 & update package-lock.json * Update all embeds to work with v14 * Do not show discriminator if it is 0
This commit is contained in:
parent
c751a5aec2
commit
062e6d43dc
14 changed files with 1306 additions and 2437 deletions
|
@ -1,24 +1,24 @@
|
|||
const Discord = require('discord.js');
|
||||
const getCreationDate = require('../../util/getCreationDate');
|
||||
const getGuildCount = require('../../util/getGuildCount');
|
||||
|
||||
|
||||
|
||||
module.exports = {
|
||||
name: 'botinfo',
|
||||
description: 'Shows information about the bot',
|
||||
execute({message, client, prefix}) {
|
||||
let guildCount = getGuildCount(client)
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setColor(15780145)
|
||||
.setTitle("Information about bot")
|
||||
.setTimestamp()
|
||||
.setAuthor(client.user.username, client.user.avatarURL({ dynamic: true, size: 4096 }))
|
||||
.addFields({
|
||||
name: "General info", value: `Name: ${client.user.username}\nPrefix: ${prefix}\nTotal Servers: ${guildCount}\nTotal Commands: ${client.commands.size}\nCreation Date: ${getCreationDate(client)}\nSource: [Click Here](https://github.com/SileNce5k/discord_bot)`,
|
||||
},)
|
||||
|
||||
message.channel.send({embeds :[embed]})
|
||||
|
||||
}
|
||||
const {EmbedBuilder} = require('discord.js');
|
||||
const getCreationDate = require('../../util/getCreationDate');
|
||||
const getGuildCount = require('../../util/getGuildCount');
|
||||
|
||||
|
||||
|
||||
module.exports = {
|
||||
name: 'botinfo',
|
||||
description: 'Shows information about the bot',
|
||||
execute({message, client, prefix}) {
|
||||
let guildCount = getGuildCount(client)
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(15780145)
|
||||
.setTitle("Information about bot")
|
||||
.setTimestamp()
|
||||
.setAuthor({name: client.user.username, iconURL: client.user.avatarURL({ format: 'png', dynamic: true, size: 2048 })})
|
||||
.addFields({
|
||||
name: "General info", value: `Name: ${client.user.username}\nPrefix: ${prefix}\nTotal Servers: ${guildCount}\nTotal Commands: ${client.commands.size}\nCreation Date: ${getCreationDate(client)}\nSource: [Click Here](https://github.com/SileNce5k/discord_bot)`,
|
||||
},)
|
||||
|
||||
message.channel.send({embeds :[embed]})
|
||||
|
||||
}
|
||||
};
|
|
@ -1,97 +1,97 @@
|
|||
const fs = require('fs');
|
||||
const Discord = require('discord.js');
|
||||
const getSubdirFiles = require('../../util/getSubdirFiles');
|
||||
|
||||
|
||||
module.exports = {
|
||||
name: 'help',
|
||||
description: 'List all available commands.',
|
||||
moreHelp: ["Examples:","`<prefix>help [optional_page]` will return help with a small description for each command",
|
||||
"`<prefix>help <another_command>` will return help with a more descriptive description",
|
||||
"The descriptive description isn't available on all commands",
|
||||
"`<prefix>help netmodules` to display help for netmodules"
|
||||
],
|
||||
execute({ message, args, prefix, client }) {
|
||||
let commands = ""
|
||||
let commandFiles = getSubdirFiles('commands/')
|
||||
let x = false;
|
||||
let fieldName = `Page [[page]]/${Math.round(client.commands.size / 10)}`;
|
||||
let iteration = 0;
|
||||
let num_in_args = false;
|
||||
let added_commands = 0;
|
||||
let page = -1;
|
||||
if (args[0] == "netmodules") {
|
||||
commandFiles = fs.readdirSync('../../netload').filter(file => file.endsWith('.js'));
|
||||
if (commandFiles.length == 0) {
|
||||
message.channel.send("There are no netmodules currently loaded.")
|
||||
x = true;
|
||||
}
|
||||
|
||||
}else if(!isNaN(parseInt(args[0])) && parseInt(args[0])){
|
||||
num_in_args = true;
|
||||
iteration = ( parseInt(args[0]) - 1) * 10;
|
||||
page = Math.round(parseInt(args[0]))
|
||||
}
|
||||
if(page === -1){
|
||||
page = 1;
|
||||
}
|
||||
fieldName = fieldName.replace("[[page]]", page);
|
||||
const max_commands = iteration + 10;
|
||||
|
||||
if (x) return;
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setColor(15780145)
|
||||
.setTitle("Commands")
|
||||
.setTimestamp()
|
||||
.setAuthor(client.user.username, client.user.avatarURL({ dynamic: true, size: 4096 }))
|
||||
let start = 0;
|
||||
for (const file of commandFiles) {
|
||||
if(iteration >= max_commands) break;
|
||||
const command = require(`../../${file}`);
|
||||
|
||||
if(command.disabled) continue;
|
||||
|
||||
if (args[0] == "admin") {
|
||||
if (command.admin)
|
||||
commands = commands + `${prefix}${command.name} | ${command.description}\n`
|
||||
}else if(!args[0] || num_in_args){
|
||||
if (!command.admin){
|
||||
if(start < iteration){
|
||||
}else{
|
||||
added_commands++
|
||||
commands = commands + `${prefix}${command.name} | ${command.description}\n`;
|
||||
iteration++
|
||||
}
|
||||
start++;
|
||||
}
|
||||
}else if(args[0] === command.name){
|
||||
commands = commands + `${prefix}${command.name}\n`
|
||||
embed.setTitle(command.name.charAt(0).toUpperCase() + command.name.slice(1))
|
||||
if(command.moreHelp){
|
||||
command.moreHelp.forEach(element => {
|
||||
commands = commands + `${element}\n`
|
||||
});
|
||||
} else {
|
||||
fieldName = "Description";
|
||||
commands = commands + `${command.description}`;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(commands === ""){
|
||||
fieldName = "Command not found";
|
||||
commands = "No command with that name found."
|
||||
}
|
||||
let regex = /<prefix>/g;
|
||||
commands = commands.replace(regex, prefix)
|
||||
embed.addFields(
|
||||
{ name: fieldName, value: commands },
|
||||
)
|
||||
if(embed.fields[0].value.length > 1023){
|
||||
message.channel.send(`There are more than 1023 characters`)
|
||||
}else {
|
||||
message.channel.send({embeds :[embed]});
|
||||
}
|
||||
},
|
||||
const fs = require('fs');
|
||||
const {EmbedBuilder} = require('discord.js');
|
||||
const getSubdirFiles = require('../../util/getSubdirFiles');
|
||||
|
||||
|
||||
module.exports = {
|
||||
name: 'help',
|
||||
description: 'List all available commands.',
|
||||
moreHelp: ["Examples:","`<prefix>help [optional_page]` will return help with a small description for each command",
|
||||
"`<prefix>help <another_command>` will return help with a more descriptive description",
|
||||
"The descriptive description isn't available on all commands",
|
||||
"`<prefix>help netmodules` to display help for netmodules"
|
||||
],
|
||||
execute({ message, args, prefix, client }) {
|
||||
let commands = ""
|
||||
let commandFiles = getSubdirFiles('commands/')
|
||||
let x = false;
|
||||
let fieldName = `Page [[page]]/${Math.round(client.commands.size / 10)}`;
|
||||
let iteration = 0;
|
||||
let num_in_args = false;
|
||||
let added_commands = 0;
|
||||
let page = -1;
|
||||
if (args[0] == "netmodules") {
|
||||
commandFiles = fs.readdirSync('../../netload').filter(file => file.endsWith('.js'));
|
||||
if (commandFiles.length == 0) {
|
||||
message.channel.send("There are no netmodules currently loaded.")
|
||||
x = true;
|
||||
}
|
||||
|
||||
}else if(!isNaN(parseInt(args[0])) && parseInt(args[0])){
|
||||
num_in_args = true;
|
||||
iteration = ( parseInt(args[0]) - 1) * 10;
|
||||
page = Math.round(parseInt(args[0]))
|
||||
}
|
||||
if(page === -1){
|
||||
page = 1;
|
||||
}
|
||||
fieldName = fieldName.replace("[[page]]", page);
|
||||
const max_commands = iteration + 10;
|
||||
|
||||
if (x) return;
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(15780145)
|
||||
.setTitle("Commands")
|
||||
.setTimestamp()
|
||||
.setAuthor({name: client.user.username, iconURL: client.user.avatarURL({ format: 'png', dynamic: true, size: 2048 })})
|
||||
let start = 0;
|
||||
for (const file of commandFiles) {
|
||||
if(iteration >= max_commands) break;
|
||||
const command = require(`../../${file}`);
|
||||
|
||||
if(command.disabled) continue;
|
||||
|
||||
if (args[0] == "admin") {
|
||||
if (command.admin)
|
||||
commands = commands + `${prefix}${command.name} | ${command.description}\n`
|
||||
}else if(!args[0] || num_in_args){
|
||||
if (!command.admin){
|
||||
if(start < iteration){
|
||||
}else{
|
||||
added_commands++
|
||||
commands = commands + `${prefix}${command.name} | ${command.description}\n`;
|
||||
iteration++
|
||||
}
|
||||
start++;
|
||||
}
|
||||
}else if(args[0] === command.name){
|
||||
commands = commands + `${prefix}${command.name}\n`
|
||||
embed.setTitle(command.name.charAt(0).toUpperCase() + command.name.slice(1))
|
||||
if(command.moreHelp){
|
||||
command.moreHelp.forEach(element => {
|
||||
commands = commands + `${element}\n`
|
||||
});
|
||||
} else {
|
||||
fieldName = "Description";
|
||||
commands = commands + `${command.description}`;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(commands === ""){
|
||||
fieldName = "Command not found";
|
||||
commands = "No command with that name found."
|
||||
}
|
||||
let regex = /<prefix>/g;
|
||||
commands = commands.replace(regex, prefix)
|
||||
embed.addFields(
|
||||
{ name: fieldName, value: commands },
|
||||
)
|
||||
if(embed.data.fields[0].value.length > 1023){
|
||||
message.channel.send(`There are more than 1023 characters`)
|
||||
}else {
|
||||
message.channel.send({embeds :[embed]});
|
||||
}
|
||||
},
|
||||
};
|
|
@ -1,23 +1,27 @@
|
|||
const Discord = require('discord.js');
|
||||
const convertDateToISOString = require('../../util/convertDateToISOString');
|
||||
|
||||
module.exports = {
|
||||
name: 'serverinfo',
|
||||
description: 'Displays information about the server',
|
||||
execute({message}) {
|
||||
const embed = new Discord.MessageEmbed()
|
||||
|
||||
.setThumbnail(message.guild.iconURL({ format: 'png', dynamic: true, size: 4096 }))
|
||||
.setColor("#ee7939")
|
||||
.setTimestamp()
|
||||
.addField("Server Owner: ", `<@${message.guild.ownerId}>`)
|
||||
.addField("Server Name: ", message.guild.name)
|
||||
.addField("Created", convertDateToISOString(message.guild.createdAt))
|
||||
.addField("Members: ", message.guild.memberCount.toString())
|
||||
//.addField("Emojis: ", message.guild.emojis.cache.array().length)
|
||||
|
||||
message.channel.send({embeds :[embed]});
|
||||
|
||||
|
||||
}
|
||||
const {EmbedBuilder} = require('discord.js');
|
||||
const convertDateToISOString = require('../../util/convertDateToISOString');
|
||||
|
||||
module.exports = {
|
||||
name: 'serverinfo',
|
||||
description: 'Displays information about the server',
|
||||
execute({message}) {
|
||||
const embed = new EmbedBuilder()
|
||||
|
||||
.setThumbnail(message.guild.iconURL({ format: 'png', dynamic: true, size: 4096 }))
|
||||
.setColor("#ee7939")
|
||||
.setTimestamp()
|
||||
.addFields([
|
||||
{name: "Server Owner", value: `<@${message.guild.ownerId}>`, inline: false},
|
||||
{name: "Server Name", value: message.guild.name, inline: false},
|
||||
{name: "Created", value: convertDateToISOString(message.guild.createdAt), inline: false},
|
||||
{name: "Members", value: message.guild.memberCount.toString(), inline: false},
|
||||
|
||||
|
||||
])
|
||||
//.addField("Emojis: ", message.guild.emojis.cache.array().length)
|
||||
|
||||
message.channel.send({embeds :[embed]});
|
||||
|
||||
|
||||
}
|
||||
};
|
|
@ -1,4 +1,4 @@
|
|||
const Discord = require('discord.js');
|
||||
const {EmbedBuilder} = require('discord.js');
|
||||
const getCreationDate = require('../../util/getCreationDate.js');
|
||||
const getJoinDate = require('../../util/getJoinDate.js');
|
||||
const getNickname = require('../../util/getNickname.js');
|
||||
|
@ -39,7 +39,8 @@ module.exports = {
|
|||
}
|
||||
status = user.presence.status.charAt(0).toUpperCase()+user.presence.status.slice(1)
|
||||
|
||||
}
|
||||
}
|
||||
if(status === "Dnd") status = "Do Not Disturb";
|
||||
let roles = "";
|
||||
user.roles.cache.each(role => {
|
||||
if (role.name != "@everyone")
|
||||
|
@ -48,23 +49,32 @@ module.exports = {
|
|||
let discriminator = user.user.discriminator;
|
||||
if(discriminator === "0")
|
||||
discriminator = "";
|
||||
let username = `**${user.user.username}#${user.user.discriminator}**${nickname}`
|
||||
const embed = new Discord.MessageEmbed()
|
||||
else
|
||||
discriminator = `#${discriminator}`;
|
||||
let username = `**${user.user.username}${discriminator}**${nickname}`;
|
||||
const embed = new EmbedBuilder()
|
||||
.setThumbnail(user.user.avatarURL({ format: 'png', dynamic: true, size: 2048 }))
|
||||
.setColor(roleColor)
|
||||
.setTimestamp()
|
||||
.setAuthor(user.user.username, user.user.avatarURL({ format: 'png', dynamic: true, size: 2048 }))
|
||||
.addField("Username", username)
|
||||
.addField("Status", status, false)
|
||||
if(isPresence)
|
||||
embed.addField("Presence", user.presence.activities[0].name, false)
|
||||
if(presenceDetails != 0)
|
||||
embed.addField("Details", presenceDetails.toString(), false)
|
||||
embed.addField("Creation date", getCreationDate(user), true)
|
||||
embed.addField("Join date", getJoinDate(user, message.guild), true)
|
||||
if(roles != ""){
|
||||
embed.addField("Roles", roles)
|
||||
}
|
||||
.setAuthor({name: user.user.username, iconURL: user.user.avatarURL({ format: 'png', dynamic: true, size: 2048 })})
|
||||
.addFields([
|
||||
{ name: "Username", value: username, inline: false },
|
||||
]);
|
||||
if (isPresence)
|
||||
embed.addFields([{name: "Presence", value: user.presence.activities[0].name, inline: false}])
|
||||
if (presenceDetails != 0){
|
||||
embed.addFields([{name: "Details", value: presenceDetails.toString(), inline: false}])
|
||||
embed.addFields([{name: "Status", value: status, inline: true }])
|
||||
}
|
||||
else
|
||||
embed.addFields([{ name: "Status", value: status, inline: false }])
|
||||
embed.addFields([
|
||||
{ name: "Creation date", value: getCreationDate(user), inline: true },
|
||||
{ name: "Join date", value: getJoinDate(user, message.guild), inline: true }
|
||||
])
|
||||
if (roles != "") {
|
||||
embed.addFields({name: "Roles", value: roles, inline: false})
|
||||
}
|
||||
|
||||
message.channel.send({embeds :[embed]});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue