Skip to content

Commit

Permalink
(fix) 60 -> 30s, imageColor fix, user nickname
Browse files Browse the repository at this point in the history
  • Loading branch information
MrSerge01 committed Nov 3, 2024
1 parent 0ccfcbe commit 1fef7e7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/commands/Leaderboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default class Leaderboard {

if (totalPages > 1) {
const collector = reply.createMessageComponentCollector({
time: 60000
time: 30000
});

collector.on("collect", async (i: ButtonInteraction) => {
Expand All @@ -95,7 +95,7 @@ export default class Leaderboard {
if (i.user.id != interaction.user.id)
return errorEmbed(i, "You are not the person who executed this command.");

collector.resetTimer({ time: 60000 });
collector.resetTimer({ time: 30000 });
if (i.customId == "left") page = page > 1 ? page - 1 : totalPages;
else page = page < totalPages ? page + 1 : 1;

Expand Down
4 changes: 2 additions & 2 deletions src/commands/Serverboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default class Serverboard {
});
if (pages == 1) return;

const collector = reply.createMessageComponentCollector({ time: 60000 });
const collector = reply.createMessageComponentCollector({ time: 30000 });
collector.on("collect", async (i: ButtonInteraction) => {
if (i.message.id != (await reply.fetch()).id)
return await errorEmbed(
Expand All @@ -70,7 +70,7 @@ export default class Serverboard {
if (i.user.id != interaction.user.id)
return await errorEmbed(i, "You aren't the person who executed this command.");

collector.resetTimer({ time: 60000 });
collector.resetTimer({ time: 30000 });
switch (i.customId) {
case "left":
page--;
Expand Down
6 changes: 3 additions & 3 deletions src/commands/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default class User {

let embed = new EmbedBuilder()
.setAuthor({
name: `${avatar ? "• " : ""}${user.displayName}`,
name: `${avatar ? "• " : ""}${target?.nickname ?? user.displayName}`,
iconURL: avatar
})
.setFields({
Expand Down Expand Up @@ -107,7 +107,7 @@ export default class User {
100 * difficulty * (level + 1) ** 2 - 85 * difficulty * level ** 2
)?.toLocaleString("en-US");

const collector = reply.createMessageComponentCollector({ time: 60000 });
const collector = reply.createMessageComponentCollector({ time: 30000 });
collector.on("collect", async (i: ButtonInteraction) => {
if (i.message.id != (await reply.fetch()).id)
return await errorEmbed(
Expand All @@ -118,7 +118,7 @@ export default class User {
if (i.user.id != interaction.user.id)
return await errorEmbed(i, "You aren't the person who executed this command.");

collector.resetTimer({ time: 60000 });
collector.resetTimer({ time: 30000 });
i.customId == "general"
? row.components[0].setDisabled(true)
: row.components[1].setDisabled(true);
Expand Down
4 changes: 2 additions & 2 deletions src/commands/news/View.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default class View {
);

const reply = await interaction.reply({ embeds: [getEmbed()], components: [row] });
const collector = reply.createMessageComponentCollector({ time: 60000 });
const collector = reply.createMessageComponentCollector({ time: 30000 });
collector.on("collect", async (i: ButtonInteraction) => {
if (i.message.id != (await reply.fetch()).id)
return await errorEmbed(
Expand All @@ -72,7 +72,7 @@ export default class View {
if (i.user.id != interaction.user.id)
return await errorEmbed(i, "You aren't the person who executed this command.");

collector.resetTimer({ time: 60000 });
collector.resetTimer({ time: 30000 });
switch (i.customId) {
case "left":
page--;
Expand Down
4 changes: 3 additions & 1 deletion src/utils/imageColor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import sharp from "sharp";
import { genRGBColor } from "./colorGen";

export async function imageColor(guildURL?: string, memberURL?: string) {
const imageBuffer = await (await fetch(guildURL! ?? memberURL)).arrayBuffer();
if (!guildURL || !memberURL) return;

const imageBuffer = await (await fetch(guildURL ?? memberURL)).arrayBuffer();
const { r, g, b } = (
await new Vibrant(await sharp(imageBuffer).toFormat("jpg").toBuffer()).getPalette()
).Vibrant!;
Expand Down

0 comments on commit 1fef7e7

Please sign in to comment.