Skip to content

Commit f4eee93

Browse files
committed
the final commit?
re-adds multiReact under request, nothing else
1 parent 47c17fb commit f4eee93

File tree

4 files changed

+23
-15
lines changed

4 files changed

+23
-15
lines changed

src/events/easterEggs/bread.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
11
import type { Message, TextChannel } from "discord.js";
2+
import { multiReact } from "utils/multiReact";
23

34
export async function run(message: Message) {
45
if (!message.content.trim().toLowerCase().includes("bread")) return;
56

67
if (Math.round(Math.random() * 100) <= 0.25)
78
await (message.channel as TextChannel).send("https://tenor.com/bOMAb.gif");
8-
else {
9-
if (!message.guild?.members.cache.get(message.client.user.id)?.permissions.has("AddReactions"))
10-
return;
11-
12-
for (const i of "🍞🇧🇷🇪🇦🇩👍") {
13-
if (typeof i == "object") {
14-
await message.react(i);
15-
continue;
16-
}
17-
for (const reaction of i) if (reaction != " ") await message.react(reaction);
18-
}
19-
}
9+
else await multiReact(message, "🍞🇧🇷🇪🇦🇩👍");
2010
}

src/utils/embeds/serverEmbed.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ export async function serverEmbed(options: Options) {
5656

5757
const statValues: (string | null)[] = [
5858
`**${guild.memberCount?.toLocaleString("en-US")}** members`,
59-
channelSizes.voice > 0 ? `**${channelCount}** ${pluralOrNot("channel", channelCount)} • **${channelSizes.text}** text and **${channelSizes.voice}** voice` : `**${channelCount}** text ${pluralOrNot("channel", channelCount)}`,
59+
channelSizes.voice > 0
60+
? `**${channelCount}** ${pluralOrNot("channel", channelCount)} • **${channelSizes.text}** text and **${channelSizes.voice}** voice`
61+
: `**${channelCount}** text ${pluralOrNot("channel", channelCount)}`,
6062
];
6163

6264
if (boostTier)

src/utils/multiReact.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import type { Message } from "discord.js";
2+
3+
/**
4+
* Reacts to a message with multiple emojis.
5+
* @param {Message} message Message to react to.
6+
* @param {string[]} emojis Emojis that will be used to react.
7+
*/
8+
export async function multiReact(message: Message, ...emojis: string[]): Promise<void> {
9+
for (const i of emojis) {
10+
if (typeof i == "object") {
11+
await message.react(i);
12+
continue;
13+
}
14+
for (const reaction of i) if (reaction != " ") await message.react(reaction);
15+
}
16+
}

src/utils/newline.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ export function newline(str: string, chars: number, startWith: string = ""): str
99
splitStr.map(string => {
1010
let word = string.concat(" ");
1111
if (word.trim().startsWith("**")) {
12-
word = `\n${word}`
13-
length -= (word.length + startWith.length)
12+
word = `\n${word}`;
13+
length -= word.length + startWith.length;
1414
}
1515
length += word.length;
1616
while (length > chars + i) {

0 commit comments

Comments
 (0)