Skip to content

Commit

Permalink
Fix helper pings in meta discussions when triggered by TripSit mode (#…
Browse files Browse the repository at this point in the history
…896)

* fix(tripsitmode): helpers not being pinged in discussions

* remove invalid chars from env
  • Loading branch information
theimperious1 authored Dec 3, 2024
1 parent af3c52c commit dd6bd41
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
3 changes: 1 addition & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,4 @@ WOLFRAM_TOKEN = <Optional> # For WolframAlpha API
IMGUR_ID = <Optional> # For Imgur API
IMGUR_SECRET = <Optional> # For Imgur API
YOUTUBE_TOKEN = <Optional> # For YouTube API
IMDB_TOKEN = <Optional> # For IMDB API
```
IMDB_TOKEN = <Optional> # For IMDB API
11 changes: 9 additions & 2 deletions src/discord/commands/global/d.tripsitmode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ async function tripsitmodeOn(
const now = new Date();
const diff = now.getTime() - createdDate.getTime();
const minutes = Math.floor(diff / 1000 / 60);
// const seconds = Math.floor(diff / 1000); // Uncomment this for dev server
if (minutes > 5) {
const helperStr = `and/or ${roleHelper}`;
// log.debug(F, `Target has open ticket, and it was created over 5 minutes ago!`);
Expand All @@ -247,9 +248,15 @@ async function tripsitmodeOn(
// If the meta thread exists, update the name and ping the team
if (ticketData.meta_thread_id) {
let metaMessage = '';
if (minutes > 5) {
if (minutes > 5) { // Switch to seconds > 10 for dev server
const helperString = `and/or ${roleHelper}`;
metaMessage = `Hey ${roleTripsitter} ${guildData.role_helper ?? helperString} team, ${interaction.member} has indicated that ${target.displayName} needs assistance!`; // eslint-disable-line max-len
try {
metaMessage = `Hey ${roleTripsitter} ${guildData.role_helper ? helperString : ''} team, ${interaction.member} has indicated that ${target.displayName} needs assistance!`;

Check warning on line 254 in src/discord/commands/global/d.tripsitmode.ts

View workflow job for this annotation

GitHub Actions / Lint

This line has a length of 182. Maximum allowed is 120
} catch (err) {
// If for example helper role has been deleted but the ID is still stored, do this
metaMessage = `Hey ${roleTripsitter} team, ${interaction.member} has indicated that ${target.displayName} needs assistance!`;

Check warning on line 257 in src/discord/commands/global/d.tripsitmode.ts

View workflow job for this annotation

GitHub Actions / Lint

This line has a length of 137. Maximum allowed is 120
log.error(F, `Stored Helper ID for guild ${guildData.id} is no longer valid. Role is unfetchable or deleted.`);

Check warning on line 258 in src/discord/commands/global/d.tripsitmode.ts

View workflow job for this annotation

GitHub Actions / Lint

This line has a length of 123. Maximum allowed is 120
}
} else {
metaMessage = `${interaction.member} has indicated that ${target.displayName} needs assistance!`;
}
Expand Down

0 comments on commit dd6bd41

Please sign in to comment.