diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2023-07-16 04:16:48 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-16 04:16:48 +0000 |
commit | 49bbc926e76147d2f380685d4635ebcdf2163f8f (patch) | |
tree | 740be513f52752cf25479bede9e8e2231bf0ffa6 /src/discord | |
parent | 52a340e3666e4081b5f284c320404d06ac37b2f3 (diff) | |
parent | 52b52eb489caa64e6cea978f2c6917a55fa70979 (diff) | |
download | abaddon-portaudio-49bbc926e76147d2f380685d4635ebcdf2163f8f.tar.gz abaddon-portaudio-49bbc926e76147d2f380685d4635ebcdf2163f8f.zip |
Merge pull request #192 from uowuo/message-editing
Improve message editing
Diffstat (limited to 'src/discord')
-rw-r--r-- | src/discord/chatsubmitparams.hpp | 1 | ||||
-rw-r--r-- | src/discord/message.cpp | 4 | ||||
-rw-r--r-- | src/discord/message.hpp | 10 |
3 files changed, 11 insertions, 4 deletions
diff --git a/src/discord/chatsubmitparams.hpp b/src/discord/chatsubmitparams.hpp index 24c6f50..e195189 100644 --- a/src/discord/chatsubmitparams.hpp +++ b/src/discord/chatsubmitparams.hpp @@ -20,6 +20,7 @@ struct ChatSubmitParams { bool Silent = false; Snowflake ChannelID; Snowflake InReplyToID; + Snowflake EditingID; Glib::ustring Message; std::vector<Attachment> Attachments; }; diff --git a/src/discord/message.cpp b/src/discord/message.cpp index f5d8ad8..9adc7e6 100644 --- a/src/discord/message.cpp +++ b/src/discord/message.cpp @@ -265,6 +265,10 @@ bool Message::IsEdited() const { return m_edited; } +bool Message::IsEditable() const noexcept { + return (Abaddon::Get().GetDiscordClient().GetUserData().ID == Author.ID) && !IsDeleted() && !IsPending && (Type == MessageType::DEFAULT || Type == MessageType::INLINE_REPLY); +} + bool Message::DoesMentionEveryoneOrUser(Snowflake id) const noexcept { if (DoesMentionEveryone) return true; return std::any_of(Mentions.begin(), Mentions.end(), [id](const UserData &user) { diff --git a/src/discord/message.hpp b/src/discord/message.hpp index 5028104..fb11604 100644 --- a/src/discord/message.hpp +++ b/src/discord/message.hpp @@ -219,11 +219,13 @@ struct Message { void SetDeleted(); void SetEdited(); - [[nodiscard]] bool IsDeleted() const; - [[nodiscard]] bool IsEdited() const; + bool IsDeleted() const; + bool IsEdited() const; - [[nodiscard]] bool DoesMentionEveryoneOrUser(Snowflake id) const noexcept; - [[nodiscard]] bool DoesMention(Snowflake id) const noexcept; + bool IsEditable() const noexcept; + + bool DoesMentionEveryoneOrUser(Snowflake id) const noexcept; + bool DoesMention(Snowflake id) const noexcept; private: bool m_deleted = false; |