forked from OpenGamers/abaddon
fix removing roles from members (maybe)
This commit is contained in:
parent
acb80da387
commit
96ec5bb665
@ -253,6 +253,14 @@ void Store::SetGuildMember(Snowflake guild_id, Snowflake user_id, const GuildMem
|
||||
|
||||
s->Reset();
|
||||
|
||||
{
|
||||
auto &s = m_stmt_clr_member_roles;
|
||||
s->Bind(1, user_id);
|
||||
s->Bind(2, guild_id);
|
||||
s->Step();
|
||||
s->Reset();
|
||||
}
|
||||
|
||||
{
|
||||
auto &s = m_stmt_set_member_roles;
|
||||
|
||||
@ -1881,6 +1889,20 @@ bool Store::CreateStatements() {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_stmt_clr_member_roles = std::make_unique<Statement>(m_db, R"(
|
||||
DELETE FROM member_roles
|
||||
WHERE user = ? AND
|
||||
EXISTS (
|
||||
SELECT 1 FROM roles
|
||||
WHERE member_roles.role = roles.id
|
||||
AND roles.guild = ?
|
||||
)
|
||||
)");
|
||||
if (!m_stmt_clr_member_roles->OK()) {
|
||||
fprintf(stderr, "failed to prepare clear member roles statement: %s\n", m_db.ErrStr());
|
||||
return false;
|
||||
}
|
||||
|
||||
m_stmt_set_guild_emoji = std::make_unique<Statement>(m_db, R"(
|
||||
REPLACE INTO guild_emojis VALUES (
|
||||
?, ?
|
||||
|
@ -281,6 +281,7 @@ private:
|
||||
STMT(set_interaction);
|
||||
STMT(set_member_roles);
|
||||
STMT(get_member_roles);
|
||||
STMT(clr_member_roles);
|
||||
STMT(set_guild_emoji);
|
||||
STMT(get_guild_emojis);
|
||||
STMT(clr_guild_emoji);
|
||||
|
Loading…
Reference in New Issue
Block a user