Skip to content

Commit f937afa

Browse files
authored
Merge pull request #174 from Josh-Cena/laugh-for-rep-self
laugh when self-repping
2 parents 3417d60 + 7f5c269 commit f937afa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/modules/rep.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,18 @@ export class RepModule extends Module {
4141
const GIVE = '✅';
4242
const PARTIAL_GIVE = '🤔';
4343
const NO_GIVE = '❌';
44+
const LAUGH = '😆';
4445

4546
// Check for thanks messages
4647
const isThanks = this.THANKS_REGEX.test(msg.content);
4748

4849
if (msg.author.bot || !isThanks || !msg.guild) return;
4950

50-
const mentionUsers = msg.mentions.users;
51+
const allMentionUsers = msg.mentions.users;
52+
const mentionUsers = allMentionUsers.filter(
53+
user => user.id !== msg.member?.id,
54+
);
55+
if (mentionUsers.size < allMentionUsers.size) await msg.react(LAUGH);
5156
if (!mentionUsers.size) return;
5257

5358
const senderRU = await this.getOrMakeUser(msg.author);
@@ -58,7 +63,6 @@ export class RepModule extends Module {
5863
if (currentSent >= this.MAX_REP) return await msg.react(NO_GIVE);
5964

6065
for (const user of mentionUsers.values()) {
61-
if (user.id === msg.member?.id) continue;
6266
if (currentSent >= this.MAX_REP)
6367
return await msg.react(PARTIAL_GIVE);
6468

0 commit comments

Comments
 (0)