Skip to content

Commit

Permalink
fix(help): hoot in footer too short (excluded "hot")
Browse files Browse the repository at this point in the history
  • Loading branch information
fieztazica committed May 11, 2024
1 parent d1edcb9 commit 0dbdb1c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/commands/General/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ApplyOptions } from '@sapphire/decorators';
import { PaginatedMessage } from '@sapphire/discord.js-utilities';
import { Command } from '@sapphire/framework';
import { ApplicationCommandType, EmbedBuilder, chatInputApplicationCommandMention } from 'discord.js';
import { getRandomHoot, replyLoadingChatInputInteraction } from '../../lib/utils';
import { getRandomHootString, replyLoadingChatInputInteraction } from '../../lib/utils';

const dev = process.env.NODE_ENV !== 'production';

Expand All @@ -25,7 +25,7 @@ export class UserCommand extends Command {
template: new EmbedBuilder()
.setColor('Random')
// Be sure to add a space so this is offset from the page numbers!
.setFooter({ text: ` ${getRandomHoot()}`, iconURL: `${interaction.user.displayAvatarURL()}` })
.setFooter({ text: ` ${getRandomHootString()}`, iconURL: `${interaction.user.displayAvatarURL()}` })
.setThumbnail(this.container.client.user?.displayAvatarURL() || null)
});

Expand Down
10 changes: 7 additions & 3 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,15 @@ export function getRandomInt(min: number, max: number) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}

export function getRandomHoot(oLength: number = 0, upperH: boolean = false, upperCase: boolean = false) {
const min = 1,
export function getRandomHootString(oLength: number = 0, upperH: boolean = false, upperCase: boolean = false) {
const min = 2,
max = oLength <= 0 ? 10 : oLength > 10 ? 10 : oLength;
const randomLength = getRandomInt(min, max);
const oString = new Array(randomLength).fill('o').join('');
const oString = generateDuplicateString('o', randomLength);
const content = `${upperH ? 'H' : 'h'}${oString}t`;
return upperCase ? content.toUpperCase() : content;
}

export function generateDuplicateString(input: string, length: number) {
return new Array(length).fill(input).join('');
}

0 comments on commit 0dbdb1c

Please sign in to comment.