mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 15:07:42 +02:00
Redis isWearingHat
This commit is contained in:
@@ -127,6 +127,8 @@ client.on('clientReady', async () => {
|
|||||||
}, 60000);
|
}, 60000);
|
||||||
|
|
||||||
// Interval to check for holidays and change the avatar if needed
|
// Interval to check for holidays and change the avatar if needed
|
||||||
|
const isWearingHat = await client.redis.db.get('hat');
|
||||||
|
client.avatarChanger.isWearingHat = isWearingHat;
|
||||||
client.avatarChanger.setInterval();
|
client.avatarChanger.setInterval();
|
||||||
|
|
||||||
// Set up disabled commands
|
// Set up disabled commands
|
||||||
|
|||||||
@@ -21,11 +21,13 @@ module.exports = class AvatarChanger {
|
|||||||
|
|
||||||
async setAvatar(hat) {
|
async setAvatar(hat) {
|
||||||
if (!hat) {
|
if (!hat) {
|
||||||
|
await this.client.redis.db.set('hat', false);
|
||||||
this.isWearingHat = false;
|
this.isWearingHat = false;
|
||||||
await this.client.user.setAvatar(path.join(__dirname, '..', 'assets', 'images', 'Xiao.png'));
|
await this.client.user.setAvatar(path.join(__dirname, '..', 'assets', 'images', 'Xiao.png'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.isWearingHat = true;
|
this.isWearingHat = true;
|
||||||
|
await this.client.redis.db.set('hat', true);
|
||||||
const image = await this.editAvatar(hat);
|
const image = await this.editAvatar(hat);
|
||||||
await this.client.user.setAvatar(image);
|
await this.client.user.setAvatar(image);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user