# A new wrapper for the Discorb API. # # @author sevenc-nanashi module Discorb interface _SnowflakeLike def to_s: () -> String end Colour: untyped API_BASE_URL: untyped VERSION: untyped USER_AGENT: untyped def macro: () -> void # @private class Logger def initialize: (untyped _out, untyped colorize_log, untyped level) -> void def level: () -> untyped def level=: (untyped level) -> untyped def debug: (untyped message) -> untyped def info: (untyped message) -> untyped def warn: (untyped message) -> untyped def error: (untyped message) -> untyped def fatal: (untyped message) -> untyped def write_output: (untyped name, untyped color, untyped message) -> untyped # Returns the value of attribute out. attr_accessor out: untyped # Returns the value of attribute colorize_log. attr_accessor colorize_log: untyped end # # Represents a attachment file. class Attachment < Discorb::DiscordModel def initialize: (untyped data) -> void # _@return_ — The file content. attr_reader io: untyped # _@return_ — The attachment id. attr_reader id: Discorb::Snowflake # _@return_ — The attachment filename. attr_reader filename: String # _@return_ — The attachment content type. attr_reader content_type: String # _@return_ — The attachment size in bytes. attr_reader size: Integer # _@return_ — The attachment url. attr_reader url: String # _@return_ — The attachment proxy url. attr_reader proxy_url: String # _@return_ — The image height. # # _@return_ — If the attachment is not an image. attr_reader height: Integer? # _@return_ — The image width. # # _@return_ — If the attachment is not an image. attr_reader width: Integer? # _@return_ — whether the file is an image. attr_reader image?: bool end # # Represents a file to send as an attachment. class File def initialize: (untyped io, ?untyped filename, ?content_type: untyped) -> void # _@return_ — The IO of the file. attr_accessor io: untyped # _@return_ — The filename of the file. If not set, path or object_id of the IO is used. attr_accessor filename: String # _@return_ — The content type of the file. If not set, it is guessed from the filename. attr_accessor content_type: String end # # Represents a flag. # @abstract class Flag # Initialize the flag. # # _@param_ `value` — The value of the flag. # # _@note_ — This is usually called by the subclass. 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_ `other` — The other flag. # # _@return_ — The union of the two flags. def |: (Discorb::Flag other) -> Discorb::Flag # Subtraction of two flags. # # _@param_ `other` — The other flag. # # _@return_ — The subtraction of the two flags. def -: (Discorb::Flag other) -> Discorb::Flag # Intersection of two flags. # # _@param_ `other` — The other flag. # # _@return_ — The intersection of the two flags. def &: (Discorb::Flag other) -> Discorb::Flag # XOR of two flags. # # _@param_ `other` — The other flag. # # _@return_ — The XOR of the two flags. def ^: (Discorb::Flag other) -> Discorb::Flag # # Negation of the flag. # # # # _@return_ — The negation of the flag. # def ~@: () -> Discorb::Flag # Max value of the flag. # # _@return_ — the max value of the flag. def self.max_value: () -> Integer # _@return_ — the values of the flag. attr_reader values: ::Hash[Symbol, bool] # _@return_ — the value of the flag. attr_reader value: Integer end # # A class to handle http requests. # @private class HTTP def initialize: (untyped client) -> void # Execute a GET request. # # _@param_ `path` — The path to the resource. # # _@param_ `headers` — The headers to send with the request. # # _@param_ `audit_log_reason` — The audit log reason to send with the request. # # _@param_ `kwargs` — The keyword arguments. # # _@return_ — The response and as JSON. # # _@return_ — The response was 204. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. def get: ( String path, ?headers: ::Hash[untyped, untyped]?, ?audit_log_reason: String?, **::Hash[untyped, untyped] kwargs ) -> [Net::HTTPResponse, ::Hash[untyped, untyped]] # Execute a POST request. # # _@param_ `path` — The path to the resource. # # _@param_ `body` — The body of the request. # # _@param_ `headers` — The headers to send with the request. # # _@param_ `audit_log_reason` — The audit log reason to send with the request. # # _@param_ `kwargs` — The keyword arguments. # # _@return_ — The response and as JSON. # # _@return_ — The response was 204. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. def post: ( String path, ?(String | ::Hash[untyped, untyped]) body, ?headers: ::Hash[untyped, untyped]?, ?audit_log_reason: String?, **::Hash[untyped, untyped] kwargs ) -> [Net::HTTPResponse, ::Hash[untyped, untyped]] # Execute a PATCH request. # # _@param_ `path` — The path to the resource. # # _@param_ `body` — The body of the request. # # _@param_ `headers` — The headers to send with the request. # # _@param_ `audit_log_reason` — The audit log reason to send with the request. # # _@param_ `kwargs` — The keyword arguments. # # _@return_ — The response and as JSON. # # _@return_ — The response was 204. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. def patch: ( String path, ?(String | ::Hash[untyped, untyped]) body, ?headers: ::Hash[untyped, untyped]?, ?audit_log_reason: String?, **::Hash[untyped, untyped] kwargs ) -> [Net::HTTPResponse, ::Hash[untyped, untyped]] # Execute a PUT request. # # _@param_ `path` — The path to the resource. # # _@param_ `body` — The body of the request. # # _@param_ `headers` — The headers to send with the request. # # _@param_ `audit_log_reason` — The audit log reason to send with the request. # # _@param_ `kwargs` — The keyword arguments. # # _@return_ — The response and as JSON. # # _@return_ — The response was 204. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. def put: ( String path, ?(String | ::Hash[untyped, untyped]) body, ?headers: ::Hash[untyped, untyped]?, ?audit_log_reason: String?, **::Hash[untyped, untyped] kwargs ) -> [Net::HTTPResponse, ::Hash[untyped, untyped]] # Execute a DELETE request. # # _@param_ `path` — The path to the resource. # # _@param_ `headers` — The headers to send with the request. # # _@param_ `audit_log_reason` — The audit log reason to send with the request. # # _@param_ `kwargs` — The keyword arguments. # # _@return_ — The response and as JSON. # # _@return_ — The response was 204. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. def delete: ( String path, ?headers: ::Hash[untyped, untyped]?, ?audit_log_reason: String?, **::Hash[untyped, untyped] kwargs ) -> [Net::HTTPResponse, ::Hash[untyped, untyped]] def inspect: () -> untyped # A helper method to send multipart/form-data requests. # # _@param_ `payload` — The payload to send. # # _@param_ `files` — The files to send. # # _@return_ — The boundary and body. def self.multipart: (::Hash[untyped, untyped] payload, ::Array[Discorb::File] files) -> [String, String] def test_error: (untyped ary) -> untyped def get_headers: (untyped headers, ?untyped body, ?untyped audit_log_reason) -> untyped def get_body: (untyped body) -> untyped def get_path: (untyped path) -> untyped def get_response_data: (untyped resp) -> untyped def http: () -> untyped def recr_utf8: (untyped data) -> untyped end # # Represents a role in the guild. class Role < Discorb::DiscordModel include Comparable def initialize: (untyped client, untyped guild, untyped data) -> void # Compares two roles by their position. # # _@param_ `other` — The role to compare to. # # _@return_ — -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_ — The formatted string. def to_s: () -> String def mention: () -> untyped def color?: () -> bool def inspect: () -> untyped # Moves the role to a new position. # # _@param_ `position` — The new position. # # _@param_ `reason` — The reason for moving the role. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def move: (Integer position, ?reason: String?) -> untyped # Edits the role. # # _@param_ `name` — The new name of the role. # # _@param_ `position` — The new position of the role. # # _@param_ `color` — The new color of the role. # # _@param_ `hoist` — Whether the role should be hoisted. # # _@param_ `mentionable` — Whether the role should be mentionable. # # _@param_ `reason` — The reason for editing the role. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. # # _@note_ — The arguments of this method are defaultly set to `:unset`. Specify value to set the value, if not don't specify or specify `:unset`. def edit: ( ?name: String, ?position: Integer, ?color: Discorb::Color, ?hoist: bool, ?mentionable: bool, ?reason: String? ) -> untyped # Deletes the role. # # _@param_ `reason` — The reason for deleting the role. def delete!: (?reason: String?) -> untyped def tag: () -> untyped def _set_data: (untyped data) -> untyped # _@return_ — The ID of the role. attr_reader id: Discorb::Snowflake # _@return_ — The name of the role. attr_reader name: String # _@return_ — The color of the role. attr_reader color: Discorb::Color # _@return_ — The permissions of the role. attr_reader permissions: Discorb::Permission # _@return_ — The position of the role. attr_reader position: Integer # _@return_ — The guild this role belongs to. attr_reader guild: Discorb::Guild # _@return_ — Whether the role is hoisted. attr_reader hoist: bool # _@return_ — Whether the role is managed. attr_reader managed: bool # _@return_ — Whether the role is a default role. attr_reader mentionable: bool # # Represents a tag of a role. class Tag < Discorb::DiscordModel def initialize: (untyped data) -> void # _@return_ — The ID of the bot that owns the role. attr_reader bot_id: Discorb::Snowflake # _@return_ — The ID of the integration. attr_reader integration_id: Discorb::Snowflake # _@return_ — Whether the tag is a premium subscriber role. attr_reader premium_subscriber: bool # _@return_ — Whether the role is a bot role. attr_reader bot?: bool # _@return_ — 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 def initialize: (untyped client, untyped data) -> void # Format the user as `Username#Discriminator` style. # # _@return_ — The formatted username. def to_s: () -> String def inspect: () -> untyped # Whether the user is a owner of the client. # # _@param_ `strict` — Whether don't allow if the user is a member of the team. # # _@return_ — Whether the user is a owner of the client. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def bot_owner?: (?strict: bool) -> Async::Task[bool] def channel_id: () -> untyped def _set_data: (untyped data) -> untyped # Post a message to the channel. # # _@param_ `content` — The message content. # # _@param_ `tts` — Whether the message is tts. # # _@param_ `embed` — The embed to send. # # _@param_ `embeds` — The embeds to send. # # _@param_ `allowed_mentions` — The allowed mentions. # # _@param_ `reference` — The message to reply to. # # _@param_ `components` — The components to send. # # _@param_ `file` — The file to send. # # _@param_ `files` — The files to send. # # _@return_ — The message sent. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def post: ( ?String? content, ?tts: bool, ?embed: Discorb::Embed?, ?embeds: ::Array[Discorb::Embed]?, ?allowed_mentions: Discorb::AllowedMentions?, ?reference: (Discorb::Message | Discorb::Message::Reference)?, ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?, ?file: Discorb::File?, ?files: ::Array[Discorb::File]? ) -> Async::Task[Discorb::Message] # Edit a message. # # _@param_ `message_id` — The message id. # # _@param_ `content` — The message content. # # _@param_ `embed` — The embed to send. # # _@param_ `embeds` — The embeds to send. # # _@param_ `allowed_mentions` — The allowed mentions. # # _@param_ `components` — The components to send. # # _@param_ `supress` — Whether to supress embeds. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def edit_message: ( _SnowflakeLike message_id, ?String? content, ?embed: Discorb::Embed?, ?embeds: ::Array[Discorb::Embed]?, ?allowed_mentions: Discorb::AllowedMentions?, ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?, ?supress: bool? ) -> untyped # Delete a message. # # _@param_ `message_id` — The message id. # # _@param_ `reason` — The reason for deleting the message. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def delete_message!: (_SnowflakeLike message_id, ?reason: String?) -> untyped # Fetch a message from ID. # # _@param_ `id` — The ID of the message. # # _@return_ — The message. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_message: (Discorb::Snowflake id) -> Async::Task[Discorb::Message] # Fetch a message history. # # _@param_ `limit` — The number of messages to fetch. # # _@param_ `before` — The ID of the message to fetch before. # # _@param_ `after` — The ID of the message to fetch after. # # _@param_ `around` — The ID of the message to fetch around. # # _@return_ — The messages. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_messages: ( ?Integer limit, ?before: Discorb::Snowflake?, ?after: Discorb::Snowflake?, ?around: Discorb::Snowflake? ) -> Async::Task[::Array[Discorb::Message]] # Trigger the typing indicator in the channel. # If block is given, trigger typing indicator during executing block. # # ```ruby # channel.typing do # channel.post("Waiting for 60 seconds...") # sleep 60 # channel.post("Done!") # end # ``` # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def typing: () -> untyped # _@return_ — Whether the user is verified. attr_reader verified: bool # _@return_ — The user's username. attr_reader username: String # _@return_ — The user's ID. attr_reader id: Discorb::Snowflake # _@return_ — The user's flags. attr_reader flag: Discorb::User::Flag # _@return_ — The user's discriminator. attr_reader discriminator: String # _@return_ — The user's avatar. attr_reader avatar: Discorb::Asset # _@return_ — Whether the user is a bot. attr_reader bot: bool # _@return_ — The time the user was created. attr_reader created_at: Time # # 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. # # _@param_ `name` — The new username. # # _@param_ `avatar` — The new avatar. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. # # _@note_ — The arguments of this method are defaultly set to `:unset`. Specify value to set the value, if not don't specify or specify `:unset`. def edit: (?name: String, ?avatar: Discorb::Image) -> untyped end # # Represents a single asset. class Asset < Discorb::DiscordModel def initialize: (untyped target, untyped hash, ?path: untyped) -> void # URL of the asset. # # _@param_ `image_format` — The image format. # # _@param_ `size` — The size of the image. # # _@return_ — URL of the asset. def url: (?image_format: String?, ?size: Integer) -> String def inspect: () -> untyped def endpoint: () -> untyped # _@return_ — The hash of asset. attr_reader hash: String # _@return_ — Whether the asset is animated. attr_reader animated?: bool end # # Represents a default avatar. class DefaultAvatar < Discorb::DiscordModel def initialize: (untyped discriminator) -> void # Returns the URL of the avatar. # # _@param_ `image_format` — The image format. This is compatible with {Asset#url}, will be ignored. # # _@param_ `size` — The size of the image. This is compatible with {Asset#url}, will be ignored. # # _@return_ — URL of the avatar. def url: (?image_format: String?, ?size: Integer) -> String def inspect: () -> untyped # _@return_ — For compatibility with {Asset}, always `false`. attr_reader animated?: bool end # # Represents RGB color. class Color # Create a color from a Integer. # # _@param_ `value` — A color value. def initialize: (Integer value) -> void # Integerize a color. # # _@return_ — A color value. def to_i: () -> Integer # Convert a color to a hexadecimal value. # # _@return_ — A hexadecimal value. def to_hex: () -> String # Convert a color to RGB array. # # _@return_ — A RGB array. def to_rgb: () -> [Integer, Integer, Integer] # Convert a color to RGB hash. # # _@return_ — A RGB hash. def to_rgb_hash: () -> Hash[:r | :g | :b, Integer] # Converts a color to a `#000000` string. # # _@return_ — Converted string. def to_s: () -> String def inspect: () -> untyped # Create a color from a hexadecimal string. # # _@param_ `hex` — A hexadecimal string. # # _@return_ — A color object. def self.from_hex: (String hex) -> Discorb::Color # Create a color from a RGB array. # # _@param_ `red` — A red value. # # _@param_ `green` — A green value. # # _@param_ `blue` — A blue value. # # _@return_ — 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: # - teal (0x1abc9c) # - dark_teal (0x11806a) # - green (0x2ecc71) # - dark_green (0x1f8b4c) # - blue (0x3498db) # - dark_blue (0x206694) # - purple (0x9b59b6) # - dark_purple (0x71368a) # - magenta (0xe91e63) # - dark_magenta (0xad1457) # - gold (0xf1c40f) # - dark_gold (0xc27c0e) # - orange (0xe67e22) # - dark_orange (0xa84300) # - red (0xe74c3c) # - dark_red (0x992d22) # - lighter_grey (0x95a5a6) # - lighter_gray (0x95a5a6) # - dark_grey (0x607d8b) # - dark_gray (0x607d8b) # - light_grey (0x979c9f) # - light_gray (0x979c9f) # - darker_grey (0x546e7a) # - darker_gray (0x546e7a) # - og_blurple (0x7289da) # - blurple (0x5865f2) # - greyple (0x99aab5) # - dark_theme (0x36393f) # - fuchsia (0xeb459e) # # _@param_ `color` — A Discord color name. # # _@return_ — 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_ `title` — The title of embed. # # _@param_ `description` — The description of embed. # # _@param_ `color` — The color of embed. # # _@param_ `url` — The url of embed. # # _@param_ `timestamp` — The timestamp of embed. # # _@param_ `author` — The author field of embed. # # _@param_ `fields` — The fields of embed. # # _@param_ `footer` — The footer of embed. # # _@param_ `image` — The image of embed. # # _@param_ `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)?, ?data: untyped ) -> void # Convert embed to hash. # # _@return_ — Converted embed. # # _@see_ `https://discord.com/developers/docs/resources/channel#embed-object-embed-structure` — Offical Discord API Docs def to_hash: () -> ::Hash[untyped, untyped] # _@return_ — The title of embed. attr_accessor title: String? # _@return_ — The description of embed. attr_accessor description: String? # _@return_ — The url of embed. attr_accessor url: String? # _@return_ — The timestamp of embed. attr_accessor timestamp: Time? # _@return_ — The color of embed. attr_accessor color: Discorb::Color? # _@return_ — The author of embed. attr_accessor author: Discorb::Embed::Author? # _@return_ — The fields of embed. attr_accessor fields: ::Array[Discorb::Embed::Field] # _@return_ — The footer of embed. attr_accessor footer: Discorb::Embed::Footer? # _@return_ — The type of embed. attr_reader type: Symbol # _@return_ — The image of embed. attr_accessor image: Discorb::Embed::Image # _@return_ — The thumbnail of embed. attr_accessor thumbnail: Discorb::Embed::Thumbnail # # Represents an author of embed. class Author # Initialize a new Author object. # # _@param_ `name` — The name of author. # # _@param_ `url` — The url of author. # # _@param_ `icon` — The icon url of author. def initialize: (String name, ?url: String?, ?icon: String?) -> void # Convert author to hash. # # _@return_ — Converted author. # # _@see_ `https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure` — Offical Discord API Docs def to_hash: () -> ::Hash[untyped, untyped] # _@return_ — The name of author. attr_accessor name: String # _@return_ — The url of author. attr_accessor url: String? # _@return_ — The icon url of author. attr_accessor icon: String? end # # Represemts a footer of embed. class Footer # Initialize a new Footer object. # # _@param_ `text` — The text of footer. # # _@param_ `icon` — The icon url of footer. def initialize: (String text, ?icon: String?) -> void # Convert footer to hash. # # _@return_ — Converted footer. # # _@see_ `https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure` — Offical Discord API Docs 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 # Initialize a new Field object. # # _@param_ `name` — The name of field. # # _@param_ `value` — The value of field. # # _@param_ `inline` — Whether the field is inline. def initialize: (String name, String value, ?inline: bool) -> void # Convert field to hash. # # _@return_ — Converted field. # # _@see_ `https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure` — Offical Discord API Docs def to_hash: () -> ::Hash[untyped, untyped] # _@return_ — The name of field. attr_accessor name: String # _@return_ — The value of field. attr_accessor value: String # _@return_ — Whether the field is inline. attr_accessor inline: bool end # # Represents an image of embed. class Image # Initialize a new Image object. # # _@param_ `url` — URL of image. def initialize: (String url) -> void # Convert image to hash for sending. # # _@return_ — Converted image. # # _@see_ `https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure` — Offical Discord API Docs def to_hash: () -> ::Hash[untyped, untyped] # _@return_ — The url of image. attr_accessor url: String # _@return_ — The proxy url of image. # # _@return_ — The Image object wasn't created from gateway. attr_reader proxy_url: String? # _@return_ — The height of image. # # _@return_ — The Image object wasn't created from gateway. attr_reader height: Integer? # _@return_ — The width of image. # # _@return_ — The Image object wasn't created from gateway. attr_reader width: Integer? end # # Represents a thumbnail of embed. class Thumbnail # Initialize a new Thumbnail object. # # _@param_ `url` — URL of thumbnail. def initialize: (String url) -> void # Convert thumbnail to hash for sending. # # _@return_ — Converted thumbnail. # # _@see_ `https://discord.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure` — Offical Discord API Docs def to_hash: () -> ::Hash[untyped, untyped] # _@return_ — The url of thumbnail. attr_accessor url: String # _@return_ — The proxy url of thumbnail. # # _@return_ — The Thumbnail object wasn't created from gateway. attr_reader proxy_url: String? # _@return_ — The height of thumbnail. # # _@return_ — The Thumbnail object wasn't created from gateway. attr_reader height: Integer? # _@return_ — The width of thumbnail. # # _@return_ — The Thumbnail object wasn't created from gateway. attr_reader width: Integer? end # # Represents a video of embed. class Video def initialize: (untyped data) -> void # _@return_ — The url of video. attr_reader url: String # _@return_ — The proxy url of video. attr_reader proxy_url: String # _@return_ — The height of video. attr_reader height: Integer # _@return_ — The width of video. attr_reader width: Integer end # # Represents a provider of embed. class Provider def initialize: (untyped data) -> void # _@return_ — The name of provider. attr_reader name: String # _@return_ — 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 end # Represents a custom emoji in discord. class CustomEmoji < Discorb::Emoji def initialize: (untyped client, untyped guild, untyped data) -> void # Format the emoji for sending. # # _@return_ — the formatted emoji. def to_s: () -> String # Format the emoji for URI. # # _@return_ — the formatted emoji. def to_uri: () -> String def inspect: () -> untyped # Edit the emoji. # # _@param_ `name` — The new name of the emoji. # # _@param_ `roles` — The new roles that can use this emoji. # # _@param_ `reason` — The reason for editing the emoji. # # _@return_ — The edited emoji. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. # # _@note_ — The arguments of this method are defaultly set to `:unset`. Specify value to set the value, if not don't specify or specify `:unset`. def edit: (?name: String, ?roles: ::Array[Discorb::Role], ?reason: String?) -> Async::Task[self] # Delete the emoji. # # _@param_ `reason` — The reason for deleting the emoji. # # _@return_ — The deleted emoji. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def delete!: (?reason: String?) -> Async::Task[self] def _set_data: (untyped data) -> untyped # _@return_ — The ID of the emoji. attr_reader id: Discorb::Snowflake # _@return_ — The name of the emoji. attr_reader name: String # _@return_ — The roles that can use this emoji. attr_reader roles: ::Array[Discorb::Role] # _@return_ — The user that created this emoji. attr_reader user: Discorb::User # _@return_ — Whether the emoji requires colons. attr_reader guild: bool # _@return_ — whether the emoji is managed by integration (ex: Twitch). attr_reader managed: bool # _@return_ — whether the emoji requires colons. attr_reader require_colons: bool # _@return_ — whether the emoji is available. attr_reader available: bool # _@return_ — 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 def initialize: (untyped data) -> void # Format the emoji for URI. # # _@return_ — the formatted emoji. def to_uri: () -> String def inspect: () -> untyped # Format the emoji for sending. # # _@return_ — the formatted emoji. def to_s: () -> String # _@return_ — The ID of the emoji. attr_reader id: Discorb::Snowflake # _@return_ — The name of the emoji. attr_reader name: String # _@return_ — Whether the emoji is deleted. attr_reader deleted: bool end # # Represents a unicode emoji (default emoji) in discord. class UnicodeEmoji < Discorb::Emoji def initialize: (untyped name, ?tone: untyped) -> void # _@return_ — The unicode string of the emoji. def to_s: () -> String # Format the emoji for URI. # # _@return_ — the formatted emoji. def to_uri: () -> String def inspect: () -> untyped # _@return_ — The name of the emoji. (e.g. :grinning:) attr_reader name: String # _@return_ — The unicode value of the emoji. (e.g. U+1F600) attr_reader value: String # _@return_ — 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 def initialize: (untyped resp, untyped data) -> void # _@return_ — the HTTP response code. attr_reader code: String # _@return_ — the HTTP response. attr_reader response: Net::HTTPResponse end # # Represents a 400 error. class BadRequestError < Discorb::HTTPError def initialize: (untyped resp, untyped data) -> void 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 a event. # This class shouldn't be instantiated directly. # Use {Client#on} instead. class Event def initialize: (untyped block, untyped id, untyped metadata) -> void # Calls the block associated with the event. def call: () -> untyped # _@return_ — the block to be called. attr_reader block: Proc # _@return_ — the event id. attr_reader id: Symbol # _@return_ — the event metadata. attr_reader metadata: ::Hash[untyped, untyped] # _@return_ — whether the event is once or not. attr_reader once: bool end # # Represents a guild in the Discord. class Guild < Discorb::DiscordModel def initialize: (untyped client, untyped data, untyped is_create_event) -> void def update!: () -> untyped def afk_channel: () -> untyped def system_channel: () -> untyped def rules_channel: () -> untyped def public_updates_channel: () -> untyped def inspect: () -> untyped def me: () -> untyped # Leave the guild. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def leave!: () -> untyped # Fetch emoji list of the guild. # # _@return_ — A dictionary of emoji in the guild. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. # # _@note_ — This querys the API every time. We recommend using {#emojis} instead. def fetch_emoji_list: () -> Async::Task[Discorb::Dictionary[Discorb::Snowflake, Discorb::CustomEmoji]] # Fetch emoji id of the guild. # # _@param_ `id` — The emoji id. # # _@return_ — The emoji with the given id. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. # # _@note_ — This querys the API every time. We recommend using {#emojis} instead. def fetch_emoji: (untyped id) -> Async::Task[Discorb::CustomEmoji] # Create a custom emoji. # # _@param_ `name` — The name of the emoji. # # _@param_ `image` — The image of the emoji. # # _@param_ `roles` — A list of roles to give the emoji. # # _@return_ — The created emoji. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def create_emoji: (untyped name, Discorb::Image image, ?roles: ::Array[Discorb::Role]) -> Async::Task[Discorb::CustomEmoji] # Fetch webhooks of the guild. # # _@return_ — A list of webhooks in the guild. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_webhooks: () -> Async::Task[::Array[Discorb::Webhook]] # Fetch audit log of the guild. # # _@return_ — The audit log of the guild. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_audit_log: () -> Async::Task[Discorb::AuditLog] # Fetch channels of the guild. # # _@return_ — A list of channels in the guild. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_channels: () -> Async::Task[::Array[Discorb::Channel]] # Create a new text channel. # # _@param_ `name` — The name of the channel. # # _@param_ `topic` — The topic of the channel. # # _@param_ `rate_limit_per_user` — The rate limit per user in the channel. # # _@param_ `slowmode` — Alias for `rate_limit_per_user`. # # _@param_ `position` — The position of the channel. # # _@param_ `nsfw` — Whether the channel is nsfw. # # _@param_ `permission_overwrites` — A list of permission overwrites. # # _@param_ `parent` — The parent of the channel. # # _@param_ `reason` — The reason for creating the channel. # # _@return_ — The created text channel. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def create_text_channel: ( String name, ?topic: String?, ?rate_limit_per_user: Integer?, ?slowmode: Integer?, ?position: Integer?, ?nsfw: bool?, ?permission_overwrites: Hash[Discorb::Role | Discorb::Member, Discorb::PermissionOverwrite]?, ?parent: Discorb::CategoryChannel?, ?reason: String? ) -> Async::Task[Discorb::TextChannel] # Create a new voice channel. # # _@param_ `name` — The name of the channel. # # _@param_ `bitrate` — The bitrate of the channel. # # _@param_ `user_limit` — The user limit of the channel. # # _@param_ `position` — The position of the channel. # # _@param_ `permission_overwrites` — A list of permission overwrites. # # _@param_ `parent` — The parent of the channel. # # _@param_ `reason` — The reason for creating the channel. # # _@return_ — The created voice channel. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def create_voice_channel: ( String name, ?bitrate: Integer, ?user_limit: Integer?, ?position: Integer?, ?permission_overwrites: Hash[Discorb::Role | Discorb::Member, Discorb::PermissionOverwrite]?, ?parent: Discorb::CategoryChannel?, ?reason: String? ) -> Async::Task[Discorb::VoiceChannel] # Create a new category channel. # # _@param_ `name` — The name of the channel. # # _@param_ `position` — The position of the channel. # # _@param_ `permission_overwrites` — A list of permission overwrites. # # _@param_ `parent` — The parent of the channel. # # _@param_ `reason` — The reason for creating the channel. # # _@return_ — The created category channel. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def create_category_channel: ( String name, ?position: Integer?, ?permission_overwrites: Hash[Discorb::Role | Discorb::Member, Discorb::PermissionOverwrite]?, ?parent: Discorb::CategoryChannel?, ?reason: String? ) -> Async::Task[Discorb::CategoryChannel] # Create a new stage channel. # # _@param_ `name` — The name of the channel. # # _@param_ `bitrate` — The bitrate of the channel. # # _@param_ `position` — The position of the channel. # # _@param_ `permission_overwrites` — A list of permission overwrites. # # _@param_ `parent` — The parent of the channel. # # _@param_ `reason` — The reason for creating the channel. # # _@return_ — The created stage channel. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def create_stage_channel: ( String name, ?bitrate: Integer, ?position: Integer?, ?permission_overwrites: Hash[Discorb::Role | Discorb::Member, Discorb::PermissionOverwrite]?, ?parent: Discorb::CategoryChannel?, ?reason: String? ) -> Async::Task[Discorb::StageChannel] # Create a new news channel. # # _@param_ `name` — The name of the channel. # # _@param_ `topic` — The topic of the channel. # # _@param_ `rate_limit_per_user` — The rate limit per user in the channel. # # _@param_ `slowmode` — Alias for `rate_limit_per_user`. # # _@param_ `position` — The position of the channel. # # _@param_ `nsfw` — Whether the channel is nsfw. # # _@param_ `permission_overwrites` — A list of permission overwrites. # # _@param_ `parent` — The parent of the channel. # # _@param_ `reason` — The reason for creating the channel. # # _@return_ — The created news channel. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def create_news_channel: ( String name, ?topic: String?, ?rate_limit_per_user: Integer?, ?slowmode: Integer?, ?position: Integer?, ?nsfw: bool?, ?permission_overwrites: Hash[Discorb::Role | Discorb::Member, Discorb::PermissionOverwrite]?, ?parent: Discorb::CategoryChannel?, ?reason: String? ) -> Async::Task[Discorb::NewsChannel] # Fetch a list of active threads in the guild. # # _@return_ — The list of threads. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_active_threads: () -> Async::Task[::Array[Discorb::ThreadChannel]] # Fetch a member in the guild. # # _@param_ `id` — The ID of the member to fetch. # # _@return_ — The member. # # _@return_ — If the member is not found. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. # # _@note_ — You must enable `GUILD_MEMBERS` intent to use this method. def fetch_member: (untyped id) -> Async::Task[Discorb::Member] # Search for members by name in the guild. # # _@param_ `name` — The name of the member to search for. # # _@param_ `limit` — The maximum number of members to return. # # _@return_ — The list of members. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_members_named: (String name, ?limit: Integer) -> Async::Task[::Array[Discorb::Member]] # Almost the same as {#fetch_members_named}, but returns a single member. # # _@return_ — The member. # # _@return_ — If the member is not found. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_member_named: () -> Async::Task[Discorb::Member] # Change nickname of client member. # # _@param_ `nickname` — The nickname to set. # # _@param_ `reason` — The reason for changing the nickname. def edit_nickname: (String nickname, ?reason: String?) -> untyped # Kick a member from the guild. # # _@param_ `member` — The member to kick. # # _@param_ `reason` — The reason for kicking the member. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def kick_member: (Discorb::Member member, ?reason: String?) -> untyped # Fetch a list of bans in the guild. # # _@return_ — The list of bans. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_bans: () -> Async::Task[::Array[Discorb::Guild::Ban]] # Fetch a ban in the guild. # # _@param_ `user` — The user to fetch. # # _@return_ — The ban. # # _@return_ — If the ban is not found. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_ban: (Discorb::User user) -> Async::Task[Discorb::Guild::Ban] # Checks the user was banned from the guild. # # _@param_ `user` — The user to check. # # _@return_ — Whether the user was banned. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def banned?: (Discorb::User user) -> Async::Task[bool] # Ban a member from the guild. # # _@param_ `member` — The member to ban. # # _@param_ `delete_message_days` — The number of days to delete messages. # # _@param_ `reason` — The reason for banning the member. # # _@return_ — The ban. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def ban_member: (Discorb::Member member, ?delete_message_days: Integer, ?reason: String?) -> Async::Task[Discorb::Guild::Ban] # Unban a user from the guild. # # _@param_ `user` — The user to unban. # # _@param_ `reason` — The reason for unbanning the user. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def unban_user: (Discorb::User user, ?reason: String?) -> untyped # Fetch a list of roles in the guild. # # _@return_ — The list of roles. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_roles: () -> Async::Task[::Array[Discorb::Role]] # Create a role in the guild. # # _@param_ `name` — The name of the role. # # _@param_ `color` — The color of the role. # # _@param_ `hoist` — Whether the role should be hoisted. # # _@param_ `mentionable` — Whether the role should be mentionable. # # _@param_ `reason` — The reason for creating the role. # # _@return_ — The role. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def create_role: ( ?String? name, ?color: Discorb::Color?, ?hoist: bool?, ?mentionable: bool?, ?reason: String? ) -> Async::Task[Discorb::Role] # Fetch how many members will be pruned. # # _@param_ `days` — The number of days to prune. # # _@param_ `roles` — The roles that include for pruning. # # _@return_ — The number of members that will be pruned. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_prune: (?Integer days, ?roles: ::Array[Discorb::Role]) -> Async::Task[Integer] # Prune members from the guild. # # _@param_ `days` — The number of days to prune. # # _@param_ `roles` — The roles that include for pruning. # # _@param_ `reason` — The reason for pruning. # # _@return_ — The number of members that were pruned. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def prune: (?Integer days, ?roles: ::Array[Discorb::Role], ?reason: String?) -> Async::Task[Integer] # Fetch voice regions that are available in the guild. # # _@return_ — The available voice regions. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_voice_regions: () -> Async::Task[::Array[Discorb::VoiceRegion]] # Fetch invites in the guild. # # _@return_ — The invites. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_invites: () -> Async::Task[::Array[Invite]] # Fetch integrations in the guild. # # _@return_ — The integrations. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_integrations: () -> Async::Task[::Array[Discorb::Integration]] # Fetch the widget of the guild. # # _@return_ — The widget. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_widget: () -> Async::Task[Discorb::Guild::Widget] # Fetch the vanity URL of the guild. # # _@return_ — The vanity URL. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_vanity_invite: () -> Async::Task[Discorb::Guild::VanityInvite] # Fetch the welcome screen of the guild. # # _@return_ — The welcome screen. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_welcome_screen: () -> Async::Task[Discorb::Guild::WelcomeScreen] # Fetch stickers in the guild. # # _@return_ — The stickers. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_stickers: () -> Async::Task[::Array[Discorb::Sticker::GuildSticker]] # Fetch the sticker by ID. # # _@param_ `id` — The ID of the sticker. # # _@return_ — The sticker. # # _@return_ — If the sticker does not exist. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_sticker: (untyped id) -> Async::Task[Discorb::Sticker::GuildSticker] # Fetch templates in the guild. # # _@return_ — The templates. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_templates: () -> Async::Task[Discorb::GuildTemplate] # Almost the same as {#fetch_templates}, but returns a single template. # # _@return_ — The template. # # _@return_ — If the template does not exist. def fetch_template: () -> Discorb::GuildTemplate # Create a new template in the guild. # # _@param_ `name` — The name of the template. # # _@param_ `description` — The description of the template. # # _@param_ `reason` — The reason for creating the template. # # _@return_ — The template. def create_template: (String name, ?String? description, ?reason: String?) -> Async::Task[Discorb::GuildTemplate] # Returns a banner url from the guild's ID. # # _@param_ `guild_id` — The ID of the guild. # # _@param_ `style` — The style of the banner. # # _@return_ — The url of the banner. def self.banner: (_SnowflakeLike guild_id, ?style: Symbol) -> String def _set_data: (untyped data, untyped is_create_event) -> untyped # _@return_ — ID of the guild. attr_reader id: Discorb::Snowflake # _@return_ — The name of the guild. attr_reader name: String # _@return_ — The splash of the guild. attr_reader splash: Discorb::Asset # _@return_ — The discovery splash of the guild. attr_reader discovery_splash: Discorb::Asset # _@return_ — ID of the guild owner. attr_reader owner_id: Discorb::Snowflake # _@return_ — The bot's permission in the guild. attr_reader permissions: Discorb::Permission # _@return_ — The AFK timeout of the guild. attr_reader afk_timeout: Integer # _@return_ — A dictionary of roles in the guild. attr_reader roles: Discorb::Dictionary[Discorb::Snowflake, Discorb::Role] # _@return_ — A dictionary of custom emojis in the guild. attr_reader emojis: Discorb::Dictionary[Discorb::Snowflake, Discorb::CustomEmoji] # _@return_ — features that are enabled in the guild. # # _@see_ `https://discord.com/developers/docs/resources/guild#guild-object-guild-features` — Official Discord API docs attr_reader features: ::Array[Symbol] # _@return_ — The MFA level of the guild. attr_reader mfa_level: Symbol # _@return_ — The flag for the system channel. attr_reader system_channel_flags: Discorb::Guild::SystemChannelFlag # _@return_ — Time that representing when bot has joined the guild. attr_reader joined_at: Time # _@return_ — Whether the guild is unavailable. attr_reader unavailable: bool # _@return_ — The amount of members in the guild. attr_reader member_count: Integer # _@return_ — The icon of the guild. attr_reader icon: Discorb::Asset # _@return_ — A dictionary of voice states in the guild. attr_reader voice_states: Discorb::Dictionary[Discorb::User, Discorb::VoiceState] # _@return_ — A dictionary of members in the guild. # # _@note_ — You must enable `GUILD_MEMBERS` intent to use this method. attr_reader members: Discorb::Dictionary[Discorb::Snowflake, Discorb::Member] # _@return_ — A dictionary of channels in the guild. attr_reader channels: Discorb::Dictionary[Discorb::Snowflake, Discorb::GuildChannel] # _@return_ — A dictionary of threads in the guild. attr_reader threads: Discorb::Dictionary[Discorb::Snowflake, Discorb::ThreadChannel] # _@return_ — A dictionary of presence in the guild. attr_reader presences: Discorb::Dictionary[Discorb::User, Discorb::Presence] # _@return_ — Number of online members in the guild. attr_reader max_presences: Integer # _@return_ — The vanity invite URL for the guild. # # _@return_ — If the guild does not have a vanity invite URL. attr_reader vanity_url_code: String? # _@return_ — The description of the guild. attr_reader description: String # _@return_ — The banner of the guild. # # _@return_ — If the guild does not have a banner. attr_reader banner: Discorb::Asset? # _@return_ — The premium tier (Boost Level) of the guild. attr_reader premium_tier: Integer # _@return_ — The amount of premium subscriptions (Server Boosts) the guild has. attr_reader premium_subscription_count: Integer # _@return_ — The preffered language of the guild. # # _@note_ — This modifies the language code, `-` will be replaced with `_`. attr_reader preferred_locale: Symbol # _@return_ — The maximum amount of users in a video channel. attr_reader max_video_channel_users: Integer # _@return_ — The approxmate amount of members in the guild. attr_reader approximate_member_count: Integer # _@return_ — The approxmate amount of non-offline members in the guild. attr_reader approximate_presence_count: Integer # _@return_ — The welcome screen of the guild. attr_reader welcome_screen: Discorb::WelcomeScreen # _@return_ — The nsfw level of the guild. attr_reader nsfw_level: Symbol # _@return_ — A dictionary of stage instances in the guild. attr_reader stage_instances: Discorb::Dictionary[Discorb::Snowflake, Discorb::StageInstance] # _@return_ — The verification level of the guild. attr_reader verification_level: Symbol # _@return_ — The default message notification level of the guild. attr_reader default_message_notifications: Symbol # _@return_ — The explict content filter level of the guild. attr_reader explicit_content_filter: Symbol # _@return_ — Whether the client is the owner of the guild. attr_reader owner: bool # _@return_ — Whether the guild is large. attr_reader large: bool # _@return_ — Whether the guild enabled the widget. attr_reader widget_enabled: bool # _@return_ — Whether the guild is available. attr_reader available: bool # # Represents a vanity invite. class VanityInvite < Discorb::DiscordModel def initialize: (untyped client, untyped guild, untyped data) -> void # _@return_ — The vanity invite code. attr_reader code: String # _@return_ — The number of uses. attr_reader uses: Integer # _@return_ — The vanity URL. attr_reader url: String end # # Represents a guild widget. class Widget < Discorb::DiscordModel def initialize: (untyped client, _SnowflakeLike guild_id, untyped data) -> void # Edit the widget. # # _@param_ `enabled` — Whether the widget is enabled. # # _@param_ `channel` — The channel. # # _@param_ `reason` — The reason for editing the widget. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. # # _@note_ — The arguments of this method are defaultly set to `:unset`. Specify value to set the value, if not don't specify or specify `:unset`. def edit: (?enabled: bool?, ?channel: Discorb::GuildChannel?, ?reason: String?) -> untyped # Return iframe HTML of the widget. # # _@param_ `theme` — The theme of the widget. # # _@param_ `width` — The width of the widget. # # _@param_ `height` — The height of the widget. # # _@return_ — The iframe HTML. def iframe: (?theme: ("dark" | "light"), ?width: Integer, ?height: Integer) -> String # _@return_ — The guild ID. attr_reader guild_id: Discorb::Snowflake # _@return_ — The channel ID. attr_reader channel_id: Discorb::Snowflake # _@return_ — Whether the widget is enabled. attr_reader enabled: bool # _@return_ — The object wasn't cached. # # _@return_ — The channel. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader channel: Discorb::Channel? # _@return_ — The object wasn't cached. # # _@return_ — The guild. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader guild: Discorb::Guild? # _@return_ — The JSON URL. attr_reader json_url: String end # # Represents a ban. class Ban < Discorb::DiscordModel def initialize: (untyped client, untyped guild, untyped data) -> void # _@return_ — The user. attr_reader user: Discorb::User # _@return_ — The reason for the ban. attr_reader reason: String end end # # Represents a system channel flag. # ## Flag fields # |Field|Value| # |-|-| # |`1 << 0`|`:member_join`| # |`1 << 1`|`:server_boost`| # |`1 << 2`|`:setup_tips`| class SystemChannelFlag < Discorb::Flag end # # Represents a welcome screen. class WelcomeScreen < Discorb::DiscordModel def initialize: (untyped client, untyped guild, untyped data) -> void # _@return_ — The description of the welcome screen. attr_reader description: String # _@return_ — The channels to display the welcome screen. attr_reader channels: ::Array[Discorb::WelcomeScreen::Channel] # _@return_ — The guild the welcome screen belongs to. attr_reader guild: Discorb::Guild # # Represents a channel to display the welcome screen. class Channel < Discorb::DiscordModel # Initialize a new welcome screen channel. # # _@param_ `channel` — The channel to display the welcome screen. # # _@param_ `description` — The channel's name. # # _@param_ `emoji` — The emoji to display. def initialize: (Discorb::TextChannel channel, String description, Discorb::Emoji emoji) -> void # Converts the channel to a hash. # # _@return_ — The hash. # # _@see_ `https://discord.com/developers/docs/resources/guild#welcome-screen-object` def to_hash: () -> ::Hash[untyped, untyped] # Edits the welcome screen. # # _@param_ `enabled` — Whether the welcome screen is enabled. # # _@param_ `channels` — The channels to display the welcome screen. # # _@param_ `description` — The description of the welcome screen. # # _@param_ `reason` — The reason for editing the welcome screen. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. # # _@note_ — The arguments of this method are defaultly set to `:unset`. Specify value to set the value, if not don't specify or specify `:unset`. def edit: ( ?enabled: bool, ?channels: ::Array[Discorb::WelcomeScreen::Channel], ?description: String, ?reason: String? ) -> untyped # _@return_ — The channel's name. attr_reader description: String # _@return_ — The emoji to display. attr_reader emoji: Discorb::Emoji # _@return_ — The object wasn't cached. # # _@return_ — The channel to display the welcome screen. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader channel: Discorb::Channel? end end # # Represents an image. class Image # Initializes a new Image. # # _@param_ `source` — The IO source or path of the image. # # _@param_ `type` — The MIME type of the image. def initialize: ((untyped | String) source, ?String? _type) -> void # Formats the image as a Discord style. # # _@return_ — The image as a Discord style. def to_s: () -> String end # @private module Utils def try: (untyped object, untyped message) -> untyped def self.try: (untyped object, untyped message) -> untyped end # # Class for connecting to the Discord server. class Client include Discorb::Gateway::Handler include Discorb::ApplicationCommand::Handler # Initializes a new client. # # _@param_ `allowed_mentions` — The allowed mentions that the client is using. # # _@param_ `intents` — The intents that the client is currently using. # # _@param_ `message_caches` — The number of messages to cache. # # _@param_ `log` — The IO object to use for logging. # # _@param_ `colorize_log` — Whether to colorize the log. # # _@param_ `log_level` — The log level. # # _@param_ `wait_until_ready` — Whether to delay event dispatch until ready. def initialize: ( ?allowed_mentions: Discorb::AllowedMentions?, ?intents: Discorb::Intents?, ?message_caches: Integer, ?log: untyped, ?colorize_log: bool, ?log_level: Symbol, ?wait_until_ready: bool ) -> void # Registers an event handler. # # _@param_ `event_name` — The name of the event. # # _@param_ `id` — Custom ID of the event. # # _@param_ `metadata` — The metadata of the event. # # _@param_ `block` — The block to execute when the event is triggered. # # _@return_ — The event. # # _@see_ `file:docs/Events.md` def on: (Symbol event_name, ?id: Symbol?, **::Hash[untyped, untyped] metadata) -> Discorb::Event # Almost same as {#on}, but only triggers the event once. # # _@return_ — The event. def once: (Symbol event_name, ?id: Symbol?, **::Hash[untyped, untyped] metadata) -> Discorb::Event # Remove event by ID. # # _@param_ `event_name` — The name of the event. # # _@param_ `id` — The ID of the event. def remove_event: (Symbol event_name, Symbol id) -> untyped # Dispatch an event. # # _@param_ `event_name` — The name of the event. # # _@param_ `args` — The arguments to pass to the event. def dispatch: (Symbol event_name, *Object args) -> untyped # Fetch user from ID. # # _@param_ `id` — # # _@return_ — The user. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_user: (untyped id) -> Async::Task[Discorb::User] # Fetch channel from ID. # # _@param_ `id` — The ID of the channel. # # _@return_ — The channel. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_channel: (untyped id) -> Async::Task[Discorb::Channel] # Fetch guild from ID. # # _@param_ `id` — # # _@return_ — The guild. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_guild: (untyped id) -> Async::Task[Discorb::Guild] # Fetch invite from code. # # _@param_ `code` — The code of the invite. # # _@param_ `with_count` — Whether to include the count of the invite. # # _@param_ `with_expiration` — Whether to include the expiration of the invite. # # _@return_ — The invite. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_invite: (String code, ?with_count: bool, ?with_expiration: bool) -> Async::Task[Discorb::Invite] # Fetch webhook from ID. # If application was cached, it will be used. # # _@param_ `force` — Whether to force the fetch. # # _@return_ — The application. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_application: (?force: bool) -> Async::Task[Discorb::Application] # Fetch nitro sticker pack from ID. # # _@return_ — The packs. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_nitro_sticker_packs: () -> Async::Task[::Array[Discorb::Sticker::Pack]] # Update presence of the client. # # _@param_ `activity` — The activity to update. # # _@param_ `status` — The status to update. def update_presence: (?Discorb::Activity? activity, ?status: Symbol?) -> untyped # Method to wait for a event. # # _@param_ `event` — The name of the event. # # _@param_ `timeout` — The timeout in seconds. # # _@param_ `check` — The check to use. # # _@return_ — The result of the event. def event_lock: (Symbol event, ?Integer? timeout) -> Object def inspect: () -> untyped # Load the extension. # # _@param_ `mod` — The extension to load. def extend: (Module mod) -> untyped # Starts the client. # # _@param_ `token` — The token to use. # # _@note_ — This method behavior will change by CLI. # # _@note_ — If the token is nil, you should use `discorb run` with the `-t` or `--token` option. # # _@see_ `file:docs/cli.md` def run: (?String? token) -> untyped # Stops the client. def close!: () -> untyped def start_client: (untyped token) -> untyped # Add new top-level command. # # _@param_ `command_name` — Command name. # # _@param_ `description` — Command description. # # _@param_ `options` — Command options. The key is the option name, the value is a hash with the following keys: | Key | Type | Description | | --- | --- | --- | | `:description` | `String` | Description of the option. | | `:optional` | `Boolean` | Whether the option is optional or not. | | `:type` | `Object` | Type of the option. | | `:choice` | `Hash{String => String, Integer, Float}` | Type of the option. | # # _@param_ `guild_ids` — Guild IDs to set the command to. `false` to global command, `nil` to use default. # # _@param_ `block` — Command block. # # _@see_ `file:docs/application_command.md#register-slash-command` # # _@see_ `file:docs/cli/setup.md` def slash: ( String command_name, String description, ?::Hash[String, Hash[:description | :optional | :type, Object]] options, ?guild_ids: (::Array[untyped] | bool)? ) -> Discorb::ApplicationCommand::Command::SlashCommand # Add new command with group. # # _@param_ `command_name` — Command name. # # _@param_ `description` — Command description. # # _@param_ `guild_ids` — Guild IDs to set the command to. `false` to global command, `nil` to use default. # # _@return_ — Command object. # # _@see_ `file:docs/slash_command.md` # # _@see_ `file:docs/cli/setup.md` def slash_group: (String command_name, String description, ?guild_ids: (::Array[untyped] | bool)?) -> Discorb::ApplicationCommand::Command::GroupCommand # Add message context menu command. # # _@param_ `command_name` — Command name. # # _@param_ `guild_ids` — Guild IDs to set the command to. `false` to global command, `nil` to use default. # # _@param_ `block` — Command block. # # _@return_ — Command object. def message_command: (String command_name, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::ApplicationCommandInteraction::UserMenuCommand interaction, Discorb::Message message) -> void } -> Discorb::ApplicationCommand::Command # Add user context menu command. # # _@param_ `command_name` — Command name. # # _@param_ `guild_ids` — Guild IDs to set the command to. `false` to global command, `nil` to use default. # # _@param_ `block` — Command block. # # _@return_ — Command object. def user_command: (String command_name, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::ApplicationCommandInteraction::UserMenuCommand interaction, Discorb::User user) -> void } -> Discorb::ApplicationCommand::Command # Setup commands. # # _@param_ `token` — Bot token. # # _@param_ `guild_ids` — Guild IDs to use as default. If `false` is given, it will be global command. # # _@note_ — `token` parameter only required if you don't run client. # # _@see_ `Client#initialize` def setup_commands: (?String? token, ?guild_ids: (::Array[untyped] | bool)?) -> untyped def connect_gateway: (untyped first) -> untyped def send_gateway: (untyped opcode, **untyped value) -> untyped def handle_gateway: (untyped payload) -> untyped def handle_heartbeat: (untyped interval) -> untyped def handle_event: (untyped event_name, untyped data) -> untyped # _@return_ — The intents that the client is currently using. attr_accessor intents: Discorb::Intents # _@return_ — The application that the client is using. # # _@return_ — If never fetched application by {#fetch_application}. attr_reader application: Discorb::Application? # _@return_ — The http client. attr_reader http: Discorb::HTTP # _@return_ — The heartbeat interval. attr_reader heartbeat_interval: Integer # _@return_ — The API version of the Discord gateway. # # _@return_ — If not connected to the gateway. attr_reader api_version: Integer? # _@return_ — The token of the client. attr_reader token: String # _@return_ — The allowed mentions that the client is using. attr_reader allowed_mentions: Discorb::AllowedMentions # _@return_ — The client user. attr_reader user: Discorb::ClientUser # _@return_ — A dictionary of guilds. attr_reader guilds: Discorb::Dictionary[Discorb::Snowflake, Discorb::Guild] # _@return_ — A dictionary of users. attr_reader users: Discorb::Dictionary[Discorb::Snowflake, Discorb::User] # _@return_ — A dictionary of channels. attr_reader channels: Discorb::Dictionary[Discorb::Snowflake, Discorb::Channel] # _@return_ — A dictionary of emojis. attr_reader emojis: Discorb::Dictionary[Discorb::Snowflake, Discorb::Emoji] # _@return_ — A dictionary of messages. attr_reader messages: Discorb::Dictionary[Discorb::Snowflake, Discorb::Message] # _@return_ — The logger. attr_reader log: Discorb::Logger # _@return_ — The commands that the client is using. attr_reader commands: ::Array[Discorb::ApplicationCommand::Command] # _@return_ — The ping of the client. # @note This will be calculated from heartbeat and heartbeat_ack. # # _@return_ — If not connected to the gateway. attr_reader ping: Float? # _@return_ — The status of the client. attr_reader status: Symbol # _@return_ — The session ID of connection. attr_reader session_id: Integer attr_reader bottom_commands: untyped end # # @abstract # Represents Discord model. class DiscordModel def eql?: (untyped other) -> bool def ==: (untyped other) -> untyped def inspect: () -> untyped def hash: () -> untyped end # # Represents Snowflake of Discord. # # @see https://discord.com/developers/docs/reference#snowflakes Official Discord API docs class Snowflake < Discorb::DiscordModel def initialize: (untyped value) -> void # Stringify snowflake. # # _@return_ — Stringified snowflake. def to_s: () -> String # Integerize snowflake. # # _@return_ — Integerized snowflake. def to_i: () -> Integer # Compares snowflake with other object. # # _@param_ `other` — Object to compare with. # # _@return_ — True if snowflake is equal to other object. def ==: (untyped other) -> bool # Alias of {#==}. def eql?: (untyped other) -> bool # Return hash of snowflake. def hash: () -> untyped # Timestamp of snowflake. # # _@return_ — Timestamp of snowflake. attr_reader timestamp: Time # Worker ID of snowflake. # # _@return_ — Worker ID of snowflake. attr_reader worker_id: Integer # Process ID of snowflake. # # _@return_ — Process ID of snowflake. attr_reader process_id: Integer # Increment of snowflake. # # _@return_ — Increment of snowflake. attr_reader increment: Integer end # # Represents invite of discord. class Invite < Discorb::DiscordModel def initialize: (untyped client, untyped data, untyped gateway) -> void def channel: () -> untyped def guild: () -> untyped def url: () -> untyped def remain_uses: () -> untyped def temporary?: () -> bool # Delete the invite. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def delete!: (?reason: untyped) -> untyped def _set_data: (untyped data, untyped gateway) -> untyped # _@return_ — The code of invite. attr_reader code: String # _@return_ — The type of invite. attr_reader target_type: Symbol # _@return_ — The user of invite. attr_reader target_user: User # _@return_ — The approximate number of online users of invite. attr_reader approximate_presence_count: Integer # _@return_ — The approximate number of members of invite. attr_reader approximate_member_count: Integer # _@return_ — The time when invite expires. # # _@return_ — The invite never expires. attr_reader expires_at: Time? # _@return_ — The number of uses of invite. # # _@return_ — The invite doesn't have metadata. attr_reader uses: Integer? # _@return_ — The maximum number of uses of invite. # # _@return_ — The invite doesn't have metadata. attr_reader max_uses: Integer? # _@return_ — Duration of invite in seconds. # # _@return_ — The invite doesn't have metadata. attr_reader max_age: Integer? # _@return_ — The time when invite was created. # # _@return_ — The invite doesn't have metadata. attr_reader created_at: Time? end # # Represents a member of a guild. class Member < Discorb::User def initialize: ( untyped client, _SnowflakeLike guild_id, untyped user_data, untyped member_data ) -> void # Format the member to `@name` style. # # _@return_ — The formatted member. def to_s: () -> String # Format the member to `Username#Discriminator` style. # # _@return_ — The formatted member. def to_s_user: () -> String def inspect: () -> untyped # Add a role to the member. # # _@param_ `role` — The role to add. # # _@param_ `reason` — The reason for the action. # # _@note_ — This method calls HTTP request. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. def add_role: (Discorb::Role role, ?reason: String?) -> untyped # Remove a role to the member. # # _@param_ `role` — The role to add. # # _@param_ `reason` — The reason for the action. # # _@note_ — This method calls HTTP request. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. def remove_role: (Discorb::Role role, ?reason: String?) -> untyped # Edit the member. # # _@param_ `nick` — The nickname of the member. # # _@param_ `role` — The roles of the member. # # _@param_ `mute` — Whether the member is muted. # # _@param_ `deaf` — Whether the member is deafened. # # _@param_ `channel` — The channel the member is moved to. # # _@param_ `reason` — The reason for the action. # # _@note_ — This method calls HTTP request. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — The arguments of this method are defaultly set to `:unset`. Specify value to set the value, if not don't specify or specify `:unset`. def edit: ( ?nick: String, ?role: Discorb::Role, ?mute: bool, ?deaf: bool, ?channel: Discorb::StageChannel, ?reason: String? ) -> untyped # Kick the member. # # _@param_ `reason` — The reason for the action. def kick: (?reason: String?) -> untyped # Ban the member. # # _@param_ `delete_message_days` — The number of days to delete messages. # # _@param_ `reason` — The reason for the action. # # _@return_ — The ban. def ban: (?delete_message_days: Integer, ?reason: String?) -> Async::Task[Discorb::Guild::Ban] def _set_data: (untyped user_data, untyped member_data) -> untyped # _@return_ — The time the member boosted the guild. attr_reader premium_since: Time # _@return_ — The nickname of the member. # # _@return_ — If the member has no nickname. attr_reader nick: String? # _@return_ — The time the member joined the guild. attr_reader joined_at: Time # _@return_ — The custom avatar of the member. # # _@return_ — If the member has no custom avatar. attr_reader custom_avatar: Discorb::Asset? # _@return_ — The display avatar of the member. attr_reader display_avatar: Discorb::Asset # _@return_ — Whether the member is muted. attr_reader mute: bool # _@return_ — Whether the member is deafened. attr_reader deaf: bool # _@return_ — Whether the member is pending (Not passed member screening). attr_reader pending: bool # _@return_ — The display name of the member. attr_reader name: String # _@return_ — The mention of the member. attr_reader mention: String # _@return_ — The voice state of the member. attr_reader voice_state: Discorb::VoiceState # _@return_ — The object wasn't cached. # # _@return_ — The roles of the member. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader roles: ::Array[Discorb::Role]? # _@return_ — The object wasn't cached. # # _@return_ — The guild the member is in. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader guild: Discorb::Guild? # _@return_ — The object wasn't cached. # # _@return_ — The hoisted role of the member. # # _@return_ — If the member has no hoisted role. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader hoisted_role: Discorb::Role? # _@return_ — Whether the member has a hoisted role. attr_reader hoisted?: bool # _@return_ — The permissions of the member. attr_reader permissions: Discorb::Permission # _@return_ — The object wasn't cached. # # _@return_ — The presence of the member. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader presence: Discorb::Presence? # _@return_ — The object wasn't cached. # # _@return_ — The activity of the member. It's from the {#presence}. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader activity: Discorb::Activity? # _@return_ — The object wasn't cached. # # _@return_ — The activities of the member. It's from the {#presence}. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader activities: ::Array[Discorb::Activity]? # _@return_ — The object wasn't cached. # # _@return_ — The status of the member. It's from the {#presence}. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader status: Symbol? end # # Represents a channel of Discord. # @abstract class Channel < Discorb::DiscordModel def initialize: (untyped client, untyped data, ?no_cache: untyped) -> void # Checks if the channel is other channel. # # _@param_ `other` — The channel to check. # # _@return_ — True if the channel is other channel. def ==: (Discorb::Channel other) -> bool def inspect: () -> untyped def self.descendants: () -> untyped def self.make_channel: (untyped client, untyped data, ?no_cache: untyped) -> untyped def type: () -> untyped def channel_id: () -> untyped def _set_data: (untyped data) -> untyped # _@return_ — The ID of the channel. attr_reader id: Discorb::Snowflake # _@return_ — The name of the channel. attr_reader name: String end # # Represents a channel in guild. # @abstract class GuildChannel < Discorb::Channel include Comparable # Compares position of two channels. # # _@param_ `other` — The channel to compare. # # _@return_ — -1 if the channel is at lower than the other, 1 if the channel is at highter than the other. def <=>: (Discorb::GuildChannel other) -> Integer # Checks if the channel is same as another. # # _@param_ `other` — The channel to check. # # _@return_ — `true` if the channel is same as another. def ==: (Discorb::GuildChannel other) -> bool # Stringifies the channel. # # _@return_ — The name of the channel with `#`. def to_s: () -> String def mention: () -> untyped def parent: () -> untyped def guild: () -> untyped def inspect: () -> untyped # Deletes the channel. # # _@param_ `reason` — The reason of deleting the channel. # # _@return_ — The deleted channel. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def delete!: (?reason: String?) -> Async::Task[self] # Moves the channel to another position. # # _@param_ `position` — The position to move the channel. # # _@param_ `lock_permissions` — Whether to lock the permissions of the channel. # # _@param_ `parent` — The parent of channel. # # _@param_ `reason` — The reason of moving the channel. # # _@return_ — The moved channel. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def move: ( Integer position, ?lock_permissions: bool, ?parent: Discorb::CategoryChannel, ?reason: String? ) -> Async::Task[self] def _set_data: (untyped data) -> untyped # _@return_ — The position of the channel as integer. attr_reader position: Integer # _@return_ — The permission overwrites of the channel. attr_reader permission_overwrites: Hash[Discorb::Role | Discorb::Member, Discorb::PermissionOverwrite] end # # Represents a text channel. class TextChannel < Discorb::GuildChannel include Discorb::Messageable def initialize: (untyped client, untyped data, ?no_cache: untyped) -> void # Edits the channel. # # _@param_ `name` — The name of the channel. # # _@param_ `position` — The position of the channel. # # _@param_ `category` — The parent of channel. Specify `nil` to remove the parent. # # _@param_ `parent` — Alias of `category`. # # _@param_ `topic` — The topic of the channel. # # _@param_ `nsfw` — Whether the channel is nsfw. # # _@param_ `announce` — Whether the channel is announce channel. # # _@param_ `rate_limit_per_user` — The rate limit per user (Slowmode) in the channel. # # _@param_ `slowmode` — Alias of `rate_limit_per_user`. # # _@param_ `default_auto_archive_duration` — The default auto archive duration of the channel. # # _@param_ `archive_in` — Alias of `default_auto_archive_duration`. # # _@param_ `reason` — The reason of editing the channel. # # _@return_ — The edited channel. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. # # _@note_ — The arguments of this method are defaultly set to `:unset`. Specify value to set the value, if not don't specify or specify `:unset`. def edit: ( ?name: String, ?position: Integer, ?category: Discorb::CategoryChannel?, ?parent: Discorb::CategoryChannel?, ?topic: String, ?nsfw: bool, ?announce: bool, ?rate_limit_per_user: Integer, ?slowmode: Integer, ?default_auto_archive_duration: Integer, ?archive_in: Integer, ?reason: String? ) -> Async::Task[self] # Create webhook in the channel. # # _@param_ `name` — The name of the webhook. # # _@param_ `avatar` — The avatar of the webhook. # # _@return_ — The created webhook. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def create_webhook: (String name, ?avatar: Discorb::Image?) -> Async::Task[Discorb::Webhook::IncomingWebhook] # Fetch webhooks in the channel. # # _@return_ — The webhooks in the channel. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_webhooks: () -> Async::Task[::Array[Discorb::Webhook]] # Bulk delete messages in the channel. # # _@param_ `messages` — The messages to delete. # # _@param_ `force` — Whether to ignore the validation for message (14 days limit). # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def delete_messages!: (*Discorb::Message messages, ?force: bool) -> untyped # Set the channel's permission overwrite. # # _@param_ `target` — The target of the overwrite. # # _@param_ `reason` — The reason of setting the overwrite. # # _@param_ `perms` — The permission overwrites to replace. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def set_permissions: ((Discorb::Role | Discorb::Member) target, ?reason: String?, **bool perms) -> untyped # Delete the channel's permission overwrite. # # _@param_ `target` — The target of the overwrite. # # _@param_ `reason` — The reason of deleting the overwrite. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def delete_permissions: ((Discorb::Role | Discorb::Member) target, ?reason: String?) -> untyped # Fetch the channel's invites. # # _@return_ — The invites in the channel. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_invites: () -> Async::Task[::Array[Discorb::Invite]] # Create an invite in the channel. # # _@param_ `max_age` — The max age of the invite. # # _@param_ `max_uses` — The max uses of the invite. # # _@param_ `temporary` — Whether the invite is temporary. # # _@param_ `unique` — Whether the invite is unique. @note if it's `false` it may return existing invite. # # _@param_ `reason` — The reason of creating the invite. # # _@return_ — The created invite. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def create_invite: ( ?max_age: Integer?, ?max_uses: Integer?, ?temporary: bool, ?unique: bool, ?reason: String? ) -> Async::Task[Invite] # Follow the existing announcement channel. # # _@param_ `target` — The channel to follow. # # _@param_ `reason` — The reason of following the channel. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def follow_from: (Discorb::NewsChannel target, ?reason: String?) -> untyped # Follow the existing announcement channel from self. # # _@param_ `target` — The channel to follow to. # # _@param_ `reason` — The reason of following the channel. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def follow_to: (Discorb::TextChannel target, ?reason: String?) -> untyped # Fetch the pinned messages in the channel. # # _@return_ — The pinned messages in the channel. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_pins: () -> Async::Task[::Array[Discorb::Message]] # Pin a message in the channel. # # _@param_ `message` — The message to pin. # # _@param_ `reason` — The reason of pinning the message. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def pin_message: (Discorb::Message message, ?reason: String?) -> untyped # Unpin a message in the channel. # # _@param_ `message` — The message to unpin. # # _@param_ `reason` — The reason of unpinning the message. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def unpin_message: (Discorb::Message message, ?reason: String?) -> untyped # Start thread in the channel. # # _@param_ `name` — The name of the thread. # # _@param_ `message` — The message to start the thread. # # _@param_ `auto_archive_duration` — The duration of auto-archiving. # # _@param_ `public` — Whether the thread is public. # # _@param_ `reason` — The reason of starting the thread. # # _@return_ — The started thread. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def start_thread: ( String name, ?message: Discorb::Message?, ?auto_archive_duration: Integer, ?public: bool, ?reason: String? ) -> Async::Task[Discorb::ThreadChannel] # Fetch archived threads in the channel. # # _@return_ — The archived threads in the channel. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_archived_public_threads: () -> Async::Task[::Array[Discorb::ThreadChannel]] # Fetch archived private threads in the channel. # # _@return_ — The archived private threads in the channel. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_archived_private_threads: () -> Async::Task[::Array[Discorb::ThreadChannel]] # Fetch joined archived private threads in the channel. # # _@param_ `limit` — The limit of threads to fetch. # # _@param_ `before` — # # _@return_ — The joined archived private threads in the channel. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_joined_archived_private_threads: (?limit: Integer?, ?before: Time?) -> Async::Task[::Array[Discorb::ThreadChannel]] def _set_data: (untyped data) -> untyped # Post a message to the channel. # # _@param_ `content` — The message content. # # _@param_ `tts` — Whether the message is tts. # # _@param_ `embed` — The embed to send. # # _@param_ `embeds` — The embeds to send. # # _@param_ `allowed_mentions` — The allowed mentions. # # _@param_ `reference` — The message to reply to. # # _@param_ `components` — The components to send. # # _@param_ `file` — The file to send. # # _@param_ `files` — The files to send. # # _@return_ — The message sent. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def post: ( ?String? content, ?tts: bool, ?embed: Discorb::Embed?, ?embeds: ::Array[Discorb::Embed]?, ?allowed_mentions: Discorb::AllowedMentions?, ?reference: (Discorb::Message | Discorb::Message::Reference)?, ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?, ?file: Discorb::File?, ?files: ::Array[Discorb::File]? ) -> Async::Task[Discorb::Message] # Edit a message. # # _@param_ `message_id` — The message id. # # _@param_ `content` — The message content. # # _@param_ `embed` — The embed to send. # # _@param_ `embeds` — The embeds to send. # # _@param_ `allowed_mentions` — The allowed mentions. # # _@param_ `components` — The components to send. # # _@param_ `supress` — Whether to supress embeds. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def edit_message: ( _SnowflakeLike message_id, ?String? content, ?embed: Discorb::Embed?, ?embeds: ::Array[Discorb::Embed]?, ?allowed_mentions: Discorb::AllowedMentions?, ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?, ?supress: bool? ) -> untyped # Delete a message. # # _@param_ `message_id` — The message id. # # _@param_ `reason` — The reason for deleting the message. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def delete_message!: (_SnowflakeLike message_id, ?reason: String?) -> untyped # Fetch a message from ID. # # _@param_ `id` — The ID of the message. # # _@return_ — The message. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_message: (Discorb::Snowflake id) -> Async::Task[Discorb::Message] # Fetch a message history. # # _@param_ `limit` — The number of messages to fetch. # # _@param_ `before` — The ID of the message to fetch before. # # _@param_ `after` — The ID of the message to fetch after. # # _@param_ `around` — The ID of the message to fetch around. # # _@return_ — The messages. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_messages: ( ?Integer limit, ?before: Discorb::Snowflake?, ?after: Discorb::Snowflake?, ?around: Discorb::Snowflake? ) -> Async::Task[::Array[Discorb::Message]] # Trigger the typing indicator in the channel. # If block is given, trigger typing indicator during executing block. # # ```ruby # channel.typing do # channel.post("Waiting for 60 seconds...") # sleep 60 # channel.post("Done!") # end # ``` # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def typing: () -> untyped # _@return_ — The topic of the channel. attr_reader topic: String # _@return_ — Whether the channel is nsfw. attr_reader nsfw: bool # _@return_ — The id of the last message. attr_reader last_message_id: Discorb::Snowflake # _@return_ — The rate limit per user (Slowmode) in the channel. attr_reader rate_limit_per_user: Integer # _@return_ — The time when the last pinned message was pinned. attr_reader last_pin_timestamp: Time # _@return_ — The threads in the channel. attr_reader threads: ::Array[Discorb::ThreadChannel] end # # Represents a news channel (announcement channel). class NewsChannel < Discorb::TextChannel include Discorb::Messageable # Post a message to the channel. # # _@param_ `content` — The message content. # # _@param_ `tts` — Whether the message is tts. # # _@param_ `embed` — The embed to send. # # _@param_ `embeds` — The embeds to send. # # _@param_ `allowed_mentions` — The allowed mentions. # # _@param_ `reference` — The message to reply to. # # _@param_ `components` — The components to send. # # _@param_ `file` — The file to send. # # _@param_ `files` — The files to send. # # _@return_ — The message sent. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def post: ( ?String? content, ?tts: bool, ?embed: Discorb::Embed?, ?embeds: ::Array[Discorb::Embed]?, ?allowed_mentions: Discorb::AllowedMentions?, ?reference: (Discorb::Message | Discorb::Message::Reference)?, ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?, ?file: Discorb::File?, ?files: ::Array[Discorb::File]? ) -> Async::Task[Discorb::Message] # Edit a message. # # _@param_ `message_id` — The message id. # # _@param_ `content` — The message content. # # _@param_ `embed` — The embed to send. # # _@param_ `embeds` — The embeds to send. # # _@param_ `allowed_mentions` — The allowed mentions. # # _@param_ `components` — The components to send. # # _@param_ `supress` — Whether to supress embeds. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def edit_message: ( _SnowflakeLike message_id, ?String? content, ?embed: Discorb::Embed?, ?embeds: ::Array[Discorb::Embed]?, ?allowed_mentions: Discorb::AllowedMentions?, ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?, ?supress: bool? ) -> untyped # Delete a message. # # _@param_ `message_id` — The message id. # # _@param_ `reason` — The reason for deleting the message. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def delete_message!: (_SnowflakeLike message_id, ?reason: String?) -> untyped # Fetch a message from ID. # # _@param_ `id` — The ID of the message. # # _@return_ — The message. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_message: (Discorb::Snowflake id) -> Async::Task[Discorb::Message] # Fetch a message history. # # _@param_ `limit` — The number of messages to fetch. # # _@param_ `before` — The ID of the message to fetch before. # # _@param_ `after` — The ID of the message to fetch after. # # _@param_ `around` — The ID of the message to fetch around. # # _@return_ — The messages. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_messages: ( ?Integer limit, ?before: Discorb::Snowflake?, ?after: Discorb::Snowflake?, ?around: Discorb::Snowflake? ) -> Async::Task[::Array[Discorb::Message]] # Trigger the typing indicator in the channel. # If block is given, trigger typing indicator during executing block. # # ```ruby # channel.typing do # channel.post("Waiting for 60 seconds...") # sleep 60 # channel.post("Done!") # end # ``` # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def typing: () -> untyped end # # Represents a voice channel. class VoiceChannel < Discorb::GuildChannel include Discorb::Connectable # Edit the voice channel. # # _@param_ `name` — The name of the voice channel. # # _@param_ `position` — The position of the voice channel. # # _@param_ `bitrate` — The bitrate of the voice channel. # # _@param_ `user_limit` — The user limit of the voice channel. # # _@param_ `rtc_region` — The region of the voice channel. # # _@param_ `reason` — The reason of editing the voice channel. # # _@return_ — The edited voice channel. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. # # _@note_ — The arguments of this method are defaultly set to `:unset`. Specify value to set the value, if not don't specify or specify `:unset`. def edit: ( ?name: String, ?position: Integer, ?bitrate: Integer, ?user_limit: Integer, ?rtc_region: Symbol, ?reason: String? ) -> Async::Task[self] def _set_data: (untyped data) -> untyped def connect: () -> untyped # _@return_ — The bitrate of the voice channel. attr_reader bitrate: Integer # _@return_ — The user limit of the voice channel. # # _@return_ — If the user limit is not set. attr_reader user_limit: Integer? end # # Represents a stage channel. class StageChannel < Discorb::GuildChannel include Discorb::Connectable def initialize: () -> void def stage_instance: () -> untyped # Edit the stage channel. # # _@param_ `name` — The name of the stage channel. # # _@param_ `position` — The position of the stage channel. # # _@param_ `bitrate` — The bitrate of the stage channel. # # _@param_ `rtc_region` — The region of the stage channel. # # _@param_ `reason` — The reason of editing the stage channel. # # _@return_ — The edited stage channel. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. # # _@note_ — The arguments of this method are defaultly set to `:unset`. Specify value to set the value, if not don't specify or specify `:unset`. def edit: ( ?name: String, ?position: Integer, ?bitrate: Integer, ?rtc_region: Symbol, ?reason: String? ) -> Async::Task[self] # Start a stage instance. # # _@param_ `topic` — The topic of the stage instance. # # _@param_ `public` — Whether the stage instance is public or not. # # _@param_ `reason` — The reason of starting the stage instance. # # _@return_ — The started stage instance. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def start: (String topic, ?public: bool, ?reason: String?) -> Async::Task[Discorb::StageInstance] # Fetch a current stage instance. # # _@return_ — The current stage instance. # # _@return_ — If there is no current stage instance. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_stage_instance: () -> Async::Task[StageInstance] def _set_data: (untyped data) -> untyped def connect: () -> untyped # _@return_ — The bitrate of the voice channel. attr_reader bitrate: Integer # _@return_ — The user limit of the voice channel. attr_reader user_limit: Integer # Returns the value of attribute stage_instances. attr_reader stage_instances: untyped end # # Represents a thread. # @abstract class ThreadChannel < Discorb::Channel include Discorb::Messageable def initialize: (untyped client, untyped data, ?no_cache: untyped) -> void # Edit the thread. # # _@param_ `name` — The name of the thread. # # _@param_ `archived` — Whether the thread is archived or not. # # _@param_ `auto_archive_duration` — The auto archive duration in seconds. # # _@param_ `archive_in` — Alias of `auto_archive_duration`. # # _@param_ `locked` — Whether the thread is locked or not. # # _@param_ `reason` — The reason of editing the thread. # # _@return_ — The edited thread. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. # # _@note_ — The arguments of this method are defaultly set to `:unset`. Specify value to set the value, if not don't specify or specify `:unset`. # # _@see_ `#archive` # # _@see_ `#lock` # # _@see_ `#unarchive` # # _@see_ `#unlock` def edit: ( ?name: String, ?archived: bool, ?auto_archive_duration: Integer, ?archive_in: Integer, ?locked: bool, ?reason: String? ) -> Async::Task[self] # Helper method to archive the thread. # # _@param_ `reason` — The reason of archiving the thread. # # _@return_ — The archived thread. def archive: (?reason: String?) -> self # Helper method to lock the thread. # # _@param_ `reason` — The reason of locking the thread. # # _@return_ — The locked thread. def lock: (?reason: String?) -> self # Helper method to unarchive the thread. # # _@param_ `reason` — The reason of unarchiving the thread. # # _@return_ — The unarchived thread. def unarchive: (?reason: String?) -> self # Helper method to unlock the thread. # # _@param_ `reason` — The reason of unlocking the thread. # # _@return_ — The unlocked thread. # # _@note_ — This method won't unarchive the thread. Use {#unarchive} instead. def unlock: (?reason: String?) -> self def parent: () -> untyped def me: () -> untyped def joined?: () -> bool def guild: () -> untyped def owner: () -> untyped def inspect: () -> untyped def add_member: (?untyped member) -> untyped def remove_member: (?untyped member) -> untyped def fetch_members: () -> untyped def _set_data: (untyped data) -> untyped # Post a message to the channel. # # _@param_ `content` — The message content. # # _@param_ `tts` — Whether the message is tts. # # _@param_ `embed` — The embed to send. # # _@param_ `embeds` — The embeds to send. # # _@param_ `allowed_mentions` — The allowed mentions. # # _@param_ `reference` — The message to reply to. # # _@param_ `components` — The components to send. # # _@param_ `file` — The file to send. # # _@param_ `files` — The files to send. # # _@return_ — The message sent. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def post: ( ?String? content, ?tts: bool, ?embed: Discorb::Embed?, ?embeds: ::Array[Discorb::Embed]?, ?allowed_mentions: Discorb::AllowedMentions?, ?reference: (Discorb::Message | Discorb::Message::Reference)?, ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?, ?file: Discorb::File?, ?files: ::Array[Discorb::File]? ) -> Async::Task[Discorb::Message] # Edit a message. # # _@param_ `message_id` — The message id. # # _@param_ `content` — The message content. # # _@param_ `embed` — The embed to send. # # _@param_ `embeds` — The embeds to send. # # _@param_ `allowed_mentions` — The allowed mentions. # # _@param_ `components` — The components to send. # # _@param_ `supress` — Whether to supress embeds. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def edit_message: ( _SnowflakeLike message_id, ?String? content, ?embed: Discorb::Embed?, ?embeds: ::Array[Discorb::Embed]?, ?allowed_mentions: Discorb::AllowedMentions?, ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?, ?supress: bool? ) -> untyped # Delete a message. # # _@param_ `message_id` — The message id. # # _@param_ `reason` — The reason for deleting the message. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def delete_message!: (_SnowflakeLike message_id, ?reason: String?) -> untyped # Fetch a message from ID. # # _@param_ `id` — The ID of the message. # # _@return_ — The message. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_message: (Discorb::Snowflake id) -> Async::Task[Discorb::Message] # Fetch a message history. # # _@param_ `limit` — The number of messages to fetch. # # _@param_ `before` — The ID of the message to fetch before. # # _@param_ `after` — The ID of the message to fetch after. # # _@param_ `around` — The ID of the message to fetch around. # # _@return_ — The messages. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_messages: ( ?Integer limit, ?before: Discorb::Snowflake?, ?after: Discorb::Snowflake?, ?around: Discorb::Snowflake? ) -> Async::Task[::Array[Discorb::Message]] # Trigger the typing indicator in the channel. # If block is given, trigger typing indicator during executing block. # # ```ruby # channel.typing do # channel.post("Waiting for 60 seconds...") # sleep 60 # channel.post("Done!") # end # ``` # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def typing: () -> untyped # _@return_ — The ID of the channel. # # _@note_ — This ID is same as the starter message's ID attr_reader id: Discorb::Snowflake # _@return_ — The name of the thread. attr_reader name: String # _@return_ — The number of messages in the thread. # # _@note_ — This will stop counting at 50. attr_reader message_count: Integer # _@return_ — The number of recipients in the thread. # # _@note_ — This will stop counting at 50. attr_reader member_count: Integer # _@return_ — The rate limit per user (slowmode) in the thread. attr_reader rate_limit_per_user: Integer # _@return_ — The members of the thread. attr_reader members: ::Array[Discorb::ThreadChannel::Member] # _@return_ — The time the thread was archived. # # _@return_ — If the thread is not archived. attr_reader archived_timestamp: Time? # _@return_ — Auto archive duration in seconds. attr_reader auto_archive_duration: Integer # _@return_ — Whether the thread is archived or not. attr_reader archived: bool class News < Discorb::ThreadChannel end class Public < Discorb::ThreadChannel end class Private < Discorb::ThreadChannel end class Member < Discorb::DiscordModel def initialize: (untyped cilent, untyped data) -> void def thread: () -> untyped def member: () -> untyped def id: () -> untyped def user: () -> untyped def inspect: () -> untyped # Returns the value of attribute joined_at. attr_reader joined_at: untyped end end class CategoryChannel < Discorb::GuildChannel def text_channels: () -> untyped def voice_channels: () -> untyped def news_channel: () -> untyped def stage_channels: () -> untyped def create_text_channel: (*untyped args, **untyped kwargs) -> untyped def create_voice_channel: (*untyped args, **untyped kwargs) -> untyped def create_news_channel: (*untyped args, **untyped kwargs) -> untyped def create_stage_channel: (*untyped args, **untyped kwargs) -> untyped def _set_data: (untyped data) -> untyped # Returns the value of attribute channels. attr_reader channels: untyped end class DMChannel < Discorb::Channel include Discorb::Messageable def channel_id: () -> untyped def _set_data: (untyped data) -> untyped # Post a message to the channel. # # _@param_ `content` — The message content. # # _@param_ `tts` — Whether the message is tts. # # _@param_ `embed` — The embed to send. # # _@param_ `embeds` — The embeds to send. # # _@param_ `allowed_mentions` — The allowed mentions. # # _@param_ `reference` — The message to reply to. # # _@param_ `components` — The components to send. # # _@param_ `file` — The file to send. # # _@param_ `files` — The files to send. # # _@return_ — The message sent. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def post: ( ?String? content, ?tts: bool, ?embed: Discorb::Embed?, ?embeds: ::Array[Discorb::Embed]?, ?allowed_mentions: Discorb::AllowedMentions?, ?reference: (Discorb::Message | Discorb::Message::Reference)?, ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?, ?file: Discorb::File?, ?files: ::Array[Discorb::File]? ) -> Async::Task[Discorb::Message] # Edit a message. # # _@param_ `message_id` — The message id. # # _@param_ `content` — The message content. # # _@param_ `embed` — The embed to send. # # _@param_ `embeds` — The embeds to send. # # _@param_ `allowed_mentions` — The allowed mentions. # # _@param_ `components` — The components to send. # # _@param_ `supress` — Whether to supress embeds. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def edit_message: ( _SnowflakeLike message_id, ?String? content, ?embed: Discorb::Embed?, ?embeds: ::Array[Discorb::Embed]?, ?allowed_mentions: Discorb::AllowedMentions?, ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?, ?supress: bool? ) -> untyped # Delete a message. # # _@param_ `message_id` — The message id. # # _@param_ `reason` — The reason for deleting the message. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def delete_message!: (_SnowflakeLike message_id, ?reason: String?) -> untyped # Fetch a message from ID. # # _@param_ `id` — The ID of the message. # # _@return_ — The message. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_message: (Discorb::Snowflake id) -> Async::Task[Discorb::Message] # Fetch a message history. # # _@param_ `limit` — The number of messages to fetch. # # _@param_ `before` — The ID of the message to fetch before. # # _@param_ `after` — The ID of the message to fetch after. # # _@param_ `around` — The ID of the message to fetch around. # # _@return_ — The messages. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_messages: ( ?Integer limit, ?before: Discorb::Snowflake?, ?after: Discorb::Snowflake?, ?around: Discorb::Snowflake? ) -> Async::Task[::Array[Discorb::Message]] # Trigger the typing indicator in the channel. # If block is given, trigger typing indicator during executing block. # # ```ruby # channel.typing do # channel.post("Waiting for 60 seconds...") # sleep 60 # channel.post("Done!") # end # ``` # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def typing: () -> untyped end # # Handles application commands. module Command # # Module to handle commands. module Handler # Add new top-level command. # # _@param_ `command_name` — Command name. # # _@param_ `description` — Command description. # # _@param_ `options` — Command options. The key is the option name, the value is a hash with the following keys: | Key | Type | Description | | --- | --- | --- | | `:description` | `String` | Description of the option. | | `:optional` | `Boolean` | Whether the option is optional or not. | | `:type` | `Object` | Type of the option. | | `:choice` | `Hash{String => String, Integer, Float}` | Type of the option. | # # _@param_ `guild_ids` — Guild IDs to set the command to. `false` to global command, `nil` to use default. # # _@param_ `block` — Command block. # # _@see_ `file:docs/application_command.md#register-slash-command` # # _@see_ `file:docs/cli/setup.md` def slash: ( String command_name, String description, ?::Hash[String, Hash[:description | :optional | :type, Object]] options, ?guild_ids: (::Array[untyped] | bool)? ) -> Discorb::ApplicationCommand::Command::SlashCommand # Add new command with group. # # _@param_ `command_name` — Command name. # # _@param_ `description` — Command description. # # _@param_ `guild_ids` — Guild IDs to set the command to. `false` to global command, `nil` to use default. # # _@return_ — Command object. # # _@see_ `file:docs/slash_command.md` # # _@see_ `file:docs/cli/setup.md` def slash_group: (String command_name, String description, ?guild_ids: (::Array[untyped] | bool)?) -> Discorb::ApplicationCommand::Command::GroupCommand # Add message context menu command. # # _@param_ `command_name` — Command name. # # _@param_ `guild_ids` — Guild IDs to set the command to. `false` to global command, `nil` to use default. # # _@param_ `block` — Command block. # # _@return_ — Command object. def message_command: (String command_name, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::ApplicationCommandInteraction::UserMenuCommand interaction, Discorb::Message message) -> void } -> Discorb::ApplicationCommand::Command # Add user context menu command. # # _@param_ `command_name` — Command name. # # _@param_ `guild_ids` — Guild IDs to set the command to. `false` to global command, `nil` to use default. # # _@param_ `block` — Command block. # # _@return_ — Command object. def user_command: (String command_name, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::ApplicationCommandInteraction::UserMenuCommand interaction, Discorb::User user) -> void } -> Discorb::ApplicationCommand::Command # Setup commands. # # _@param_ `token` — Bot token. # # _@param_ `guild_ids` — Guild IDs to use as default. If `false` is given, it will be global command. # # _@note_ — `token` parameter only required if you don't run client. # # _@see_ `Client#initialize` def setup_commands: (?String? token, ?guild_ids: (::Array[untyped] | bool)?) -> untyped end # # Represents a application command. # @abstract class Command < Discorb::DiscordModel def initialize: ( untyped name, untyped guild_ids, untyped block, untyped _type ) -> void def to_hash: () -> untyped # _@return_ — The name of the command. attr_reader name: String # _@return_ — The guild ids that the command is enabled in. attr_reader guild_ids: ::Array[untyped] # _@return_ — The block of the command. attr_reader block: Proc # _@return_ — The type of the command. attr_reader type: Symbol # _@return_ — The raw type of the command. attr_reader type_raw: Integer # _@return_ — The ID mapping. attr_reader id_map: Discorb::Dictionary[Discorb::Snowflake, Symbol, Discorb::Snowflake] # # Represents the slash command. class SlashCommand < Discorb::ApplicationCommand::Command def initialize: ( untyped name, untyped description, untyped options, untyped guild_ids, untyped block, untyped _type, untyped parent ) -> void # Returns the commands name. # # _@return_ — The name of the command. def to_s: () -> String def to_hash: () -> untyped # _@return_ — The description of the command. attr_reader description: String # _@return_ — The options of the command. attr_reader options: ::Hash[String, ::Hash[untyped, untyped]] end # # Represents the command with subcommands. class GroupCommand < Discorb::ApplicationCommand::Command def initialize: ( untyped name, untyped description, untyped guild_ids, untyped _type, untyped client ) -> void # Add new subcommand. # # _@return_ — The added subcommand. def slash: (String command_name, String description, ?::Hash[String, Hash[:description | :optional | :type, Object]] options) -> Discorb::ApplicationCommand::Command::SlashCommand # Add new subcommand group. # # _@param_ `command_name` — Group name. # # _@param_ `description` — Group description. # # _@return_ — Command object. # # _@see_ `file:docs/slash_command.md` def group: (String command_name, String description) -> Discorb::ApplicationCommand::Command::SubcommandGroup # Returns the command name. # # _@return_ — The command name. def to_s: () -> String def to_hash: () -> untyped # _@return_ — The subcommands of the command. attr_reader commands: ::Array[(Discorb::ApplicationCommand::Command::SlashCommand | Discorb::ApplicationCommand::Command::SubcommandGroup)] # _@return_ — The description of the command. attr_reader description: String end # # Represents the subcommand group. class SubcommandGroup < Discorb::ApplicationCommand::Command::GroupCommand def initialize: ( untyped name, untyped description, untyped parent, untyped client ) -> void def to_s: () -> untyped # Add new subcommand. # # _@return_ — The added subcommand. def slash: (String command_name, String description, ?::Hash[String, Hash[:description | :optional | :type, Object]] options) -> Discorb::ApplicationCommand::Command::SlashCommand # _@return_ — The subcommands of the command. attr_reader commands: ::Array[Discorb::ApplicationCommand::Command::SlashCommand] end end end # # A module for Discord Gateway. # This module is internal use only. module Gateway # # Represents an event. class GatewayEvent def initialize: (untyped data) -> void end # # Represents a reaction event. class ReactionEvent < Discorb::Gateway::GatewayEvent def initialize: (untyped client, untyped data) -> void # Fetch the message. # If message is cached, it will be returned. # # _@param_ `force` — Whether to force fetching the message. # # _@return_ — The message. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_message: (?force: bool) -> Async::Task[Discorb::Message] # _@return_ — The raw data of the event. attr_reader data: ::Hash[untyped, untyped] # _@return_ — The ID of the user who reacted. attr_reader user_id: Discorb::Snowflake # _@return_ — The ID of the channel the message was sent in. attr_reader channel_id: Discorb::Snowflake # _@return_ — The ID of the message. attr_reader message_id: Discorb::Snowflake # _@return_ — The ID of the guild the message was sent in. attr_reader guild_id: Discorb::Snowflake # _@return_ — The object wasn't cached. # # _@return_ — The user who reacted. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader user: Discorb::User? # _@return_ — The object wasn't cached. # # _@return_ — The channel the message was sent in. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader channel: Discorb::Channel? # _@return_ — The object wasn't cached. # # _@return_ — The guild the message was sent in. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader guild: Discorb::Guild? # _@return_ — The object wasn't cached. # # _@return_ — The message the reaction was sent in. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader message: Discorb::Message? # _@return_ — The object wasn't cached. # # _@return_ — The member who reacted. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader member: Discorb::Member? # _@return_ — The emoji that was reacted with. attr_reader emoji: (Discorb::UnicodeEmoji | Discorb::PartialEmoji) end # # Represents a `MESSAGE_REACTION_REMOVE_ALL` event. class ReactionRemoveAllEvent < Discorb::Gateway::GatewayEvent def initialize: (untyped client, untyped data) -> void # Fetch the message. # If message is cached, it will be returned. # # _@param_ `force` — Whether to force fetching the message. # # _@return_ — The message. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_message: (?force: bool) -> Async::Task[Discorb::Message] # _@return_ — The ID of the channel the message was sent in. attr_reader channel_id: Discorb::Snowflake # _@return_ — The ID of the message. attr_reader message_id: Discorb::Snowflake # _@return_ — The ID of the guild the message was sent in. attr_reader guild_id: Discorb::Snowflake # _@return_ — The object wasn't cached. # # _@return_ — The channel the message was sent in. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader channel: Discorb::Channel? # _@return_ — The object wasn't cached. # # _@return_ — The guild the message was sent in. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader guild: Discorb::Guild? # _@return_ — The object wasn't cached. # # _@return_ — The message the reaction was sent in. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader message: Discorb::Message? end # # Represents a `MESSAGE_REACTION_REMOVE_EMOJI` event. class ReactionRemoveEmojiEvent < Discorb::Gateway::GatewayEvent def initialize: (untyped client, untyped data) -> void # Fetch the message. # If message is cached, it will be returned. # # _@param_ `force` — Whether to force fetching the message. # # _@return_ — The message. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_message: (?force: bool) -> Async::Task[Discorb::Message] # _@return_ — The ID of the channel the message was sent in. attr_reader channel_id: Discorb::Snowflake # _@return_ — The ID of the message. attr_reader message_id: Discorb::Snowflake # _@return_ — The ID of the guild the message was sent in. attr_reader guild_id: Discorb::Snowflake # _@return_ — The object wasn't cached. # # _@return_ — The channel the message was sent in. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader channel: Discorb::Channel? # _@return_ — The object wasn't cached. # # _@return_ — The guild the message was sent in. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader guild: Discorb::Guild? # _@return_ — The object wasn't cached. # # _@return_ — The message the reaction was sent in. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader message: Discorb::Message? # _@return_ — The emoji that was reacted with. attr_reader emoji: (Discorb::UnicodeEmoji | Discorb::PartialEmoji) end # # Represents a `MESSAGE_UPDATE` event. class MessageUpdateEvent < Discorb::Gateway::GatewayEvent def initialize: ( untyped client, untyped data, untyped before, untyped after ) -> void # Fetch the message. # # _@return_ — The message. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_message: () -> Async::Task[Discorb::Message] # _@return_ — The message before update. attr_reader before: Discorb::Message # _@return_ — The message after update. attr_reader after: Discorb::Message # _@return_ — The ID of the message. attr_reader id: Discorb::Snowflake # _@return_ — The ID of the channel the message was sent in. attr_reader channel_id: Discorb::Snowflake # _@return_ — The ID of the guild the message was sent in. attr_reader guild_id: Discorb::Snowflake # _@return_ — The new content of the message. attr_reader content: String # _@return_ — The time the message was edited. attr_reader timestamp: Time # _@return_ — Whether the message pings @everyone. attr_reader mention_everyone: bool # _@return_ — The object wasn't cached. # # _@return_ — The roles mentioned in the message. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader mention_roles: ::Array[Discorb::Role]? # _@return_ — The attachments in the message. attr_reader attachments: ::Array[Discorb::Attachment] # _@return_ — The embeds in the message. attr_reader embeds: ::Array[Discorb::Embed] # _@return_ — The object wasn't cached. # # _@return_ — The channel the message was sent in. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader channel: Discorb::Channel? # _@return_ — The object wasn't cached. # # _@return_ — The guild the message was sent in. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader guild: Discorb::Guild? end # # Represents a message but it has only ID. class UnknownDeleteBulkMessage < Discorb::Gateway::GatewayEvent def initialize: (untyped client, untyped id, untyped data) -> void # _@return_ — The ID of the message. attr_reader id: Discorb::Snowflake # _@return_ — The object wasn't cached. # # _@return_ — The channel the message was sent in. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader channel: Discorb::Channel? # _@return_ — The object wasn't cached. # # _@return_ — The guild the message was sent in. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader guild: Discorb::Guild? end # # Represents a `INVITE_DELETE` event. class InviteDeleteEvent < Discorb::Gateway::GatewayEvent def initialize: (untyped client, untyped data) -> void # _@return_ — The invite code. attr_reader code: String # _@return_ — The object wasn't cached. # # _@return_ — The channel the message was sent in. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader channel: Discorb::Channel? # _@return_ — The object wasn't cached. # # _@return_ — The guild the message was sent in. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader guild: Discorb::Guild? end class GuildIntegrationsUpdateEvent < Discorb::Gateway::GatewayEvent def initialize: (untyped client, untyped data) -> void def guild: () -> untyped end # # Represents a `TYPING_START` event. class TypingStartEvent < Discorb::Gateway::GatewayEvent def initialize: (untyped client, untyped data) -> void # _@return_ — The ID of the channel the user is typing in. attr_reader user_id: Discorb::Snowflake # _@return_ — The object wasn't cached. # # _@return_ — The channel the user is typing in. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader channel: Discorb::Channel? # _@return_ — The object wasn't cached. # # _@return_ — The guild the user is typing in. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader guild: Discorb::Guild? # _@return_ — The object wasn't cached. # # _@return_ — The user that is typing. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader user: Discorb::User? end # # Represents a message pin event. class MessagePinEvent < Discorb::Gateway::GatewayEvent def initialize: (untyped client, untyped data, untyped message) -> void # _@return_ — The message that was pinned. attr_reader message: Discorb::Message # _@return_ — The type of event. attr_reader type: Symbol # _@return_ — Whether the message was pinned. attr_reader pinned?: bool # _@return_ — Whether the message was unpinned. attr_reader unpinned?: bool end # # Represents a `WEBHOOKS_UPDATE` event. class WebhooksUpdateEvent < Discorb::Gateway::GatewayEvent def initialize: (untyped client, untyped data) -> void # _@return_ — The object wasn't cached. # # _@return_ — The channel where the webhook was updated. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader channel: Discorb::Channel? # _@return_ — The object wasn't cached. # # _@return_ — The guild where the webhook was updated. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader guild: Discorb::Guild? end # # A module to handle gateway events. module Handler def connect_gateway: (untyped first) -> untyped def send_gateway: (untyped opcode, **untyped value) -> untyped def handle_gateway: (untyped payload) -> untyped def handle_heartbeat: (untyped interval) -> untyped def handle_event: (untyped event_name, untyped data) -> untyped end # # A class for connecting websocket with raw bytes data. # @private class RawConnection < Async::WebSocket::Connection def initialize: () -> void def parse: (untyped buffer) -> untyped def dump: (untyped object) -> untyped end end # Represents intents. class Intents # Create new intents object with default (no members and presence) intents. # # _@param_ `guilds` — Whether guild related events are enabled. # # _@param_ `members` — Whether guild members related events are enabled. @note You must enable members intent on developers portal. # # _@param_ `bans` — Whether guild ban related events are enabled. # # _@param_ `emojis` — Whether guild emojis related events are enabled. # # _@param_ `integrations` — Whether guild integration related events are enabled. # # _@param_ `webhooks` — Whether guild webhooks related events are enabled. # # _@param_ `invites` — Whether guild invite related events are enabled. # # _@param_ `voice_states` — Whether guild voice state related events are enabled. # # _@param_ `presences` — Whether guild presences related events are enabled. @note You must enable members intent on developers portal. # # _@param_ `messages` — Whether guild messages related events are enabled. # # _@param_ `reactions` — Whether guild reaction related events are enabled. # # _@param_ `dm_messages` — Whether dm messages related events are enabled. # # _@param_ `dm_reactions` — Whether dm reactions related events are enabled. # # _@param_ `dm_typing` — Whether dm typing related events are enabled. def initialize: ( ?guilds: bool, ?members: bool, ?bans: bool, ?emojis: bool, ?integrations: bool, ?webhooks: bool, ?invites: bool, ?voice_states: bool, ?presences: bool, ?messages: bool, ?reactions: bool, ?typing: untyped, ?dm_messages: bool, ?dm_reactions: bool, ?dm_typing: bool ) -> 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 # Returns value of the intent. # # _@return_ — The value of the intent. def value: () -> Integer def inspect: () -> untyped # Create new intent object from raw value. # # _@param_ `value` — The value of the intent. def self.from_value: (Integer value) -> untyped # Create new intent object with default values. def self.default: () -> untyped # Create new intent object with all intents. def self.all: () -> untyped # Create new intent object with no intents. def self.none: () -> untyped end # # Represents a allowed mentions in a message. class AllowedMentions # Initializes a new instance of the AllowedMentions class. # # _@param_ `everyone` — Whether to allow @everyone or @here. # # _@param_ `roles` — The roles to allow, or false to disable. # # _@param_ `users` — The users to allow, or false to disable. # # _@param_ `replied_user` — Whether to ping the user that sent the message to reply. def initialize: ( ?everyone: bool?, ?roles: (bool | ::Array[Discorb::Role])?, ?users: (bool | ::Array[Discorb::User])?, ?replied_user: bool? ) -> void def to_hash: (?untyped other) -> untyped def nil_merge: (*untyped args) -> untyped # _@return_ — Whether to allow @everyone or @here. attr_accessor everyone: bool # _@return_ — The roles to allow, or false to disable. attr_accessor roles: (bool | ::Array[Discorb::Role]) # _@return_ — The users to allow, or false to disable. attr_accessor users: (bool | ::Array[Discorb::User]) # _@return_ — Whether to ping the user that sent the message to reply. attr_accessor replied_user: bool end # # Represents a message. class Message < Discorb::DiscordModel def initialize: (untyped client, untyped data, ?no_cache: untyped) -> void # Edit the message. # # _@param_ `content` — The message content. # # _@param_ `embed` — The embed to send. # # _@param_ `embeds` — The embeds to send. # # _@param_ `allowed_mentions` — The allowed mentions. # # _@param_ `components` — The components to send. # # _@param_ `supress` — Whether to supress embeds. def edit: ( _SnowflakeLike message_id, ?String? content, ?embed: Discorb::Embed?, ?embeds: ::Array[Discorb::Embed]?, ?allowed_mentions: Discorb::AllowedMentions?, ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?, ?supress: bool? ) -> untyped # Delete the message. # # _@param_ `reason` — The reason for deleting the message. def delete!: (?reason: String?) -> untyped # Convert the message to reference object. # # _@param_ `fail_if_not_exists` — Whether to raise an error if the message does not exist. # # _@return_ — The reference object. def to_reference: (?fail_if_not_exists: bool) -> ::Hash[untyped, untyped] # Reply to the message. # # _@return_ — The message. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def reply: (*untyped args, **untyped kwargs) -> Async::Task[Discorb::Message] # Publish the message. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def publish: () -> untyped # Add a reaction to the message. # # _@param_ `emoji` — The emoji to react with. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def add_reaction: (Discorb::Emoji emoji) -> untyped # Remove a reaction from the message. # # _@param_ `emoji` — The emoji to remove. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def remove_reaction: (Discorb::Emoji emoji) -> untyped # Remove other member's reaction from the message. # # _@param_ `emoji` — The emoji to remove. # # _@param_ `member` — The member to remove the reaction from. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def remove_reaction_of: (Discorb::Emoji emoji, Discorb::Member member) -> untyped # Fetch reacted users of reaction. # # _@param_ `emoji` — The emoji to fetch. # # _@param_ `limit` — The maximum number of users to fetch. `nil` for no limit. # # _@param_ `after` — The ID of the user to start fetching from. # # _@return_ — The users. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_reacted_users: (Discorb::Emoji emoji, ?limit: Integer?, ?after: Discorb::Snowflake?) -> Async::Task[::Array[Discorb::User]] # Pin the message. # # _@param_ `reason` — The reason for pinning the message. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def pin: (?reason: String?) -> untyped # Unpin the message. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def unpin: () -> untyped # Start thread from the message. # # _@return_ — def start_thread: (*untyped args, **untyped kwargs) -> Async::Task[::Array[Type]] # Meta def inspect: () -> untyped def _set_data: (untyped data) -> untyped # _@return_ — The ID of the message. attr_reader id: Discorb::Snowflake # _@return_ — The user that sent the message. attr_reader author: (Discorb::User | Discorb::Member) # _@return_ — The content of the message. attr_reader content: String # _@return_ — The time the message was created. attr_reader created_at: Time # _@return_ — The time the message was edited. # # _@return_ — If the message was not edited. attr_reader updated_at: Time? # _@return_ — The attachments of the message. attr_reader attachments: ::Array[Discorb::Attachment] # _@return_ — The embeds of the message. attr_reader embeds: ::Array[Discorb::Embed] # _@return_ — The reactions of the message. attr_reader reactions: ::Array[Discorb::Reaction] # _@return_ — The ID of the channel the message was sent in. attr_reader webhook_id: Discorb::Snowflake # Currently, this will be one of: # # * `:default` # * `:recipient_add` # * `:recipient_remove` # * `:call` # * `:channel_name_change` # * `:channel_icon_change` # * `:channel_pinned_message` # * `:guild_member_join` # * `:user_premium_guild_subscription` # * `:user_premium_guild_subscription_tier_1` # * `:user_premium_guild_subscription_tier_2` # * `:user_premium_guild_subscription_tier_3` # * `:channel_follow_add` # * `:guild_discovery_disqualified` # * `:guild_discovery_requalified` # * `:guild_discovery_grace_period_initial_warning` # * `:guild_discovery_grace_period_final_warning` # * `:thread_created` # * `:reply` # * `:application_command` # * `:thread_starter_message` # * `:guild_invite_reminder` # # _@return_ — The type of the message. attr_reader type: Symbol # _@return_ — The activity of the message. attr_reader activity: Discorb::Message::Activity # _@return_ — The application of the message. attr_reader application_id: Discorb::Application # _@return_ — The reference of the message. attr_reader message_reference: Discorb::Message::Reference # _@return_ — The flag of the message. # # _@see_ `Discorb::Message::Flag` attr_reader flag: Discorb::Message::Flag # _@return_ — The sticker of the message. attr_reader stickers: Discorb::Message::Sticker # _@return_ — The interaction of the message. attr_reader interaction: Discorb::Message::Interaction # _@return_ — The thread channel of the message. attr_reader thread: Discorb::ThreadChannel # _@return_ — The components of the message. attr_reader components: ::Array[::Array[Discorb::Component]] # _@return_ — Whether the message is deleted. attr_reader deleted: bool # _@return_ — Whether the message is tts. attr_reader tts: bool # _@return_ — Whether the message mentions everyone. attr_reader mention_everyone: bool # _@return_ — Whether the message is pinned. attr_reader pinned: bool # _@return_ — The object wasn't cached. # # _@return_ — The channel the message was sent in. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader channel: Discorb::Channel? # _@return_ — The object wasn't cached. # # _@return_ — The guild the message was sent in. # # _@return_ — If the message was not sent in a guild. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader guild: Discorb::Guild? # _@return_ — Whether the message was sent by a webhook. attr_reader webhook?: bool # _@return_ — Whether the message was edited. attr_reader edited?: bool # _@return_ — The URL to jump to the message. attr_reader jump_url: String # _@return_ — The embed of the message. # # _@return_ — If the message has no embed. attr_reader embed: Discorb::Embed? # # Represents message flag. # ## Flag fields # |Field|Value| # |-|-| # |`1 << 0`|`:crossposted`| # |`1 << 1`|`:crosspost`| # |`1 << 2`|`:supress_embeds`| # |`1 << 3`|`:source_message_deleted`| # |`1 << 4`|`:urgent`| # |`1 << 5`|`:has_thread`| # |`1 << 6`|`:ephemeral`| # |`1 << 7`|`:loading`| class Flag < Discorb::Flag end # # Represents reference of message. class Reference # Initialize a new reference. # # _@param_ `guild_id` — The guild ID. # # _@param_ `channel_id` — The channel ID. # # _@param_ `message_id` — The message ID. # # _@param_ `fail_if_not_exists` — Whether fail the request if the message is not found. def initialize: ( Discorb::Snowflake guild_id, Discorb::Snowflake channel_id, Discorb::Snowflake message_id, ?fail_if_not_exists: bool ) -> void # Convert the reference to a hash. # # _@return_ — The hash. def to_hash: () -> ::Hash[untyped, untyped] # Initialize a new reference from a hash. # # _@param_ `data` — The hash. # # _@return_ — The reference. # # _@see_ `https://discord.com/developers/docs/resources/channel#message-reference-object` def self.from_hash: (::Hash[untyped, untyped] data) -> Discorb::Message::Reference # _@return_ — The guild ID. attr_accessor guild_id: Discorb::Snowflake # _@return_ — The channel ID. attr_accessor channel_id: Discorb::Snowflake # _@return_ — The message ID. attr_accessor message_id: Discorb::Snowflake # _@return_ — Whether fail the request if the message is not found. attr_accessor fail_if_not_exists: bool end class Sticker def initialize: (untyped data) -> void # Returns the value of attribute id. attr_reader id: untyped # Returns the value of attribute name. attr_reader name: untyped # Returns the value of attribute format. attr_reader format: untyped end # # Represents a interaction of message. class Interaction < Discorb::DiscordModel def initialize: (untyped client, untyped data) -> void # _@return_ — The user ID. attr_reader id: Discorb::Snowflake # _@return_ — The name of command. # # _@return_ — If the message is not a command. attr_reader name: String? # _@return_ — The type of interaction. attr_reader type: Class # _@return_ — The user. attr_reader user: Discorb::User end # # Represents a activity of message. class Activity < Discorb::DiscordModel def initialize: (untyped data) -> void # _@return_ — The name of activity. attr_reader name: String # _@return_ — The type of activity. attr_reader type: Symbol end end # # Module for sending and reading messages. module Messageable # Post a message to the channel. # # _@param_ `content` — The message content. # # _@param_ `tts` — Whether the message is tts. # # _@param_ `embed` — The embed to send. # # _@param_ `embeds` — The embeds to send. # # _@param_ `allowed_mentions` — The allowed mentions. # # _@param_ `reference` — The message to reply to. # # _@param_ `components` — The components to send. # # _@param_ `file` — The file to send. # # _@param_ `files` — The files to send. # # _@return_ — The message sent. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def post: ( ?String? content, ?tts: bool, ?embed: Discorb::Embed?, ?embeds: ::Array[Discorb::Embed]?, ?allowed_mentions: Discorb::AllowedMentions?, ?reference: (Discorb::Message | Discorb::Message::Reference)?, ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?, ?file: Discorb::File?, ?files: ::Array[Discorb::File]? ) -> Async::Task[Discorb::Message] # Edit a message. # # _@param_ `message_id` — The message id. # # _@param_ `content` — The message content. # # _@param_ `embed` — The embed to send. # # _@param_ `embeds` — The embeds to send. # # _@param_ `allowed_mentions` — The allowed mentions. # # _@param_ `components` — The components to send. # # _@param_ `supress` — Whether to supress embeds. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def edit_message: ( _SnowflakeLike message_id, ?String? content, ?embed: Discorb::Embed?, ?embeds: ::Array[Discorb::Embed]?, ?allowed_mentions: Discorb::AllowedMentions?, ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?, ?supress: bool? ) -> untyped # Delete a message. # # _@param_ `message_id` — The message id. # # _@param_ `reason` — The reason for deleting the message. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def delete_message!: (_SnowflakeLike message_id, ?reason: String?) -> untyped # Fetch a message from ID. # # _@param_ `id` — The ID of the message. # # _@return_ — The message. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_message: (Discorb::Snowflake id) -> Async::Task[Discorb::Message] # Fetch a message history. # # _@param_ `limit` — The number of messages to fetch. # # _@param_ `before` — The ID of the message to fetch before. # # _@param_ `after` — The ID of the message to fetch after. # # _@param_ `around` — The ID of the message to fetch around. # # _@return_ — The messages. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def fetch_messages: ( ?Integer limit, ?before: Discorb::Snowflake?, ?after: Discorb::Snowflake?, ?around: Discorb::Snowflake? ) -> Async::Task[::Array[Discorb::Message]] # Trigger the typing indicator in the channel. # If block is given, trigger typing indicator during executing block. # # ```ruby # channel.typing do # channel.post("Waiting for 60 seconds...") # sleep 60 # channel.post("Done!") # end # ``` # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def typing: () -> untyped end # # Module for connecting to a voice channel. # This will be discord-voice gem. module Connectable def connect: () -> untyped end # # Represents a sticker. class Sticker < Discorb::DiscordModel def initialize: (untyped client, untyped data) -> void def _set_data: (untyped data) -> untyped # _@return_ — The ID of the sticker. attr_reader id: Discorb::Snowflake # _@return_ — The name of the sticker. attr_reader name: String # _@return_ — The tags of the sticker. attr_reader tags: ::Array[String] # _@return_ — The type of sticker. attr_reader type: Symbol # _@return_ — The format of the sticker. attr_reader format: Symbol # _@return_ — The URL of the sticker. attr_reader description: String # _@return_ — The ID of the sticker pack. attr_reader pack_id: Discorb::Sticker # _@return_ — The sort value of the sticker. attr_reader sort_value: Integer # _@return_ — The ID of the guild the sticker is in. attr_reader guild_id: Discorb::Snowflake # _@return_ — The user who created the sticker. attr_reader user: Discorb::User # _@return_ — Whether the sticker is available. attr_reader available: bool # # Represents a sticker of guilds. class GuildSticker < Discorb::Sticker # Edits the sticker. # # _@param_ `name` — The new name of the sticker. # # _@param_ `description` — The new description of the sticker. # # _@param_ `tag` — The new tags of the sticker. # # _@param_ `reason` — The reason for the edit. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. # # _@note_ — The arguments of this method are defaultly set to `:unset`. Specify value to set the value, if not don't specify or specify `:unset`. def edit: ( ?name: String, ?description: String, ?tag: Discorb::Emoji, ?reason: String ) -> untyped # Deletes the sticker. # # _@param_ `reason` — The reason for the deletion. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def delete!: (?reason: String?) -> untyped attr_reader guild: untyped end # # Represents a sticker pack. class Pack < Discorb::DiscordModel def initialize: (untyped client, untyped data) -> void # _@return_ — The ID of the sticker pack. attr_reader id: Discorb::Snowflake # _@return_ — The name of the sticker pack. attr_reader name: String # _@return_ — The ID of the SKU. attr_reader sku_id: Discorb::Snowflake # _@return_ — The cover sticker of the pack. attr_reader cover_sticker_id: Discorb::Snowflake # _@return_ — The description of the pack. attr_reader description: String # _@return_ — The banner asset ID of the pack. attr_reader banner_asset_id: Discorb::Store::SKU # _@return_ — The stickers in the pack. attr_reader stickers: ::Array[Discorb::Sticker] # _@return_ — The banner of the pack. attr_reader banner: Discorb::Asset end end # # Represents a webhook. # @abstract class Webhook def initialize: (untyped client, untyped data) -> void def inspect: () -> untyped # Posts a message to the webhook. # # _@param_ `content` — The content of the message. # # _@param_ `tts` — Whether the message should be sent as text-to-speech. # # _@param_ `embed` — The embed to send. # # _@param_ `embeds` — The embeds to send. # # _@param_ `allowed_mentions` — The allowed mentions to send. # # _@param_ `file` — The file to send. # # _@param_ `files` — The files to send. # # _@param_ `username` — The username of the message. # # _@param_ `avatar_url` — The avatar URL of the message. # # _@param_ `wait` — Whether to wait for the message to be sent. # # _@return_ — The message that was sent. # # _@return_ — If `wait` is false. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def post: ( ?String? content, ?tts: bool, ?embed: Discorb::Embed?, ?embeds: ::Array[Discorb::Embed]?, ?allowed_mentions: Discorb::AllowedMentions?, ?file: Discorb::File?, ?files: ::Array[Discorb::File]?, ?username: String?, ?avatar_url: String, ?wait: bool ) -> Discorb::Webhook::Message # Edits the webhook. # # _@param_ `name` — The new name of the webhook. # # _@param_ `avatar` — The new avatar of the webhook. # # _@param_ `channel` — The new channel of the webhook. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. # # _@note_ — The arguments of this method are defaultly set to `:unset`. Specify value to set the value, if not don't specify or specify `:unset`. def edit: (?name: String, ?avatar: Discorb::Image, ?channel: Discorb::GuildChannel) -> untyped # Deletes the webhook. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def delete!: () -> untyped # Edits the webhook's message. # # _@param_ `message` — The message to edit. # # _@param_ `content` — The new content of the message. # # _@param_ `embed` — The new embed of the message. # # _@param_ `embeds` — The new embeds of the message. # # _@param_ `attachments` — The attachments to remain. # # _@param_ `file` — The file to send. # # _@param_ `files` — The files to send. # # _@param_ `allowed_mentions` — The allowed mentions to send. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. # # _@note_ — The arguments of this method are defaultly set to `:unset`. Specify value to set the value, if not don't specify or specify `:unset`. def edit_message: ( Discorb::Webhook::Message message, ?String content, ?embed: Discorb::Embed, ?embeds: ::Array[Discorb::Embed], ?file: Discorb::File, ?files: ::Array[Discorb::File], ?attachments: ::Array[Discorb::Attachment], ?allowed_mentions: Discorb::AllowedMentions ) -> untyped # Deletes the webhook's message. # # _@param_ `message` — The message to delete. def delete_message!: (Discorb::Webhook::Message message) -> untyped # Creates URLWebhook. # # _@param_ `url` — The URL of the webhook. # # _@return_ — The URLWebhook. def self.new: (String url) -> Discorb::Webhook::URLWebhook def self.from_url: (untyped url) -> untyped # _@return_ — The name of the webhook. attr_reader name: String # _@return_ — The ID of the guild this webhook belongs to. attr_reader guild_id: Discorb::Snowflake # _@return_ — The ID of the channel this webhook belongs to. attr_reader channel_id: Discorb::Snowflake # _@return_ — The user that created this webhook. attr_reader user: Discorb::User # _@return_ — The avatar of the webhook. attr_reader avatar: Discorb::Asset # _@return_ — The application ID of the webhook. # # _@return_ — If the webhook is not an application webhook. attr_reader application_id: Discorb::Snowflake? # _@return_ — The URL of the webhook. attr_reader token: String # # Represents a webhook from URL. class URLWebhook < Discorb::Webhook # Initializes the webhook from URL. # # _@param_ `url` — The URL of the webhook. def initialize: (String url) -> void # _@return_ — The URL of the webhook. attr_reader url: String end # # Represents a bot created webhook. class IncomingWebhook < Discorb::Webhook def initialize: (untyped client, untyped data) -> void # _@return_ — The URL of the webhook. attr_reader url: String end # # Represents a webhook of channel following. class FollowerWebhook < Discorb::Webhook def initialize: (untyped client, untyped data) -> void # Represents a source guild of follower webhook. # # _@return_ — The source guild of follower webhook. attr_reader source_guild: (Discorb::Guild | Discorb::Webhook::FollowerWebhook::Guild) # Represents a source channel of follower webhook. # # _@return_ — The source channel of follower webhook. attr_reader source_channel: (Discorb::Channel | Discorb::Webhook::FollowerWebhook::Channel) # # Represents a guild of follower webhook. class Guild < Discorb::DiscordModel def initialize: (untyped data) -> void # _@return_ — The ID of the guild. attr_reader id: Discorb::Snowflake # _@return_ — The name of the guild. attr_reader name: String # _@return_ — The icon of the guild. attr_reader icon: Discorb::Asset end # # Represents a channel of follower webhook. class Channel < Discorb::DiscordModel def initialize: (untyped data) -> void # _@return_ — The ID of the channel. attr_reader id: Discorb::Snowflake # _@return_ — The name of the channel. attr_reader name: String end end # # Represents a webhook from oauth2. class ApplicationWebhook < Discorb::Webhook end # # Represents a webhook message. class Message < Discorb::Message def initialize: (untyped webhook, untyped data, ?untyped client) -> void # Edits the message. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. # # _@note_ — The arguments of this method are defaultly set to `:unset`. Specify value to set the value, if not don't specify or specify `:unset`. def edit: () -> untyped # Deletes the message. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def delete!: () -> untyped def _set_data: (untyped data) -> untyped # _@return_ — The ID of the channel. attr_reader channel_id: Discorb::Snowflake # _@return_ — The ID of the guild. attr_reader guild_id: Discorb::Snowflake # # Represents an author of webhook message. class Author < Discorb::DiscordModel def initialize: (untyped data) -> void # Format author with `Name#Discriminator` style. # # _@return_ — Formatted author. def to_s: () -> String # _@return_ — Whether the author is a bot. # # _@note_ — This will be always `true`. attr_reader bot: bool # _@return_ — The ID of the author. attr_reader id: Discorb::Snowflake # _@return_ — The name of the author. attr_reader username: String # _@return_ — The avatar of the author. attr_reader avatar: Discorb::Asset # _@return_ — The discriminator of the author. attr_reader discriminator: String end end end # # Represents a presence of user. class Presence < Discorb::DiscordModel def initialize: (untyped client, untyped data) -> void def inspect: () -> untyped def _set_data: (untyped data) -> untyped # _@return_ — The status of the user. attr_reader status: Symbol # _@return_ — The activities of the user. attr_reader activities: ::Array[Discorb::Presence::Activity] # _@return_ — The client status of the user. attr_reader client_status: Discorb::Presence::ClientStatus # _@return_ — The user of the presence. attr_reader user: Discorb::User # _@return_ — The guild of the presence. attr_reader guild: Discorb::Guild # _@return_ — The activity of the presence. attr_reader activity: Discorb::Presence::Activity # # Represents an activity of a user. class Activity < Discorb::DiscordModel def initialize: (untyped data) -> void # Convert the activity to a string. # # _@return_ — The string representation of the activity. def to_s: () -> String # _@return_ — The name of the activity. attr_reader name: String # _@return_ — The type of the activity. attr_reader type: Symbol # _@return_ — The url of the activity. attr_reader url: String # _@return_ — The time the activity was created. attr_reader created_at: Time # _@return_ — The timestamps of the activity. attr_reader timestamps: Discorb::Presence::Activity::Timestamps # _@return_ — The application id of the activity. attr_reader application_id: Discorb::Snowflake # _@return_ — The details of the activity. attr_reader details: String # _@return_ — The state of party. attr_reader state: String # _@return_ — The emoji of the activity. attr_reader emoji: Discorb::Emoji # _@return_ — The party of the activity. # # _@return_ — If the activity is not a party activity. attr_reader party: Discorb::Presence::Activity::Party? # _@return_ — The assets of the activity. # # _@return_ — If the activity has no assets. attr_reader assets: Discorb::Presence::Activity::Asset? # _@return_ — The instance of the activity. # # _@return_ — If the activity is not a stage activity. attr_reader instance: Discorb::StageInstance? # _@return_ — The buttons of the activity. # # _@return_ — If the activity has no buttons. attr_reader buttons: ::Array[Discorb::Presence::Activity::Button]? # _@return_ — The flags of the activity. attr_reader flags: Discorb::Presence::Activity::Flag # # Represents the timestamps of an activity. class Timestamps < Discorb::DiscordModel def initialize: (untyped data) -> void # _@return_ — The start time of the activity. attr_reader start: Time # _@return_ — The end time of the activity. attr_reader end: Time end class Party < Discorb::DiscordModel def initialize: (untyped data) -> void # _@return_ — The id of the party. attr_reader id: String # _@return_ — The current size of the party. attr_reader current_size: Integer # _@return_ — The max size of the party. attr_reader max_size: Integer end # # Represents the assets of an activity. class Asset < Discorb::DiscordModel def initialize: (untyped data) -> void # _@return_ — The large image ID of the asset. attr_reader large_image: String # _@return_ — The large text of the activity. attr_reader large_text: String # _@return_ — The small image ID of the activity. attr_reader small_image: String # _@return_ — The small text of the activity. attr_reader small_text: String end # # Represents the flags of an activity. # ## Flag fields # |`1 << 0`|`:instance`| # |`1 << 1`|`:join`| # |`1 << 2`|`:spectate`| # |`1 << 3`|`:join_request`| # |`1 << 4`|`:sync`| # |`1 << 5`|`:play`| class Flag < Discorb::Flag end # # Represents a secrets of an activity. class Secrets < Discorb::DiscordModel def initialize: (untyped data) -> void # _@return_ — The join secret of the activity. attr_reader join: String # _@return_ — The spectate secret of the activity. attr_reader spectate: String # _@return_ — The match secret of the activity. attr_reader match: String end # # Represents a button of an activity. class Button < Discorb::DiscordModel def initialize: (untyped data) -> void # _@return_ — The text of the button. attr_reader label: String # _@return_ — The URL of the button. attr_reader url: String end end # # Represents a user's client status. class ClientStatus < Discorb::DiscordModel def initialize: (untyped data) -> void # _@return_ — The desktop status of the user. attr_reader desktop: Symbol # _@return_ — The mobile status of the user. attr_reader mobile: Symbol # _@return_ — The web status of the user. attr_reader web: Symbol # _@return_ — Whether the user is not offline on desktop. attr_reader desktop?: bool # _@return_ — Whether the user is not offline on mobile. attr_reader mobile?: bool # _@return_ — Whether the user is not offline on web. attr_reader web?: bool end end # # Represents a reaction to a message. class Reaction < Discorb::DiscordModel def initialize: (untyped message, untyped data) -> void # Fetch the user that reacted with this emoji. # # _@return_ — The users that reacted with this emoji. def fetch_users: () -> ::Array[Discorb::User] def _set_data: (untyped data) -> untyped # _@return_ — The number of users that have reacted with this emoji. attr_reader count: Integer # _@return_ — The emoji that was reacted with. attr_reader emoji: Discorb::Emoji # _@return_ — The message that this reaction is on. attr_reader message: Discorb::Message # _@return_ — Whether client user reacted with this emoji. attr_reader me: bool end # # Module to make extension. # extend this module to make your own extension. # @see file:docs/extension.md # @abstract module Extension include Discorb::ApplicationCommand::Handler # Define a new event. # # _@param_ `event_name` — The name of the event. # # _@param_ `id` — The id of the event. Used to delete the event. # # _@param_ `metadata` — Other metadata. # # _@param_ `block` — The block to execute when the event is triggered. # # _@return_ — The event. def event: (Symbol event_name, ?id: Symbol?, **::Hash[untyped, untyped] metadata) -> Discorb::Event # Define a new once event. # # _@param_ `event_name` — The name of the event. # # _@param_ `id` — The id of the event. Used to delete the event. # # _@param_ `metadata` — Other metadata. # # _@param_ `block` — The block to execute when the event is triggered. # # _@return_ — The event. def once_event: (Symbol event_name, ?id: Symbol?, **::Hash[untyped, untyped] metadata) -> Discorb::Event def self.extended: (untyped obj) -> untyped # Add new top-level command. # # _@param_ `command_name` — Command name. # # _@param_ `description` — Command description. # # _@param_ `options` — Command options. The key is the option name, the value is a hash with the following keys: | Key | Type | Description | | --- | --- | --- | | `:description` | `String` | Description of the option. | | `:optional` | `Boolean` | Whether the option is optional or not. | | `:type` | `Object` | Type of the option. | | `:choice` | `Hash{String => String, Integer, Float}` | Type of the option. | # # _@param_ `guild_ids` — Guild IDs to set the command to. `false` to global command, `nil` to use default. # # _@param_ `block` — Command block. # # _@see_ `file:docs/application_command.md#register-slash-command` # # _@see_ `file:docs/cli/setup.md` def slash: ( String command_name, String description, ?::Hash[String, Hash[:description | :optional | :type, Object]] options, ?guild_ids: (::Array[untyped] | bool)? ) -> Discorb::ApplicationCommand::Command::SlashCommand # Add new command with group. # # _@param_ `command_name` — Command name. # # _@param_ `description` — Command description. # # _@param_ `guild_ids` — Guild IDs to set the command to. `false` to global command, `nil` to use default. # # _@return_ — Command object. # # _@see_ `file:docs/slash_command.md` # # _@see_ `file:docs/cli/setup.md` def slash_group: (String command_name, String description, ?guild_ids: (::Array[untyped] | bool)?) -> Discorb::ApplicationCommand::Command::GroupCommand # Add message context menu command. # # _@param_ `command_name` — Command name. # # _@param_ `guild_ids` — Guild IDs to set the command to. `false` to global command, `nil` to use default. # # _@param_ `block` — Command block. # # _@return_ — Command object. def message_command: (String command_name, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::ApplicationCommandInteraction::UserMenuCommand interaction, Discorb::Message message) -> void } -> Discorb::ApplicationCommand::Command # Add user context menu command. # # _@param_ `command_name` — Command name. # # _@param_ `guild_ids` — Guild IDs to set the command to. `false` to global command, `nil` to use default. # # _@param_ `block` — Command block. # # _@return_ — Command object. def user_command: (String command_name, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::ApplicationCommandInteraction::UserMenuCommand interaction, Discorb::User user) -> void } -> Discorb::ApplicationCommand::Command # Setup commands. # # _@param_ `token` — Bot token. # # _@param_ `guild_ids` — Guild IDs to use as default. If `false` is given, it will be global command. # # _@note_ — `token` parameter only required if you don't run client. # # _@see_ `Client#initialize` def setup_commands: (?String? token, ?guild_ids: (::Array[untyped] | bool)?) -> untyped # _@return_ — The events of the extension. attr_reader events: ::Hash[Symbol, ::Array[Discorb::Event]] # _@return_ — The commands of the extension. attr_reader commands: ::Array[Discorb::ApplicationCommand::Command] attr_reader bottom_commands: untyped # Returns the value of attribute client. attr_accessor client: untyped end # # Represents a Discord audit log. class AuditLog < Discorb::DiscordModel def initialize: (untyped client, untyped data, untyped guild) -> void # Gets an entry from entries. # # _@param_ `index` — The index of the entry. # # _@return_ — The entry. # # _@return_ — If the index is out of range. def []: (Integer index) -> Discorb::AuditLog::Entry # _@return_ — The webhooks in this audit log. attr_reader webhooks: ::Array[Discorb::Webhook] # _@return_ — The users in this audit log. attr_reader users: ::Array[Discorb::User] # _@return_ — The threads in this audit log. attr_reader threads: ::Array[Discorb::ThreadChannel] # _@return_ — The entries in this audit log. attr_reader entries: ::Array[Discorb::AuditLog::Entry] # # Represents an entry in an audit log. class Entry < Discorb::DiscordModel def initialize: (untyped client, untyped data, _SnowflakeLike guild_id) -> void # Get a change with the given key. # # _@param_ `key` — The key to get. # # _@return_ — The change with the given key. # # _@return_ — The change with the given key does not exist. def []: (Symbol key) -> Discorb::AuditLog::Entry::Change def inspect: () -> untyped # _@return_ — The ID of the entry. attr_reader id: Discorb::Snowflake # _@return_ — The ID of the user who performed the action. attr_reader user_id: Discorb::Snowflake # _@return_ — The ID of the target of the action. attr_reader target_id: Discorb::Snowflake # These symbols will be used: # # * `:guild_update` # * `:channel_create` # * `:channel_update` # * `:channel_delete` # * `:channel_overwrite_create` # * `:channel_overwrite_update` # * `:channel_overwrite_delete` # * `:member_kick` # * `:member_prune` # * `:member_ban_add` # * `:member_ban_remove` # * `:member_update` # * `:member_role_update` # * `:member_move` # * `:member_disconnect` # * `:bot_add` # * `:role_create` # * `:role_update` # * `:role_delete` # * `:invite_create` # * `:invite_update` # * `:invite_delete` # * `:webhook_create` # * `:webhook_update` # * `:webhook_delete` # * `:emoji_create` # * `:emoji_update` # * `:emoji_delete` # * `:message_delete` # * `:message_bulk_delete` # * `:message_pin` # * `:message_unpin` # * `:integration_create` # * `:integration_update` # * `:integration_delete` # * `:stage_instance_create` # * `:stage_instance_update` # * `:stage_instance_delete` # * `:sticker_create` # * `:sticker_update` # * `:sticker_delete` # * `:thread_create` # * `:thread_update` # * `:thread_delete` # # _@return_ — The type of the entry. attr_reader type: Symbol # _@return_ — The changes in this entry. attr_reader changes: Discorb::AuditLog::Entry::Changes # _@return_ — The target of the entry. attr_reader target: (Discorb::Channel | Discorb::Role | Discorb::Member | Discorb::Guild | Discorb::Message) # _@return_ — The optional data for this entry. # # _@note_ — You can use dot notation to access the data. attr_reader options: ::Hash[Symbol, Object] # _@return_ — The user who performed the action. attr_reader user: Discorb::User # # Represents the changes in an audit log entry. class Changes < Discorb::DiscordModel def initialize: (untyped data) -> void def inspect: () -> untyped # Get keys of changes. # # _@return_ — The keys of the changes. def keys: () -> ::Array[Symbol] # Get a change with the given key. # # _@param_ `key` — The key to get. # # _@return_ — The change with the given key. # # _@return_ — The change with the given key does not exist. def []: (Symbol key) -> Discorb::AuditLog::Entry::Change # Returns the value of attribute data. attr_reader data: untyped end # # Represents a change in an audit log entry. # @note This instance will try to call a method of {#new_value} if the method wasn't defined. class Change < Discorb::DiscordModel def initialize: (untyped data) -> void # Send a message to the new value. def method_missing: (untyped method) -> untyped def inspect: () -> untyped def respond_to_missing?: (untyped method, ?untyped include_private) -> bool # _@return_ — The key of the change. attr_reader key: Symbol # _@return_ — The old value of the change. attr_reader old_value: Object # _@return_ — The new value of the change. attr_reader new_value: Object end end # # Represents an integration in an audit log entry. class Integration < Discorb::DiscordModel def initialize: (untyped data) -> void def inspect: () -> untyped # _@return_ — The ID of the integration. attr_reader id: Discorb::Snowflake # _@return_ — The type of the integration. attr_reader type: Symbol # _@return_ — The name of the integration. attr_reader name: String # _@return_ — The account of the integration. attr_reader account: Discorb::Integration::Account end end # # @abstract # Represents a Discord component. class Component # Create a new component from hash data. # # _@param_ `data` — Hash data. # # _@return_ — A new component. # # _@see_ `https://discord.com/developers/docs/interactions/message-components` — Official Discord API documentation def self.from_hash: (::Hash[untyped, untyped] data) -> Component end # # Represents a button component. class Button < Discorb::Component # Initialize a new button. # # _@param_ `label` — The label of the button. # # _@param_ `style` — The style of the button. # # _@param_ `emoji` — The emoji of the button. # # _@param_ `custom_id` — The custom ID of the button. # # _@param_ `url` — The URL of the button. # # _@param_ `disabled` — Whether the button is disabled. def initialize: ( String label, ?Symbol style, ?emoji: Discorb::Emoji?, ?custom_id: String?, ?url: String?, ?disabled: bool ) -> void # Converts the button to a hash. # # _@return_ — A hash representation of the button. # # _@see_ `https://discord.com/developers/docs/interactions/message-components#button-object-button-structure` — Official Discord API docs def to_hash: () -> ::Hash[untyped, untyped] def hash_emoji: (untyped emoji) -> untyped # _@return_ — The label of the button. attr_accessor label: String # _@return_ — The style of the button. attr_accessor style: Symbol # _@return_ — The emoji of the button. attr_accessor emoji: Discorb::Emoji # _@return_ — The custom ID of the button. # Won't be used if the style is `:link`. attr_accessor custom_id: String # _@return_ — The URL of the button. # Only used when the style is `:link`. attr_accessor url: String # _@return_ — Whether the button is disabled. attr_accessor disabled: bool end # # Represents a select menu component. class SelectMenu < Discorb::Component # Initialize a new select menu. # # _@param_ `custom_id` — Custom ID of the select menu. # # _@param_ `options` — The options of the select menu. # # _@param_ `placeholder` — The placeholder of the select menu. # # _@param_ `min_values` — The minimum number of values. # # _@param_ `max_values` — The maximum number of values. def initialize: ( (String | Symbol) custom_id, ::Array[Discorb::SelectMenu::Option] options, ?placeholder: String?, ?min_values: Integer, ?max_values: Integer ) -> void # Converts the select menu to a hash. # # _@return_ — A hash representation of the select menu. # # _@see_ `https://discord.com/developers/docs/interactions/message-components#select-menu-object-select-menu-structure` — Official Discord API docs def to_hash: () -> ::Hash[untyped, untyped] def hash_emoji: (untyped emoji) -> untyped # _@return_ — The custom ID of the select menu. attr_accessor custom_id: String # _@return_ — The options of the select menu. attr_accessor options: ::Array[SelectMenu::Option] # _@return_ — The minimum number of values. attr_accessor min_values: Integer # _@return_ — The maximum number of values. attr_accessor max_values: Integer # _@return_ — Whether the select menu is disabled. attr_reader disabled: bool # # Represents an option of a select menu. class Option # Initialize a new option. # # _@param_ `label` — The label of the option. # # _@param_ `value` — The value of the option. # # _@param_ `description` — The description of the option. # # _@param_ `emoji` — The emoji of the option. # # _@param_ `default` — Whether the option is default. def initialize: ( String label, String value, ?description: String?, ?emoji: Discorb::Emoji?, ?default: bool ) -> void # Converts the option to a hash. # # _@return_ — Hash representation of the option. # # _@see_ `https://discord.com/developers/docs/interactions/message-components#select-menu-object-select-option-structure` — Official Discord API docs def to_hash: () -> ::Hash[untyped, untyped] def hash_emoji: (untyped emoji) -> untyped # Creates a new option from a hash. # # _@param_ `data` — A hash representing the option. # # _@return_ — A new option. def self.from_hash: (::Hash[untyped, untyped] data) -> Discorb::SelectMenu::Option # _@return_ — The label of the option. attr_accessor label: String # _@return_ — The value of the option. attr_accessor value: String # _@return_ — The description of the option. attr_accessor description: String # _@return_ — The emoji of the option. attr_accessor emoji: Discorb::Emoji # _@return_ — Whether the option is default. attr_accessor default: bool end end class Dictionary[K, V] # Initialize a new Dictionary. # # _@param_ `hash` — A hash of items to add to the dictionary. # # _@param_ `limit` — The maximum number of items in the dictionary. # # _@param_ `sort` — Whether to sort the items in the dictionary. def initialize: (?::Hash[untyped, untyped] hash, ?limit: Integer?, ?sort: (bool | Proc)) -> void # Registers a new item in the dictionary. # # _@param_ `id` — The ID of the item. # # _@param_ `body` — The item to register. # # _@return_ — The dictionary. def register: (untyped id, Object body) -> self # Merges another dictionary into this one. # # _@param_ `other` — The dictionary to merge. def merge: (Discorb::Dictionary other) -> untyped # Removes an item from the dictionary. # # _@param_ `id` — The ID of the item to remove. def remove: (untyped id) -> untyped # Get an item from the dictionary. # # _@param_ `id` — The ID of the item. # # _@return_ — The item. # # _@return_ — if the item was not found. def get: (untyped id) -> V # Returns the values of the dictionary. # # _@return_ — The values of the dictionary. def values: () -> ::Array[V] # Checks if the dictionary has an ID. # # _@param_ `id` — The ID to check. # # _@return_ — `true` if the dictionary has the ID, `false` otherwise. def has?: (untyped id) -> bool # Send a message to the array of values. def method_missing: (untyped name) -> untyped def respond_to_missing?: (untyped name, untyped args, untyped kwargs) -> bool def inspect: () -> untyped # _@return_ — The maximum number of items in the dictionary. attr_accessor limit: Integer end # # Represents a permission per guild. # ## Flag fields # # | Field | Value | # |-------|-------| # |`1 << 0`|`:create_instant_invite`| # |`1 << 1`|`:kick_members`| # |`1 << 2`|`:ban_members`| # |`1 << 3`|`:administrator`| # |`1 << 4`|`:manage_channels`| # |`1 << 5`|`:manage_guild`| # |`1 << 6`|`:add_reactions`| # |`1 << 7`|`:view_audit_log`| # |`1 << 8`|`:priority_speaker`| # |`1 << 9`|`:stream`| # |`1 << 10`|`:view_channel`| # |`1 << 11`|`:send_messages`| # |`1 << 12`|`:send_tts_messages`| # |`1 << 13`|`:manage_messages`| # |`1 << 14`|`:embed_links`| # |`1 << 15`|`:attach_files`| # |`1 << 16`|`:read_message_history`| # |`1 << 17`|`:mention_everyone`| # |`1 << 18`|`:use_external_emojis`| # |`1 << 19`|`:view_guild_insights`| # |`1 << 20`|`:connect`| # |`1 << 21`|`:speak`| # |`1 << 22`|`:mute_members`| # |`1 << 23`|`:deafen_members`| # |`1 << 24`|`:move_members`| # |`1 << 25`|`:use_vad`| # |`1 << 26`|`:change_nickname`| # |`1 << 27`|`:manage_nicknames`| # |`1 << 28`|`:manage_roles`| # |`1 << 29`|`:manage_webhooks`| # |`1 << 30`|`:manage_emojis`| # |`1 << 31`|`:use_slash_commands`| # |`1 << 32`|`:request_to_speak`| # |`1 << 34`|`:manage_threads`| # |`1 << 35`|`:use_public_threads`| # |`1 << 36`|`:use_private_threads`| class Permission < Discorb::Flag end # # Represents a permission per channel. class PermissionOverwrite def initialize: (untyped allow, untyped deny) -> void def allow: () -> untyped def deny: () -> untyped def allow_value: () -> untyped def deny_value: () -> untyped # Converts the permission overwrite to a hash. # # _@return_ — The permission overwrite as a hash. def to_hash: () -> ::Hash[untyped, untyped] # Union of the permission overwrites. # # _@param_ `other` — The other permission overwrite. # # _@return_ — The union of the permission overwrites. def +: (Discorb::PermissionOverwrite other) -> Discorb::PermissionOverwrite # Returns whether overwrite of the given field. # # _@param_ `field` — The field to check. # # _@return_ — Whether the field is allowed, denied or not set. def []: (Symbol field) -> bool? # Sets the given field to the given value. # # _@param_ `key` — The field to set. # # _@param_ `bool` — The value to set. def []=: (Symbol key, bool _bool) -> untyped # Returns the value of the flag. def method_missing: (untyped method, ?untyped _bool) -> untyped def respond_to_missing?: (untyped method, untyped _arg) -> bool # Initializes a permission overwrite from a hash. # # _@param_ `hash` — The hash to initialize the permission overwrite from. # # _@return_ — The permission overwrite. def self.from_hash: (::Hash[untyped, untyped] hash) -> Discorb::PermissionOverwrite end # # Class to handle rate limiting. # @private class RatelimitHandler def initialize: (untyped client) -> void # Wait for the rate limit to reset. # # _@param_ `method` — The HTTP method. # # _@param_ `path` — The path. def wait: (String method, String path) -> untyped # Save the rate limit. # # _@param_ `method` — The HTTP method. # # _@param_ `path` — The path. # # _@param_ `resp` — The response. def save: (String method, String path, Net::HTTPResponse resp) -> untyped end # # Represents a Discord application. class Application < Discorb::DiscordModel def initialize: (untyped client, untyped data) -> void def inspect: () -> untyped # _@return_ — The application's ID. attr_reader id: Discorb::Snowflake # _@return_ — The application's name. attr_reader name: String # _@return_ — The application's icon. attr_reader icon: Discorb::Asset # _@return_ — The application's description. attr_reader description: String # _@return_ — The application's summary. attr_reader summary: String # _@return_ — The application's public key. attr_reader verify_key: String # _@return_ — The application's owner. attr_reader owner: Discorb::User # _@return_ — The application's team. attr_reader team: Discorb::Application::Team # _@return_ — Whether the application's bot is public. attr_reader bot_public: bool # _@return_ — Whether the application's bot requires a code grant. attr_reader bot_require_code_grant: bool # # Represents a team for an application. class Team < Discorb::DiscordModel def initialize: (untyped client, untyped data) -> void # The team's owner. # # _@return_ — The team's owner. def owner: () -> Discorb::Application::Team::Member def inspect: () -> untyped # _@return_ — The team's ID. attr_reader id: Discorb::Snowflake # _@return_ — The team's icon. attr_reader icon: Discorb::Asset # _@return_ — The team's name. attr_reader name: String # _@return_ — The team's owner's ID. attr_reader owner_user_id: Discorb::Snowflake # _@return_ — The team's member. attr_reader members: Discorb::Application::Team::Member # # Represents a member of team. class Member < Discorb::DiscordModel def initialize: (untyped client, untyped team, untyped data) -> void def pending?: () -> bool def accepted?: () -> bool def inspect: () -> untyped def owner?: () -> bool def ==: (untyped other) -> untyped # _@return_ — The user. attr_reader user: Discorb::User # _@return_ — The ID of member's team. attr_reader team_id: Snowflake # _@return_ — The member's membership state. attr_reader membership_state: Symbol # _@return_ — The permissions of the member. # # _@note_ — This always return `:*`. attr_reader permissions: ::Array[Permissions] end end end # # A table of emoji names and their unicode values. module EmojiTable DISCORD_TO_UNICODE: untyped UNICODE_TO_DISCORD: untyped SKIN_TONES: untyped end # # Represents a integration. class Integration < Discorb::DiscordModel def initialize: ( untyped client, untyped data, _SnowflakeLike guild_id, ?no_cache: untyped ) -> void def guild: () -> untyped # Delete the integration. # # _@param_ `reason` — The reason for deleting the integration. def delete!: (?reason: String?) -> untyped def _set_data: (untyped data) -> untyped # _@return_ — The ID of the integration. attr_reader id: Discorb::Snowflake # _@return_ — The type of integration. attr_reader type: Symbol # _@return_ — Whether the integration is enabled. attr_reader enabled: bool # _@return_ — Whether the integration is syncing. attr_reader syncing: bool # _@return_ — Whether the integration is enabled emoticons. attr_reader enable_emoticons: bool # _@return_ — The behavior of the integration when it expires. attr_reader expire_behavior: Symbol # _@return_ — The grace period of the integration. attr_reader expire_grace_period: Integer # _@return_ — The user for the integration. attr_reader user: Discorb::User # _@return_ — The account for the integration. attr_reader account: Discorb::Integration::Account # _@return_ — The number of subscribers for the integration. attr_reader subscriber_count: Integer # _@return_ — Whether the integration is revoked. attr_reader revoked: bool # _@return_ — The application for the integration. attr_reader application: Discorb::Application # # Represents an account for an integration. class Account < Discorb::DiscordModel def initialize: (untyped data) -> void # _@return_ — The ID of the account. attr_reader id: String # _@return_ — The name of the account. attr_reader name: String end end # # Represents a user interaction with the bot. class Interaction < Discorb::DiscordModel def initialize: (untyped client, untyped data) -> void def guild: () -> untyped def channel: () -> untyped def target: () -> untyped def inspect: () -> untyped def self.make_interaction: (untyped client, untyped data) -> untyped def self.descendants: () -> untyped def _set_data: () -> untyped # _@return_ — The ID of the interaction. attr_reader id: Discorb::Snowflake # _@return_ — The ID of the application that created the interaction. attr_reader application_id: Discorb::Snowflake # _@return_ — The type of interaction. attr_reader type: Symbol # _@return_ — The member that created the interaction. attr_reader member: Discorb::Member # _@return_ — The user that created the interaction. attr_reader user: Discorb::User # _@return_ — The type of interaction. # # _@note_ — This is always `1` for now. attr_reader version: Integer # _@return_ — The token for the interaction. attr_reader token: String # # A module for response with source. module SourceResponse # Response with `DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE`(`5`). # # _@param_ `ephemeral` — Whether to make the response ephemeral. def defer_source: (?ephemeral: bool) -> untyped # Response with `CHANNEL_MESSAGE_WITH_SOURCE`(`4`). # # _@param_ `content` — The content of the response. # # _@param_ `tts` — Whether to send the message as text-to-speech. # # _@param_ `embed` — The embed to send. # # _@param_ `embeds` — The embeds to send. (max: 10) # # _@param_ `allowed_mentions` — The allowed mentions to send. # # _@param_ `components` — The components to send. # # _@param_ `ephemeral` — Whether to make the response ephemeral. def post: ( ?String? content, ?tts: bool, ?embed: Discorb::Embed?, ?embeds: ::Array[Discorb::Embed]?, ?allowed_mentions: Discorb::AllowedMentions?, ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?, ?ephemeral: bool ) -> untyped end # # A module for response with update. module UpdateResponse # Response with `DEFERRED_UPDATE_MESSAGE`(`6`). # # _@param_ `ephemeral` — Whether to make the response ephemeral. def defer_update: (?ephemeral: bool) -> untyped # Response with `UPDATE_MESSAGE`(`7`). # # _@param_ `content` — The content of the response. # # _@param_ `tts` — Whether to send the message as text-to-speech. # # _@param_ `embed` — The embed to send. # # _@param_ `embeds` — The embeds to send. (max: 10) # # _@param_ `allowed_mentions` — The allowed mentions to send. # # _@param_ `components` — The components to send. # # _@param_ `ephemeral` — Whether to make the response ephemeral. def edit: ( String content, ?tts: bool, ?embed: Discorb::Embed?, ?embeds: ::Array[Discorb::Embed]?, ?allowed_mentions: Discorb::AllowedMentions?, ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?, ?ephemeral: bool ) -> untyped end end # # Represents a command interaction. class CommandInteraction < Discorb::Interaction include Discorb::Interaction::SourceResponse def _set_data: (untyped data) -> untyped def self.make_interaction: (untyped client, untyped data) -> untyped def self.nested_classes: () -> untyped # Response with `DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE`(`5`). # # _@param_ `ephemeral` — Whether to make the response ephemeral. def defer_source: (?ephemeral: bool) -> untyped # Response with `CHANNEL_MESSAGE_WITH_SOURCE`(`4`). # # _@param_ `content` — The content of the response. # # _@param_ `tts` — Whether to send the message as text-to-speech. # # _@param_ `embed` — The embed to send. # # _@param_ `embeds` — The embeds to send. (max: 10) # # _@param_ `allowed_mentions` — The allowed mentions to send. # # _@param_ `components` — The components to send. # # _@param_ `ephemeral` — Whether to make the response ephemeral. def post: ( ?String? content, ?tts: bool, ?embed: Discorb::Embed?, ?embeds: ::Array[Discorb::Embed]?, ?allowed_mentions: Discorb::AllowedMentions?, ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?, ?ephemeral: bool ) -> untyped # # Represents a slash command interaction. class SlashCommand < Discorb::ApplicationCommandInteraction def _set_data: (untyped data) -> untyped end # # Represents a user context menu interaction. class UserMenuCommand < Discorb::ApplicationCommandInteraction def _set_data: (untyped data) -> untyped # _@return_ — The target user. attr_reader target: (Discorb::Member | Discorb::User) end # # Represents a message context menu interaction. class MessageMenuCommand < Discorb::ApplicationCommandInteraction def _set_data: (untyped data) -> untyped # _@return_ — The target message. attr_reader target: Discorb::Message end end # # Represents a message component interaction. # @abstract class MessageComponentInteraction < Discorb::Interaction include Discorb::Interaction::SourceResponse include Discorb::Interaction::UpdateResponse def initialize: (untyped client, untyped data) -> void def self.make_interaction: (untyped client, untyped data) -> untyped def self.nested_classes: () -> untyped # Response with `DEFERRED_UPDATE_MESSAGE`(`6`). # # _@param_ `ephemeral` — Whether to make the response ephemeral. def defer_update: (?ephemeral: bool) -> untyped # Response with `UPDATE_MESSAGE`(`7`). # # _@param_ `content` — The content of the response. # # _@param_ `tts` — Whether to send the message as text-to-speech. # # _@param_ `embed` — The embed to send. # # _@param_ `embeds` — The embeds to send. (max: 10) # # _@param_ `allowed_mentions` — The allowed mentions to send. # # _@param_ `components` — The components to send. # # _@param_ `ephemeral` — Whether to make the response ephemeral. def edit: ( String content, ?tts: bool, ?embed: Discorb::Embed?, ?embeds: ::Array[Discorb::Embed]?, ?allowed_mentions: Discorb::AllowedMentions?, ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?, ?ephemeral: bool ) -> untyped # Response with `DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE`(`5`). # # _@param_ `ephemeral` — Whether to make the response ephemeral. def defer_source: (?ephemeral: bool) -> untyped # Response with `CHANNEL_MESSAGE_WITH_SOURCE`(`4`). # # _@param_ `content` — The content of the response. # # _@param_ `tts` — Whether to send the message as text-to-speech. # # _@param_ `embed` — The embed to send. # # _@param_ `embeds` — The embeds to send. (max: 10) # # _@param_ `allowed_mentions` — The allowed mentions to send. # # _@param_ `components` — The components to send. # # _@param_ `ephemeral` — Whether to make the response ephemeral. def post: ( ?String? content, ?tts: bool, ?embed: Discorb::Embed?, ?embeds: ::Array[Discorb::Embed]?, ?allowed_mentions: Discorb::AllowedMentions?, ?components: (::Array[Discorb::Component] | ::Array[::Array[Discorb::Component]])?, ?ephemeral: bool ) -> untyped # _@return_ — The content of the response. attr_reader custom_id: String # # Represents a button interaction. class Button < Discorb::MessageComponentInteraction def _set_data: (untyped data) -> untyped # _@return_ — The custom id of the button. attr_reader custom_id: String end # # Represents a select menu interaction. class SelectMenu < Discorb::MessageComponentInteraction def _set_data: (untyped data) -> untyped # _@return_ — The custom id of the select menu. attr_reader custom_id: String # _@return_ — The selected options. attr_reader values: ::Array[String] attr_reader value: untyped end end class VoiceState < Discorb::DiscordModel def initialize: (untyped client, untyped data) -> void def _set_data: (untyped data) -> untyped # _@return_ — The member associated with this voice state. attr_reader member: Discorb::Member # _@return_ — The ID of the guild this voice state is for. attr_reader session_id: Discorb::Snowflake # _@return_ — The time at which the user requested to speak. attr_reader request_to_speak_timestamp: Time # _@return_ — Whether the user is deafened. attr_reader self_deaf: bool # _@return_ — Whether the user is muted. attr_reader self_mute: bool # _@return_ — Whether the user is streaming. attr_reader self_stream: bool # _@return_ — Whether the user is video-enabled. attr_reader self_video: bool # _@return_ — Whether the user is suppressed. (Is at audience) attr_reader suppress: bool # _@return_ — Whether the user is deafened. attr_reader deaf?: bool # _@return_ — Whether the user is muted. attr_reader mute?: bool # _@return_ — Whether the user is deafened on the server. attr_reader server_deaf?: bool # _@return_ — Whether the user is muted on the server. attr_reader server_mute?: bool # _@return_ — The object wasn't cached. # # _@return_ — The guild this voice state is for. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader guild: Discorb::Guild? # _@return_ — The object wasn't cached. # # _@return_ — The channel this voice state is for. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader channel: Discorb::Channel? # _@return_ — The object wasn't cached. # # _@return_ — The user this voice state is for. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader user: Discorb::User? end # # Represents a stage instance of a voice state. class StageInstance < Discorb::DiscordModel def initialize: (untyped client, untyped data, ?no_cache: untyped) -> void def guild: () -> untyped def channel: () -> untyped def discoverable?: () -> bool def public?: () -> bool def guild_only?: () -> bool def inspect: () -> untyped # Edits the stage instance. # # _@param_ `topic` — The new topic of the stage instance. # # _@param_ `privacy_level` — The new privacy level of the stage instance. # # _@param_ `reason` — The reason for editing the stage instance. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. # # _@note_ — The arguments of this method are defaultly set to `:unset`. Specify value to set the value, if not don't specify or specify `:unset`. def edit: (?topic: String, ?privacy_level: Symbol, ?reason: String?) -> untyped # Deletes the stage instance. # # _@param_ `reason` — The reason for deleting the stage instance. def delete!: (?reason: String?) -> untyped def _set_data: (untyped data) -> untyped # _@return_ — The ID of the guild this voice state is for. attr_reader id: Discorb::Snowflake # _@return_ — The topic of the stage instance. attr_reader topic: String # _@return_ — The privacy level of the stage instance. attr_reader privacy_level: Symbol end # # Represents a voice region. class VoiceRegion < Discorb::DiscordModel def initialize: (untyped data) -> void # _@return_ — The ID of the voice region. attr_reader id: Discorb::Snowflake # _@return_ — The name of the voice region. attr_reader name: String # _@return_ — Whether the voice region is VIP. attr_reader vip: bool # _@return_ — Whether the voice region is optimal. attr_reader optimal: bool # _@return_ — Whether the voice region is deprecated. attr_reader deprecated: bool # _@return_ — Whether the voice region is custom. attr_reader custom: bool end # # Represents a guild template. class GuildTemplate < Discorb::DiscordModel def initialize: (untyped client, untyped data) -> void # Edit the template. # # _@param_ `name` — The new name of the template. # # _@param_ `description` — The new description of the template. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. # # _@note_ — The arguments of this method are defaultly set to `:unset`. Specify value to set the value, if not don't specify or specify `:unset`. def edit: (?String? name, ?String description) -> untyped # Update the template. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def update: () -> untyped # Delete the template. # # _@note_ — This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result. # # _@note_ — This method calls HTTP request. def delete!: () -> untyped def _set_data: (untyped data) -> untyped # _@return_ — The code of the template. attr_reader code: String # _@return_ — The name of the template. attr_reader name: String # _@return_ — The description of the template. attr_reader description: String # _@return_ — The number of times this template has been used. attr_reader usage_count: Integer # _@return_ — The user who created this template. attr_reader creator: Discorb::User # _@return_ — The time this template was created. attr_reader created_at: Time # _@return_ — The time this template was last updated. attr_reader updated_at: Time # _@return_ — The guild where the template was created. attr_reader source_guild_id: Discorb::Guild # _@return_ — The guild where the template was created. attr_reader serialized_source_guild: Discorb::GuildTemplate::TemplateGuild # _@return_ — Whether this template is dirty. attr_reader is_dirty: bool # _@return_ — The object wasn't cached. # # _@return_ — The guild this template is based on. # # _@return_ — Client wasn't able to find the guild this template is based on. # # _@note_ — This method returns an object from client cache. it will return `nil` if the object is not in cache. attr_reader source_guild: Discorb::Guild? # # Represents a guild in guild template. class TemplateGuild < Discorb::DiscordModel def initialize: (untyped data) -> void # _@return_ — The name of the guild. attr_reader name: String # _@return_ — The AFK timeout of the guild. attr_reader afk_timeout: Integer # _@return_ — A dictionary of roles in the guild. attr_reader roles: Discorb::Dictionary[Discorb::Snowflake, Discorb::Role] # _@return_ — The flag for the system channel. attr_reader system_channel_flags: Discorb::Guild::SystemChannelFlag # _@return_ — A dictionary of channels in the guild. attr_reader channels: Discorb::Dictionary[Discorb::Snowflake, Discorb::GuildChannel] # _@return_ — The description of the guild. attr_reader description: String # _@return_ — The preffered language of the guild. # # _@note_ — This modifies the language code, `-` will be replaced with `_`. attr_reader preferred_locale: Symbol # _@return_ — The verification level of the guild. attr_reader verification_level: Symbol # _@return_ — The default message notification level of the guild. attr_reader default_message_notifications: Symbol # _@return_ — The explict content filter level of the guild. attr_reader explicit_content_filter: Symbol # _@return_ — Whether the guild enabled the widget. attr_reader widget_enabled: bool # # Represents a role in guild template. class Role < Discorb::DiscordModel def initialize: (untyped data) -> void # _@return_ — The name of the role. attr_reader name: String # _@return_ — The permissions of the role. attr_reader permissions: Discorb::Permission # _@return_ — The color of the role. attr_reader color: Discorb::Color end # # Represents a channel in guild template. class Channel < Discorb::DiscordModel def initialize: (untyped data) -> void # _@return_ — The name of the channel. attr_reader name: String # _@return_ — The position of the channel. attr_reader position: Integer # _@return_ — The type of the channel. attr_reader topic: String # _@return_ — The bitrate of the channel. attr_reader bitrate: Integer # _@return_ — The user limit of the channel. attr_reader user_limit: Integer # _@return_ — Whether the channel is nsfw. attr_reader nsfw: bool # _@return_ — The rate limit of the channel. attr_reader rate_limit_per_user: Integer # _@return_ — The class of the channel. attr_reader type: Class end end end # # Represents an activity for Gateway Command. class Activity # Initializes a new Activity. # # _@param_ `name` — The name of the activity. # # _@param_ `type` — The type of activity. # # _@param_ `url` — The URL of the activity. def initialize: (String name, ?Symbol _type, ?String? url) -> void # Converts the activity to a hash. # # _@return_ — A hash representation of the activity. def to_hash: () -> ::Hash[untyped, untyped] end end class Time # sord warn - "\"f\"" does not appear to be a type # sord warn - "\"F\"" does not appear to be a type # sord warn - "\"d\"" does not appear to be a type # sord warn - "\"D\"" does not appear to be a type # sord warn - "\"t\"" does not appear to be a type # sord warn - "\"T\"" does not appear to be a type # sord warn - "\"R\"" does not appear to be a type # Format a time object to a Discord formatted string. # # _@param_ `type` — The format to use. # # _@return_ — The formatted time. def to_df: (?("f" | "F" | "d" | "D" | "t" | "T" | "R")? _type) -> String end class Async::Task[R] def wait: () -> R end