mirror of
https://gitlab.com/niansa/SomeBot.git
synced 2025-03-06 20:48:26 +01:00
Lua bindings: allow kicking/banning user object
This commit is contained in:
parent
c228ce8b44
commit
e4e89d60a2
1 changed files with 16 additions and 0 deletions
|
@ -352,6 +352,22 @@ public:
|
|||
.addProperty("has_animated_icon", &user::has_animated_icon)
|
||||
.addProperty("formatted_username", &user::format_username)
|
||||
.addFunction("get_avatar_url", &user::get_avatar_url)
|
||||
.addFunction("kick", [guild_id = baseContext.guild_id, cluster = &baseContext.bot->cluster] (const user *o) -> bool {
|
||||
try {
|
||||
cluster->guild_member_kick_sync(o->id, guild_id);
|
||||
return true;
|
||||
} catch (...) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.addFunction("ban", [guild_id = baseContext.guild_id, cluster = &baseContext.bot->cluster] (const user *o, unsigned delete_message_settings) -> bool {
|
||||
try {
|
||||
cluster->guild_ban_add_sync(guild_id, o->id, delete_message_settings);
|
||||
return true;
|
||||
} catch (...) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.endClass()
|
||||
.beginClass<guild_member>("Member")
|
||||
.addProperty("nickname", &guild_member::nickname, true)
|
||||
|
|
Loading…
Add table
Reference in a new issue