mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-22 18:29:14 +02:00
ESM, man
This commit is contained in:
@@ -1,9 +1,7 @@
|
|||||||
const Command = require('../../framework/Command');
|
const Command = require('../../framework/Command');
|
||||||
const { PermissionFlagsBits } = require('discord.js');
|
const { PermissionFlagsBits } = require('discord.js');
|
||||||
const sagiri = require('sagiri');
|
|
||||||
const { embedURL } = require('../../util/Util');
|
const { embedURL } = require('../../util/Util');
|
||||||
const { SAUCENAO_KEY } = process.env;
|
const { SAUCENAO_KEY } = process.env;
|
||||||
const sagiriClient = sagiri(SAUCENAO_KEY);
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const images = fs.readdirSync(path.join(__dirname, '..', '..', 'assets', 'images', 'xiao'));
|
const images = fs.readdirSync(path.join(__dirname, '..', '..', 'assets', 'images', 'xiao'));
|
||||||
@@ -33,6 +31,8 @@ module.exports = class XiaoCommand extends Command {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.cache = new Map();
|
this.cache = new Map();
|
||||||
|
this.sagiri = null;
|
||||||
|
this.sagiriClient = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
async run(msg) {
|
async run(msg) {
|
||||||
@@ -72,7 +72,9 @@ module.exports = class XiaoCommand extends Command {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
sauceNao(img) {
|
async sauceNao(img) {
|
||||||
|
if (!this.sagiri) this.sagiri = await import('sagiri');
|
||||||
|
if (!this.sagiriClient) this.sagiriClient = this.sagiri(SAUCENAO_KEY);
|
||||||
return sagiriClient(path.join(__dirname, '..', '..', 'assets', 'images', 'xiao', img));
|
return sagiriClient(path.join(__dirname, '..', '..', 'assets', 'images', 'xiao', img));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user