mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Fix
This commit is contained in:
@@ -29,7 +29,7 @@ module.exports = class Timer {
|
||||
await channel.send(`🕰️ <@${this.userID}>, you wanted me to remind you of: **"${this.title}"**.`);
|
||||
} finally {
|
||||
this.client.timers.delete(this.id);
|
||||
await this.client.redis.hdel('timer', this.id);
|
||||
await this.client.redis.db.hdel('timer', this.id);
|
||||
}
|
||||
}, time);
|
||||
}
|
||||
@@ -37,6 +37,6 @@ module.exports = class Timer {
|
||||
delete() {
|
||||
clearTimeout(this.timeout);
|
||||
this.client.timers.delete(this.id);
|
||||
return this.client.redis.hdel('timer', this.id);
|
||||
return this.client.redis.db.hdel('timer', this.id);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@ module.exports = class TimerManager extends Collection {
|
||||
}
|
||||
|
||||
async fetchAll() {
|
||||
const timers = await this.client.redis.hgetall('timer');
|
||||
const timers = await this.client.redis.db.hgetall('timer');
|
||||
for (let data of Object.values(timers)) {
|
||||
data = JSON.parse(data);
|
||||
await this.setTimer(data.id, data.channelID, new Date(data.time) - new Date(), data.userID, data.title, false);
|
||||
@@ -19,7 +19,7 @@ module.exports = class TimerManager extends Collection {
|
||||
|
||||
async setTimer(id, channelID, time, userID, title, updateRedis = true) {
|
||||
const timer = new Timer(this.client, id, channelID, userID, time, title);
|
||||
if (updateRedis) await this.client.redis.hset('timer', { [timer.id]: timer.stringify() });
|
||||
if (updateRedis) await this.client.redis.db.hset('timer', { [timer.id]: timer.stringify() });
|
||||
this.set(timer.id, timer);
|
||||
return timer;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user