Skip to content

Commit 65dc3e5

Browse files
authored
Merge pull request #89 from typescript-community/fix/fix-rep
Fix rep giving false positives
2 parents e6aa8a5 + e4e494d commit 65dc3e5

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/modules/rep.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class RepModule extends Module {
2020
MAX_REP = 3;
2121

2222
// all messages have to be fully lowercase
23-
THANKS_MESSAGES = ['thanks', 'thx', 'cheers', 'thanx', 'ty', 'tks', 'tkx'];
23+
THANKS_REGEX = /(?:thanks|thx|cheers|thanx|ty|tks|tkx)\b/i;
2424

2525
async getOrMakeUser(user: User) {
2626
let ru = await RepUser.findOne(
@@ -42,9 +42,7 @@ export class RepModule extends Module {
4242
const NO_GIVE = '❌';
4343

4444
// Check for thanks messages
45-
const isThanks = this.THANKS_MESSAGES.some(s =>
46-
msg.content.toLowerCase().includes(s),
47-
);
45+
const isThanks = this.THANKS_REGEX.test(msg.content);
4846

4947
if (msg.author.bot || !isThanks || !msg.guild) return;
5048

0 commit comments

Comments
 (0)