-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
2,228 additions
and
1,849 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}; |
Oops, something went wrong.