Skip to content

Commit 6a8709d

Browse files
committed
refactor: pr changes
1 parent 169b729 commit 6a8709d

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/modules/helpchan.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -290,13 +290,13 @@ export class HelpChanModule extends Module {
290290
}
291291

292292
// Ensure the user has permission to ping helpers
293-
const owner = await HelpUser.findOne({
293+
const asker = await HelpUser.findOne({
294294
channelId: msg.channel.id,
295295
});
296-
const isOwner = owner?.userId === msg.author.id;
296+
const isAsker = asker?.userId === msg.author.id;
297297
const isTrusted =
298298
(await isTrustedMember(msg, this.client)) === undefined; // No error if trusted
299-
if (!isOwner && !isTrusted) {
299+
if (!isAsker && !isTrusted) {
300300
return msg.channel.send(
301301
':warning: Only the asker can ping helpers',
302302
);
@@ -305,14 +305,13 @@ export class HelpChanModule extends Module {
305305
// Ensure they've waited long enough
306306
// Trusted members (who aren't the asker) are allowed to disregard the timeout
307307
const askTime = msg.channel.lastPinTimestamp ?? 0;
308-
const timeToWait = timeBeforeHelperPing - (Date.now() - askTime);
308+
const pingAllowedAfter = askTime + timeBeforeHelperPing;
309309

310-
if (isOwner && timeToWait > 0) {
311-
const minutesToWait = Math.round(timeToWait / (60 * 1000));
310+
if (isAsker && Date.now() < pingAllowedAfter) {
312311
return msg.channel.send(
313-
`:warning: Please wait at least ${minutesToWait} minute${
314-
minutesToWait === 1 ? '' : 's'
315-
} before attempting to ping helpers`,
312+
`:warning: Please wait a bit longer. You can ping helpers <t:${
313+
pingAllowedAfter / 1000
314+
}:R>.`,
316315
);
317316
}
318317

0 commit comments

Comments
 (0)