Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
BenSegal855 committed Feb 16, 2024
2 parents 059be65 + f73951b commit 76c8814
Show file tree
Hide file tree
Showing 9 changed files with 2,228 additions and 1,849 deletions.
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@
"sreply",
"sudoreply",
"tagq",
"timeslot",
"timespan",
"udel",
"unfaxed",
"viewremind"
],
"debug.javascript.unmapMissingSources": true
"debug.javascript.unmapMissingSources": true,
"WhiteSource Advise.Diff.BaseBranch": "main"
}
875 changes: 0 additions & 875 deletions .yarn/releases/yarn-3.7.0.cjs

This file was deleted.

875 changes: 875 additions & 0 deletions .yarn/releases/yarn-3.8.0.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ enableGlobalCache: true

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.7.0.cjs
yarnPath: .yarn/releases/yarn-3.8.0.cjs
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"chartjs-plugin-datalabels": "2.2.0",
"colorette": "2.0.20",
"common-tags": "1.8.2",
"date-and-time": "^3.1.1",
"discord.js": "14.14.1",
"module-alias": "2.2.3",
"mongodb": "4.17.2",
Expand All @@ -51,8 +52,8 @@
"@types/node": "17.0.45",
"@types/node-cron": "3.0.11",
"@types/ws": "8.5.10",
"@typescript-eslint/eslint-plugin": "6.20.0",
"@typescript-eslint/parser": "6.20.0",
"@typescript-eslint/eslint-plugin": "6.21.0",
"@typescript-eslint/parser": "6.21.0",
"eslint": "8.56.0",
"eslint-plugin-deprecation": "1.5.0",
"npm-run-all": "4.1.5",
Expand All @@ -75,5 +76,5 @@
"clean:purge": "rimraf node_modules dist yarn.lock package-lock.json",
"updeps": "yarn clean:purge && yarn install"
},
"packageManager": "yarn@3.7.0"
"packageManager": "yarn@3.8.0"
}
249 changes: 249 additions & 0 deletions src/assets/P4A24Schedule.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,249 @@
{
"p4aSchedule": [
{
"time": "2/16/2024 12:00pm -0500",
"tag": "Live",
"hosts": "Hank Green, John Green"
},
{
"time": "2/16/2024 1:00pm -0500",
"tag": "Live",
"hosts": "John Green, Dr. Joia Mukherjee"
},
{
"time": "2/16/2024 2:00pm -0500",
"tag": "Live",
"hosts": "John Green"
},
{
"time": "2/16/2024 3:00pm -0500",
"tag": "Live",
"hosts": "Hank Green, Ettore Rossetti"
},
{
"time": "2/16/2024 4:00pm -0500",
"tag": "Live",
"hosts": "Hank Green"
},
{
"time": "2/16/2024 5:00pm -0500",
"tag": "Live",
"hosts": "Hank Green, Travis McElroy"
},
{
"time": "2/16/2024 6:00pm -0500",
"tag": "Live",
"hosts": "John Green"
},
{
"time": "2/16/2024 7:00pm -0500",
"tag": "Live",
"hosts": "John Green, Danielle Bainbridge"
},
{
"time": "2/16/2024 8:00pm -0500",
"tag": "Live",
"hosts": "Sabrina Cruz, Tom Lum"
},
{
"time": "2/16/2024 9:00pm -0500",
"tag": "Live",
"hosts": "Nerdfighteria Minecraft Server"
},
{
"time": "2/16/2024 10:00pm -0500",
"tag": "Live",
"hosts": "Ceri Riley, Sam Schultz"
},
{
"time": "2/16/2024 11:00pm -0500",
"tag": "Live",
"hosts": "Hank Green, Ceri Riley, Sam Schultz"
},
{
"time": "2/17/2024 12:00am -0500",
"tag": "Live",
"hosts": "Hank Green, Brennan Lee Mulligan"
},
{
"time": "2/17/2024 1:00am -0500",
"tag": "Live",
"hosts": "Hank Green"
},
{
"time": "2/17/2024 2:00am -0500",
"tag": "Optional",
"hosts": "Hank Green"
},
{
"time": "2/17/2024 3:00am -0500",
"tag": "Optional",
"hosts": "Hank Green"
},
{
"time": "2/17/2024 4:00am -0500",
"tag": "Dark",
"hosts": "Taking a break! 💤"
},
{
"time": "2/17/2024 5:00am -0500",
"tag": "Dark",
"hosts": "Taking a break! 💤"
},
{
"time": "2/17/2024 6:00am -0500",
"tag": "Dark",
"hosts": "Taking a break! 💤"
},
{
"time": "2/17/2024 7:00am -0500",
"tag": "Dark",
"hosts": "Taking a break! 💤"
},
{
"time": "2/17/2024 8:00am -0500",
"tag": "Dark",
"hosts": "Taking a break! 💤"
},
{
"time": "2/17/2024 9:00am -0500",
"tag": "Dark",
"hosts": "Taking a break! 💤"
},
{
"time": "2/17/2024 10:00am -0500",
"tag": "Live",
"hosts": "John Green"
},
{
"time": "2/17/2024 11:00am -0500",
"tag": "Live",
"hosts": "John Green, Phil Plait"
},
{
"time": "2/17/2024 12:00pm -0500",
"tag": "Live",
"hosts": "Hank Green"
},
{
"time": "2/17/2024 1:00pm -0500",
"tag": "Live",
"hosts": "Rosianna Halse Rojas"
},
{
"time": "2/17/2024 2:00pm -0500",
"tag": "Live",
"hosts": "Rosianna Halse Rojas"
},
{
"time": "2/17/2024 3:00pm -0500",
"tag": "Live",
"hosts": "Hank Green, Tyler Thrasher"
},
{
"time": "2/17/2024 4:00pm -0500",
"tag": "Live",
"hosts": "Hank Green, Drawfee"
},
{
"time": "2/17/2024 5:00pm -0500",
"tag": "Live",
"hosts": "Animal Wonders (Jessi Knudsen-Castañeda), Nicole Sweeney"
},
{
"time": "2/17/2024 6:00pm -0500",
"tag": "Live",
"hosts": "Taylor Behnke , Miriam Nielsen"
},
{
"time": "2/17/2024 7:00pm -0500",
"tag": "Live",
"hosts": "John Green"
},
{
"time": "2/17/2024 8:00pm -0500",
"tag": "Live",
"hosts": "John Green"
},
{
"time": "2/17/2024 9:00pm -0500",
"tag": "Live",
"hosts": "Hank Green, Alexis Nikole Nelson"
},
{
"time": "2/17/2024 10:00pm -0500",
"tag": "Live",
"hosts": "Destin Sandlin"
},
{
"time": "2/17/2024 11:00pm -0500",
"tag": "Live",
"hosts": "Destin Sandlin"
},
{
"time": "2/18/2024 12:00am -0500",
"tag": "Live",
"hosts": "Hank Green"
},
{
"time": "2/18/2024 1:00am -0500",
"tag": "Live",
"hosts": "Hank Green, Brittany Broski"
},
{
"time": "2/18/2024 2:00am -0500",
"tag": "Optional",
"hosts": "Hank Green"
},
{
"time": "2/18/2024 3:00am -0500",
"tag": "Optional",
"hosts": "Hank Green"
},
{
"time": "2/18/2024 4:00am -0500",
"tag": "Dark",
"hosts": "Taking a break! 💤"
},
{
"time": "2/18/2024 5:00am -0500",
"tag": "Dark",
"hosts": "Taking a break! 💤"
},
{
"time": "2/18/2024 6:00am -0500",
"tag": "Dark",
"hosts": "Taking a break! 💤"
},
{
"time": "2/18/2024 7:00am -0500",
"tag": "Live",
"hosts": "John Green"
},
{
"time": "2/18/2024 8:00am -0500",
"tag": "Live",
"hosts": "John Green"
},
{
"time": "2/18/2024 9:00am -0500",
"tag": "Live",
"hosts": "Hank Green"
},
{
"time": "2/18/2024 10:00am -0500",
"tag": "Live",
"hosts": "Hank Green, John Green"
},
{
"time": "2/18/2024 11:00am -0500",
"tag": "Live",
"hosts": "Hank Green, John Green"
},
{
"time": "2/18/2024 12:00pm -0500",
"tag": "Dark",
"hosts": "No one, its over"
}
]
}
89 changes: 89 additions & 0 deletions src/commands/Info/p4a.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import { ApplyOptions } from '@sapphire/decorators';
import type { Command, CommandOptions } from '@sapphire/framework';
import date from 'date-and-time';
import meridiem from 'date-and-time/plugin/meridiem';
import { EmbedBuilder, Message, TimestampStyles, time as discordTime } from 'discord.js';
import { SteveCommand } from '@lib/extensions/SteveCommand';
import { p4aSchedule } from '../../assets/P4A24Schedule.json';
import { send } from '@sapphire/plugin-editable-commands';

date.plugin(meridiem);

@ApplyOptions<CommandOptions>({
description: 'See who\'s live right now on the Project for Awesome',
preconditions: ['CommitteeOnly']
})
export class UserCommand extends SteveCommand {

public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand(builder => {
builder
.setName(this.name)
.setDescription(this.description);
}, { guildIds: ['700378785605877820'] });
}

public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
interaction.reply({ embeds: [this.buildEmbed()] });
}

public async messageRun(msg: Message) {
return send(msg, { embeds: [this.buildEmbed()] });
}

private buildEmbed(): EmbedBuilder {
const embed = new EmbedBuilder()
.setThumbnail('https://projectforawesome.com/assets/2024/Social/p4a_2024_profile.png')
.setColor('#1B9C64');

const trueDateSchedule: timeslot[] = p4aSchedule.map(({ tag, hosts, time }) => ({
tag: tag === 'Live' || tag === 'Dark' || tag === 'Optional' ? tag : 'Unknown',
hosts,
time: date.parse(time, 'M/D/YYYY h:mma Z')
}));

const nextSlotIdx = trueDateSchedule.findIndex(timeslot => timeslot.time.getTime() > Date.now());

if (nextSlotIdx < 0) {
return embed
.setTitle('The P4A is over. See you next year');
}

const currentSlot = trueDateSchedule[nextSlotIdx - 1];
const nextSlot = trueDateSchedule[nextSlotIdx];

switch (currentSlot.tag) {
case 'Live':
embed.setTitle(`Live now: ${currentSlot.hosts}`)
.setDescription(`**${currentSlot.hosts}** Will be live until ${discordTime(nextSlot.time, TimestampStyles.ShortTime)}
Next up, its ${nextSlot.hosts}`)
.setURL('https://projectforawesome.com/live');
break;
case 'Optional':
embed.setTitle(`${currentSlot.hosts} might be live now, but they might not`)
.setDescription(`**${currentSlot.hosts}** Will be live until ${discordTime(nextSlot.time, TimestampStyles.ShortTime)}
Next up, its ${nextSlot.hosts}`)
.setURL('https://projectforawesome.com/live'); ;
break;
case 'Dark':
embed.setTitle('The Project for Awesome is taking a break.')
.setDescription('Take this time to catch some sleep')
.setColor('DarkButNotBlack');
break;
case 'Unknown':
default:
embed.setTitle('Something broke!')
.setDescription('If you think this is an issue, contact Ben');
break;
}

return embed;
}

}

type timeslot = {
time: Date,
tag: 'Live'|'Dark'|'Optional'|'Unknown',
hosts: string
};
Loading

0 comments on commit 76c8814

Please sign in to comment.