aboutsummaryrefslogtreecommitdiff
path: root/src/tasks
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-06-16 14:32:18 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-06-16 14:32:18 -0400
commit0e87bbd3940d89defcb04926587b35c8f4d1947f (patch)
treee50860d4dc25a11d4c3977b583284c4bcad1b077 /src/tasks
parent661e4c9935aeb8760dafc7ced4bbec6cc356a033 (diff)
downloadtanzanite-0e87bbd3940d89defcb04926587b35c8f4d1947f.tar.gz
tanzanite-0e87bbd3940d89defcb04926587b35c8f4d1947f.tar.bz2
tanzanite-0e87bbd3940d89defcb04926587b35c8f4d1947f.zip
remove util classes, move config out of src
Diffstat (limited to 'src/tasks')
-rw-r--r--src/tasks/cpuUsage.ts8
-rw-r--r--src/tasks/handleReminders.ts8
-rw-r--r--src/tasks/removeExpiredPunishements.ts6
-rw-r--r--src/tasks/updateCache.ts4
-rw-r--r--src/tasks/updateHighlightCache.ts2
-rw-r--r--src/tasks/updatePriceItemCache.ts2
-rw-r--r--src/tasks/updateStats.ts2
7 files changed, 15 insertions, 17 deletions
diff --git a/src/tasks/cpuUsage.ts b/src/tasks/cpuUsage.ts
index e5cfc00..6ce6671 100644
--- a/src/tasks/cpuUsage.ts
+++ b/src/tasks/cpuUsage.ts
@@ -1,5 +1,5 @@
import { BushTask, Time } from '#lib';
-import osu from 'node-os-utils';
+import { cpu } from 'node-os-utils';
export default class CpuUsageTask extends BushTask {
public constructor() {
@@ -9,8 +9,8 @@ export default class CpuUsageTask extends BushTask {
});
}
- public override async exec() {
- const cpu = await osu.cpu.usage(client.stats.cpu === undefined ? 100 * Time.Millisecond : Time.Minute);
- client.stats.cpu = cpu;
+ public async exec() {
+ const cpuStats = await cpu.usage(client.stats.cpu === undefined ? 100 * Time.Millisecond : Time.Minute);
+ client.stats.cpu = cpuStats;
}
}
diff --git a/src/tasks/handleReminders.ts b/src/tasks/handleReminders.ts
index e281903..79693f5 100644
--- a/src/tasks/handleReminders.ts
+++ b/src/tasks/handleReminders.ts
@@ -1,4 +1,4 @@
-import { BushTask, Reminder, Time } from '#lib';
+import { BushTask, dateDelta, format, Reminder, Time } from '#lib';
const { Op } = (await import('sequelize')).default;
export default class HandlerRemindersTask extends BushTask {
@@ -9,7 +9,7 @@ export default class HandlerRemindersTask extends BushTask {
});
}
- public override async exec() {
+ public async exec() {
const expiredEntries = await Reminder.findAll({
where: {
expires: {
@@ -26,9 +26,7 @@ export default class HandlerRemindersTask extends BushTask {
void client.users
.send(
entry.user,
- `The reminder you set ${util.dateDelta(entry.created)} ago has expired: ${util.format.bold(entry.content)}\n${
- entry.messageUrl
- }`
+ `The reminder you set ${dateDelta(entry.created)} ago has expired: ${format.bold(entry.content)}\n${entry.messageUrl}`
)
.catch(() => false);
void entry.update({ notified: true });
diff --git a/src/tasks/removeExpiredPunishements.ts b/src/tasks/removeExpiredPunishements.ts
index 6b36473..3f6f6dd 100644
--- a/src/tasks/removeExpiredPunishements.ts
+++ b/src/tasks/removeExpiredPunishements.ts
@@ -1,4 +1,4 @@
-import { ActivePunishment, ActivePunishmentType, BushTask, Time } from '#lib';
+import { ActivePunishment, ActivePunishmentType, BushTask, resolveNonCachedUser, Time } from '#lib';
import assert from 'assert';
const { Op } = (await import('sequelize')).default;
@@ -10,7 +10,7 @@ export default class RemoveExpiredPunishmentsTask extends BushTask {
});
}
- public override async exec() {
+ public async exec() {
const expiredEntries = await ActivePunishment.findAll({
where: {
expires: {
@@ -31,7 +31,7 @@ export default class RemoveExpiredPunishmentsTask extends BushTask {
// eslint-disable-next-line @typescript-eslint/no-misused-promises
setTimeout(async () => {
const member = guild.members.cache.get(entry.user);
- const user = await util.resolveNonCachedUser(entry.user);
+ const user = await resolveNonCachedUser(entry.user);
assert(guild);
switch (entry.type) {
diff --git a/src/tasks/updateCache.ts b/src/tasks/updateCache.ts
index 3794f76..487b9bc 100644
--- a/src/tasks/updateCache.ts
+++ b/src/tasks/updateCache.ts
@@ -1,7 +1,7 @@
import { Time } from '#constants';
import { Global, Guild, Shared, type BushClient } from '#lib';
+import config from '../../config/options.js';
import { BushTask } from '../lib/extensions/discord-akairo/BushTask.js';
-import config from './../config/options.js';
export default class UpdateCacheTask extends BushTask {
public constructor() {
@@ -11,7 +11,7 @@ export default class UpdateCacheTask extends BushTask {
});
}
- public override async exec() {
+ public async exec() {
await Promise.all([
UpdateCacheTask.#updateGlobalCache(client),
UpdateCacheTask.#updateSharedCache(client),
diff --git a/src/tasks/updateHighlightCache.ts b/src/tasks/updateHighlightCache.ts
index 22289ce..d4fca71 100644
--- a/src/tasks/updateHighlightCache.ts
+++ b/src/tasks/updateHighlightCache.ts
@@ -9,7 +9,7 @@ export default class UpdateHighlightCacheTask extends BushTask {
});
}
- public override async exec() {
+ public async exec() {
return client.highlightManager.syncCache();
}
}
diff --git a/src/tasks/updatePriceItemCache.ts b/src/tasks/updatePriceItemCache.ts
index 6414eb0..e6d2db4 100644
--- a/src/tasks/updatePriceItemCache.ts
+++ b/src/tasks/updatePriceItemCache.ts
@@ -10,7 +10,7 @@ export default class UpdatePriceItemCache extends BushTask {
});
}
- public override async exec() {
+ public async exec() {
//prettier-ignore
const [bazaar, currentLowestBIN, averageLowestBIN, auctionAverages] = (await Promise.all([
got.get('https://api.hypixel.net/skyblock/bazaar').json().catch(() => {}),
diff --git a/src/tasks/updateStats.ts b/src/tasks/updateStats.ts
index f27841f..0e50c23 100644
--- a/src/tasks/updateStats.ts
+++ b/src/tasks/updateStats.ts
@@ -8,7 +8,7 @@ export default class UpdateStatsTask extends BushTask {
});
}
- public override async exec() {
+ public async exec() {
const row =
(await Stat.findByPk(client.config.environment)) ?? (await Stat.create({ environment: client.config.environment }));
row.commandsUsed = client.stats.commandsUsed;