Last active
October 16, 2024 19:52
-
-
Save brian6932/148fa9c2a2bb19a3aaaaf9e86ac7e55e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const | |
y = 31_536_000, | |
d = 86_400, | |
h = 3_600, | |
m = 60, | |
SecondsConverter = function (input) { | |
let remainder | |
this.y = input / y | 0 | |
this.d = (remainder = input - y * this.y) / d | 0 | |
this.h = (remainder -= d * this.d) / h | 0 | |
this.m = (remainder -= h * this.h) / m | 0 | |
}, | |
execute = async function () { | |
const cmd = await command.execute(...arguments) | |
if (!cmd.success) { | |
let acc = `` | |
for (const argument of arguments) | |
acc += argument + ` ` | |
throw Error(`$${acc}\u{2022} ${cmd.reason ?? cmd.reply}`) | |
} | |
return cmd.reply | |
}, | |
main = async () => { | |
const time = new SecondsConverter(1.893e8 * Math.random() + 1) | |
let | |
i = 0, | |
difference = `` | |
for (const field in time) { | |
if (!time[field]) | |
continue | |
difference += (difference.length ? `, ` : ``) + time[field] + field | |
if (++i === 2) | |
break | |
} | |
return `(${difference} ago) ${args[0]?.slice(args[0][0] === `@`) || await execute(`abb`, `chatter`, `excludeSelf:true`)}: ${(await execute(`tweet`, `random:true`, `textOnly:true`, `QTHESTORMM`)).replace(RegExp(String.raw` https:\/{2}t\.co\/[A-Za-z\d]{10}\b.*$|^RT @\w{1,15}: `, `l`), ``)}` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment