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
|
// 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]
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -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
5
src/types.d.ts
vendored
|
|
@ -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[];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue