diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2020-09-10 23:57:36 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2020-09-10 23:57:36 -0400 |
commit | b9fb7c536ae6ab46f15c355176edbd5d25db6669 (patch) | |
tree | 89d40423dbc35bd3b8ee4ffd2afa9a975fe0dca3 /discord/store.cpp | |
parent | 54a8244bfdd26656260b3c82391db2213f937ac7 (diff) | |
download | abaddon-portaudio-b9fb7c536ae6ab46f15c355176edbd5d25db6669.tar.gz abaddon-portaudio-b9fb7c536ae6ab46f15c355176edbd5d25db6669.zip |
fix edited/deleted being reset on channel change
Diffstat (limited to 'discord/store.cpp')
-rw-r--r-- | discord/store.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/discord/store.cpp b/discord/store.cpp index 270f16c..fb0bec1 100644 --- a/discord/store.cpp +++ b/discord/store.cpp @@ -24,6 +24,13 @@ void Store::SetGuildMemberData(Snowflake guild_id, Snowflake user_id, const Guil m_members[guild_id][user_id] = data; } +User *Store::GetUser(Snowflake id) { + auto it = m_users.find(id); + if (it == m_users.end()) + return nullptr; + return &it->second; +} + const User *Store::GetUser(Snowflake id) const { auto it = m_users.find(id); if (it == m_users.end()) @@ -31,6 +38,13 @@ const User *Store::GetUser(Snowflake id) const { return &it->second; } +Channel *Store::GetChannel(Snowflake id) { + auto it = m_channels.find(id); + if (it == m_channels.end()) + return nullptr; + return &it->second; +} + const Channel *Store::GetChannel(Snowflake id) const { auto it = m_channels.find(id); if (it == m_channels.end()) @@ -38,6 +52,13 @@ const Channel *Store::GetChannel(Snowflake id) const { return &it->second; } +Guild *Store::GetGuild(Snowflake id) { + auto it = m_guilds.find(id); + if (it == m_guilds.end()) + return nullptr; + return &it->second; +} + const Guild *Store::GetGuild(Snowflake id) const { auto it = m_guilds.find(id); if (it == m_guilds.end()) @@ -45,6 +66,13 @@ const Guild *Store::GetGuild(Snowflake id) const { return &it->second; } +Role *Store::GetRole(Snowflake id) { + auto it = m_roles.find(id); + if (it == m_roles.end()) + return nullptr; + return &it->second; +} + const Role *Store::GetRole(Snowflake id) const { auto it = m_roles.find(id); if (it == m_roles.end()) @@ -52,6 +80,13 @@ const Role *Store::GetRole(Snowflake id) const { return &it->second; } +Message *Store::GetMessage(Snowflake id) { + auto it = m_messages.find(id); + if (it == m_messages.end()) + return nullptr; + return &it->second; +} + const Message *Store::GetMessage(Snowflake id) const { auto it = m_messages.find(id); if (it == m_messages.end()) @@ -59,6 +94,16 @@ const Message *Store::GetMessage(Snowflake id) const { return &it->second; } +GuildMember *Store::GetGuildMemberData(Snowflake guild_id, Snowflake user_id) { + auto git = m_members.find(guild_id); + if (git == m_members.end()) + return nullptr; + auto mit = git->second.find(user_id); + if (mit == git->second.end()) + return nullptr; + return &mit->second; +} + const GuildMember *Store::GetGuildMemberData(Snowflake guild_id, Snowflake user_id) const { auto git = m_members.find(guild_id); if (git == m_members.end()) |