if (message.content.startsWith('hi')) {
const last_message = await message.channel.messages.fetch({ limit: 2 });
const last_embed = last_message.last().embeds[0];
let color_index = 0;
if (last_embed && last_embed.color && colors.includes(last_embed.color)) {
const last_color_index = colors.indexOf(last_embed.color);
color_index = (last_color_index + 1) % colors.length;
} else {
color_index = colors.length - 1; // Set the initial color to the last color in the array
}
const next_color_index = (color_index + 1) % colors.length;
const embed = new EmbedBuilder()
.setDescription(`Welcome to Snoopal, ${message.author}!`)
.setColor(colors[next_color_index]);
message.channel.send({ embeds: [embed] });
}
if (message.content.startsWith('hi')) {
const last_message = await message.channel.messages.fetch({ limit: 2 });
const last_embed = last_message.last().embeds[0];
let color_index = 0;
if (last_embed && last_embed.color && colors.includes(last_embed.color)) {
const last_color_index = colors.indexOf(last_embed.color);
color_index = (last_color_index + 1) % colors.length;
} else {
color_index = colors.length - 1; // Set the initial color to the last color in the array
}
const next_color_index = (color_index + 1) % colors.length;
const embed = new EmbedBuilder()
.setDescription(`Welcome to Snoopal, ${message.author}!`)
.setColor(colors[next_color_index]);
message.channel.send({ embeds: [embed] });
}