# A new wrapper for the Discorb API. # # @author sevenc-nanashi module Discorb Colour: untyped API_BASE_URL: untyped VERSION: untyped VERSION_ARRAY: untyped USER_AGENT: untyped Unset: untyped # # Method to define a macro for YARD. # # Represents a flag. # @abstract class Flag # Initialize the flag. # @note This is usually called by the subclass. # # @param [Integer] value The value of the flag. def initialize: (Integer value) -> void # # Returns the value of the flag. def method_missing: (untyped name, ?untyped args) -> untyped def respond_to_missing?: (untyped sym, untyped include_private) -> bool # # Union of two flags. # # @param [Discorb::Flag] other The other flag. # # @return [Discorb::Flag] The union of the two flags. def |: (Discorb::Flag other) -> Discorb::Flag # # Subtraction of two flags. # # @param [Discorb::Flag] other The other flag. # # @return [Discorb::Flag] The subtraction of the two flags. def -: (Discorb::Flag other) -> Discorb::Flag # # Intersection of two flags. # # @param [Discorb::Flag] other The other flag. # # @return [Discorb::Flag] The intersection of the two flags. def &: (Discorb::Flag other) -> Discorb::Flag # # XOR of two flags. # # @param [Discorb::Flag] other The other flag. # # @return [Discorb::Flag] The XOR of the two flags. def ^: (Discorb::Flag other) -> Discorb::Flag # # Negation of the flag. # # @return [Discorb::Flag] The negation of the flag. def ~: () -> Discorb::Flag def inspect: () -> untyped # # Max value of the flag. # # @return [Integer] the max value of the flag. def self.max_value: () -> Integer # @return [Hash{Symbol => Boolean}] the values of the flag. attr_reader values: ::Hash[Symbol, bool] # @return [Integer] the value of the flag. attr_reader value: Integer end # # A class to handle http requests. # # Represents a role in the guild. class Role < Discorb::DiscordModel include Comparable # # Initializes a new role. # # Compares two roles by their position. # # @param [Discorb::Role] other The role to compare to. # # @return [Integer] -1 if the other role is higher, 0 if they are equal, 1 if the other role is lower. def <=>: (Discorb::Role other) -> Integer # # Formats the role as a string. # # @return [String] The formatted string. def to_s: () -> String def mention: () -> untyped def color?: () -> bool def inspect: () -> untyped # # Moves the role to a new position. # @async # # @param [Integer] position The new position. # @param [String] reason The reason for moving the role. # # @return [Async::Task] The task. def move: (Integer position, ?reason: String?) -> Async::Task[void] # # Edits the role. # @async # @macro edit # # @param [String] name The new name of the role. # @param [Integer] position The new position of the role. # @param [Discorb::Color] color The new color of the role. # @param [Boolean] hoist Whether the role should be hoisted. # @param [Boolean] mentionable Whether the role should be mentionable. # @param [Discorb::Image, Discorb::UnicodeEmoji] icon The new icon or emoji of the role. # @param [String] reason The reason for editing the role. # # @return [Async::Task] The task. def edit: ( ?name: String, ?position: Integer, ?color: Discorb::Color, ?hoist: bool, ?mentionable: bool, ?icon: (Discorb::Image | Discorb::UnicodeEmoji), ?reason: String? ) -> Async::Task[void] # # Deletes the role. # # @param [String] reason The reason for deleting the role. # # @return [Async::Task] The task. def delete!: (?reason: String?) -> Async::Task[void] def tag: () -> untyped # @return [Discorb::Snowflake] The ID of the role. attr_reader id: Discorb::Snowflake # @return [String] The name of the role. attr_reader name: String # @return [Discorb::Color] The color of the role. attr_reader color: Discorb::Color # @return [Discorb::Permission] The permissions of the role. attr_reader permissions: Discorb::Permission # @return [Integer] The position of the role. attr_reader position: Integer # @return [Discorb::Guild] The guild this role belongs to. attr_reader guild: Discorb::Guild # @return [Boolean] Whether the role is hoisted. attr_reader hoist: bool # @return [Boolean] Whether the role is managed. attr_reader managed: bool # @return [Boolean] Whether the role is a default role. attr_reader mentionable: bool # @return [Discorb::Asset, nil] The icon of the role. attr_reader custom_icon: Discorb::Asset? # @return [Discorb::Emoji, nil] The emoji of the role. attr_reader emoji: Discorb::Emoji? # # Represents a tag of a role. class Tag < Discorb::DiscordModel # # Initializes a new tag. # @return [Discorb::Snowflake] The ID of the bot that owns the role. attr_reader bot_id: Discorb::Snowflake # @return [Discorb::Snowflake] The ID of the integration. attr_reader integration_id: Discorb::Snowflake # @return [Boolean] Whether the tag is a premium subscriber role. attr_reader premium_subscriber: bool # @return [Boolean] Whether the role is a bot role. attr_reader bot?: bool # @return [Boolean] Whether the role is an integration role. attr_reader integration?: bool end end # # Represents a user of discord. class User < Discorb::DiscordModel include Discorb::Messageable # # Initializes a new user. # # Format the user as `Username#Discriminator` style. # # @return [String] The formatted username. def to_s: () -> String def inspect: () -> untyped # # Whether the user is a owner of the client. # @async # # @param [Boolean] strict Whether don't allow if the user is a member of the team. # # @return [Async::Task] Whether the user is a owner of the client. def bot_owner?: (?strict: bool) -> Async::Task[bool] # # Returns the dm channel id of the user. # # Edit a message. # @async # @!macro edit # # @param [#to_s] message_id The message id. # @param [String] content The message content. # @param [Discorb::Embed] embed The embed to send. # @param [Array] embeds The embeds to send. # @param [Discorb::AllowedMentions] allowed_mentions The allowed mentions. # @param [Array] attachments The new attachments. # @param [Array, Array>] components The components to send. # @param [Boolean] supress Whether to supress embeds. # # @return [Async::Task] The task. def edit_message: ( _ToS message_id, ?String content, ?embed: Discorb::Embed, ?embeds: ::Array[Discorb::Embed], ?allowed_mentions: Discorb::AllowedMentions, ?attachments: ::Array[Discorb::Attachment], ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]]), ?supress: bool ) -> Async::Task[void] # # Delete a message. # @async # # @param [#to_s] message_id The message id. # @param [String] reason The reason for deleting the message. # # @return [Async::Task] The task. def delete_message!: (_ToS message_id, ?reason: String?) -> Async::Task[void] # # Fetch a message from ID. # @async # # @param [Discorb::Snowflake] id The ID of the message. # # @return [Async::Task] The message. # @raise [Discorb::NotFoundError] If the message is not found. def fetch_message: (Discorb::Snowflake id) -> Async::Task[Discorb::Message] # # Fetch a message history. # @async # # @param [Integer] limit The number of messages to fetch. # @param [Discorb::Snowflake] before The ID of the message to fetch before. # @param [Discorb::Snowflake] after The ID of the message to fetch after. # @param [Discorb::Snowflake] around The ID of the message to fetch around. # # @return [Async::Task>] The messages. def fetch_messages: ( ?Integer limit, ?before: Discorb::Snowflake?, ?after: Discorb::Snowflake?, ?around: Discorb::Snowflake? ) -> Async::Task[::Array[Discorb::Message]] # # Fetch the pinned messages in the channel. # @async # # @return [Async::Task>] The pinned messages in the channel. def fetch_pins: () -> Async::Task[::Array[Discorb::Message]] # # Pin a message in the channel. # @async # # @param [Discorb::Message] message The message to pin. # @param [String] reason The reason of pinning the message. # # @return [Async::Task] The task. def pin_message: (Discorb::Message message, ?reason: String?) -> Async::Task[void] # # Unpin a message in the channel. # @async # # @param [Discorb::Message] message The message to unpin. # @param [String] reason The reason of unpinning the message. # # @return [Async::Task] The task. def unpin_message: (Discorb::Message message, ?reason: String?) -> Async::Task[void] # # Trigger the typing indicator in the channel. # @async # # If block is given, trigger typing indicator during executing block. # @example # channel.typing do # channel.post("Waiting for 60 seconds...") # sleep 60 # channel.post("Done!") # end def typing: () -> untyped # @return [Boolean] Whether the user is verified. attr_reader verified: bool # @return [String] The user's username. attr_reader username: String # @return [Discorb::Snowflake] The user's ID. attr_reader id: Discorb::Snowflake # @return [Discorb::User::Flag] The user's flags. attr_reader flag: Discorb::User::Flag # @return [String] The user's discriminator. attr_reader discriminator: String # @return [Discorb::Asset] The user's avatar. attr_reader avatar: Discorb::Asset # @return [Boolean] Whether the user is a bot. attr_reader bot: bool # @return [Time] The time the user was created. attr_reader created_at: Time # @return [String] The user's mention. attr_reader mention: String # # Represents the user's flags. # ## Flag fields # |`1 << 0`|`:discord_employee`| # |`1 << 1`|`:partnered_server_owner`| # |`1 << 2`|`:hypesquad_events`| # |`1 << 3`|`:bug_hunter_level_1`| # |`1 << 6`|`:house_bravery`| # |`1 << 7`|`:house_brilliance`| # |`1 << 8`|`:house_balance`| # |`1 << 9`|`:early_supporter`| # |`1 << 10`|`:team_user`| # |`1 << 14`|`:bug_hunter_level_2`| # |`1 << 16`|`:verified_bot`| # |`1 << 17`|`:early_verified_bot_developer`| # |`1 << 18`|`:discord_certified_moderator`| class Flag < Discorb::Flag end end # # Represents a client user. class ClientUser < Discorb::User # # Edit the client user. # @async # @macro edit # # @param [String] name The new username. # @param [Discorb::Image] avatar The new avatar. # # @return [Async::Task] The task. def edit: (?name: String, ?avatar: Discorb::Image) -> Async::Task[void] end # # Represents a single asset. class Asset < Discorb::DiscordModel # # Initialize a new instance of the Asset class. # # URL of the asset. # # @param [String] image_format The image format. # @param [Integer] size The size of the image. # # @return [String] URL of the asset. def url: (?image_format: String?, ?size: Integer) -> String def inspect: () -> untyped def endpoint: () -> untyped # @return [String] The hash of asset. attr_reader hash: String # @return [Boolean] Whether the asset is animated. attr_reader animated?: bool end # # Represents a default avatar. class DefaultAvatar < Discorb::DiscordModel # # Initialize a new instance of the DefaultAvatar class. # # Returns the URL of the avatar. # # @param [String] image_format The image format. This is compatible with {Asset#url}, will be ignored. # @param [Integer] size The size of the image. This is compatible with {Asset#url}, will be ignored. # # @return [String] URL of the avatar. # # rubocop: disable Lint/UnusedMethodArgument def url: (?image_format: String?, ?size: Integer) -> String def inspect: () -> untyped # @return [false] For compatibility with {Asset}, always `false`. attr_reader animated?: bool end # # Represents RGB color. class Color # # Create a color from a Integer. # # @param [Integer] value A color value. def initialize: (Integer value) -> void # # Integerize a color. # # @return [Integer] A color value. def to_i: () -> Integer # # Convert a color to a hexadecimal value. # # @return [String] A hexadecimal value. def to_hex: () -> String # # Convert a color to RGB array. # # @return [Array(Integer, Integer, Integer)] A RGB array. def to_rgb: () -> [Integer, Integer, Integer] # # Convert a color to RGB hash. # # @return [Hash{:r, :g, :b => Integer}] A RGB hash. def to_rgb_hash: () -> { r: Integer, g: Integer, b: Integer} # # Converts a color to a `#000000` string. # # @return [String] Converted string. def to_s: () -> String def inspect: () -> untyped # # Create a color from a hexadecimal string. # # @param [String] hex A hexadecimal string. # # @return [Discorb::Color] A color object. def self.from_hex: (String hex) -> Discorb::Color # # Create a color from a RGB array. # # @param [Integer] red A red value. # @param [Integer] green A green value. # @param [Integer] blue A blue value. # # @return [Discorb::Color] A color object. def self.from_rgb: (Integer red, Integer green, Integer blue) -> Discorb::Color # # Create a color from a Discord's color. # Currently these colors are supported: # # | Color Name | Hexadecimal | # |------------|------------| # | `:teal` | `#1abc9c` | # | `:dark_teal` | `#11806a` | # | `:green` | `#2ecc71` | # | `:dark_green` | `#1f8b4c` | # | `:blue` | `#3498db` | # | `:dark_blue` | `#206694` | # | `:purple` | `#9b59b6` | # | `:dark_purple` | `#71368a` | # | `:magenta` | `#e91e63` | # | `:dark_magenta` | `#ad1457` | # | `:gold` | `#f1c40f` | # | `:dark_gold` | `#c27c0e` | # | `:orange` | `#e67e22` | # | `:dark_orange` | `#a84300` | # | `:red` | `#e74c3c` | # | `:dark_red` | `#992d22` | # | `:lighter_grey` | `#95a5a6` | # | `:lighter_gray` | `#95a5a6` | # | `:dark_grey` | `#607d8b` | # | `:dark_gray` | `#607d8b` | # | `:light_grey` | `#979c9f` | # | `:light_gray` | `#979c9f` | # | `:darker_grey` | `#546e7a` | # | `:darker_gray` | `#546e7a` | # | `:og_blurple` | `#7289da` | # | `:blurple` | `#5865f2` | # | `:greyple` | `#99aab5` | # | `:dark_theme` | `#36393f` | # | `:fuchsia` | `#eb459e` | # | `:dark_teal` | `#11806a` | # | `:green` | `#2ecc71` | # | `:dark_green` | `#1f8b4c` | # | `:blue` | `#3498db` | # | `:dark_blue` | `#206694` | # | `:purple` | `#9b59b6` | # | `:dark_purple` | `#71368a` | # | `:magenta` | `#e91e63` | # | `:dark_magenta` | `#ad1457` | # | `:gold` | `#f1c40f` | # | `:dark_gold` | `#c27c0e` | # | `:orange` | `#e67e22` | # | `:dark_orange` | `#a84300` | # | `:red` | `#e74c3c` | # | `:dark_red` | `#992d22` | # | `:lighter_grey` | `#95a5a6` | # | `:lighter_gray` | `#95a5a6` | # | `:dark_grey` | `#607d8b` | # | `:dark_gray` | `#607d8b` | # | `:light_grey` | `#979c9f` | # | `:light_gray` | `#979c9f` | # | `:darker_grey` | `#546e7a` | # | `:darker_gray` | `#546e7a` | # | `:og_blurple` | `#7289da` | # | `:blurple` | `#5865f2` | # | `:greyple` | `#99aab5` | # | `:dark_theme` | `#36393f` | # | `:fuchsia` | `#eb459e` | # # @param [Symbol] color A Discord color name. # # @return [Discorb::Color] A color object. def self.[]: (Symbol color) -> Discorb::Color # Returns the value of attribute value. attr_accessor value: untyped end # # Represents an embed of discord. class Embed # # Initialize a new Embed object. # # @param [String] title The title of embed. # @param [String] description The description of embed. # @param [Discorb::Color] color The color of embed. # @param [String] url The url of embed. # @param [Time] timestamp The timestamp of embed. # @param [Discorb::Embed::Author] author The author field of embed. # @param [Array] fields The fields of embed. # @param [Discorb::Embed::Footer] footer The footer of embed. # @param [Discorb::Embed::Image, String] image The image of embed. # @param [Discorb::Embed::Thumbnail, String] thumbnail The thumbnail of embed. def initialize: ( ?String? title, ?String? description, ?color: Discorb::Color?, ?url: String?, ?timestamp: Time?, ?author: Discorb::Embed::Author?, ?fields: ::Array[Discorb::Embed::Field]?, ?footer: Discorb::Embed::Footer?, ?image: (Discorb::Embed::Image | String)?, ?thumbnail: (Discorb::Embed::Thumbnail | String)? ) -> void # # Initialize embed from hash. # # Convert embed to hash. # # @see https://discord.com/developers/docs/resources/channel#embed-object-embed-structure Offical Discord API Docs # @return [Hash] Converted embed. def to_hash: () -> ::Hash[untyped, untyped] def self.from_hash: (untyped data) -> untyped # @return [String, nil] The title of embed. attr_accessor title: String? # @return [String, nil] The description of embed. attr_accessor description: String? # @return [String, nil] The url of embed. attr_accessor url: String? # @return [Time, nil] The timestamp of embed. attr_accessor timestamp: Time? # @return [Discorb::Color, nil] The color of embed. attr_accessor color: Discorb::Color? # @return [Discorb::Embed::Author, nil] The author of embed. attr_accessor author: Discorb::Embed::Author? # @return [Array] The fields of embed. attr_accessor fields: ::Array[Discorb::Embed::Field] # @return [Discorb::Embed::Footer, nil] The footer of embed. attr_accessor footer: Discorb::Embed::Footer? # @return [Symbol] The type of embed. attr_reader type: Symbol # @return [Discorb::Embed::Image] The image of embed. attr_accessor image: Discorb::Embed::Image # @return [Discorb::Embed::Thumbnail] The thumbnail of embed. attr_accessor thumbnail: Discorb::Embed::Thumbnail # # Represents an entry in embed. # @abstract # # Represents an author of embed. class Author < Discorb::Embed::Entry # # Initialize a new Author object. # # @param [String] name The name of author. # @param [String] url The url of author. # @param [String] icon The icon url of author. def initialize: (String name, ?url: String?, ?icon: String?) -> void # # Convert author to hash. # # @see https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure Offical Discord API Docs # @return [Hash] Converted author. def to_hash: () -> ::Hash[untyped, untyped] # @return [String] The name of author. attr_accessor name: String # @return [String, nil] The url of author. attr_accessor url: String? # @return [String, nil] The icon url of author. attr_accessor icon: String? end # # Represemts a footer of embed. class Footer < Discorb::Embed::Entry # # Initialize a new Footer object. # # @param [String] text The text of footer. # @param [String] icon The icon url of footer. def initialize: (String text, ?icon: String?) -> void # # Convert footer to hash. # # @see https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure Offical Discord API Docs # @return [Hash] Converted footer. def to_hash: () -> ::Hash[untyped, untyped] # Returns the value of attribute text. attr_accessor text: untyped # Returns the value of attribute icon. attr_accessor icon: untyped end # # Represents a field of embed. class Field < Discorb::Embed::Entry # # Initialize a new Field object. # # @param [String] name The name of field. # @param [String] value The value of field. # @param [Boolean] inline Whether the field is inline. def initialize: (String name, String value, ?inline: bool) -> void # # Convert field to hash. # # @see https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure Offical Discord API Docs # @return [Hash] Converted field. def to_hash: () -> ::Hash[untyped, untyped] # @return [String] The name of field. attr_accessor name: String # @return [String] The value of field. attr_accessor value: String # @return [Boolean] Whether the field is inline. attr_accessor inline: bool end # # Represents an image of embed. class Image < Discorb::Embed::Entry # # Initialize a new Image object. # # @param [String] url URL of image. def initialize: (String url) -> void # # Convert image to hash for sending. # # @see https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure Offical Discord API Docs # @return [Hash] Converted image. def to_hash: () -> ::Hash[untyped, untyped] # @return [String] The url of image. attr_accessor url: String # @return [String] The proxy url of image. # @return [nil] The Image object wasn't created from gateway. attr_reader proxy_url: String? # @return [Integer] The height of image. # @return [nil] The Image object wasn't created from gateway. attr_reader height: Integer? # @return [Integer] The width of image. # @return [nil] The Image object wasn't created from gateway. attr_reader width: Integer? end # # Represents a thumbnail of embed. class Thumbnail < Discorb::Embed::Entry # # Initialize a new Thumbnail object. # # @param [String] url URL of thumbnail. def initialize: (String url) -> void # # Convert thumbnail to hash for sending. # # @see https://discord.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure Offical Discord API Docs # @return [Hash] Converted thumbnail. def to_hash: () -> ::Hash[untyped, untyped] # @return [String] The url of thumbnail. attr_accessor url: String # @return [String] The proxy url of thumbnail. # @return [nil] The Thumbnail object wasn't created from gateway. attr_reader proxy_url: String? # @return [Integer] The height of thumbnail. # @return [nil] The Thumbnail object wasn't created from gateway. attr_reader height: Integer? # @return [Integer] The width of thumbnail. # @return [nil] The Thumbnail object wasn't created from gateway. attr_reader width: Integer? end # # Represents a video of embed. class Video < Discorb::Embed::Entry # # Initialize a new Video object. # @return [String] The url of video. attr_reader url: String # @return [String] The proxy url of video. attr_reader proxy_url: String # @return [Integer] The height of video. attr_reader height: Integer # @return [Integer] The width of video. attr_reader width: Integer end # # Represents a provider of embed. class Provider < Discorb::Embed::Entry # # Initialize a new Provider object. # @return [String] The name of provider. attr_reader name: String # @return [String] The url of provider. attr_reader url: String end end # Represents a Discord emoji. # @abstract class Emoji def eql?: (untyped other) -> bool def ==: (untyped other) -> untyped def inspect: () -> untyped end # Represents a custom emoji in discord. class CustomEmoji < Discorb::Emoji # # Initialize a new custom emoji. # # Format the emoji for sending. # # @return [String] the formatted emoji. def to_s: () -> String # # Format the emoji for URI. # # @return [String] the formatted emoji. def to_uri: () -> String def inspect: () -> untyped # # Edit the emoji. # @async # @macro edit # # @param [String] name The new name of the emoji. # @param [Array] roles The new roles that can use this emoji. # @param [String] reason The reason for editing the emoji. # # @return [Async::Task] The edited emoji. def edit: (?name: String, ?roles: ::Array[Discorb::Role], ?reason: String?) -> Async::Task[self] # # Delete the emoji. # @async # # @param [String] reason The reason for deleting the emoji. # # @return [Async::Task] The deleted emoji. def delete!: (?reason: String?) -> Async::Task[self] # # Converts the object to a hash. # @return [String] The name of the emoji. attr_reader name: String # @return [Array] The roles that can use this emoji. attr_reader roles: ::Array[Discorb::Role] # @return [Discorb::User] The user that created this emoji. attr_reader user: Discorb::User # @return [Boolean] Whether the emoji requires colons. attr_reader guild: bool # @return [Boolean] whether the emoji is managed by integration (ex: Twitch). attr_reader managed: bool # @return [Boolean] whether the emoji requires colons. attr_reader require_colons: bool # @return [Boolean] whether the emoji is available. attr_reader available: bool # @return [Boolean] whether or not this emoji is restricted to certain roles. attr_reader roles?: bool end # # Represents a partial custom emoji in discord. class PartialEmoji < Discorb::DiscordModel # # Initialize a new partial custom emoji. # # Format the emoji for URI. # # @return [String] the formatted emoji. def to_uri: () -> String def inspect: () -> untyped # # Format the emoji for sending. # # @return [String] the formatted emoji. def to_s: () -> String # @return [Discorb::Snowflake] The ID of the emoji. attr_reader id: Discorb::Snowflake # @return [String] The name of the emoji. attr_reader name: String # @return [Boolean] Whether the emoji is deleted. attr_reader deleted: bool end # # Represents a unicode emoji (default emoji) in discord. class UnicodeEmoji < Discorb::Emoji # # Initialize a new unicode emoji. # # @param [String] name The name of the emoji. # @param [Integer] tone The skin tone of the emoji. def initialize: (String name, ?tone: Integer) -> void # @return [String] The unicode string of the emoji. def to_s: () -> String # # Format the emoji for URI. # # @return [String] the formatted emoji. def to_uri: () -> String def inspect: () -> untyped # # Converts the object to a hash. # @return [String] The name of the emoji. (e.g. :grinning:) attr_reader name: String # @return [String] The unicode value of the emoji. (e.g. U+1F600) attr_reader value: String # @return [Integer] The skin tone of the emoji. attr_reader skin_tone: Integer end # # Error class for Discorb. # @abstract class DiscorbError < StandardError def enumerate_errors: (untyped hash) -> untyped def _recr_items: (untyped key, untyped item, untyped res) -> untyped end # # Represents a HTTP error. # @abstract class HTTPError < Discorb::DiscorbError # # Initialize a new instance of the HTTPError class. # @return [String] the JSON response code. # @see https://discord.com/developers/docs/topics/opcodes-and-status-codes#json-json-error-codes attr_reader code: String # @return [Net::HTTPResponse] the HTTP response. attr_reader response: Net::HTTPResponse end # # Represents a 400 error. class BadRequestError < Discorb::HTTPError # # Initialize a new instance of the BadRequestError class. end # # Represents a 401 error. class UnauthorizedError < Discorb::HTTPError end # # Represents a 403 error. class ForbiddenError < Discorb::HTTPError end # # Represents a 404 error. class NotFoundError < Discorb::HTTPError end # # Represents a error because of a cloudflare ban. class CloudFlareBanError < Discorb::HTTPError def initialize: (untyped _resp, untyped client) -> void end # # Represents a error in client-side. class ClientError < Discorb::DiscorbError end # # Represents a timeout error. class TimeoutError < Discorb::DiscorbError end # # Represents a warning. class NotSupportedWarning < Discorb::DiscorbError def initialize: (untyped message) -> void end # # Represents an event in guild. class ScheduledEvent < Discorb::DiscordModel PRIVACY_LEVEL: untyped STATUS: untyped ENTITY_TYPE: untyped # @!visibility private def initialize: (untyped client, untyped data) -> void # # Create a scheduled event for the guild. # @async # # @param [:stage_instance, :voice, :external] type The type of event to create. # @param [String] name The name of the event. # @param [String] description The description of the event. # @param [Time] start_time The start time of the event. # @param [Time, nil] end_time The end time of the event. Defaults to `nil`. # @param [Discorb::Channel, Discorb::Snowflake, nil] channel The channel to run the event in. # @param [String, nil] location The location of the event. Defaults to `nil`. # @param [:guild_only] privacy_level The privacy level of the event. This must be `:guild_only`. # @param [:active, :completed, :canceled] status The status of the event. # # @return [Async::Task] The event that was created. # # @see Event#start # @see Event#cancel # @see Event#complete def edit: ( ?_type: Symbol, ?name: String, ?description: String, ?start_time: Time, ?end_time: Time?, ?privacy_level: Symbol, ?location: String?, ?channel: (Discorb::Channel | Discorb::Snowflake)?, ?status: Symbol ) -> Async::Task[Discorb::ScheduledEvent] # # Starts the event. Shortcut for `edit(status: :active)`. def start: () -> untyped # # Completes the event. Shortcut for `edit(status: :completed)`. def complete: () -> untyped # # Cancels the event. Shortcut for `edit(status: :canceled)`. def cancel: () -> untyped # # Deletes the event. # @async # # @return [Async::Task] The task. def delete!: () -> Async::Task[void] # # Fetches the event users. # @async # # @note You can fetch all of members by not specifying a parameter. # # @param [Integer] limit The maximum number of users to fetch. Defaults to `100`. # @param [#to_s] after The ID of the user to start fetching from. Defaults to `nil`. # @param [#to_s] before The ID of the user to stop fetching at. Defaults to `nil`. # @param [Boolean] with_member Whether to include the member object of the event. Defaults to `false`. # This should be used for manual fetching of members. # # @return [Async::Task>] The event users. def fetch_users: ( ?Integer? limit, ?before: untyped, ?after: untyped, ?with_member: bool ) -> Async::Task[::Array[Discorb::Member]] # @return [Discorb::Snowflake] The ID of the event. attr_reader id: Discorb::Snowflake # @return [String] The name of the event. attr_reader name: String # @return [String] The description of the event. attr_reader description: String # @return [Time] The time the event starts. attr_reader scheduled_start_time: Time # @return [Time] The time the event ends. attr_reader scheduled_end_time: Time # @return [:guild_only] The privacy level of the event. attr_reader privacy_level: Symbol # @return [:scheduled, :active, :completed, :canceled] The status of the event. attr_reader status: Symbol # @return [:stage_instance, :voice, :external] The type of the event. attr_reader entity_type: Symbol # @return [Discorb::Snowflake] The ID of the entity the event is for. attr_reader entity_id: Discorb::Snowflake # @return [Discorb::ScheduledEvent::Metadata] The metadata of the event. attr_reader metadata: Discorb::ScheduledEvent::Metadata # @return [Integer] The user count of the event. attr_reader user_count: Integer # @!attribute [r] guild # @return [Discorb::Guild, nil] The guild of the event. # @!attribute [r] channel # @return [Discorb::Channel, nil] The channel of the event. # Only present if the event will do in stage instance or voice channel. # @!attribute [r] creator # @return [Discorb::User] The user who created the event.# # @!attribute [r] time # @return [Range