diff --git a/src/update.js b/src/update.js
index 0e02178fd3..487afb9677 100644
--- a/src/update.js
+++ b/src/update.js
@@ -2,6 +2,7 @@ const { join } = require("path");
const fetch = require("node-fetch");
const { writeFileSync } = require("fs");
const Twitter = require("twitter");
+
const days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
const months = [
"Jan",
@@ -22,7 +23,6 @@ const getDateSuffix = (date) => {
if (date >= 10 && date < 20) {
return "th";
}
-
return (
{
1: "st",
@@ -34,203 +34,50 @@ const getDateSuffix = (date) => {
const make2Digit = (num) => `0${num}`.slice(-2);
-const client = new Twitter({
- consumer_key: process.env.TWITTER_API_KEY,
- consumer_secret: process.env.TWITTER_SECRET,
- access_token_key: process.env.TWITTER_ACCESS_KEY,
- access_token_secret: process.env.TWITTER_TOKEN_SECRET,
-});
-
-let stars = 0,
- page = 1;
-
-const countStars = async () => {
- const starsData = await fetch(
- `https://api.github.com/users/2M4U/starred?per_page=100&page=${page}`
- ).then((res) => res.json());
- stars += starsData.length;
- page++;
- if (starsData.length === 100) countStars();
- else writeReadMe();
-};
-
-const writeReadMe = async () => {
- const readMe = join(__dirname, "..", "README.md");
- const now = new Date();
-
- const params = { screen_name: "stomperleaks", count: 1 }// = { screen_name: "stomperleaks", count: 1 };
- let tweet = await client.get("statuses/user_timeline", params);
-
-// const names = ["Rixqi", "StomperTheBunny","ImWay2Much4U"];
-// console.log(names.map(getUser))
-// const users = await Promise.all(names.map(getUser))
-// console.log(JSON.stringify(users))
- console.log(tweet);
-
- let data = await fetch(
- `https://fortnite-api.com/v2/stats/br/v2?name=${encodeURIComponent(process.env.FORTNITE_USERNAME)}`,
- {
- headers: {
- Authorization: process.env.API_SECRET,
- },
- }
- ).then((res) => res.json());
- let season = await fetch(
- `https://fortnite-api.com/v2/stats/br/v2?name=${encodeURIComponent(process.env.FORTNITE_USERNAME)}&timeWindow=season`,
- {
- headers: {
- Authorization: process.env.API_SECRET,
- },
- }
- ).then((res) => res.json());
- let struct = {
- Battlepass: {
- Level: `${data.data.battlePass.level}`,
- Progress: `${data.data.battlePass.progress}%`,
- },
- Season: {
- Win_Ratio: `${season.data.stats.all.overall.winRate.toFixed(2)}%`,
- KD_Ratio: `${season.data.stats.all.overall.kd.toFixed(2)}%`,
- Kills_Per_Match: `${season.data.stats.all.overall.killsPerMatch.toFixed(
- 2
- )}%`,
- Total_Matches: `${season.data.stats.all.overall.matches.toLocaleString()}`,
- Total_Kills: `${season.data.stats.all.overall.kills.toLocaleString()}`,
- Total_Deaths: `${season.data.stats.all.overall.deaths.toLocaleString()}`,
- Total_Wins: `${season.data.stats.all.overall.wins.toLocaleString()}`,
- Outlived: {
- Players: `${season.data.stats.all.overall.playersOutlived.toLocaleString()}`,
- },
- },
- Lifetime: {
- Win_Ratio: `${data.data.stats.all.overall.winRate.toFixed(2)}%`,
- KD_Ratio: `${data.data.stats.all.overall.kd.toFixed(2)}%`,
- Kills_Per_Match: `${data.data.stats.all.overall.killsPerMatch.toFixed(
- 2
- )}%`,
- Total_Matches: `${data.data.stats.all.overall.matches.toLocaleString()}`,
- Total_Kills: `${data.data.stats.all.overall.kills.toLocaleString()}`,
- Total_Deaths: `${data.data.stats.all.overall.deaths.toLocaleString()}`,
- Total_Wins: `${data.data.stats.all.overall.wins.toLocaleString()}`,
- Outlived: {
- Players: `${data.data.stats.all.overall.playersOutlived.toLocaleString()}`,
- },
- },
+function genDate() {
+ const date = new Date();
+ let hr = date.getHours(),
+ ampm = hr < 12 ? "AM" : "PM";
+ if (hr > 12) hr -= 12;
+ else if (!hr) hr = 12;
+
+ const dd = date.getDate(),
+ mon = months[date.getMonth()],
+ day = days[date.getDay()],
+ min = make2Digit(date.getMinutes());
+
+ return {
+ date: `${day}, ${dd}${getDateSuffix(dd)} ${mon} ${date.getFullYear()}`,
+ time: `${hr}:${min} ${ampm} IST`,
};
- let UserData = await fetch("https://api.github.com/users/2M4U").then((res) =>
- res.json()
- );
- let ram = process.memoryUsage().heapUsed / 1024 / 1024;
- console.log(UserData);
- const text = `
- https://discord.gg/sack
- 
-
- Welcome **Github User** to the Code Land of ${UserData.login} (me),
- What you see below is a future project for updating my
- In-Game Fortnite Statistics, Feel free to Fork this repository
- If you wish to see how this works.
-
- Wish to contact me? [Add me on Discord](https://tinyurl.com/addmeondiscord)
-
-
-
- | Followers | Following |
- | ---------- |:---------:|
- |  |  |
-
-
-

- ${tweet[0].text}
-
-
-
-
-
-
-