Skip to content

Instantly share code, notes, and snippets.

@brian6932
Last active October 15, 2024 20:36
Show Gist options
  • Save brian6932/7d7a15d093b1fcecaea18327ccf02076 to your computer and use it in GitHub Desktop.
Save brian6932/7d7a15d093b1fcecaea18327ccf02076 to your computer and use it in GitHub Desktop.
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,
out = ``
for (const field in time) {
if (!time[field])
continue
out += (out.length ? `, ` : ``) + time[field] + field
if (++i === 2)
break
}
return out
})() + ` ago) ${args[0]?.slice(args[0][0] === `@`) || await execute(`abb`, `chatter`, `excludeSelf:true`)}: ${await execute(`fakenews`)}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment