mirror of
https://github.com/kirameki-cafe/Yumi.git
synced 2026-09-13 10:49:20 +00:00
Add user data caching
This commit is contained in:
@@ -124,7 +124,11 @@ class Discord {
|
||||
});
|
||||
|
||||
// Interaction create event to modules
|
||||
this.client.on('interactionCreate', (interaction: Interaction) => {
|
||||
this.client.on('interactionCreate', async (interaction: Interaction) => {
|
||||
|
||||
if(!Cache.isUserCached(interaction.user.id))
|
||||
await Cache.updateUserCache(interaction.user.id);
|
||||
|
||||
for (const module of this.loaded_module) {
|
||||
let thisModule: DiscordModule = module[1];
|
||||
|
||||
@@ -175,7 +179,7 @@ class Discord {
|
||||
if (message.author.bot) return;
|
||||
if (typeof message.guild?.id === 'undefined') return;
|
||||
|
||||
let GuildCache = await Cache.getGuild(message.guild.id);
|
||||
let GuildCache = await Cache.getCachedGuild(message.guild.id);
|
||||
if (typeof GuildCache === 'undefined' || typeof GuildCache.prefix === 'undefined')
|
||||
return;
|
||||
|
||||
@@ -243,15 +247,10 @@ class Discord {
|
||||
} else {
|
||||
if (noPrefixMessage.charAt(0) !== ' ') return;
|
||||
}
|
||||
//if(noPrefixMessage.charAt(0) !== ' ' && !symbols.includes(noPrefixMessage.charAt(0))) return;
|
||||
}
|
||||
|
||||
if (noPrefixMessage === '') return;
|
||||
if (noPrefixMessage.charAt(0) === ' ') {
|
||||
/*if(symbols.includes(GuildCache.prefix.charAt(GuildCache.prefix.length - 1))) {
|
||||
if((GuildCache.prefix.indexOf(' ') >= 0)) return;
|
||||
}*/
|
||||
|
||||
noPrefixMessage = noPrefixMessage.substring(1);
|
||||
}
|
||||
|
||||
@@ -264,6 +263,9 @@ class Discord {
|
||||
|
||||
if (args.length === 0) args = [];
|
||||
|
||||
if(!Cache.isUserCached(message.author.id))
|
||||
await Cache.updateUserCache(message.author.id);
|
||||
|
||||
for (const module of this.loaded_module) {
|
||||
let thisModule: DiscordModule = module[1];
|
||||
thisModule.GuildOnCommand(command, args, message);
|
||||
@@ -294,6 +296,9 @@ class Discord {
|
||||
|
||||
if (args.length === 0) args = [];
|
||||
|
||||
if(!Cache.isUserCached(message.author.id))
|
||||
await Cache.updateUserCache(message.author.id);
|
||||
|
||||
for (const module of this.loaded_module) {
|
||||
let thisModule: DiscordModule = module[1];
|
||||
thisModule.GuildOnCommand(command, args, message);
|
||||
|
||||
Reference in New Issue
Block a user