update date

This commit is contained in:
Avi 2023-02-22 00:13:35 +00:00
parent 6e63e84233
commit 7c58140511
4 changed files with 106 additions and 11 deletions

76
.replit
View file

@ -1,2 +1,76 @@
entrypoint = "index.js"
hidden = [".config"]
run = "node api/app.js"
[[hints]]
regex = "Error \\[ERR_REQUIRE_ESM\\]"
message = "We see that you are using require(...) inside your code. We currently do not support this syntax. Please use 'import' instead when using external modules. (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import)"
[nix]
channel = "stable-21_11"
[env]
PATH = "/home/runner/$REPL_SLUG/.config/npm/node_global/bin:/home/runner/$REPL_SLUG/node_modules/.bin"
XDG_CONFIG_HOME = "/home/runner/.config"
npm_config_prefix = "/home/runner/$REPL_SLUG/.config/npm/node_global"
[gitHubImport]
requiredFiles = [".replit", "replit.nix", ".config"]
[packager]
language = "nodejs"
run = "node api/app.js"
[packager.features]
packageSearch = true
guessImports = true
enabledForHosting = false
[unitTest]
language = "nodejs"
[languages.javascript]
pattern = "**/{*.js,*.jsx,*.ts,*.tsx}"
[languages.javascript.languageServer]
start = "typescript-language-server --stdio"
[debugger]
support = true
[debugger.interactive]
transport = "localhost:0"
startCommand = [ "dap-node" ]
[debugger.interactive.initializeMessage]
command = "initialize"
type = "request"
[debugger.interactive.initializeMessage.arguments]
clientID = "replit"
clientName = "replit.com"
columnsStartAt1 = true
linesStartAt1 = true
locale = "en-us"
pathFormat = "path"
supportsInvalidatedEvent = true
supportsProgressReporting = true
supportsRunInTerminalRequest = true
supportsVariablePaging = true
supportsVariableType = true
[debugger.interactive.launchMessage]
command = "launch"
type = "request"
[debugger.interactive.launchMessage.arguments]
args = []
console = "externalTerminal"
cwd = "."
environment = []
pauseForSourceMap = false
program = "./index.js"
request = "launch"
sourceMaps = true
stopOnEntry = false
type = "pwa-node"

2
.replit.backup Normal file
View file

@ -0,0 +1,2 @@
language = "nodejs"
run = "node api/app.js"

View file

@ -5,7 +5,7 @@ const addQuotes = require('./quotes.js');
const schedule = require('node-schedule');
const moment = require('moment');
const token = process.env.SLACK_BOT_TOKEN;
const channel = "CDJMS683D";
const channel = "CDJMS683D";
const Airtable = require('airtable');
Airtable.configure({
endpointUrl: 'https://api.airtable.com',
@ -15,8 +15,8 @@ const base = Airtable.base('appogmRaVRo5ElVH7');
let speedArr = [];
let latest;
const goalDate = '06/20/2021';
const goalNumber = 200000;
const goalDate = '10/31/2023';
const goalNumber = 300000;
const app = new App({
token: token,
@ -63,7 +63,7 @@ async function fetchOldest(id) {
inclusive: false,
});
let number;
for (let x = result.messages.length - 2; x >= 0 ; x--) {
for (let x = result.messages.length - 2; x >= 0; x--) {
number = extractNumber(
result.messages[x].text,
);
@ -122,7 +122,7 @@ function findMean(arr) {
}
async function addData(db, object) {
base(db).create(object, function(err, record){
base(db).create(object, function(err, record) {
if (err) {
console.error(err);
return;
@ -157,8 +157,9 @@ async function report() {
"Date": moment().subtract(1, "days").format("YYYY-MM-DD"),
"increase": diff,
"stats": [
"rec2XI8QAsPr7EMVB"
]
"rec2XI8QAsPr7EMVB"
],
"start": oldest,
})
let averageSpeed = await getAverage();
let thousandsGoal = Math.ceil(latest / 1000) * 1000;
@ -176,7 +177,7 @@ async function report() {
- :1234: Here's a number to aim for today: *${Math.ceil(parseInt(latest) + parseInt(goals[1]))}*`;
if (pastThousandsGoal > oldest && pastThousandsGoal <= latest) {
let messageWithCelebration = `:tada: Congratulations! We've went past ${pastThousandsGoal}! :tada: \n` + message;
publishMessage(channel, addQuotes(messageWithCelebration, goals, averageSpeed));
publishMessage(channel, addQuotes(messageWithCelebration, goals, averageSpeed));
// publishMessage('C017W4PHYKS', addQuotes(messageWithCelebration, goals, averageSpeed));
} else {
publishMessage(channel, addQuotes(message, goals, averageSpeed));
@ -234,8 +235,18 @@ app.event('app_mention', async (body) => {
try {
let e = body.event;
let c = e.channel;
console.log('pong');
publishMessage(c, "DO NOT BOTHER ME. I AM SLEEPING.")
let choose = Math.floor(Math.random() * 8);
let messageArray = [
"DO NOT BOTHER ME. I AM SLEEPING.",
"AAAAAAAA!!! THE SUN! *pulls curtains closed* I nearly got _burnt_ that time, you pathetic little minions! Next time, DO NOT WAKE ME.",
"What do you want, human weakling?",
"Hrmh? Is Count von Corgo pissing on the lawn _again_?",
"What is it? Are you going too slow that you need another supernatural being to help you _speed-count_? If so, you've found the wrong one, because this supernatural being is _trying to sleep!_",
"HISSSSSSSSSSS!",
"Minions, I had _three hours_ of sleep yesterday, and I am trying to catch up. Please, _leave me alone to sleep._",
]
publishMessage(c, messageArray[choose])
} catch (err) {
console.error(err)
}

8
replit.nix Normal file
View file

@ -0,0 +1,8 @@
{ pkgs }: {
deps = [
pkgs.nodejs-12_x
pkgs.nodePackages.typescript-language-server
pkgs.yarn
pkgs.replitPackages.jest
];
}