Skip to content

Commit

Permalink
Switch const variables to lets in embeds
Browse files Browse the repository at this point in the history
  • Loading branch information
ddinan committed May 11, 2022
1 parent ea57f1c commit 6b9b9ba
Show file tree
Hide file tree
Showing 65 changed files with 332 additions and 253 deletions.
2 changes: 1 addition & 1 deletion commands/50.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ exports.run = async (client, message, args, level) => {
if (message.channel.nsfw === false) return message.channel.send('You need to be in an NSFW channel to use this command.')

random('fiftyfifty').then(url => {
const embed = new MessageEmbed()
let embed = new MessageEmbed()
.setAuthor('Reddit 50/50', 'https://www.redditinc.com/assets/images/site/reddit-logo.png', url)
.setColor('#FF4300')
.setImage(`${url}`)
Expand Down
4 changes: 2 additions & 2 deletions commands/8ball.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ exports.run = async (client, message, args) => {

if (!input) {
let command = client.commands.get("8ball")
const embed = new MessageEmbed()
let embed = new MessageEmbed()
.setColor(colors.red)
.setTitle(lang.InvalidSyntax)
.setDescription(`\`${prefix}${command.help.usage}\`\n\n${command.help.description}`)
Expand All @@ -33,7 +33,7 @@ exports.run = async (client, message, args) => {
message.channel.send(`${result}`);
}
var member = message.guild.members.cache.random();
const embed = new MessageEmbed()
let embed = new MessageEmbed()
.setColor(colors.default)
.setThumbnail(member.avatarURL)
.addField(member.displayName, `<@${member.id}>`)
Expand Down
7 changes: 3 additions & 4 deletions commands/avatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ exports.run = async (client, message, args, level) => {
const lang = require("../lib/languages/" + language + ".json")

try {
const embed = new MessageEmbed()
let embed = new MessageEmbed()
.setColor(colors.default)
.setImage(`${message.author.displayAvatarURL()}`)
.addField(lang.YourAvatar, `[${lang.ImageURL}](${message.author.avatarURL()})`, true)
Expand All @@ -26,9 +26,8 @@ exports.run = async (client, message, args, level) => {

embed = new MessageEmbed()
.setColor(colors.default)
.setImage(`${user.avatarURL}`)
.setThumbnail(`${user.avatarURL}`)
.addField(`${user.username}${lang.UsersAvatar}`, `${user.avatarURL()}`, true)
.setImage(`${user.avatarURL()}`)
.addField(`${user.username}${lang.UsersAvatar}`, `[${lang.ImageURL}](${user.avatarURL()})`, true)
.setFooter(`${lang.RespondingTo} ${message.author.tag}`, message.author.avatarURL())
.setTimestamp()

Expand Down
6 changes: 3 additions & 3 deletions commands/ban.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ exports.run = async (client, message, args, level) => {
try {
const user = message.mentions.users.first()
const settings = client.getSettings(message.guild.id)
const modRole = message.guild.roles.cache.find(r => r.name.toLowerCase() === client.getSettings(message.guild.id).modRole.toLowerCase());
const adminRole = message.guild.roles.cache.find(r => r.name.toLowerCase() === client.getSettings(message.guild.id).adminRole.toLowerCase());
const modRole = message.guild.roles.cache.find(r => r.name.toLowerCase() === client.getSettings(message.guild.id).modRole.toLowerCase())
const adminRole = message.guild.roles.cache.find(r => r.name.toLowerCase() === client.getSettings(message.guild.id).adminRole.toLowerCase())

// Ensure mod/admin roles actually exist
if (!modRole) {
Expand All @@ -20,7 +20,7 @@ exports.run = async (client, message, args, level) => {
return message.channel.send(lang.NoAdminRole)
}

if (!message.member.roles.cache.has(modRole.id) && !message.member.hasPermission("MANAGE_MESSAGES") && !message.member.roles.cache.has(adminRole.id) && !message.member.hasPermission("ADMINISTRATOR")) {
if (!message.member.roles.cache.has(modRole.id) && !message.member.permissions.has("MANAGE_MESSAGES") && !message.member.roles.cache.has(adminRole.id) && !message.member.permissions.has("ADMINISTRATOR")) {
return message.channel.send(lang.NoPermission)
}

Expand Down
6 changes: 3 additions & 3 deletions commands/blacklist.wip
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ exports.run = async (client, message, args) => {
const cmds = client.blacklist.cache.cache.get(`${message.guild.id}`, 'commands')

client.blacklist.set(`${message.guild.id}`, `${cmds.replace("null", "")} + , + ${args[1].toLowerCase()} `, "commands")
const embed = new MessageEmbed()
let embed = new MessageEmbed()
.setAuthor('Blacklist')
.setColor(colors.green)
.setDescription(`Blacklisted \`;;${args[1].toLowerCase()}\` in this server.`)
Expand All @@ -33,7 +33,7 @@ exports.run = async (client, message, args) => {
if (commands === null) return message.channel.send('This command is not blacklisted.')
var newList = commands
client.pingwords.set(`${message.author.id}`, newList, 'pingOne')
const embed = new MessageEmbed()
let embed = new MessageEmbed()
.setAuthor('Ping Words')
.setCmessage.channel.send({
embeds: [embed]
Expand All @@ -45,7 +45,7 @@ exports.run = async (client, message, args) => {
}

if (args[0] === 'list') {
const embed = new MessageEmbed()
let embed = new MessageEmbed()
.setAuthor('Ping Words')
.setCmessage.channel.send({
embeds: [embed]
Expand Down
21 changes: 14 additions & 7 deletions commands/bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,25 @@ exports.run = (client, message, args, level) => {

try {
const duration = moment.duration(client.uptime).format(' D [days], H [hrs], m [mins], s [secs]')
console.log(lang.SupportServer, '[Click here](https://discord.gg/3hbeQgY)', true)
console.log(lang.TotalGuilds, client.guilds.cache.size, true)
console.log(lang.HostedIn, `:flag_us: ${lang.UnitedStates}`, true)
console.log(lang.Uptime, duration, true)
console.log(lang.ID, message.client.user.id, true)
console.log(lang.CreatedBy, '<@191517443519152129>', true)
console.log(lang.TotalMembers, client.users.cache.size, true)

const embed = new MessageEmbed()
let embed = new MessageEmbed()
.setAuthor(lang.BotInformation)
.setColor(colors.default)
.setThumbnail(client.user.avatarURL)
.addField(lang.TotalGuilds, message.client.guilds.cache.size, true)
.addField(lang.TotalMembers, `${message.client.users.cache.size}`, true)
.setThumbnail(client.user.avatarURL())
.addField(lang.TotalGuilds, `${client.guilds.cache.size}`, true)
.addField(lang.TotalMembers, `${client.users.cache.size}`, true)
.addField(lang.ID, `${message.client.user.id}`, true)
.addField(lang.HostedIn, `:flag_gb: ${lang.London}`, true)
.addField(lang.Uptime, `${duration}`, true)
.addField(lang.HostedIn, `:flag_us: ${lang.UnitedStates}`, true)
.addField(lang.Uptime, duration, true)
.addField(lang.CreatedBy, '<@191517443519152129>', true)
.addField(lang.SupportServer, '[Click here](https://discord.gg/3hbeQgY)')
.addField(lang.SupportServer, '[Click here](https://discord.gg/3hbeQgY)', true)
.setImage("https://i.imgur.com/sCNV086.png")
.setFooter(`${lang.RespondingTo} ${message.author.tag}`, message.author.avatarURL())
.setTimestamp()
Expand Down
67 changes: 67 additions & 0 deletions commands/button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
const {
Client,
Message,
MessageEmbed
} = require('discord.js')

const {
pagination
} = require('reconlx')

exports.run = async (client, message, args, level) => { // eslint-disable-line no-unused-vars
const language = client.getSettings(message.guild.id).language
const lang = require("../lib/languages/" + language + ".json")

try {
let embed1 = new MessageEmbed().setTitle('one')
let embed2 = new MessageEmbed().setTitle('two')
let embed3 = new MessageEmbed().setTitle('three')
let embed4 = new MessageEmbed().setTitle('four')
let embed5 = new MessageEmbed().setTitle('five')
let embed6 = new MessageEmbed().setTitle('six')
let embed7 = new MessageEmbed().setTitle('seven')
let embed8 = new MessageEmbed().setTitle('eight')
let embed9 = new MessageEmbed().setTitle('nine')
let embed10 = new MessageEmbed().setTitle('ten')

let embeds = [
embed1,
embed2,
embed3,
embed4,
embed5,
embed6,
embed7,
embed8,
embed9,
embed10
]

pagination({
embeds: embeds,
channel: message.channel,
author: message.author,
fastSkip: true,
pageTravel: true,
max: 0
})

} catch (err) {
const errors = require('../modules/errors.js')
errors.embedError(err, lang, message)
}
}

exports.conf = {
enabled: false,
aliases: ['btn'],
guildOnly: false,
permLevel: 'User'
}

exports.help = {
name: 'button',
category: 'Utility',
description: 'Example button navigation menu.',
usage: 'button'
}
2 changes: 1 addition & 1 deletion commands/cat.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exports.run = async (client, message, args, level) => {
try {
request('https://aws.random.cat/meow', function(error, body) {
var result = JSON.parse(body.body)
const embed = new MessageEmbed()
let embed = new MessageEmbed()
.setColor(colors.default)
.setImage(result.file)
.setFooter(`${lang.RespondingTo} ${message.author.tag}`, message.author.avatarURL())
Expand Down
20 changes: 13 additions & 7 deletions commands/classicube.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,18 @@ exports.run = async (client, message, args) => {
var result = JSON.parse(body.body)
if (!result || result.username === null) return message.channel.send(lang.InvalidUser)

const embed = new MessageEmbed()
const unixTimestamp = result.registered
const milliseconds = unixTimestamp * 1000
const dateObject = new Date(milliseconds)
const humanDateFormat = dateObject.toLocaleString() //2019-12-9 10:30:15

let embed = new MessageEmbed()
.setTitle(result.username)
.setColor(lavender)
.setThumbnail(`https://www.classicube.net/face/${result.username}.png`)
.addField(lang.ID, result.id, true)
.addField(lang.Premium, result.premium, true)
.addField(lang.ID, `${result.id}`, true)
.addField(lang.Registered, `${humanDateFormat}`, true)
.addField(lang.Premium, `${result.premium}`, true)
.setFooter(`${lang.RespondingTo} ${message.author.tag}`, message.author.avatarURL())
.setTimestamp()

Expand All @@ -45,9 +51,9 @@ exports.run = async (client, message, args) => {
if (args[1].startsWith('+')) {
const skin = args[1].replace('+', '')

const embed = new MessageEmbed()
let embed = new MessageEmbed()
.setAuthor(skin + lang.UsersSkin)
.setTitle(lang.SkinUrl)
.setTitle(`${lang.SkinURL}`)
.setURL(`https://minotar.net/skin/${skin}.png`)
.setColor('#3BCE3B')
.setImage(`https://minotar.net/skin/${skin}.png`)
Expand All @@ -62,9 +68,9 @@ exports.run = async (client, message, args) => {
var result = JSON.parse(body.body)
if (!result || result.username === null) return message.channel.send(`\`${args[1]}\` is not a registered user.`)

const embed = new MessageEmbed()
let embed = new MessageEmbed()
.setAuthor(result.username + `'s skin`)
.setTitle(lang.SkinUrl)
.setTitle(`${lang.SkinURL}`)
.setURL(`https://www.classicube.net/skins/${result.username}.png`)
.setColor(lavender)
.setImage(`https://www.classicube.net/skins/${result.username}.png`)
Expand Down
2 changes: 1 addition & 1 deletion commands/color.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exports.run = async (client, message, args, level) => {

const color = !args[0] ? hex : args[0]

const embed = new MessageEmbed()
let embed = new MessageEmbed()
.setColor(hex)
.setDescription(`${lang.RandomHex} \`#${hex}\``)
.setTitle("#" + hex)
Expand Down
16 changes: 8 additions & 8 deletions commands/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,49 +49,49 @@ exports.run = (client, message, args, level) => {
}
})

const embed1 = new MessageEmbed()
let embed1 = new MessageEmbed()
.setTitle(lang.Commands)
.setColor(colors.default)
.addField(`${lang.Type} ${prefix}commands <${lang.Category}> ${lang.InThatCategory}.`, `\n${lang.ValidCategories}:\n\`admin\`, \`economy\`, \`fun\`, \`moderation\`, \`utility\``)
.setFooter(`${lang.RespondingTo} ${message.author.tag}`, message.author.avatarURL())
.setTimestamp()

const embed2 = new MessageEmbed()
let embed2 = new MessageEmbed()
.setTitle('🔮 Admin')
.setColor(colors.default)
.addField(`${lang.Type} ${prefix}help <${lang.Command}> ${lang.MoreInfoOnHowToUse}.`, output)
.setFooter(`${lang.RespondingTo} ${message.author.tag}`, message.author.avatarURL())
.setTimestamp()

const embed3 = new MessageEmbed()
let embed3 = new MessageEmbed()
.setTitle('💰 Economy')
.setColor(colors.default)
.addField(`${lang.Type} ${prefix}help <${lang.Command}> ${lang.MoreInfoOnHowToUse}.`, output2)
.setFooter(`${lang.RespondingTo} ${message.author.tag}`, message.author.avatarURL())
.setTimestamp()

const embed4 = new MessageEmbed()
let embed4 = new MessageEmbed()
.setTitle('🎉 Fun')
.setColor(colors.default)
.addField(`${lang.Type} ${prefix}help <${lang.Command}> ${lang.MoreInfoOnHowToUse}.`, output3)
.setFooter(`${lang.RespondingTo} ${message.author.tag}`, message.author.avatarURL())
.setTimestamp()

const embed5 = new MessageEmbed()
let embed5 = new MessageEmbed()
.setTitle('👮‍♂️ Moderation')
.setColor(colors.default)
.addField(`${lang.Type} ${prefix}help <${lang.Command}> ${lang.MoreInfoOnHowToUse}.`, output4)
.setFooter(`${lang.RespondingTo} ${message.author.tag}`, message.author.avatarURL())
.setTimestamp()

const embed6 = new MessageEmbed()
let embed6 = new MessageEmbed()
.setTitle('🔨 Utility')
.setColor(colors.default)
.addField(`${lang.Type} ${prefix}help <${lang.Command}> ${lang.MoreInfoOnHowToUse}.`, output5)
.setFooter(`${lang.RespondingTo} ${message.author.tag}`, message.author.avatarURL())
.setTimestamp()

const embeds = [
let embeds = [
embed1,
embed2,
embed3,
Expand Down Expand Up @@ -142,7 +142,7 @@ exports.run = (client, message, args, level) => {

if (!output) return message.reply(lang.InvalidCategory)

const embed = new MessageEmbed()
let embed = new MessageEmbed()
.setTitle(lang.Commands)
.setColor(colors.default)
.setThumbnail(client.user.avatarURL)
Expand Down
35 changes: 16 additions & 19 deletions commands/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,17 @@ exports.run = async (client, message, args, level) => {
const settings = client.getSettings(message.guild.id)
const defaults = client.config.defaultSettings
const overrides = client.settings.get(message.guild.id)

const adminRole = message.guild.roles.cache.find(r => r.name.toLowerCase() === client.getSettings(message.guild.id).adminRole.toLowerCase())

// Ensure admin role actually exists

if (!adminRole) {
return message.channel.send(lang.NoAdminRole)
}
if (!client.settings.has(message.guild.id)) client.settings.set(message.guild.id, client.config.defaultSettings)

if (!message.member.hasPermission("ADMINISTRATOR")) {
if (!message.member.permissions.has("ADMINISTRATOR")) {
return message.channel.send(lang.NoPermission)
}

Expand All @@ -28,31 +36,20 @@ exports.run = async (client, message, args, level) => {
else client.settings.set(message.guild.id, args.slice(2).join(' '), args[1])

message.channel.send(`${args[1]} ${lang.EditedTo} ${args.slice(2).join(' ')}!`)
} else

if (args[0] === 'del' || args[0] === 'reset') {
if (!args[1]) return message.channel.send(lang.NoOptionSpecified)
if (!defaults[args[1]]) return message.channel.send(lang.InvalidOption)
if (!overrides[args[1]]) return message.channel.send(lang.NoOverrideUsingDefaults)

const response = await client.awaitchannel.send(message, `${lang.ConfirmReset} ${args[1]} ${lang.ToDefaultValue}`)

if (['y', 'yes', '1'].includes(response.toLowerCase())) {
client.settings.delete(message.guild.id, args[1])
message.channel.send(`${args[1]} ${lang.SuccessfullyReset}.`)
} else
if (['n', 'no', 'cancel', '0'].includes(response)) {
message.channel.send(`${lang.Setting} \`${args[1]}\` ${lang.RemainsAt} \`${settings[args[1]]}\`.`)
}
} else {
let embed = new Discord.MessageEmbed()
.setTitle(`⚙️ ${lang.ServerSettings}`)
.setColor(colors.default)
.setFooter(`${lang.RespondingTo} ${message.author.tag}`, message.author.avatarURL())
.setTimestamp()
Object.keys(client.getSettings(message.guild.id)).forEach((setting) => embed = embed.addField(setting, settings[setting], true))

await message.channel.send(embed)
Object.keys(client.getSettings(message.guild.id)).forEach((setting) => {
embed = embed.addField(setting, `${settings[setting]}`, true)
})

await message.channel.send({
embeds: [embed]
})
}
} catch (err) {
message.channel.send(client.errors.genericError + err.stack).catch();
Expand Down
Loading

0 comments on commit 6b9b9ba

Please sign in to comment.