diff --git a/src/bot.js b/src/bot.js index 45a360d..a4277ed 100644 --- a/src/bot.js +++ b/src/bot.js @@ -737,6 +737,8 @@ const OG_STYLE_ICONS = { 'cid_690_athena_commando_f_photographer': 'https://fortnite-api.com/images/cosmetics/br/cid_690_athena_commando_f_photographer/variants/progressive/stage4.png', }; +let logoURL = `https://cdn.discordapp.com/attachments/1366104795215167558/1520980834138718238/icon_1.png?ex=6a432b49&is=6a41d9c9&hm=e9b35d70e831bc2035bf7486f975a357e3b7ba080b727ce4507f061674e17c3c&`; + // Cache the logo so we only fetch once per session let _logoBuffer = null; async function getLogoBuffer() { @@ -1028,15 +1030,20 @@ async function renderLockerImage(items, countLabel, subtitle, submittedBy = null return canvas.toBuffer('image/png'); } -async function sendLockerImageEmbed(message, { title, description, imageBuffer, fileName }) { +async function sendLockerImageEmbed(message, { title, description, imageBuffer, fileName, author, displayName }) { const attachment = new AttachmentBuilder(imageBuffer, { name: fileName }); const safeTitle = String(title || 'Locker Check').length > 250 ? `${String(title).slice(0, 247)}...` : String(title || 'Locker Check'); const embed = new EmbedBuilder() .setColor(0xcccccc) - .setDescription("**" + safeTitle + "**\n" + description) + .setAuthor(`${displayName} (${author})`) + .setDescription(description) .setImage(`attachment://${fileName}`) + .setFooter({ + text: `1-800 @ ${message.guild.name}`, + iconURL: client.user.displayAvatarURL() + }) .setTimestamp(); await message.author.send({ embeds: [embed], files: [attachment] }); @@ -1473,7 +1480,7 @@ client.on('messageCreate', async (message) => { // !setuproles // ───────────────────────────────────────────────────────────────────────────── client.on('messageCreate', async (message) => { - if (message.author.bot || message.content !== '!setuproles') return; + if (message.author.bot || message.content !== ',setuproles') return; if (!message.member.permissions.has(PermissionsBitField.Flags.Administrator)) return message.reply('Need Administrator permission.'); @@ -1499,7 +1506,7 @@ client.on('messageCreate', async (message) => { // !removeoldemojis // ───────────────────────────────────────────────────────────────────────────── client.on('messageCreate', async (message) => { - if (message.author.bot || message.content !== '!removeoldemojis') return; + if (message.author.bot || message.content !== ',removeoldemojis') return; if (!message.member.permissions.has(PermissionsBitField.Flags.Administrator)) return message.reply('Need Administrator permission.'); @@ -1536,7 +1543,7 @@ let emojiSession = null; // { resolve, name, channel } // !skipemoji — skip the currently stuck emoji client.on('messageCreate', async (message) => { - if (message.author.bot || message.content !== '!skipemoji') return; + if (message.author.bot || message.content !== ',skipemoji') return; if (!message.member.permissions.has(PermissionsBitField.Flags.Administrator)) return; if (!emojiSession) return message.reply('No emoji upload is currently in progress.'); message.reply(`Skipping **${emojiSession.name}**...`); @@ -1545,7 +1552,7 @@ client.on('messageCreate', async (message) => { // !stopemojis — stop the whole session client.on('messageCreate', async (message) => { - if (message.author.bot || message.content !== '!stopemojis') return; + if (message.author.bot || message.content !== ',stopemojis') return; if (!message.member.permissions.has(PermissionsBitField.Flags.Administrator)) return; if (!emojiSession) return message.reply('No emoji upload is currently in progress.'); message.reply('Stopping emoji upload session.'); @@ -1556,7 +1563,7 @@ client.on('messageCreate', async (message) => { let addIconsRunning = false; client.on('messageCreate', async (message) => { - if (message.author.bot || message.content !== '!addicons') return; + if (message.author.bot || message.content !== ',addicons') return; if (!message.member.permissions.has(PermissionsBitField.Flags.Administrator)) return message.reply('Need Administrator permission.'); @@ -1628,7 +1635,7 @@ client.on('messageCreate', async (message) => { // !setroleicons // ───────────────────────────────────────────────────────────────────────────── client.on('messageCreate', async (message) => { - if (message.author.bot || message.content !== '!setroleicons') return; + if (message.author.bot || message.content !== ',setroleicons') return; if (!message.member.permissions.has(PermissionsBitField.Flags.Administrator)) return message.reply('Need Administrator permission.'); @@ -1662,12 +1669,26 @@ client.on('messageCreate', async (message) => { // !unverify — remove verification and strip roles // ───────────────────────────────────────────────────────────────────────────── client.on('messageCreate', async (message) => { - if (message.author.bot || message.content !== '!unverify') return; + if (message.author.bot || message.content !== ',unverify') return; const userId = message.author.id; if (!verifiedUsers.has(userId)) - return message.reply('You are not currently verified. Use `!verify` to link your account.'); + return message.reply({ + content: null, embeds: [{ + color: 0xefecef, + author: { + name: message.author.username, + iconURL: message.author.displayAvatarURL(), + }, + description: "<:warning:1481811992858722335> you are not verified! use `!verify` to link and verify your account.", + footer: { + text: `1-800 @ ${message.guild.name}`, + iconURL: client.user.displayAvatarURL(), + }, + timestamp: new Date(), + }], + }); const prev = verifiedUsers.get(userId); const guild = client.guilds.cache.get(prev.guildId) || message.guild; @@ -1689,7 +1710,22 @@ client.on('messageCreate', async (message) => { } verifiedUsers.delete(userId); - message.reply(`Your verification as **${prev.epicName}** has been removed and your roles have been stripped. You can now use \`!verify\` to link a different account.`); + //message.reply(`Your verification as **${prev.epicName}** has been removed and your roles have been stripped. You can now use \`!verify\` to link a different account.`); + await message.reply({ + content: null, embeds: [{ + color: 0xefecef, + author: { + name: message.author.username, + iconURL: message.author.displayAvatarURL(), + }, + description: `<:check:1481811973447356496> your verification as **${prev.epicName}** has been removed and your roles have been stripped! you can now use \`!verify\` to link a different account.`, + footer: { + text: `1-800 @ ${message.guild.name}`, + iconURL: client.user.displayAvatarURL(), + }, + timestamp: new Date(), + }], + }) }); client.on('messageCreate', async (message) => { @@ -1727,7 +1763,7 @@ client.on('messageCreate', async (message) => { // !verify // ───────────────────────────────────────────────────────────────────────────── client.on('messageCreate', async (message) => { - if (message.author.bot || message.content !== '!verify') return; + if (message.author.bot || message.content !== ',verify') return; console.log("verify"); @@ -1744,7 +1780,22 @@ client.on('messageCreate', async (message) => { // Block if already verified if (verifiedUsers.has(userId)) { const prev = verifiedUsers.get(userId); - return message.reply(`You are already verified as **${prev.epicName}**. Use \`!unverify\` to unlink your account and verify a different one.`); + //return message.reply(`You are already verified as **${prev.epicName}**. Use \`!unverify\` to unlink your account and verify a different one.`); + return message.reply({ + content: null, embeds: [{ + color: 0xefecef, + author: { + name: message.author.username, + iconURL: message.author.displayAvatarURL(), + }, + description: `<:warning:1481811992858722335> you are already verified as **${prev.epicName}**! use \`!unverify\` to unlink your account and verify a different one.`, + footer: { + text: `1-800 @ ${message.guild.name}`, + iconURL: client.user.displayAvatarURL(), + }, + timestamp: new Date(), + }], + }) } if (pending.has(userId)) @@ -1753,12 +1804,12 @@ client.on('messageCreate', async (message) => { color: 0xefecef, author: { name: message.author.username, - icon_url: message.author.displayAvatarURL(), + iconURL: message.author.displayAvatarURL(), }, description: `<:warning:1481811992858722335> you already have a pending verification, please check your dms!`, footer: { text: `1-800 @ ${message.guild.name}`, - icon_url: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL(), }, timestamp: new Date(), }], @@ -1769,12 +1820,12 @@ client.on('messageCreate', async (message) => { color: 0xefecef, author: { name: message.author.username, - icon_url: message.author.displayAvatarURL(), + iconURL: message.author.displayAvatarURL(), }, description: `<:check:1481811973447356496> a login link has been sent to your dms!`, footer: { text: `1-800 @ ${message.guild.name ? message.guild.name : "local"}`, - icon_url: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL(), }, timestamp: new Date(), }], @@ -1792,7 +1843,7 @@ client.on('messageCreate', async (message) => { .setColor(0xcccccc) .setAuthor({ name: message.author.username, - icon_url: message.author.displayAvatarURL(), + iconURL: message.author.displayAvatarURL(), }) .setDescription( `**[click here to verify!](${loginUrl})**\n` + @@ -1801,7 +1852,7 @@ client.on('messageCreate', async (message) => { ) .setFooter({ text: `1-800 @ ${message.guild.name}`, - icon_url: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL(), }) .setTimestamp(); @@ -1817,12 +1868,12 @@ client.on('messageCreate', async (message) => { color: 0xcccccc, author: { name: message.author.username, - icon_url: message.author.displayAvatarURL(), + iconURL: message.author.displayAvatarURL(), }, description: `<:no:1481811955592466492> login expired! please try !verify again.`, footer: { text: `1-800 @ ${message.guild.name}`, - icon_url: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL(), }, timestamp: new Date(), }], @@ -1836,12 +1887,12 @@ client.on('messageCreate', async (message) => { color: 0xcccccc, author: { name: message.author.username, - icon_url: message.author.displayAvatarURL(), + iconURL: message.author.displayAvatarURL(), }, description: `<:no:1481811955592466492> authentication failed! please try again.`, footer: { text: `1-800 @ ${message.guild.name}`, - icon_url: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL(), }, timestamp: new Date(), }], @@ -1854,12 +1905,12 @@ client.on('messageCreate', async (message) => { color: 0xcccccc, author: { name: message.author.username, - icon_url: message.author.displayAvatarURL(), + iconURL: message.author.displayAvatarURL(), }, description: `<:check:1481811973447356496> logged in as **${displayName}**! fetching locker...`, footer: { text: `1-800 @ ${message.guild.name}`, - icon_url: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL(), }, timestamp: new Date(), }], @@ -1951,7 +2002,7 @@ client.on('messageCreate', async (message) => { ) .setFooter({ text: `1-800 @ ${message.guild.name}`, - icon_url: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL(), }); await message.author.send({ embeds: [verifyEmbed] }); @@ -1979,7 +2030,7 @@ client.on('messageCreate', async (message) => { ) .setFooter({ text: `1-800 @ ${message.guild.name}`, - icon_url: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL(), }) .setTimestamp(); await logChannel.send({ embeds: [logEmbed] }); @@ -2046,6 +2097,8 @@ client.on('messageCreate', async (message) => { description: `${exclusiveItems.length} exclusives`, imageBuffer: exclusiveImg, fileName: 'exclusives.png', + author: message.author.username, + displayName: displayName }); } } @@ -2087,11 +2140,27 @@ client.on('messageCreate', async (message) => { ].filter(c => c.ids.length > 0); if (categories.length === 0) { - await message.author.send('no cosmetics found in locker!'); + await message.author.send('no cosmetics found in locker! maybe try again?'); return; } //await message.author.send(`Building your full locker (${categories.length} categories)...`); + await message.author.send({ + content: null, embeds: [{ + color: 0xcccccc, + title: '', + author: { + name: message.author.username, + iconURL: message.author.displayAvatarURL(), + }, + description: ` building your full locker (${categories.length} categories)...`, + footer: { + text: `1-800 @ ${message.guild.name}`, + iconURL: client.user.displayAvatarURL(), + }, + timestamp: new Date(), + }] + }); for (const cat of categories) { const items = cat.ids.map(id => ({