mirror of
https://github.com/celisej567/abaddon.git
synced 2026-09-27 16:16:35 +03:00
add dm's
This commit is contained in:
+28
-1
@@ -145,6 +145,10 @@ const MessageData *DiscordClient::GetMessage(Snowflake id) const {
|
||||
return &m_messages.at(id);
|
||||
}
|
||||
|
||||
const ChannelData *DiscordClient::GetChannel(Snowflake id) const {
|
||||
return &m_channels.at(id);
|
||||
}
|
||||
|
||||
void DiscordClient::SendChatMessage(std::string content, Snowflake channel) {
|
||||
// @([^@#]{1,32})#(\\d{4})
|
||||
CreateMessageObject obj;
|
||||
@@ -260,9 +264,17 @@ void DiscordClient::HandleGatewayReady(const GatewayMessage &msg) {
|
||||
for (const auto &g : data.Guilds) {
|
||||
if (g.IsUnavailable)
|
||||
printf("guild (%lld) unavailable\n", g.ID);
|
||||
else
|
||||
else {
|
||||
StoreGuild(g.ID, g);
|
||||
for (const auto &c : g.Channels)
|
||||
StoreChannel(c.ID, c);
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto &dm : data.PrivateChannels) {
|
||||
StoreChannel(dm.ID, dm);
|
||||
}
|
||||
|
||||
m_abaddon->DiscordNotifyReady();
|
||||
m_user_settings = data.UserSettings;
|
||||
}
|
||||
@@ -291,6 +303,21 @@ void DiscordClient::StoreMessage(Snowflake id, const MessageData &m) {
|
||||
m_chan_to_message_map[m.ChannelID].insert(&m_messages[id]);
|
||||
}
|
||||
|
||||
void DiscordClient::StoreChannel(Snowflake id, const ChannelData &c) {
|
||||
m_channels[id] = c;
|
||||
}
|
||||
|
||||
std::set<Snowflake> DiscordClient::GetPrivateChannels() const {
|
||||
auto ret = std::set<Snowflake>();
|
||||
|
||||
for (const auto &[id, chan] : m_channels) {
|
||||
if (chan.Type == ChannelType::DM || chan.Type == ChannelType::GROUP_DM)
|
||||
ret.insert(id);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void DiscordClient::HeartbeatThread() {
|
||||
while (m_client_connected) {
|
||||
if (!m_heartbeat_acked) {
|
||||
|
||||
Reference in New Issue
Block a user