mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix: update messageCount/totalMessageSent on message events (#8635)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -10,6 +10,11 @@ class MessageCreateAction extends Action {
|
||||
if (channel) {
|
||||
if (!channel.isTextBased()) return {};
|
||||
|
||||
if (channel.isThread()) {
|
||||
channel.messageCount++;
|
||||
channel.totalMessageSent++;
|
||||
}
|
||||
|
||||
const existing = channel.messages.cache.get(data.id);
|
||||
if (existing) return { message: existing };
|
||||
const message = channel.messages._add(data);
|
||||
|
||||
@@ -11,6 +11,8 @@ class MessageDeleteAction extends Action {
|
||||
if (channel) {
|
||||
if (!channel.isTextBased()) return {};
|
||||
|
||||
if (channel.isThread()) channel.messageCount--;
|
||||
|
||||
message = this.getMessage(data, channel);
|
||||
if (message) {
|
||||
channel.messages.cache.delete(message.id);
|
||||
|
||||
@@ -12,6 +12,8 @@ class MessageDeleteBulkAction extends Action {
|
||||
if (channel) {
|
||||
if (!channel.isTextBased()) return {};
|
||||
|
||||
if (channel.isThread()) channel.messageCount -= data.ids.length;
|
||||
|
||||
const ids = data.ids;
|
||||
const messages = new Collection();
|
||||
for (const id of ids) {
|
||||
|
||||
Reference in New Issue
Block a user