Skip to content

Commit

Permalink
report embed uniformised
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixLusseau committed Feb 26, 2024
1 parent 0ddaf6c commit 3d89c7a
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions utils/reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@ const ffattacks = require('../commands/ffattacks');
const ffresults = require('../commands/ffresults');
const ffrace = require('../commands/ffrace');
const { EmbedBuilder } = require('discord.js');
const functions = require('../utils/functions.js')

async function report(bot, api, interaction, pingBool, channel, clan, guildID) {
// Get the attacks and results from the ffattacks and ffresults functions
const attacks = await ffattacks.ffattacks(bot, api, interaction, pingBool, channel, clan, guildID)
const results = await ffresults.ffresults(bot, api, interaction, clan)
const race = await ffrace.ffrace(bot, api, interaction, channel, clan, true)

const rand = Math.random().toString(36).slice(2); // Generate a random string to avoid the image cache
const reportEmbed = new EmbedBuilder();
const reportEmbed = functions.generateEmbed(bot);
reportEmbed
.setColor(0x7C0404)
.setTitle('**__Daily War Report__ :**')
.setAuthor({ name: bot.user.tag, iconURL: 'https://cdn.discordapp.com/avatars/' + bot.user.id + '/' + bot.user.avatar + '.png' })
.setDescription(
'**__Clan position__ : ' + race + '**\n\n'
+ '**__Players\' attacks__ :**\n'
Expand All @@ -23,9 +21,6 @@ async function report(bot, api, interaction, pingBool, channel, clan, guildID) {
+ '\n**__Players\' war results__ :**\n'
+ results
)
.setThumbnail('https://cdn.discordapp.com/attachments/527820923114487830/1071116873321697300/png_20230203_181427_0000.png')
.setTimestamp()
.setFooter({ text: 'by OPM | Féfé ⚡', iconURL: 'https://avatars.githubusercontent.com/u/94113911?s=400&v=4?' + rand });
try {
channel.send({ embeds: [reportEmbed] });
} catch (error) {
Expand All @@ -35,4 +30,4 @@ async function report(bot, api, interaction, pingBool, channel, clan, guildID) {

module.exports = {
report
}
}

0 comments on commit 3d89c7a

Please sign in to comment.