Merge pull request #4 from Tyler-A/develop

Develop
This commit is contained in:
Tyler 2020-01-19 00:30:51 -06:00 committed by GitHub
commit fa32df4b11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 9 deletions

1
foreshadowing.txt Normal file
View file

@ -0,0 +1 @@
https://discordapp.com/channels/588912193345683486/588912193345683488/668334714918010890

View file

@ -1,7 +1,7 @@
// //
// Twitch.ts // Twitch.ts
// //
// Written by: Tyler Akins (2020/01/06 - 2020/01/09) // Written by: Tyler Akins (2020/01/06 - 2020/01/18)
// //
@ -72,9 +72,15 @@ export const START_BOT = async () => {
// Ensure the user is live // Ensure the user is live
if (!response) { if (!response) {
data["offline"].total_bits += bits; data.offline.total_bits += bits;
data["offline"].donations.push(bits); data.offline.donations.push(bits);
data["offline"].donators.push(donator); data.offline.donators.push(donator);
// Check if we have a new max
if (data.offline.max[1] < bits) {
data.offline.max[0] = donator;
data.offline.max[1] = bits;
};
} else { } else {
// Data already exists // Data already exists
@ -88,6 +94,13 @@ export const START_BOT = async () => {
// Add the bits to the total and the array of donations // Add the bits to the total and the array of donations
data[date].total_bits += bits; data[date].total_bits += bits;
data[date].donations.push(bits); data[date].donations.push(bits);
// Check if we have a new max
if (data[date].max[1] < bits) {
data[date].max[0] = donator;
data[date].max[1] = bits;
};
} }
// Making new data point // Making new data point
@ -95,7 +108,8 @@ export const START_BOT = async () => {
data[date] = { data[date] = {
total_bits: bits, total_bits: bits,
donators: [donator], donators: [donator],
donations: [bits] donations: [bits],
max: [donator, bits]
}; };
}; };
}; };

View file

@ -1,7 +1,7 @@
// //
// main.ts // main.ts
// //
// Written by: Tyler Akins (2020/01/06 - 2020/01/07) // Written by: Tyler Akins (2020/01/06 - 2020/01/11)
// //
@ -10,7 +10,9 @@ import { START_BOT } from "./Twitch"
const MAIN = async () => { const MAIN = async () => {
START_BOT(); START_BOT().catch(
(err) => {console.error(err);}
);
}; };

5
src/types.d.ts vendored
View file

@ -1,14 +1,15 @@
// //
// types.d.ts // types.d.ts
// //
// Written by: Tyler Akins (2020/01/06) // Written by: Tyler Akins (2020/01/06 - 2020/01/18)
// //
interface data { interface data {
[key: string]: { [key: string]: {
max: [string, number];
donations: number[];
total_bits: number; total_bits: number;
donators: string[]; donators: string[];
donations: number[];
}; };
} }