Class: Discorb::Guild
- Inherits:
-
DiscordModel
- Object
- DiscordModel
- Discorb::Guild
- Includes:
- ChannelContainer
- Defined in:
- lib/discorb/guild.rb
Overview
Represents a guild in the Discord.
Defined Under Namespace
Classes: Ban, VanityInvite, Widget
Instance Attribute Summary collapse
- #afk_channel -> Discorb::VoiceChannel? readonly
-
#afk_timeout -> Integer
readonly
The AFK timeout of the guild.
-
#approximate_member_count -> Integer
readonly
The approxmate amount of members in the guild.
-
#approximate_presence_count -> Integer
readonly
The approxmate amount of non-offline members in the guild.
-
#available -> Boolean
(also: #available?)
readonly
Whether the guild is available.
- #banner -> Discorb::Asset? readonly
-
#channels -> Discorb::Dictionary{Discorb::Snowflake => Discorb::GuildChannel}
readonly
A dictionary of channels in the guild.
-
#default_message_notifications -> :all_messages, :only_mentions
readonly
The default message notification level of the guild.
-
#description -> String
readonly
The description of the guild.
-
#discovery_splash -> Discorb::Asset
readonly
The discovery splash of the guild.
-
#emojis -> Discorb::Dictionary{Discorb::Snowflake => Discorb::CustomEmoji}
readonly
A dictionary of custom emojis in the guild.
-
#explicit_content_filter -> :disabled_in_text, ...
readonly
The explict content filter level of the guild.
-
#features -> Array<Symbol>
readonly
Features that are enabled in the guild.
-
#icon -> Discorb::Asset
readonly
The icon of the guild.
-
#id -> Discorb::Snowflake
readonly
ID of the guild.
-
#joined_at -> Time
readonly
Time that representing when bot has joined the guild.
-
#large -> Boolean
(also: #large?)
readonly
Whether the guild is large.
-
#max_presences -> Integer
readonly
Number of online members in the guild.
-
#max_video_channel_users -> Integer
readonly
The maximum amount of users in a video channel.
-
#me -> Discorb::Member
readonly
The client's member in the guild.
-
#member_count -> Integer
readonly
The amount of members in the guild.
-
#members -> Discorb::Dictionary{Discorb::Snowflake => Discorb::Member}
readonly
A dictionary of members in the guild.
-
#mfa_level -> :none, :elevated
readonly
The MFA level of the guild.
-
#name -> String
readonly
The name of the guild.
-
#nsfw_level -> :default, ...
readonly
The nsfw level of the guild.
-
#owner -> Boolean
(also: #owner?)
readonly
Whether the client is the owner of the guild.
-
#owner_id -> Discorb::Snowflake
readonly
ID of the guild owner.
-
#permissions -> Discorb::Permission
readonly
The bot's permission in the guild.
-
#preferred_locale -> Symbol
readonly
The preffered language of the guild.
-
#premium_subscription_count -> Integer
readonly
The amount of premium subscriptions (Server Boosts) the guild has.
-
#premium_tier -> Integer
readonly
The premium tier (Boost Level) of the guild.
-
#presences -> Discorb::Dictionary{Discorb::User => Discorb::Presence}
readonly
A dictionary of presence in the guild.
- #public_updates_channel -> Discorb::TextChannel? readonly
-
#roles -> Discorb::Dictionary{Discorb::Snowflake => Discorb::Role}
readonly
A dictionary of roles in the guild.
- #rules_channel -> Discorb::TextChannel? readonly
-
#scheduled_events -> Dictionary{Discorb::Snowflake => Discorb::ScheduledEvent}
(also: #events)
readonly
A dictionary of scheduled events in the guild.
-
#splash -> Discorb::Asset
readonly
The splash of the guild.
-
#stage_instances -> Discorb::Dictionary{Discorb::Snowflake => Discorb::StageInstance}
readonly
A dictionary of stage instances in the guild.
- #system_channel -> Discorb::TextChannel? readonly
-
#system_channel_flags -> Discorb::SystemChannelFlag
readonly
The flag for the system channel.
-
#threads -> Discorb::Dictionary{Discorb::Snowflake => Discorb::ThreadChannel}
readonly
A dictionary of threads in the guild.
-
#unavailable -> Boolean
readonly
Whether the guild is unavailable.
- #vanity_url_code -> String? readonly
-
#verification_level -> :none, ...
readonly
The verification level of the guild.
-
#voice_states -> Discorb::Dictionary{Discorb::User => Discorb::VoiceState}
readonly
A dictionary of voice states in the guild.
-
#welcome_screen -> Discorb::WelcomeScreen
readonly
The welcome screen of the guild.
-
#widget_enabled -> Boolean
(also: #widget_enabled?)
readonly
Whether the guild enabled the widget.
Class Method Summary collapse
-
.banner(guild_id, style: :banner) -> String
Returns a banner url from the guild's ID.
Instance Method Summary collapse
-
#ban_member(member, delete_message_days: 0, reason: nil) -> Async::Task<Discorb::Guild::Ban>
Ban a member from the guild.
-
#banned?(user) -> Async::Task<Boolean>
Checks the user was banned from the guild.
-
#create_automod_rule(name, trigger_type, actions, event_type = :message_send, enabled: false, exempt_roles: [], exempt_channels: [], keyword_filter: nil, presets: nil, reason: nil) -> Async::Task<Discorb::AutoModRule>
Create a new automod rule in the guild.
-
#create_category_channel(name, position: nil, permission_overwrites: nil, parent: nil, reason: nil) -> Async::Task<Discorb::CategoryChannel>
(also: #create_category)
Create a new category channel.
-
#create_emoji(name, image, roles: []) -> Async::Task<Discorb::CustomEmoji>
Create a custom emoji.
-
#create_news_channel(name, topic: nil, rate_limit_per_user: nil, slowmode: nil, position: nil, nsfw: nil, permission_overwrites: nil, parent: nil, reason: nil) -> Async::Task<Discorb::NewsChannel>
Create a new news channel.
-
#create_role(name = nil, color: nil, hoist: nil, mentionable: nil, reason: nil) -> Async::Task<Discorb::Role>
Create a role in the guild.
-
#create_scheduled_event(type, name, description, start_time, end_time = nil, privacy_level: :guild_only, location: nil, channel: nil) -> Async::Task<Discorb::ScheduledEvent>
Create a scheduled event for the guild.
-
#create_stage_channel(name, bitrate: 64, position: nil, permission_overwrites: nil, parent: nil, reason: nil) -> Async::Task<Discorb::StageChannel>
Create a new stage channel.
-
#create_template(name, description = nil, reason: nil) -> Async::Task<Discorb::GuildTemplate>
Create a new template in the guild.
-
#create_text_channel(name, topic: nil, rate_limit_per_user: nil, slowmode: nil, position: nil, nsfw: nil, permission_overwrites: nil, parent: nil, reason: nil) -> Async::Task<Discorb::TextChannel>
Create a new text channel.
-
#create_voice_channel(name, bitrate: 64, user_limit: nil, position: nil, permission_overwrites: nil, parent: nil, reason: nil) -> Async::Task<Discorb::VoiceChannel>
Create a new voice channel.
-
#edit_nickname(nickname, reason: nil) -> Async::Task<void>
(also: #edit_nick, #modify_nickname)
Change nickname of client member.
-
#fetch_active_threads -> Async::Task<Array<Discorb::ThreadChannel>>
Fetch a list of active threads in the guild.
-
#fetch_audit_log -> Async::Task<Discorb::AuditLog>
Fetch audit log of the guild.
-
#fetch_automod_rule(id) -> Async::Task<Array<Discord::AutoModRule>>
Fetch the automod rule by ID.
-
#fetch_automod_rules -> Async::Task<Array<Discorb::AutoModRule>>
(also: #fetch_automod_rule_list)
Fetch the automod rules in the guild.
-
#fetch_ban(user) -> Async::Task<Discorb::Guild::Ban>, Async::Task<nil>
Fetch a ban in the guild.
-
#fetch_bans(limit = 50, before: nil, after: nil, around: nil) -> Async::Task<Array<Discorb::Guild::Ban>>
Fetch a list of bans in the guild.
-
#fetch_channels -> Async::Task<Array<Discorb::Channel>>
Fetch channels of the guild.
-
#fetch_emoji(id) -> Async::Task<Discorb::CustomEmoji>
Fetch emoji id of the guild.
-
#fetch_emoji_list -> Async::Task<Discorb::Dictionary{Discorb::Snowflake => Discorb::CustomEmoji}>
(also: #fetch_emojis)
Fetch emoji list of the guild.
-
#fetch_integrations -> Async::Task<Array<Discorb::Integration>>
Fetch integrations in the guild.
-
#fetch_invites -> Async::Task<Array<Invite>>
Fetch invites in the guild.
-
#fetch_member(id) -> Async::Task<Discorb::Member>, Async::Task<nil>
Fetch a member in the guild.
-
#fetch_member_named -> Async::Task<Discorb::Member>, Async::Task<nil>
Almost the same as #fetch_members_named, but returns a single member.
-
#fetch_members(limit: 0, after: nil) -> Async::Task<Array<Discorb::Member>>
(also: #fetch_member_list)
Fetch members in the guild.
-
#fetch_members_named(name, limit: 1) -> Async::Task<Array<Discorb::Member>>
Search for members by name in the guild.
-
#fetch_prune(days = 7, roles: []) -> Async::Task<Integer>
Fetch how many members will be pruned.
-
#fetch_roles -> Async::Task<Array<Discorb::Role>>
Fetch a list of roles in the guild.
-
#fetch_scheduled_event(id) -> Async::Task<Discorb::ScheduledEvent>, Async::Task<nil>
Fetch the scheduled event by ID.
-
#fetch_scheduled_events(with_user_count: true) -> Array<Discorb::ScheduledEvent>
Fetch scheduled events for the guild.
-
#fetch_sticker(id) -> Async::Task<Discorb::Sticker::GuildSticker>, Async::Task<nil>
Fetch the sticker by ID.
-
#fetch_stickers -> Async::Task<Array<Discorb::Sticker::GuildSticker>>
Fetch stickers in the guild.
-
#fetch_template -> Discorb::GuildTemplate, Async::Task<nil>
Almost the same as #fetch_templates, but returns a single template.
-
#fetch_templates -> Async::Task<Discorb::GuildTemplate>
Fetch templates in the guild.
-
#fetch_vanity_invite -> Async::Task<Discorb::Guild::VanityInvite>
Fetch the vanity URL of the guild.
-
#fetch_voice_regions -> Async::Task<Array<Discorb::VoiceRegion>>
Fetch voice regions that are available in the guild.
-
#fetch_webhooks -> Async::Task<Array<Discorb::Webhook>>
Fetch webhooks of the guild.
-
#fetch_welcome_screen -> Async::Task<Discorb::WelcomeScreen>
Fetch the welcome screen of the guild.
-
#fetch_widget -> Async::Task<Discorb::Guild::Widget>
Fetch the widget of the guild.
- #inspect -> Object
-
#kick_member(member, reason: nil) -> Async::Task<void>
Kick a member from the guild.
-
#leave -> Async::Task<void>
Leave the guild.
-
#prune(days = 7, roles: [], reason: nil) -> Async::Task<Integer>
Prune members from the guild.
-
#unban_user(user, reason: nil) -> Async::Task<void>
Unban a user from the guild.
Methods included from ChannelContainer
#news_channels, #stage_channels, #text_channels, #voice_channels
Methods inherited from DiscordModel
Instance Attribute Details
#afk_channel -> Discorb::VoiceChannel? (readonly)
This method returns an object from client cache. it will return nil
if the object is not in cache.
|
# File 'lib/discorb/guild.rb', line 107
|
#afk_timeout -> Integer (readonly)
Returns The AFK timeout of the guild.
21 22 23 |
# File 'lib/discorb/guild.rb', line 21 def afk_timeout @afk_timeout end |
#approximate_member_count -> Integer (readonly)
Returns The approxmate amount of members in the guild.
73 74 75 |
# File 'lib/discorb/guild.rb', line 73 def approximate_member_count @approximate_member_count end |
#approximate_presence_count -> Integer (readonly)
Returns The approxmate amount of non-offline members in the guild.
75 76 77 |
# File 'lib/discorb/guild.rb', line 75 def approximate_presence_count @approximate_presence_count end |
#available -> Boolean (readonly) Also known as: available?
Returns Whether the guild is available.
99 100 101 |
# File 'lib/discorb/guild.rb', line 99 def available @available end |
#banner -> Discorb::Asset? (readonly)
62 63 64 |
# File 'lib/discorb/guild.rb', line 62 def @banner end |
#channels -> Discorb::Dictionary{Discorb::Snowflake => Discorb::GuildChannel} (readonly)
Returns A dictionary of channels in the guild.
48 49 50 |
# File 'lib/discorb/guild.rb', line 48 def channels @channels end |
#default_message_notifications -> :all_messages, :only_mentions (readonly)
Returns The default message notification level of the guild.
86 87 88 |
# File 'lib/discorb/guild.rb', line 86 def @default_message_notifications end |
#description -> String (readonly)
Returns The description of the guild.
59 60 61 |
# File 'lib/discorb/guild.rb', line 59 def description @description end |
#discovery_splash -> Discorb::Asset (readonly)
Returns The discovery splash of the guild.
15 16 17 |
# File 'lib/discorb/guild.rb', line 15 def discovery_splash @discovery_splash end |
#emojis -> Discorb::Dictionary{Discorb::Snowflake => Discorb::CustomEmoji} (readonly)
Returns A dictionary of custom emojis in the guild.
26 27 28 |
# File 'lib/discorb/guild.rb', line 26 def emojis @emojis end |
#explicit_content_filter -> :disabled_in_text, ... (readonly)
Returns The explict content filter level of the guild.
88 89 90 |
# File 'lib/discorb/guild.rb', line 88 def explicit_content_filter @explicit_content_filter end |
#features -> Array<Symbol> (readonly)
Returns features that are enabled in the guild.
29 30 31 |
# File 'lib/discorb/guild.rb', line 29 def features @features end |
#icon -> Discorb::Asset (readonly)
Returns The icon of the guild.
41 42 43 |
# File 'lib/discorb/guild.rb', line 41 def icon @icon end |
#id -> Discorb::Snowflake (readonly)
Returns ID of the guild.
9 10 11 |
# File 'lib/discorb/guild.rb', line 9 def id @id end |
#joined_at -> Time (readonly)
Returns Time that representing when bot has joined the guild.
35 36 37 |
# File 'lib/discorb/guild.rb', line 35 def joined_at @joined_at end |
#large -> Boolean (readonly) Also known as: large?
Returns Whether the guild is large.
93 94 95 |
# File 'lib/discorb/guild.rb', line 93 def large @large end |
#max_presences -> Integer (readonly)
Returns Number of online members in the guild.
54 55 56 |
# File 'lib/discorb/guild.rb', line 54 def max_presences @max_presences end |
#max_video_channel_users -> Integer (readonly)
Returns The maximum amount of users in a video channel.
71 72 73 |
# File 'lib/discorb/guild.rb', line 71 def max_video_channel_users @max_video_channel_users end |
#me -> Discorb::Member (readonly)
Returns The client's member in the guild.
|
# File 'lib/discorb/guild.rb', line 107
|
#member_count -> Integer (readonly)
Returns The amount of members in the guild.
39 40 41 |
# File 'lib/discorb/guild.rb', line 39 def member_count @member_count end |
#members -> Discorb::Dictionary{Discorb::Snowflake => Discorb::Member} (readonly)
You must enable GUILD_MEMBERS
intent to use this method.
Returns A dictionary of members in the guild.
46 47 48 |
# File 'lib/discorb/guild.rb', line 46 def members @members end |
#mfa_level -> :none, :elevated (readonly)
Returns The MFA level of the guild.
31 32 33 |
# File 'lib/discorb/guild.rb', line 31 def mfa_level @mfa_level end |
#name -> String (readonly)
Returns The name of the guild.
11 12 13 |
# File 'lib/discorb/guild.rb', line 11 def name @name end |
#nsfw_level -> :default, ... (readonly)
Returns The nsfw level of the guild.
79 80 81 |
# File 'lib/discorb/guild.rb', line 79 def nsfw_level @nsfw_level end |
#owner -> Boolean (readonly) Also known as: owner?
Returns Whether the client is the owner of the guild.
90 91 92 |
# File 'lib/discorb/guild.rb', line 90 def owner @owner end |
#owner_id -> Discorb::Snowflake (readonly)
Returns ID of the guild owner.
17 18 19 |
# File 'lib/discorb/guild.rb', line 17 def owner_id @owner_id end |
#permissions -> Discorb::Permission (readonly)
Returns The bot's permission in the guild.
19 20 21 |
# File 'lib/discorb/guild.rb', line 19 def @permissions end |
#preferred_locale -> Symbol (readonly)
This modifies the language code, -
will be replaced with _
.
Returns The preffered language of the guild.
69 70 71 |
# File 'lib/discorb/guild.rb', line 69 def preferred_locale @preferred_locale end |
#premium_subscription_count -> Integer (readonly)
Returns The amount of premium subscriptions (Server Boosts) the guild has.
66 67 68 |
# File 'lib/discorb/guild.rb', line 66 def premium_subscription_count @premium_subscription_count end |
#premium_tier -> Integer (readonly)
Returns The premium tier (Boost Level) of the guild.
64 65 66 |
# File 'lib/discorb/guild.rb', line 64 def premium_tier @premium_tier end |
#presences -> Discorb::Dictionary{Discorb::User => Discorb::Presence} (readonly)
Returns A dictionary of presence in the guild.
52 53 54 |
# File 'lib/discorb/guild.rb', line 52 def presences @presences end |
#public_updates_channel -> Discorb::TextChannel? (readonly)
This method returns an object from client cache. it will return nil
if the object is not in cache.
|
# File 'lib/discorb/guild.rb', line 107
|
#roles -> Discorb::Dictionary{Discorb::Snowflake => Discorb::Role} (readonly)
Returns A dictionary of roles in the guild.
23 24 25 |
# File 'lib/discorb/guild.rb', line 23 def roles @roles end |
#rules_channel -> Discorb::TextChannel? (readonly)
This method returns an object from client cache. it will return nil
if the object is not in cache.
|
# File 'lib/discorb/guild.rb', line 107
|
#scheduled_events -> Dictionary{Discorb::Snowflake => Discorb::ScheduledEvent} (readonly) Also known as: events
Returns A dictionary of scheduled events in the guild.
102 103 104 |
# File 'lib/discorb/guild.rb', line 102 def scheduled_events @scheduled_events end |
#splash -> Discorb::Asset (readonly)
Returns The splash of the guild.
13 14 15 |
# File 'lib/discorb/guild.rb', line 13 def splash @splash end |
#stage_instances -> Discorb::Dictionary{Discorb::Snowflake => Discorb::StageInstance} (readonly)
Returns A dictionary of stage instances in the guild.
82 83 84 |
# File 'lib/discorb/guild.rb', line 82 def stage_instances @stage_instances end |
#system_channel -> Discorb::TextChannel? (readonly)
This method returns an object from client cache. it will return nil
if the object is not in cache.
|
# File 'lib/discorb/guild.rb', line 107
|
#system_channel_flags -> Discorb::SystemChannelFlag (readonly)
Returns The flag for the system channel.
33 34 35 |
# File 'lib/discorb/guild.rb', line 33 def system_channel_flags @system_channel_flags end |
#threads -> Discorb::Dictionary{Discorb::Snowflake => Discorb::ThreadChannel} (readonly)
Returns A dictionary of threads in the guild.
50 51 52 |
# File 'lib/discorb/guild.rb', line 50 def threads @threads end |
#unavailable -> Boolean (readonly)
Returns Whether the guild is unavailable.
37 38 39 |
# File 'lib/discorb/guild.rb', line 37 def unavailable @unavailable end |
#vanity_url_code -> String? (readonly)
57 58 59 |
# File 'lib/discorb/guild.rb', line 57 def vanity_url_code @vanity_url_code end |
#verification_level -> :none, ... (readonly)
Returns The verification level of the guild.
84 85 86 |
# File 'lib/discorb/guild.rb', line 84 def verification_level @verification_level end |
#voice_states -> Discorb::Dictionary{Discorb::User => Discorb::VoiceState} (readonly)
Returns A dictionary of voice states in the guild.
43 44 45 |
# File 'lib/discorb/guild.rb', line 43 def voice_states @voice_states end |
#welcome_screen -> Discorb::WelcomeScreen (readonly)
Returns The welcome screen of the guild.
77 78 79 |
# File 'lib/discorb/guild.rb', line 77 def welcome_screen @welcome_screen end |
#widget_enabled -> Boolean (readonly) Also known as: widget_enabled?
Returns Whether the guild enabled the widget.
96 97 98 |
# File 'lib/discorb/guild.rb', line 96 def @widget_enabled end |
Class Method Details
.banner(guild_id, style: :banner) -> String
Returns a banner url from the guild's ID.
1384 1385 1386 |
# File 'lib/discorb/guild.rb', line 1384 def (guild_id, style: :banner) "#{Discorb::API_BASE_URL}/guilds/#{guild_id}/widget.png&style=#{style}" end |
Instance Method Details
#ban_member(member, delete_message_days: 0, reason: nil) -> Async::Task<Discorb::Guild::Ban>
Ban a member from the guild.
864 865 866 867 868 869 870 871 872 873 874 875 876 877 |
# File 'lib/discorb/guild.rb', line 864 def ban_member(member, delete_message_days: 0, reason: nil) Async do _resp, data = @client.http.request( Route.new("/guilds/#{@id}/bans", "//guilds/:guild_id/bans", :post), { user: member.id, delete_message_days: , }, audit_log_reason: reason, ).wait Ban.new(@client, self, data) end end |
#banned?(user) -> Async::Task<Boolean>
Checks the user was banned from the guild.
848 849 850 851 852 |
# File 'lib/discorb/guild.rb', line 848 def banned?(user) Async do !fetch_ban(user).wait.nil? end end |
#create_automod_rule(name, trigger_type, actions, event_type = :message_send, enabled: false, exempt_roles: [], exempt_channels: [], keyword_filter: nil, presets: nil, reason: nil) -> Async::Task<Discorb::AutoModRule>
Create a new automod rule in the guild.
1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 |
# File 'lib/discorb/guild.rb', line 1187 def create_automod_rule( name, trigger_type, actions, event_type = :message_send, enabled: false, exempt_roles: [], exempt_channels: [], keyword_filter: nil, presets: nil, reason: nil ) Async do payload = { name: name, event_type: Discorb::AutoModRule::EVENT_TYPES.key(event_type), trigger_type: Discorb::AutoModRule::TRIGGER_TYPES.key(trigger_type), metadata: { keyword_filter: keyword_filter, presets: presets && Discorb::AutoModRule::PRESET_TYPES.key(presets), }, actions: actions.map(&:to_hash), enabled: enabled, exempt_roles: exempt_roles.map(&:id), exempt_channels: exempt_channels.map(&:id), } _resp, data = @client.http.request( Route.new( "/guilds/#{@id}/auto-moderation/rules", "//guilds/:guild_id/auto-moderation/rules", :post ), payload, audit_log_reason: reason ) Discorb::AutoModRule.new(@client, data) end end |
#create_category_channel(name, position: nil, permission_overwrites: nil, parent: nil, reason: nil) -> Async::Task<Discorb::CategoryChannel> Also known as: create_category
Create a new category channel.
529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 |
# File 'lib/discorb/guild.rb', line 529 def create_category_channel(name, position: nil, permission_overwrites: nil, parent: nil, reason: nil) Async do payload = { type: CategoryChannel.channel_type } payload[:name] = name payload[:position] = position if position if payload[:permission_overwrites] = .map do |target, overwrite| { type: target.is_a?(Role) ? 0 : 1, id: target.id, allow: overwrite.allow_value, deny: overwrite.deny_value, } end end payload[:parent_id] = parent&.id _resp, data = @client.http.request(Route.new("/guilds/#{@id}/channels", "//guilds/:guild_id/channels", :post), payload, audit_log_reason: reason).wait Channel.make_channel(@client, data) end end |
#create_emoji(name, image, roles: []) -> Async::Task<Discorb::CustomEmoji>
Create a custom emoji.
365 366 367 368 369 370 371 372 373 374 375 376 377 |
# File 'lib/discorb/guild.rb', line 365 def create_emoji(name, image, roles: []) Async do _resp, data = @client.http.request( Route.new("/guilds/#{@id}/emojis", "//guilds/:guild_id/emojis", :post), { name: name, image: image.to_s, roles: roles.map { |r| Discorb::Utils.try(r, :id) }, } ).wait @emojis[data[:id]] = CustomEmoji.new(@client, self, data) end end |
#create_news_channel(name, topic: nil, rate_limit_per_user: nil, slowmode: nil, position: nil, nsfw: nil, permission_overwrites: nil, parent: nil, reason: nil) -> Async::Task<Discorb::NewsChannel>
Create a new news channel.
607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 |
# File 'lib/discorb/guild.rb', line 607 def create_news_channel( name, topic: nil, rate_limit_per_user: nil, slowmode: nil, position: nil, nsfw: nil, permission_overwrites: nil, parent: nil, reason: nil ) Async do payload = { type: NewsChannel.channel_type } payload[:name] = name payload[:topic] = topic if topic rate_limit_per_user ||= slowmode payload[:rate_limit_per_user] = rate_limit_per_user if rate_limit_per_user payload[:position] = position if position if payload[:permission_overwrites] = .map do |target, overwrite| { type: target.is_a?(Role) ? 0 : 1, id: target.id, allow: overwrite.allow_value, deny: overwrite.deny_value, } end end payload[:nsfw] = nsfw unless nsfw.nil? payload[:parent_id] = parent&.id _resp, data = @client.http.request(Route.new("/guilds/#{@id}/channels", "//guilds/:guild_id/channels", :post), payload, audit_log_reason: reason).wait Channel.make_channel(@client, data) end end |
#create_role(name = nil, color: nil, hoist: nil, mentionable: nil, reason: nil) -> Async::Task<Discorb::Role>
Create a role in the guild.
920 921 922 923 924 925 926 927 928 929 930 931 |
# File 'lib/discorb/guild.rb', line 920 def create_role(name = nil, color: nil, hoist: nil, mentionable: nil, reason: nil) Async do payload = {} payload[:name] = name if name payload[:color] = color.to_i if color payload[:hoist] = hoist if hoist payload[:mentionable] = mentionable if mentionable _resp, data = @client.http.request(Route.new("/guilds/#{@id}/roles", "//guilds/:guild_id/roles", :post), payload, audit_log_reason: reason).wait Role.new(@client, self, data) end end |
#create_scheduled_event(type, name, description, start_time, end_time = nil, privacy_level: :guild_only, location: nil, channel: nil) -> Async::Task<Discorb::ScheduledEvent>
Create a scheduled event for the guild.
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
# File 'lib/discorb/guild.rb', line 248 def create_scheduled_event( type, name, description, start_time, end_time = nil, privacy_level: :guild_only, location: nil, channel: nil ) Async do payload = case type when :stage_instance raise ArgumentError, "channel must be provided for stage_instance events" unless channel { name: name, description: description, scheduled_start_time: start_time.iso8601, scheduled_end_time: end_time&.iso8601, privacy_level: Discorb::ScheduledEvent::PRIVACY_LEVEL.key(privacy_level), channel_id: channel&.id, entity_type: Discorb::ScheduledEvent::ENTITY_TYPE.key(:stage_instance), } when :voice raise ArgumentError, "channel must be provided for voice events" unless channel { name: name, description: description, scheduled_start_time: start_time.iso8601, scheduled_end_time: end_time&.iso8601, privacy_level: Discorb::ScheduledEvent::PRIVACY_LEVEL.key(privacy_level), channel_id: channel&.id, entity_type: Discorb::ScheduledEvent::ENTITY_TYPE.key(:voice), } when :external raise ArgumentError, "location must be provided for external events" unless location raise ArgumentError, "end_time must be provided for external events" unless end_time { name: name, description: description, scheduled_start_time: start_time.iso8601, scheduled_end_time: end_time.iso8601, privacy_level: Discorb::ScheduledEvent::PRIVACY_LEVEL.key(privacy_level), entity_type: Discorb::ScheduledEvent::ENTITY_TYPE.key(:external), entity_metadata: { location: location, }, } else raise ArgumentError, "Invalid scheduled event type: #{type}" end _resp, event = @client.http.request( Route.new("/guilds/#{@id}/scheduled-events", "//guilds/:guild_id/scheduled-events", :post), payload ).wait Discorb::ScheduledEvent.new(@client, event) end end |
#create_stage_channel(name, bitrate: 64, position: nil, permission_overwrites: nil, parent: nil, reason: nil) -> Async::Task<Discorb::StageChannel>
Create a new stage channel.
567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 |
# File 'lib/discorb/guild.rb', line 567 def create_stage_channel(name, bitrate: 64, position: nil, permission_overwrites: nil, parent: nil, reason: nil) Async do payload = { type: StageChannel.channel_type } payload[:name] = name payload[:bitrate] = bitrate * 1000 if bitrate payload[:position] = position if position if payload[:permission_overwrites] = .map do |target, overwrite| { type: target.is_a?(Role) ? 0 : 1, id: target.id, allow: overwrite.allow_value, deny: overwrite.deny_value, } end end payload[:parent_id] = parent&.id _resp, data = @client.http.request(Route.new("/guilds/#{@id}/channels", "//guilds/:guild_id/channels", :post), payload, audit_log_reason: reason).wait Channel.make_channel(@client, data) end end |
#create_template(name, description = nil, reason: nil) -> Async::Task<Discorb::GuildTemplate>
Create a new template in the guild.
1123 1124 1125 1126 1127 1128 1129 1130 1131 |
# File 'lib/discorb/guild.rb', line 1123 def create_template(name, description = nil, reason: nil) Async do _resp, data = @client.http.request( Route.new("/guilds/#{@id}/templates", "//guilds/:guild_id/templates", :post), { name: name, description: description }, audit_log_reason: reason, ).wait GuildTemplate.new(@client, data) end end |
#create_text_channel(name, topic: nil, rate_limit_per_user: nil, slowmode: nil, position: nil, nsfw: nil, permission_overwrites: nil, parent: nil, reason: nil) -> Async::Task<Discorb::TextChannel>
Create a new text channel.
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 |
# File 'lib/discorb/guild.rb', line 438 def create_text_channel( name, topic: nil, rate_limit_per_user: nil, slowmode: nil, position: nil, nsfw: nil, permission_overwrites: nil, parent: nil, reason: nil ) Async do payload = { type: TextChannel.channel_type } payload[:name] = name payload[:topic] = topic if topic rate_limit_per_user ||= slowmode payload[:rate_limit_per_user] = rate_limit_per_user if rate_limit_per_user payload[:nsfw] = nsfw if nsfw payload[:position] = position if position if payload[:permission_overwrites] = .map do |target, overwrite| { type: target.is_a?(Role) ? 0 : 1, id: target.id, allow: overwrite.allow_value, deny: overwrite.deny_value, } end end payload[:parent_id] = parent.id if parent _resp, data = @client.http.request(Route.new("/guilds/#{@id}/channels", "//guilds/:guild_id/channels", :post), payload, audit_log_reason: reason).wait payload[:parent_id] = parent&.id Channel.make_channel(@client, data) end end |
#create_voice_channel(name, bitrate: 64, user_limit: nil, position: nil, permission_overwrites: nil, parent: nil, reason: nil) -> Async::Task<Discorb::VoiceChannel>
Create a new voice channel.
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 |
# File 'lib/discorb/guild.rb', line 490 def create_voice_channel( name, bitrate: 64, user_limit: nil, position: nil, permission_overwrites: nil, parent: nil, reason: nil ) Async do payload = { type: VoiceChannel.channel_type } payload[:name] = name payload[:bitrate] = bitrate * 1000 if bitrate payload[:user_limit] = user_limit if user_limit payload[:position] = position if position if payload[:permission_overwrites] = .map do |target, overwrite| { type: target.is_a?(Role) ? 0 : 1, id: target.id, allow: overwrite.allow_value, deny: overwrite.deny_value, } end end payload[:parent_id] = parent.id if parent _resp, data = @client.http.request(Route.new("/guilds/#{@id}/channels", "//guilds/:guild_id/channels", :post), payload, audit_log_reason: reason).wait payload[:parent_id] = parent&.id Channel.make_channel(@client, data) end end |
#edit_nickname(nickname, reason: nil) -> Async::Task<void> Also known as: edit_nick, modify_nickname
Change nickname of client member.
764 765 766 767 768 769 770 771 |
# File 'lib/discorb/guild.rb', line 764 def edit_nickname(nickname, reason: nil) Async do @client.http.request( Route.new("/guilds/#{@id}/members/@me/nick", "//guilds/:guild_id/members/@me/nick", :patch), { nick: nickname }, audit_log_reason: reason, ).wait end end |
#fetch_active_threads -> Async::Task<Array<Discorb::ThreadChannel>>
Fetch a list of active threads in the guild.
649 650 651 652 653 654 655 |
# File 'lib/discorb/guild.rb', line 649 def fetch_active_threads Async do _resp, data = @client.http.request(Route.new("/guilds/#{@id}/threads/active", "//guilds/:guild_id/threads/active", :get)).wait data[:threads].map { |t| Channel.make_thread(@client, t) } end end |
#fetch_audit_log -> Async::Task<Discorb::AuditLog>
Fetch audit log of the guild.
399 400 401 402 403 404 405 |
# File 'lib/discorb/guild.rb', line 399 def fetch_audit_log Async do _resp, data = @client.http.request(Route.new("/guilds/#{@id}/audit-logs", "//guilds/:guild_id/audit-logs", :get)).wait AuditLog.new(@client, data, self) end end |
#fetch_automod_rule(id) -> Async::Task<Array<Discord::AutoModRule>>
Fetch the automod rule by ID.
1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 |
# File 'lib/discorb/guild.rb', line 1157 def fetch_automod_rule(id) Async do _resp, data = @client.http.request( Route.new( "/guilds/#{@id}/auto-moderation/rules/#{id}", "//guilds/:guild_id/auto-moderation/rules/:rule_id", :get ) ).wait AutoModRule.new(@client, data) end end |
#fetch_automod_rules -> Async::Task<Array<Discorb::AutoModRule>> Also known as: fetch_automod_rule_list
Fetch the automod rules in the guild.
1139 1140 1141 1142 1143 1144 1145 1146 |
# File 'lib/discorb/guild.rb', line 1139 def fetch_automod_rules Async do _resp, data = @client.http.request( Route.new("/guilds/#{@id}/auto-moderation/rules", "//guilds/:guild_id/auto-moderation/rules", :get) ) data.map { |d| AutoModRule.new(@client, d) } end end |
#fetch_ban(user) -> Async::Task<Discorb::Guild::Ban>, Async::Task<nil>
Fetch a ban in the guild.
829 830 831 832 833 834 835 836 837 838 |
# File 'lib/discorb/guild.rb', line 829 def fetch_ban(user) Async do _resp, data = @client.http.request(Route.new("/guilds/#{@id}/bans/#{user.id}", "//guilds/:guild_id/bans/:user_id", :get)).wait rescue Discorb::NotFoundError nil else Ban.new(@client, self, data) end end |
#fetch_bans(limit = 50, before: nil, after: nil, around: nil) -> Async::Task<Array<Discorb::Guild::Ban>>
Fetch a list of bans in the guild.
806 807 808 809 810 811 812 813 814 815 816 817 818 |
# File 'lib/discorb/guild.rb', line 806 def fetch_bans(limit = 50, before: nil, after: nil, around: nil) Async do params = { limit: limit, before: Discorb::Utils.try(after, :id), after: Discorb::Utils.try(around, :id), around: Discorb::Utils.try(before, :id), }.filter { |_k, v| !v.nil? }.to_h _resp, bans = @client.http.request(Route.new("/guilds/#{@id}/bans?#{URI.encode_www_form(params)}", "//guilds/:guild_id/bans", :get)).wait bans.map { |d| Ban.new(@client, self, d) } end end |
#fetch_channels -> Async::Task<Array<Discorb::Channel>>
Fetch channels of the guild.
413 414 415 416 417 418 419 |
# File 'lib/discorb/guild.rb', line 413 def fetch_channels Async do _resp, data = @client.http.request(Route.new("/guilds/#{@id}/channels", "//guilds/:guild_id/channels", :get)).wait data.map { |c| Channel.make_channel(@client, c) } end end |
#fetch_emoji(id) -> Async::Task<Discorb::CustomEmoji>
This querys the API every time. We recommend using #emojis instead.
Fetch emoji id of the guild.
342 343 344 345 346 347 348 349 350 351 352 353 |
# File 'lib/discorb/guild.rb', line 342 def fetch_emoji(id) Async do _resp, data = @client.http.request( Route.new( "/guilds/#{@id}/emojis/#{id}", "//guilds/:guild_id/emojis/:emoji_id", :get ) ).wait @emojis[e[:id]] = CustomEmoji.new(@client, self, data) end end |
#fetch_emoji_list -> Async::Task<Discorb::Dictionary{Discorb::Snowflake => Discorb::CustomEmoji}> Also known as: fetch_emojis
This querys the API every time. We recommend using #emojis instead.
Fetch emoji list of the guild.
317 318 319 320 321 322 323 324 325 326 327 328 329 |
# File 'lib/discorb/guild.rb', line 317 def fetch_emoji_list Async do _resp, data = @client.http.request(Route.new("/guilds/#{@id}/emojis", "//guilds/:guild_id/emojis", :get)).wait @emojis = Dictionary.new ids = @emojis.map(&:id).map(&:to_s) data.map do |e| next if ids.include?(e[:id]) @emojis[e[:id]] = CustomEmoji.new(@client, self, e) end @emojis end end |
#fetch_integrations -> Async::Task<Array<Discorb::Integration>>
Fetch integrations in the guild.
1005 1006 1007 1008 1009 1010 1011 |
# File 'lib/discorb/guild.rb', line 1005 def fetch_integrations Async do _resp, data = @client.http.request(Route.new("/guilds/#{@id}/integrations", "//guilds/:guild_id/integrations", :get)).wait data.map { |d| Integration.new(@client, d, @id) } end end |
#fetch_invites -> Async::Task<Array<Invite>>
Fetch invites in the guild.
992 993 994 995 996 997 |
# File 'lib/discorb/guild.rb', line 992 def fetch_invites Async do _resp, data = @client.http.request(Route.new("/guilds/#{@id}/invites", "//guilds/:guild_id/invites", :get)).wait data.map { |d| Invite.new(@client, d, false) } end end |
#fetch_member(id) -> Async::Task<Discorb::Member>, Async::Task<nil>
Fetch a member in the guild.
666 667 668 669 670 671 672 673 674 675 |
# File 'lib/discorb/guild.rb', line 666 def fetch_member(id) Async do _resp, data = @client.http.request(Route.new("/guilds/#{@id}/members/#{id}", "//guilds/:guild_id/members/:user_id", :get)).wait rescue Discorb::NotFoundError nil else Member.new(@client, @id, data[:user], data) end end |
#fetch_member_named -> Async::Task<Discorb::Member>, Async::Task<nil>
Almost the same as #fetch_members_named, but returns a single member.
749 750 751 752 753 |
# File 'lib/discorb/guild.rb', line 749 def fetch_member_named(...) Async do fetch_members_named(...).first end end |
#fetch_members(limit: 0, after: nil) -> Async::Task<Array<Discorb::Member>> Also known as: fetch_member_list
You must enable GUILD_MEMBERS
intent to use this method.
Fetch members in the guild.
686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 |
# File 'lib/discorb/guild.rb', line 686 def fetch_members(limit: 0, after: nil) Async do unless limit.zero? _resp, data = @client.http.request( Route.new( "/guilds/#{@id}/members?#{URI.encode_www_form( { after: after, limit: limit, } )}", "//guilds/:guild_id/members", :get ) ).wait next data[:members].map { |m| Member.new(@client, @id, m[:user], m) } end ret = [] after = 0 loop do params = { after: after, limit: 100 } _resp, data = @client.http.request(Route.new("/guilds/#{@id}/members?#{URI.encode_www_form(params)}", "//guilds/:guild_id/members", :get)).wait ret += data.map { |m| Member.new(@client, @id, m[:user], m) } after = data.last[:user][:id] break if data.length != 100 end ret end end |
#fetch_members_named(name, limit: 1) -> Async::Task<Array<Discorb::Member>>
Search for members by name in the guild.
726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 |
# File 'lib/discorb/guild.rb', line 726 def fetch_members_named(name, limit: 1) Async do _resp, data = @client.http.request( Route.new( "/guilds/#{@id}/members/search?#{URI.encode_www_form( { query: name, limit: limit, } )}", "//guilds/:guild_id/members/search", :get ) ).wait data.map { |d| Member.new(@client, @id, d[:user], d) } end end |
#fetch_prune(days = 7, roles: []) -> Async::Task<Integer>
Fetch how many members will be pruned.
942 943 944 945 946 947 948 949 950 951 952 953 |
# File 'lib/discorb/guild.rb', line 942 def fetch_prune(days = 7, roles: []) Async do params = { days: days, include_roles: @id.to_s, } param[:include_roles] = roles.map(&:id).map(&:to_s).join(";") if roles.any? _resp, data = @client.http.request(Route.new("/guilds/#{@id}/prune?#{URI.encode_www_form(params)}", "//guilds/:guild_id/prune", :get)).wait data[:pruned] end end |
#fetch_roles -> Async::Task<Array<Discorb::Role>>
Fetch a list of roles in the guild.
901 902 903 904 905 906 |
# File 'lib/discorb/guild.rb', line 901 def fetch_roles Async do _resp, data = @client.http.request(Route.new("/guilds/#{@id}/roles", "//guilds/:guild_id/roles", :get)).wait data.map { |d| Role.new(@client, self, d) } end end |
#fetch_scheduled_event(id) -> Async::Task<Discorb::ScheduledEvent>, Async::Task<nil>
Fetch the scheduled event by ID.
220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/discorb/guild.rb', line 220 def fetch_scheduled_event(id) Async do _resp, event = @client.http.request( Route.new( "/guilds/#{@id}/scheduled-events/#{id}", "//guilds/:guild_id/scheduled-events/:scheduled_event_id", :get ) ).wait ScheduledEvent.new(@client, event) end end |
#fetch_scheduled_events(with_user_count: true) -> Array<Discorb::ScheduledEvent>
Fetch scheduled events for the guild.
198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/discorb/guild.rb', line 198 def fetch_scheduled_events(with_user_count: true) Async do _resp, events = @client.http.request( Route.new( "/guilds/#{@id}/scheduled-events?with_user_count=#{with_user_count}", "//guilds/:guild_id/scheduled-events", :get ) ).wait @scheduled_events = events.map { |e| ScheduledEvent.new(@client, e) } end end |
#fetch_sticker(id) -> Async::Task<Discorb::Sticker::GuildSticker>, Async::Task<nil>
Fetch the sticker by ID.
1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 |
# File 'lib/discorb/guild.rb', line 1077 def fetch_sticker(id) Async do _resp, data = @client.http.request(Route.new("/guilds/#{@id}/stickers/#{id}", "//guilds/:guild_id/stickers/:sticker_id", :get)).wait rescue Discorb::NotFoundError nil else Sticker::GuildSticker.new(@client, data) end end |
#fetch_stickers -> Async::Task<Array<Discorb::Sticker::GuildSticker>>
Fetch stickers in the guild.
1060 1061 1062 1063 1064 1065 1066 |
# File 'lib/discorb/guild.rb', line 1060 def fetch_stickers Async do _resp, data = @client.http.request(Route.new("/guilds/#{@id}/stickers", "//guilds/:guild_id/stickers", :get)).wait data.map { |d| Sticker::GuildSticker.new(@client, d) } end end |
#fetch_template -> Discorb::GuildTemplate, Async::Task<nil>
Almost the same as #fetch_templates, but returns a single template.
1108 1109 1110 1111 1112 |
# File 'lib/discorb/guild.rb', line 1108 def fetch_template Async do fetch_templates.wait.first end end |
#fetch_templates -> Async::Task<Discorb::GuildTemplate>
Fetch templates in the guild.
1094 1095 1096 1097 1098 1099 1100 |
# File 'lib/discorb/guild.rb', line 1094 def fetch_templates Async do _resp, data = @client.http.request(Route.new("/guilds/#{@id}/templates", "//guilds/:guild_id/templates", :get)).wait data.map { |d| GuildTemplate.new(@client, d) } end end |
#fetch_vanity_invite -> Async::Task<Discorb::Guild::VanityInvite>
Fetch the vanity URL of the guild.
1032 1033 1034 1035 1036 1037 1038 |
# File 'lib/discorb/guild.rb', line 1032 def fetch_vanity_invite Async do _resp, data = @client.http.request(Route.new("/guilds/#{@id}/vanity-url", "//guilds/:guild_id/vanity-url", :get)).wait VanityInvite.new(@client, self, data) end end |
#fetch_voice_regions -> Async::Task<Array<Discorb::VoiceRegion>>
Fetch voice regions that are available in the guild.
979 980 981 982 983 984 |
# File 'lib/discorb/guild.rb', line 979 def fetch_voice_regions Async do _resp, data = @client.http.request(Route.new("/guilds/#{@id}/voice", "//guilds/:guild_id/voice", :get)).wait data.map { |d| VoiceRegion.new(d) } end end |
#fetch_webhooks -> Async::Task<Array<Discorb::Webhook>>
Fetch webhooks of the guild.
385 386 387 388 389 390 391 |
# File 'lib/discorb/guild.rb', line 385 def fetch_webhooks Async do _resp, data = @client.http.request(Route.new("/guilds/#{@id}/webhooks", "//guilds/:guild_id/webhooks", :get)).wait data.map { |webhook| Webhook.from_data(@client, webhook) } end end |
#fetch_welcome_screen -> Async::Task<Discorb::WelcomeScreen>
Fetch the welcome screen of the guild.
1046 1047 1048 1049 1050 1051 1052 |
# File 'lib/discorb/guild.rb', line 1046 def fetch_welcome_screen Async do _resp, data = @client.http.request(Route.new("/guilds/#{@id}/welcome-screen", "//guilds/:guild_id/welcome-screen", :get)).wait WelcomeScreen.new(@client, self, data) end end |
#fetch_widget -> Async::Task<Discorb::Guild::Widget>
Fetch the widget of the guild.
1019 1020 1021 1022 1023 1024 |
# File 'lib/discorb/guild.rb', line 1019 def Async do _resp, data = @client.http.request(Route.new("/guilds/#{@id}/widget", "//guilds/:guild_id/widget", :get)).wait Widget.new(@client, @id, data) end end |
#inspect -> Object
168 169 170 |
# File 'lib/discorb/guild.rb', line 168 def inspect "#<#{self.class} \"#{@name}\" id=#{@id}>" end |
#kick_member(member, reason: nil) -> Async::Task<void>
Kick a member from the guild.
786 787 788 789 790 791 792 793 |
# File 'lib/discorb/guild.rb', line 786 def kick_member(member, reason: nil) Async do @client.http.request( Route.new("/guilds/#{@id}/members/#{member.id}", "//guilds/:guild_id/members/:user_id", :delete), {}, audit_log_reason: reason, ).wait end end |
#leave -> Async::Task<void>
Leave the guild.
182 183 184 185 186 187 |
# File 'lib/discorb/guild.rb', line 182 def leave Async do @client.http.request(Route.new("/users/@me/guilds/#{@id}", "//users/@me/guilds/:guild_id", :delete)).wait @client.guilds.delete(@id) end end |
#prune(days = 7, roles: [], reason: nil) -> Async::Task<Integer>
Prune members from the guild.
965 966 967 968 969 970 971 |
# File 'lib/discorb/guild.rb', line 965 def prune(days = 7, roles: [], reason: nil) Async do _resp, data = @client.http.request(Route.new("/guilds/#{@id}/prune", "//guilds/:guild_id/prune", :post), { days: days, roles: roles.map(&:id) }, audit_log_reason: reason).wait data[:pruned] end end |
#unban_user(user, reason: nil) -> Async::Task<void>
Unban a user from the guild.
888 889 890 891 892 893 |
# File 'lib/discorb/guild.rb', line 888 def unban_user(user, reason: nil) Async do @client.http.request(Route.new("/guilds/#{@id}/bans/#{user.id}", "//guilds/:guild_id/bans/:user_id", :delete), {}, audit_log_reason: reason).wait end end |