Skip to content

Commit 3a6cea5

Browse files
authored
Merge branch 'master' into thread-fixes
2 parents 9f94a8e + 2763340 commit 3a6cea5

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/modules/playground.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ function getSelectionQueryParams(query: string, numLines: number) {
207207
const [startLine, endLine] = ['pln', 'ssl']
208208
// @ts-expect-error parseInt(null) is okay here since we check for NaN
209209
.map(name => parseInt(params.get(name)))
210-
.map(n => (n !== NaN && 1 <= n && n <= numLines ? n : undefined))
210+
.map(n => (!Number.isNaN(n) && 1 <= n && n <= numLines ? n : undefined))
211211
.sort((a, b) => (a ?? Infinity) - (b ?? Infinity));
212212

213213
return { startLine, endLine };

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

src/util/codeBlocks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { getReferencedMessage } from './getReferencedMessage';
44

55
const CODEBLOCK_REGEX = /```(?:ts|typescript)?\n([\s\S]+)```/;
66

7-
export const PLAYGROUND_REGEX = /https?:\/\/(?:www\.)?(?:typescriptlang|staging-typescript)\.org\/(?:play|dev\/bug-workbench)(?:\/index\.html)?\/?(\??(?:\w+=[^\s#&]+)?(?:\&\w+=[^\s#&]+)*)#code\/([\w\-%+_]+={0,4})/;
7+
export const PLAYGROUND_REGEX = /https?:\/\/(?:www\.)?(?:typescriptlang|staging-typescript)\.org\/(?:play|dev\/bug-workbench)(?:\/index\.html)?\/?(\??(?:\w+=[^\s#&]*)?(?:\&\w+=[^\s#&]*)*)#code\/([\w\-%+_]+={0,4})/;
88

99
export async function findCode(message: Message, ignoreLinks = false) {
1010
const codeInMessage = await findCodeInMessage(message, ignoreLinks);

0 commit comments

Comments
 (0)