Skip to content

Commit

Permalink
Rooni Mini Patch (#787)
Browse files Browse the repository at this point in the history
* Fix for submitting old scores, and recognising mobile link for The Mini

* Bugfixes for NYT tracking, remove /poll

* Whoops

* Add more rounding
  • Loading branch information
Hipperooni authored Jun 11, 2024
1 parent 6cc3b2c commit b8bd092
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 225 deletions.
189 changes: 0 additions & 189 deletions src/discord/commands/global/d.poll.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/discord/commands/guild/d.levels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ export const dLevels: SlashCommand = {
// Generate the colors for the card based on the user's role color
const roleColor = `#${(target.roles.color?.color || 0x99aab5).toString(16).padStart(6, '0')}`;

const cardLightColor = generateColors(roleColor, 0, -72, -67);
const cardDarkColor = generateColors(roleColor, 0, -72, -82);
const cardLightColor = generateColors(roleColor, 0, -75, -67);
const cardDarkColor = generateColors(roleColor, 0, -75, -80);
const chipColor = generateColors(roleColor, 0, -50, -50);
const barColor = generateColors(roleColor, 0, -20, -10);
const textColor = generateColors(roleColor, 0, 0, 0);
Expand Down
12 changes: 4 additions & 8 deletions src/discord/commands/guild/d.nyt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export const dNYT: SlashCommand = {
embed.setDescription(stripIndents`
**🎮 Games Played:** ${results.stats.gamesPlayed}
**🏆 Win Rate:** ${(results.stats.winRate * 100)}%
**🏆 Win Rate:** ${Math.round(results.stats.winRate * 100)}%
**📅 Submission Streak:** ${results.stats.submissionStreak}
Expand Down Expand Up @@ -218,7 +218,7 @@ export const dNYT: SlashCommand = {
embed.setDescription(stripIndents`
**🎮 Games Played:** ${results.stats.gamesPlayed}
**🏆 Win Rate:** ${(results.stats.winRate * 100)}%
**🏆 Win Rate:** ${Math.round(results.stats.winRate * 100)}%
**📅 Submission Streak:** ${results.stats.submissionStreak}
Expand Down Expand Up @@ -258,10 +258,6 @@ export const dNYT: SlashCommand = {
**📅 Submission Streak:** ${results.stats.submissionStreak}
**🔥 Win Streak:** ${results.stats.currentStreak}
**❤️‍🔥 Best Win Streak:** ${results.stats.bestStreak}
**🏆 Best Time:** ${formatTime(results.stats.bestTime)}
**⏱️ Average Time:** ${formatTime(results.stats.averageTime)}
Expand Down Expand Up @@ -323,7 +319,7 @@ export const dNYT: SlashCommand = {
embed.setDescription(stripIndents`
**🎮 Games Played:** ${results.stats.gamesPlayed}
**🏆 Win Rate:** ${(results.stats.winRate * 100)}%
**🏆 Win Rate:** ${Math.round(results.stats.winRate * 100)}%
**📊 Guess Distribution:**
${frequencyGraph}
Expand Down Expand Up @@ -380,7 +376,7 @@ export const dNYT: SlashCommand = {
embed.setDescription(stripIndents`
**🎮 Games Played:** ${results.stats.gamesPlayed}
**🏆 Win Rate:** ${(results.stats.winRate * 100)}%
**🏆 Win Rate:** ${Math.round(results.stats.winRate * 100)}%
**📊 Mistakes Distribution:**
${frequencyGraph}
Expand Down
6 changes: 3 additions & 3 deletions src/discord/commands/guild/d.profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export const dProfile: SlashCommand = {
const roleColor = `#${(target.roles.color?.color || 0x99aab5).toString(16).padStart(6, '0')}`;
log.debug(F, `roleColor: ${roleColor}`);

const cardLightColor = generateColors(roleColor, 0, -75, -70);
const cardLightColor = generateColors(roleColor, 0, -75, -67);
const cardDarkColor = generateColors(roleColor, 0, -75, -80);
const chipColor = generateColors(roleColor, 0, -50, -50);
const barColor = generateColors(roleColor, 0, -20, -10);
Expand Down Expand Up @@ -529,8 +529,8 @@ export async function getProfilePreview(target: GuildMember, option: string, ima
// Generate the colors for the card based on the user's role color
const roleColor = `#${(target.roles.color?.color || 0x99aab5).toString(16).padStart(6, '0')}`;

const cardLightColor = generateColors(roleColor, 0, -72, -67);
const cardDarkColor = generateColors(roleColor, 0, -72, -82);
const cardLightColor = generateColors(roleColor, 0, -75, -67);
const cardDarkColor = generateColors(roleColor, 0, -75, -80);
const chipColor = generateColors(roleColor, 0, -50, -50);
const barColor = generateColors(roleColor, 0, -20, -10);
const textColor = generateColors(roleColor, 0, 0, 0);
Expand Down
2 changes: 0 additions & 2 deletions src/discord/events/messageReactionAdd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
} from '../@types/eventDef';
import { chitragupta } from '../utils/chitragupta';
import { bestOf } from '../utils/bestOfTripsit';
import { updatePollEmbed } from '../commands/global/d.poll';
import { aiReaction } from '../commands/global/d.ai';
// import log from '../../global/utils/log';
// import {parse} from 'path';
Expand Down Expand Up @@ -47,7 +46,6 @@ export const messageReactionAdd: MessageReactionAddEvent = {

chitragupta(messageReaction, user, 1);
bestOf(messageReaction);
updatePollEmbed(messageReaction);
// await communityMod(reaction, user);
},
};
Expand Down
2 changes: 0 additions & 2 deletions src/discord/events/messageReactionRemove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
MessageReactionRemoveEvent,
} from '../@types/eventDef';
import { chitragupta } from '../utils/chitragupta';
import { updatePollEmbed } from '../commands/global/d.poll';

const F = f(__filename);

Expand Down Expand Up @@ -46,7 +45,6 @@ export const messageReactionRemove: MessageReactionRemoveEvent = {
// return;
// }
chitragupta(reaction, user, -1);
updatePollEmbed(reaction);
},
};

Expand Down
8 changes: 5 additions & 3 deletions src/discord/utils/announcements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,20 @@ export async function announcements(message:Message) {
'**Reminder:** Always research any substances you plan to take. Understanding the effects and potential risks can help you make safer choices.',
'**Reminder:** Remember to take regular breaks when using screens for a long period of time to avoid eye strain.',
'**Reminder:** TripSit strives to be a safe place for everyone. Please be kind and report any inappropriate behavior.',
'**Reminder:** Spending time outdoors is proven to have a positive impact on your mental health. Try to get some fresh air every day!',
];

const tipAnnouncements = [
'**Tip:** Report a user by using `/report` if they are breaking the rules or causing issues.',
'**Tip:** Report a specific user or message with Right Click > Apps > Report Message.',
'**Tip:** Use `/help` to learn more about the bot and its commands.',
'**Tip:** Check out the <id:guide> for more tips and server info!',
'**Tip:** Go to <id:customize> to change your name color and mindset!',
'**Tip:** Go to <id:customize> to change your name color and mindset role icon!',
'**Tip:** Use the "ephemeral" option in TripBot commands to use them privately.',
`**Tip:** Find a message especially fantastic? React with ${emojiGet('karma_upvote')} to reward karma!`,
'**Tip:** Earn TripTokens in `/rpg` to buy customization items for your `/profile`!',
'**Tip:** Head to the Activities Corner in the <id:guide> for small games and activities!',
'**Tip:** Curious about a specific server function like levelling or karma? Head to Server Tips in the <id:guide>!',
'**Tip:** Keen to help with tripsitting? Head to the <id:guide> for info on how to become a Helper!',
];

const funAnnouncements = [
Expand All @@ -154,7 +155,8 @@ export async function announcements(message:Message) {
'[**Did you know?**](https://www.guinnessworldrecords.com/world-records/fastest-time-to-eat-a-bowl-of-pasta) The fastest time to eat a bowl of pasta is 17.03 seconds.',
'[**Did you know?**](https://www.guinnessworldrecords.com/world-records/most-ice-cream-scoops-balanced-on-a-cone) The most ice cream scoops balanced on a cone is 125.',
'[**Did you know?**](https://www.guinnessworldrecords.com/world-records/largest-collection-of-pokemon-memorabilia) The largest collection of Pokémon memorabilia is 17,127 items.',
'[**Did you know?**](https://www.guinnessworldrecords.com/world-records/most-people-making-heart-shaped-hand-gestures) The most people making heart-shaped hand gestures at once is 7,232.',
'[**Did you know?**](https://www.guinnessworldrecords.com/world-records/69605-longest-conga-line) The record for the longest conga line is 119,986 people.',
'[**Did you know?**](https://www.guinnessworldrecords.com/world-records/longest-cake) The longest cake ever made was 5300m (17,388 ft) long, and was eaten in 10 minutes!',
];

// const chanAnnouncements = [
Expand Down
2 changes: 1 addition & 1 deletion src/discord/utils/messageCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ async function isTheMini(message: Message): Promise<boolean> {
const userId = message.author.id; // Extract userId from message

// Regular expression to check if the message possibly mentions a The Mini score
const theMiniScorePattern = /https:\/\/www\.nytimes\.com\/badges\/games\/mini\.html\?d=\d{4}-\d{2}-\d{2}&t=\d+&c=[a-f0-9]+&smid=url-share/;
const theMiniScorePattern = /(https:\/\/www\.nytimes\.com\/badges\/games\/mini\.html\?d=\d{4}-\d{2}-\d{2}&t=\d+&c=[a-f0-9]+&smid=url-share)|(https:\/\/www\.nytimes\.com\/crosswords\/game\/mini)/;
const match = messageContent.match(theMiniScorePattern);

// If a match is found, send the message content for further processing
Expand Down
Loading

0 comments on commit b8bd092

Please sign in to comment.