Skip to content

Commit

Permalink
fix #258
Browse files Browse the repository at this point in the history
  • Loading branch information
Larsundso committed Nov 3, 2024
1 parent 0d9302c commit cb37ed7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
13 changes: 8 additions & 5 deletions src/Events/BotEvents/messageEvents/messageCreate/antivirus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ export default async (msg: Discord.Message) => {
if (!('url' in result)) {
if (msg.inGuild()) return;

await API.channels.deleteOwnMessageReaction(
msg.channelId,
msg.id,
client.util.constants.standard.getEmoteIdentifier(client.util.emotes.loading),
);

if (!result.urls.length) return;

log(
settings?.linklogging && settings?.linklogchannels.length
? settings.linklogchannels
Expand All @@ -35,11 +43,6 @@ export default async (msg: Discord.Message) => {
result,
);

await API.channels.deleteOwnMessageReaction(
msg.channelId,
msg.id,
client.util.constants.standard.getEmoteIdentifier(client.util.emotes.loading),
);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,17 @@ const filterFastMessages = (msg: Discord.Message) => {
msg.client.util.cache.fastMsgCache.set(msg.author.id, {
msgs: [msg],
job: scheduleJob(getPathFromError(new Error(msg.author.id)), '*/10 * * * * *', () => {
const message = msg.client.util.cache.fastMsgCache.get(msg.author.id)?.msgs.shift();
if (message && (!msg.inGuild() || msg.member)) {
if (msg.inGuild()) invites(msg);
antivirus(msg);
const cache = msg.client.util.cache.fastMsgCache.get(msg.author.id);
const message = cache?.msgs.shift();

if (message && (!message.inGuild() || message.member)) {
if (message.inGuild()) invites(message);
antivirus(message);
return;
}

if (cache?.msgs.length) return;

msg.client.util.cache.fastMsgCache.get(msg.author.id)?.job.cancel();
msg.client.util.cache.fastMsgCache.delete(msg.author.id);
}),
Expand Down

0 comments on commit cb37ed7

Please sign in to comment.