commit
fa32df4b11
4 changed files with 27 additions and 9 deletions
1
foreshadowing.txt
Normal file
1
foreshadowing.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
https://discordapp.com/channels/588912193345683486/588912193345683488/668334714918010890
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// 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
|
||||
if (!response) {
|
||||
data["offline"].total_bits += bits;
|
||||
data["offline"].donations.push(bits);
|
||||
data["offline"].donators.push(donator);
|
||||
data.offline.total_bits += bits;
|
||||
data.offline.donations.push(bits);
|
||||
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 {
|
||||
|
||||
// Data already exists
|
||||
|
|
@ -88,6 +94,13 @@ export const START_BOT = async () => {
|
|||
// Add the bits to the total and the array of donations
|
||||
data[date].total_bits += 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
|
||||
|
|
@ -95,7 +108,8 @@ export const START_BOT = async () => {
|
|||
data[date] = {
|
||||
total_bits: bits,
|
||||
donators: [donator],
|
||||
donations: [bits]
|
||||
donations: [bits],
|
||||
max: [donator, bits]
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// 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 () => {
|
||||
START_BOT();
|
||||
START_BOT().catch(
|
||||
(err) => {console.error(err);}
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
5
src/types.d.ts
vendored
5
src/types.d.ts
vendored
|
|
@ -1,14 +1,15 @@
|
|||
//
|
||||
// types.d.ts
|
||||
//
|
||||
// Written by: Tyler Akins (2020/01/06)
|
||||
// Written by: Tyler Akins (2020/01/06 - 2020/01/18)
|
||||
//
|
||||
|
||||
|
||||
interface data {
|
||||
[key: string]: {
|
||||
max: [string, number];
|
||||
donations: number[];
|
||||
total_bits: number;
|
||||
donators: string[];
|
||||
donations: number[];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue