mirror of
https://github.com/uowuo/abaddon.git
synced 2026-08-15 05:19:58 +00:00
fix webhook messages not using right username + avatar (fixes #209)
This commit is contained in:
1 parent
9724023758
commit
36f2ec0996
10 files changed
+164
-16
No files matched your search
@@ -67,8 +67,22 @@ void ChatList::ProcessNewMessage(const Message &data, bool prepend) {
|
||||
|
||||
if (last_row != nullptr) {
|
||||
const uint64_t diff = std::max(data.ID, last_row->NewestID) - std::min(data.ID, last_row->NewestID);
|
||||
if (last_row->UserID == data.Author.ID && (prepend || (diff < SnowflakeSplitDifference * Snowflake::SecondsInterval)))
|
||||
if (last_row->UserID == data.Author.ID && (prepend || (diff < SnowflakeSplitDifference * Snowflake::SecondsInterval))) {
|
||||
should_attach = true;
|
||||
}
|
||||
// Separate webhooks if the usernames or avatar URLs are different
|
||||
if (data.IsWebhook() && last_row->UserID == data.Author.ID) {
|
||||
const auto last_message = discord.GetMessage(last_row->NewestID);
|
||||
if (last_message.has_value() && last_message->IsWebhook()) {
|
||||
const auto last_webhook_data = last_message->GetWebhookData();
|
||||
const auto next_webhook_data = data.GetWebhookData();
|
||||
if (last_webhook_data.has_value() && next_webhook_data.has_value()) {
|
||||
if (last_webhook_data->Username != next_webhook_data->Username || last_webhook_data->Avatar != next_webhook_data->Avatar) {
|
||||
should_attach = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user