Class for performing actions pertaining to a specified guild. More...
#include <guild.hpp>
Public Member Functions | |
guild (const int32_t _shard_id, const snowflake _id, core *_bot, asio::io_context &_io) | |
Create a new guild. More... | |
guild (const guild &)=delete | |
guild (guild &&)=delete | |
guild & | operator= (const guild &)=delete |
permission | perms () |
Get bot's current permissions for this guild. More... | |
user * | self () const |
Get pointer to own member object. More... | |
std::string | get_name () const noexcept |
Get name of guild. More... | |
std::string | get_icon () const noexcept |
Get icon of guild. More... | |
std::string | get_splash () const noexcept |
Get splash of guild. More... | |
std::string | get_region () const noexcept |
Get region of guild. More... | |
bool | member_has_role (snowflake member_id, snowflake role_id) const noexcept |
Check if member has role. More... | |
int32_t | get_member_count () const noexcept |
Get count of members in guild (potentially inaccurate) More... | |
permission | get_permissions (snowflake member_id, snowflake channel_id) const |
Get guild permissions for member in channel. More... | |
permission | get_permissions (const user *_member, const channel *_channel) const |
Get guild permissions for member in channel. More... | |
int64_t | base_permissions () const |
Get base guild permissions for member. More... | |
int64_t | base_permissions (const user *_member) const noexcept |
Get base guild permissions for self. More... | |
int64_t | base_permissions (const user &_member) const noexcept |
Get base guild permissions for member. More... | |
int64_t | compute_overwrites (const int64_t _base_permissions, const user &_member, const channel &_channel) const noexcept |
Calculate permission overrides for member in channel. More... | |
const gateway::objects::role | get_role (const int64_t r) const |
Get role. More... | |
const snowflake | get_owner () const noexcept |
Get owner of guild. More... | |
snowflake | get_id () const noexcept |
Get the snowflake of this guild. More... | |
channel * | get_channel (snowflake id) const noexcept |
Get channel internally. More... | |
aegis::future < gateway::objects::guild > | get_guild () |
Get guild information. More... | |
aegis::future < gateway::objects::guild > | modify_guild (lib::optional< std::string > name={}, lib::optional< std::string > voice_region={}, lib::optional< int > verification_level={}, lib::optional< int > default_message_notifications={}, lib::optional< int > explicit_content_filter={}, lib::optional< snowflake > afk_channel_id={}, lib::optional< int > afk_timeout={}, lib::optional< std::string > icon={}, lib::optional< snowflake > owner_id={}, lib::optional< std::string > splash={}) |
Modify guild information. More... | |
aegis::future < gateway::objects::guild > | modify_guild (modify_guild_t obj) |
Modify guild information. More... | |
aegis::future< rest::rest_reply > | delete_guild () |
Delete a guild. More... | |
aegis::future < gateway::objects::channel > | create_text_channel (const std::string &name, int64_t parent_id=0, bool nsfw=false, const std::vector< gateway::objects::permission_overwrite > &permission_overwrites={}) |
Create a text channel. More... | |
aegis::future < gateway::objects::channel > | create_text_channel (create_text_channel_t obj) |
Create a text channel. More... | |
aegis::future < gateway::objects::channel > | create_voice_channel (const std::string &name, int32_t bitrate=0, int32_t user_limit=0, int64_t parent_id=0, const std::vector< gateway::objects::permission_overwrite > &permission_overwrites={}) |
Create a voice channel. More... | |
aegis::future < gateway::objects::channel > | create_voice_channel (create_voice_channel_t obj) |
Create a voice channel. More... | |
aegis::future < gateway::objects::channel > | create_category_channel (const std::string &name, int64_t parent_id, const std::vector< gateway::objects::permission_overwrite > &permission_overwrites) |
Create a category. More... | |
aegis::future < gateway::objects::channel > | create_category_channel (create_category_channel_t obj) |
Create a category. More... | |
aegis::future< rest::rest_reply > | modify_channel_positions () |
Modify positions of channels. More... | |
aegis::future < gateway::objects::member > | modify_guild_member (snowflake user_id, lib::optional< std::string > nick, lib::optional< bool > mute, lib::optional< bool > deaf, lib::optional< std::vector< snowflake >> roles, lib::optional< snowflake > channel_id) |
aegis::future < gateway::objects::member > | modify_guild_member (modify_guild_member_t obj) |
aegis::future< rest::rest_reply > | modify_my_nick (const std::string &newname) |
Modify own nickname. More... | |
aegis::future < gateway::objects::role > | add_guild_member_role (snowflake user_id, snowflake role_id) |
Add a role to guild member. More... | |
aegis::future< rest::rest_reply > | remove_guild_member_role (snowflake user_id, snowflake role_id) |
Remove a role from guild member. More... | |
aegis::future< rest::rest_reply > | remove_guild_member (snowflake user_id) |
Remove guild member (kick) More... | |
aegis::future< rest::rest_reply > | create_guild_ban (snowflake user_id, int8_t delete_message_days=0, const std::string &reason="") |
Create a new guild ban. More... | |
aegis::future< rest::rest_reply > | create_guild_ban (create_guild_ban_t obj) |
Create a new guild ban. More... | |
aegis::future< rest::rest_reply > | remove_guild_ban (snowflake user_id) |
Remove a guild ban. More... | |
aegis::future < gateway::objects::role > | create_guild_role (const std::string &name, permission _perms, int32_t color, bool hoist, bool mentionable) |
Create a guild role. More... | |
aegis::future < gateway::objects::role > | create_guild_role (create_guild_role_t obj) |
Create a guild role. More... | |
aegis::future< rest::rest_reply > | modify_guild_role_positions (snowflake role_id, int16_t position) |
Modify the guild role positions. More... | |
aegis::future < gateway::objects::role > | modify_guild_role (snowflake role_id, const std::string &name, permission _perms, int32_t color, bool hoist, bool mentionable) |
Modify a guild role. More... | |
aegis::future < gateway::objects::role > | modify_guild_role (modify_guild_role_t obj) |
Modify a guild role. More... | |
aegis::future< rest::rest_reply > | delete_guild_role (snowflake role_id) |
Delete a guild role. More... | |
aegis::future< rest::rest_reply > | get_guild_prune_count (int16_t days) |
Get a count of members that would be pruned. More... | |
aegis::future< rest::rest_reply > | begin_guild_prune (int16_t days) |
Perform a guild prune. More... | |
aegis::future< rest::rest_reply > | get_guild_invites () |
Get active guild invites. More... | |
aegis::future< rest::rest_reply > | get_guild_integrations () |
Get guild integrations. More... | |
aegis::future< rest::rest_reply > | create_guild_integration () |
Create a new guild integration. More... | |
aegis::future< rest::rest_reply > | modify_guild_integration () |
Modify a guild integration. More... | |
aegis::future< rest::rest_reply > | delete_guild_integration () |
Delete a guild integration. More... | |
aegis::future< rest::rest_reply > | sync_guild_integration () |
Get the guild integrations. More... | |
aegis::future< rest::rest_reply > | get_guild_embed () |
Get the guild embed settings. More... | |
aegis::future< rest::rest_reply > | modify_guild_embed () |
Modify the guild embed settings. More... | |
aegis::future< rest::rest_reply > | leave () |
Leave the guild this object is associated with. More... | |
core & | get_bot () const noexcept |
Gets the Bot object. More... | |
user * | find_member (snowflake member_id) const noexcept |
Obtain a pointer to a member by snowflake. More... | |
channel * | find_channel (snowflake channel_id) const noexcept |
Obtain a pointer to a channel by snowflake. More... | |
channel * | find_channel (std::string channel_name) const noexcept |
Obtain a pointer to a channel by name. More... | |
lib::optional < gateway::objects::role > | find_role (snowflake role_id) const noexcept |
Obtain a role by snowflake. More... | |
lib::optional < gateway::objects::role > | find_role (std::string role_name) const noexcept |
Obtain a role by name. More... | |
std::unordered_map< snowflake, channel * > | get_channels () const noexcept |
Obtain map of channels. More... | |
std::unordered_map< snowflake, user * > | get_members () const noexcept |
Obtain map of members. More... | |
std::unordered_map< snowflake, gateway::objects::role > | get_roles () const noexcept |
Obtain map of roles. More... | |
std::unordered_map< snowflake, gateway::objects::voice_state > | get_voicestates () const noexcept |
Obtain map of voice states. More... | |
const std::unordered_map < snowflake, user * > & | get_members_nocopy () const noexcept |
Obtain map of members - caller must lock guild._m to ensure no race conditions. More... | |
const std::unordered_map < snowflake, gateway::objects::role > & | get_roles_nocopy () const noexcept |
Obtain map of roles - caller must lock guild._m to ensure no race conditions. More... | |
const std::unordered_map < snowflake, channel * > & | get_channels_nocopy () const noexcept |
Obtain map of channels - caller must lock guild._m to ensure no race conditions. More... | |
shared_mutex & | mtx () |
Public Attributes | |
int32_t | shard_id |
snowflake | guild_id |
Friends | |
class | core |
class | user |
Class for performing actions pertaining to a specified guild.
|
explicit |
Create a new guild.
shard_id | Shard id this guild belongs to |
state | Pointer to state struct holding bot data |
id | Snowflake of this guild |
_ratelimit | Reference to the bucket factory that handles the ratelimits for this guild |
aegis::future< gateway::objects::role > aegis::guild::add_guild_member_role | ( | snowflake | user_id, |
snowflake | role_id | ||
) |
Add a role to guild member.
user_id | The snowflake of the user to add new role |
role_id | The snowflake of the role to add to member |
int64_t aegis::guild::base_permissions | ( | ) | const |
Get base guild permissions for member.
_member | Pointer to member object |
|
noexcept |
Get base guild permissions for self.
_member | Pointer to member object |
|
noexcept |
Get base guild permissions for member.
_member | Reference to member object |
aegis::future< rest::rest_reply > aegis::guild::begin_guild_prune | ( | int16_t | days | ) |
Perform a guild prune.
days | The days of inactivity to prune the member |
|
noexcept |
Calculate permission overrides for member in channel.
_base_permissions | Base guild permissions for member in guild |
_member | Reference to member object |
_channel | Reference to channel object |
aegis::future< gateway::objects::channel > aegis::guild::create_category_channel | ( | const std::string & | name, |
int64_t | parent_id, | ||
const std::vector< gateway::objects::permission_overwrite > & | permission_overwrites | ||
) |
Create a category.
name | String of the name for the channel |
parent_id | The channel or category to place this channel below |
permission_overwrites | Array of permission overwrites to apply to the channel |
aegis::future<gateway::objects::channel> aegis::guild::create_category_channel | ( | create_category_channel_t | obj | ) |
Create a category.
obj | Struct of the contents of the request |
aegis::future< rest::rest_reply > aegis::guild::create_guild_ban | ( | snowflake | user_id, |
int8_t | delete_message_days = 0 , |
||
const std::string & | reason = "" |
||
) |
Create a new guild ban.
user_id | The snowflake of the member to ban |
delete_message_days | How many days to delete member message history (0-7) |
aegis::future<rest::rest_reply> aegis::guild::create_guild_ban | ( | create_guild_ban_t | obj | ) |
Create a new guild ban.
obj | Struct of the contents of the request |
aegis::future< rest::rest_reply > aegis::guild::create_guild_integration | ( | ) |
Create a new guild integration.
aegis::future< gateway::objects::role > aegis::guild::create_guild_role | ( | const std::string & | name, |
permission | _perms, | ||
int32_t | color, | ||
bool | hoist, | ||
bool | mentionable | ||
) |
Create a guild role.
name | The name of the role to create |
_perms | The permissions to set |
color | 32bit integer of the color |
hoist | Whether the role should be separated from other roles |
mentionable | Whether the role can be specifically mentioned |
aegis::future<gateway::objects::role> aegis::guild::create_guild_role | ( | create_guild_role_t | obj | ) |
Create a guild role.
obj | Struct of the contents of the request |
aegis::future< gateway::objects::channel > aegis::guild::create_text_channel | ( | const std::string & | name, |
int64_t | parent_id = 0 , |
||
bool | nsfw = false , |
||
const std::vector< gateway::objects::permission_overwrite > & | permission_overwrites = {} |
||
) |
Create a text channel.
name | String of the name for the channel |
parent_id | The channel or category to place this channel below |
nsfw | Whether the channel will be labeled as not safe for work |
permission_overwrites | Array of permission overwrites to apply to the channel |
aegis::future<gateway::objects::channel> aegis::guild::create_text_channel | ( | create_text_channel_t | obj | ) |
Create a text channel.
obj | Struct of the contents of the request |
aegis::future< gateway::objects::channel > aegis::guild::create_voice_channel | ( | const std::string & | name, |
int32_t | bitrate = 0 , |
||
int32_t | user_limit = 0 , |
||
int64_t | parent_id = 0 , |
||
const std::vector< gateway::objects::permission_overwrite > & | permission_overwrites = {} |
||
) |
Create a voice channel.
name | String of the name for the channel |
bitrate | The bitrate count of the channel |
user_limit | The max amount of members that may join the channel |
parent_id | The channel or category to place this channel below |
nsfw | Whether the channel will be labeled as not safe for work |
permission_overwrites | Array of permission overwrites to apply to the channel |
aegis::future<gateway::objects::channel> aegis::guild::create_voice_channel | ( | create_voice_channel_t | obj | ) |
Create a voice channel.
obj | Struct of the contents of the request |
aegis::future< rest::rest_reply > aegis::guild::delete_guild | ( | ) |
Delete a guild.
aegis::future< rest::rest_reply > aegis::guild::delete_guild_integration | ( | ) |
Delete a guild integration.
aegis::future< rest::rest_reply > aegis::guild::delete_guild_role | ( | snowflake | role_id | ) |
Delete a guild role.
role_id | The snowflake of the role to delete |
Obtain a pointer to a channel by snowflake.
channel_id | Snowflake of channel to search for |
|
noexcept |
Obtain a pointer to a channel by name.
channel_name | String of channel to search for |
Obtain a pointer to a member by snowflake.
member_id | Snowflake of member to search for |
|
noexcept |
Obtain a role by snowflake.
role_name | String of role to search for |
|
noexcept |
Obtain a role by name.
role_name | String of role to search for |
|
noexcept |
Gets the Bot object.
aegis::exception | Thrown on failure. |
Get channel internally.
id | Snowflake of channel |
Obtain map of channels.
Obtain map of channels - caller must lock guild._m to ensure no race conditions.
aegis::future< gateway::objects::guild > aegis::guild::get_guild | ( | ) |
Get guild information.
aegis::future< rest::rest_reply > aegis::guild::get_guild_embed | ( | ) |
Get the guild embed settings.
aegis::future< rest::rest_reply > aegis::guild::get_guild_integrations | ( | ) |
Get guild integrations.
aegis::future< rest::rest_reply > aegis::guild::get_guild_invites | ( | ) |
Get active guild invites.
aegis::future< rest::rest_reply > aegis::guild::get_guild_prune_count | ( | int16_t | days | ) |
Get a count of members that would be pruned.
days | The days of inactivity to prune the member |
|
noexcept |
Get icon of guild.
|
noexcept |
Get the snowflake of this guild.
|
noexcept |
Get count of members in guild (potentially inaccurate)
Obtain map of members.
Obtain map of members - caller must lock guild._m to ensure no race conditions.
|
noexcept |
Get name of guild.
|
noexcept |
Get owner of guild.
permission aegis::guild::get_permissions | ( | snowflake | member_id, |
snowflake | channel_id | ||
) | const |
Get guild permissions for member in channel.
member_id | Snowflake of member |
channel_id | Snowflake of channel |
permission aegis::guild::get_permissions | ( | const user * | _member, |
const channel * | _channel | ||
) | const |
Get guild permissions for member in channel.
_member | Pointer to member object |
_channel | Pointer to channel object |
|
noexcept |
Get region of guild.
const gateway::objects::role aegis::guild::get_role | ( | const int64_t | r | ) | const |
Get role.
r | Snowflake of role |
|
noexcept |
Obtain map of roles.
|
noexcept |
Obtain map of roles - caller must lock guild._m to ensure no race conditions.
|
noexcept |
Get splash of guild.
|
noexcept |
Obtain map of voice states.
aegis::future< rest::rest_reply > aegis::guild::leave | ( | ) |
Leave the guild this object is associated with.
Check if member has role.
member_id | Snowflake of member |
role_id | Snowflake of role |
aegis::future< rest::rest_reply > aegis::guild::modify_channel_positions | ( | ) |
Modify positions of channels.
aegis::future< gateway::objects::guild > aegis::guild::modify_guild | ( | lib::optional< std::string > | name = {} , |
lib::optional< std::string > | voice_region = {} , |
||
lib::optional< int > | verification_level = {} , |
||
lib::optional< int > | default_message_notifications = {} , |
||
lib::optional< int > | explicit_content_filter = {} , |
||
lib::optional< snowflake > | afk_channel_id = {} , |
||
lib::optional< int > | afk_timeout = {} , |
||
lib::optional< std::string > | icon = {} , |
||
lib::optional< snowflake > | owner_id = {} , |
||
lib::optional< std::string > | splash = {} |
||
) |
Modify guild information.
name | Set name of guild |
voice_region | Set region for voice |
verification_level | Set verification level from unrestricted level to verified phone level (NONE=0, LOW(verified email)=1, MEDIUM(registered >5m)=2, HIGH(member of server >10m)=3 VERY_HIGH(verified phone)=4 |
default_message_notifications | Set default notification level for new members |
explicit_content_filter | Set filter level for new content (DISABLED=0, MEMBERS_WITHOUT_ROLES=1, ALL_MEMBERS=2) |
afk_channel_id | Set channel for idle voice connections to be moved to |
afk_timeout | Set time where voice connections are considered to be idle |
icon | Set icon |
owner_id | Transfer owner to someone else |
splash |
aegis::future<gateway::objects::guild> aegis::guild::modify_guild | ( | modify_guild_t | obj | ) |
Modify guild information.
obj | Struct of the contents of the request |
aegis::future< rest::rest_reply > aegis::guild::modify_guild_embed | ( | ) |
Modify the guild embed settings.
aegis::future< rest::rest_reply > aegis::guild::modify_guild_integration | ( | ) |
Modify a guild integration.
aegis::future< gateway::objects::member > aegis::guild::modify_guild_member | ( | snowflake | user_id, |
lib::optional< std::string > | nick, | ||
lib::optional< bool > | mute, | ||
lib::optional< bool > | deaf, | ||
lib::optional< std::vector< snowflake >> | roles, | ||
lib::optional< snowflake > | channel_id | ||
) |
Modify a member All fields are optional
user_id | The snowflake of the user to edit |
nick | String of nickname to change to |
mute | Whether or not to voice mute the member |
deaf | Whether or not to voice deafen the member |
roles | Array of roles to apply to the member |
channel_id | Snowflake of the channel to move user to |
aegis::future<gateway::objects::member> aegis::guild::modify_guild_member | ( | modify_guild_member_t | obj | ) |
Modify a member All fields are optional
obj | Struct of the contents of the request |
aegis::future< gateway::objects::role > aegis::guild::modify_guild_role | ( | snowflake | role_id, |
const std::string & | name, | ||
permission | _perms, | ||
int32_t | color, | ||
bool | hoist, | ||
bool | mentionable | ||
) |
Modify a guild role.
id | The snowflake of the role to modify |
name | The name to set the role to |
_perms | The permissions to set |
color | 32bit integer of the color |
hoist | Whether the role should be separated from other roles |
mentionable | Whether the role can be specifically mentioned |
aegis::future<gateway::objects::role> aegis::guild::modify_guild_role | ( | modify_guild_role_t | obj | ) |
Modify a guild role.
obj | Struct of the contents of the request |
aegis::future< rest::rest_reply > aegis::guild::modify_guild_role_positions | ( | snowflake | role_id, |
int16_t | position | ||
) |
Modify the guild role positions.
role_id | Snowflake of role to change position |
position | Index of position to change role to |
aegis::future< rest::rest_reply > aegis::guild::modify_my_nick | ( | const std::string & | newname | ) |
Modify own nickname.
newname | String of the new nickname to apply |
permission aegis::guild::perms | ( | ) |
Get bot's current permissions for this guild.
permission
object aegis::future< rest::rest_reply > aegis::guild::remove_guild_ban | ( | snowflake | user_id | ) |
Remove a guild ban.
user_id | The snowflake of the member to unban |
aegis::future< rest::rest_reply > aegis::guild::remove_guild_member | ( | snowflake | user_id | ) |
Remove guild member (kick)
user_id | The snowflake of the member to kick |
aegis::future< rest::rest_reply > aegis::guild::remove_guild_member_role | ( | snowflake | user_id, |
snowflake | role_id | ||
) |
Remove a role from guild member.
user_id | The snowflake of the user to remove role |
role_id | The snowflake of the role to remove from member |
user * aegis::guild::self | ( | ) | const |
Get pointer to own member object.
aegis::future< rest::rest_reply > aegis::guild::sync_guild_integration | ( | ) |
Get the guild integrations.