1
0
Fork 0
mirror of https://gitlab.com/niansa/SomeBot.git synced 2025-03-06 20:48:26 +01:00

Fixed compile errors

This commit is contained in:
niansa 2023-10-06 22:53:39 +02:00
parent b7ebfdb554
commit 9a6aea0d3e
6 changed files with 16 additions and 59 deletions

View file

@ -29,7 +29,7 @@ Hier ist eine Beispielkonfiguration:
"management_guild_id": "1073679409623617556",
"token": "ODAyODYzNTU0MjY4NjI2OTY1<redacted>r7zrQOCRI",
"owner_id": "609486822715818000",
"privte": false
"private": false
},
{
"id": "exxo",

View file

@ -63,24 +63,6 @@ public:
.addProperty("increment", &snowflake::get_increment)
.endClass()
.beginClass<message>("Message")
.addConstructor([guild_id = baseContext.guild_id] (void *vo) {
auto o = new (vo) message;
o->guild_id = guild_id;
return o;
})
.addConstructor([guild_id = baseContext.guild_id] (void *vo, snowflake channel_id) {
auto o = new (vo) message;
o->guild_id = guild_id;
o->channel_id = channel_id;
return o;
})
.addConstructor([guild_id = baseContext.guild_id] (void *vo, snowflake channel_id, const std::string& content) {
auto o = new (vo) message;
o->guild_id = guild_id;
o->channel_id = channel_id;
o->content = content;
return o;
})
.addProperty("id", &message::id, false)
.addProperty("channel_id", &message::channel_id, true)
.addProperty("guild_id", &message::guild_id, false)
@ -150,12 +132,6 @@ public:
.addProperty("roles", &message::allowed_ref::roles, true)
.endClass()
.beginClass<embed>("Embed")
.addConstructor(+[] (void *vo, const std::string& title, const std::string& description) {
auto o = new (vo) embed;
o->title = title;
o->description = description;
return o;
})
.addProperty("title", &embed::title, true)
.addProperty("type", &embed::type, true)
.addProperty("description", &embed::description, true)
@ -242,24 +218,6 @@ public:
.addProperty("banner_asset_id", &sticker_pack::banner_asset_id, true)
.endClass()
.beginClass<channel>("Channel")
.addConstructor([guild_id = baseContext.guild_id] (void *vo) {
auto o = new (vo) channel;
o->guild_id = guild_id;
return o;
})
.addConstructor([guild_id = baseContext.guild_id] (void *vo, const std::string& name) {
auto o = new (vo) channel;
o->guild_id = guild_id;
o->name = name;
return o;
})
.addConstructor([guild_id = baseContext.guild_id] (void *vo, snowflake parent_id, const std::string& name) {
auto o = new (vo) channel;
o->guild_id = guild_id;
o->parent_id = parent_id;
o->name = name;
return o;
})
.addProperty("id", &channel::id, false)
.addProperty("name", &channel::name, true)
.addProperty("topic", &channel::topic, true)
@ -370,16 +328,15 @@ public:
})
.endClass()
.beginClass<guild_member>("Member")
.addProperty("nickname", &guild_member::nickname, true)
.addProperty("roles", &guild_member::roles, true)
.addProperty("nickname", &guild_member::get_nickname)
.addProperty("roles", &guild_member::get_roles)
.addProperty("guild_id", &guild_member::guild_id, false)
.addProperty("user_id", &guild_member::user_id, true)
.addProperty("avatar", &guild_member::avatar, true)
.addProperty("user_id", &guild_member::user_id, false)
.addProperty("avatar", &guild_member::avatar, false)
.addProperty("avatar_url", +[] (const guild_member *o) { return o->get_avatar_url(); })
.addProperty("communication_disabled_until", &guild_member::communication_disabled_until, true)
.addProperty("joined_at", &guild_member::joined_at, true)
.addProperty("premium_since", &guild_member::premium_since, true)
.addProperty("flags", &guild_member::flags, true)
.addProperty("communication_disabled_until", &guild_member::communication_disabled_until, false)
.addProperty("joined_at", &guild_member::joined_at, false)
.addProperty("premium_since", &guild_member::premium_since, false)
.addProperty("is_communication_disabled", &guild_member::is_communication_disabled)
.addProperty("is_muted", +[] (const guild_member* o) { return o->is_muted(); }, +[] (guild_member* o, bool v) { o->set_mute(v); })
.addProperty("is_deaf", +[] (const guild_member* o) { return o->is_deaf(); }, +[] (guild_member* o, bool v) { o->set_deaf(v); })
@ -462,7 +419,6 @@ public:
.addProperty("is_verified", &guild::is_verified)
.addProperty("is_partnered", &guild::is_partnered)
.addProperty("is_community", &guild::is_community)
.addProperty("has_commerce", &guild::has_commerce)
.addProperty("has_news", &guild::has_news)
.addProperty("is_discoverable", &guild::is_discoverable)
.addProperty("is_featureable", &guild::is_featureable)
@ -478,7 +434,6 @@ public:
.addProperty("has_animated_banner_hash", &guild::has_animated_banner_hash)
.addProperty("has_monetization_enabled", &guild::has_monetization_enabled)
.addProperty("has_more_stickers", &guild::has_more_stickers)
.addProperty("has_private_threads", &guild::has_private_threads)
.addProperty("has_role_icons", &guild::has_role_icons)
.addProperty("has_seven_day_thread_archive", &guild::has_seven_day_thread_archive)
.addProperty("has_three_day_thread_archive", &guild::has_three_day_thread_archive)

View file

@ -1,7 +1,6 @@
#include "globalchat.hpp"
#include "../bot.hpp"
#include "../util.hpp"
#include "info.hpp"
#include <string_view>
#include <optional>
@ -113,7 +112,7 @@ class Globalchat {
.set_description(":speaking_head: ["+original_msg.author.format_username()+"]("+std::string(MessageInfo::message_code_idenfitication)+messageCode+" 'Inspection Data')")
.set_thumbnail(original_msg.author.get_avatar_url())
.set_color(color)
.add_field(original_msg.member.nickname.empty()?original_msg.author.username:original_msg.member.nickname, original_msg.content+"\n")
.add_field(original_msg.member.get_nickname().empty()?original_msg.author.username:original_msg.member.get_nickname(), original_msg.content+"\n")
.set_footer(dpp::embed_footer().set_text("Gesendet von: "+guild_name))
);
// Process message reference

View file

@ -30,9 +30,10 @@ class Moderation {
if (!moderation_role) {
return false;
}
return std::find_if(member.roles.begin(), member.roles.end(), [moderation_role](auto a) {
const auto& roles = member.get_roles();
return std::find_if(roles.begin(), roles.end(), [moderation_role](auto a) {
return a == moderation_role;
}) != member.roles.end();
}) != roles.end();
}
public:

View file

@ -155,10 +155,11 @@ class Ticket {
}
bool can_change_ticket(const dpp::interaction_create_t& event, dpp::snowflake management_role_id) {
const auto& roles = event.command.member.get_roles();
return event.command.get_guild().base_permissions(event.command.member).has(dpp::permissions::p_manage_channels)
|| (management_role_id && std::find_if(event.command.member.roles.begin(), event.command.member.roles.end(), [management_role_id](auto a) {
|| (management_role_id && std::find_if(roles.begin(), roles.end(), [management_role_id](auto a) {
return a == management_role_id;
}) != event.command.member.roles.end());
}) != roles.end());
}
public:

View file

@ -6,6 +6,7 @@
#include <tuple>
#include <sstream>
#include <iomanip>
#include <cstdint>
namespace dpp {