### Installing discum from GitHub master using pip (Shell) Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/contributing.md This command installs or upgrades the `discum` library directly from the master branch of its GitHub repository using the Python interpreter's `pip` module. The `--user` flag installs to the user's directory, and `--upgrade` ensures it replaces any existing version, allowing testing of the latest development code. ```Shell python -m pip install --user --upgrade git+https://github.com/Merubokkusu/Discord-S.C.U.M.git ``` -------------------------------- ### Sending Message and Listening to Gateway Events Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Get_Started.md Provides a basic example of using `discum` to both send a message via the REST API and react to Discord gateway events like `ready_supplemental` and `message`. It demonstrates how to extract message details and user information from events. Requires the `discum` library installed and a valid user token. ```python import discum bot = discum.Client(token='user token here') bot.sendMessage("238323948859439", "Hello :)") @bot.gateway.command def helloworld(resp): if resp.event.ready_supplemental: #ready_supplemental is sent after ready user = bot.gateway.session.user print("Logged in as {}#{}".format(user['username'], user['discriminator'])) if resp.event.message: m = resp.parsed.auto() guildID = m['guild_id'] if 'guild_id' in m else None #because DMs are technically channels too channelID = m['channel_id'] username = m['author']['username'] discriminator = m['author']['discriminator'] content = m['content'] print("> guild {} channel {} | # {}: {}".format(guildID, channelID, username, discriminator, content)) bot.gateway.run(auto_reconnect=True) ``` -------------------------------- ### Fetching Guild Members (Python) Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Gateway_Actions.md Demonstrates how to start fetching members for a specific guild and channel using `bot.gateway.fetchMembers`. It then calls `bot.gateway.run()` to start the gateway connection and execute the pending fetch request. Requires `guild_id` and `channel_id`. Optional parameters control fetch method, data to keep, updates, start/stop indices, wait time, and priority. ```python bot.gateway.fetchMembers('guildID00000000000', 'channelID00000000000') bot.gateway.run() ``` -------------------------------- ### Fetching Members Before discum Gateway Starts - Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/fetchingGuildMembers.md This example shows how to initiate a member fetching request using bot.gateway.fetchMembers before the discum gateway is run. It sets up the request and then starts the gateway, registering a command function that waits for the fetching to complete and prints the result. ```python import discum bot = discum.Client(token='ur token') guild_id = '322850917248663552' channel_id = '754536220826009670' bot.gateway.fetchMembers(guild_id, channel_id) #put wait=1 in params if you'd like to wait 1 second inbetween requests @bot.gateway.command def memberTest(resp): if bot.gateway.finishedMemberFetching('322850917248663552'): lenmembersfetched = len(bot.gateway.session.guild('322850917248663552').members) print(str(lenmembersfetched)+' members fetched') bot.gateway.removeCommand(memberTest) bot.gateway.close() bot.gateway.run() for memberID in bot.gateway.session.guild('322850917248663552').members: print(memberID) ``` -------------------------------- ### Handling Gateway Events - discum Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/changelog.md This snippet shows how to use the @bot.gateway.command decorator to register a function that will be called for every message received from the Discord gateway. It includes examples of processing "READY_SUPPLEMENTAL" and "MESSAGE_CREATE" events. The bot.gateway.run method starts the gateway connection, optionally enabling auto-reconnect. ```python @bot.gateway.command def helloworld(resp): if resp['t'] == "READY_SUPPLEMENTAL": #ready_supplemental is sent after ready user = bot.gateway.SessionSettings.user print("Logged in as {}#{}".format(user['username'], user['discriminator'])) if resp['t'] == "MESSAGE_CREATE": m = resp['d'] guildID = m['guild_id'] if 'guild_id' in m else None #because DMs are technically channels too channelID = m['channel_id'] username = m['author']['username'] discriminator = m['author']['discriminator'] content = m['content'] print("> guild {} channel {} | {}#{}: {}".format(guildID, channelID, username, discriminator, content)) bot.gateway.run(auto_reconnect=True) ``` -------------------------------- ### Initializing Discum Client Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Get_Started.md Demonstrates how to import the `discum` library and create a `Client` object. The `token` parameter is used for authentication, allowing interaction with the Discord API. Requires the `discum` library installed. ```python import discum bot = discum.Client(token="user token here") ``` -------------------------------- ### Creating HTTP GET Wrapper | Discum | Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/extending.md Shows the basic structure for an internal HTTP GET wrapper function within the Discum library. It defines a placeholder URL and calls `Wrapper.sendRequest` with the session object (`self.s`), the 'get' method, the URL, and the log flag, which is used internally by the library to make GET requests to the Discord API. ```Python def wrapper(*args): url = "url" return Wrapper.sendRequest(self.s, 'get', url, log=self.log) ``` -------------------------------- ### Fetching Members Starting from Specific Index - Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/fetchingGuildMembers.md This snippet demonstrates how to resume or start fetching Discord guild members from a particular index within the member list using bot.gateway.fetchMembers. It uses startIndex to specify where to begin, method="overlap" for the fetching strategy, and reset=False to retain previously fetched member data. ```python #import discum #bot = discum.Client(token='ur token') guild_id = '322850917248663552' channel_id = '754536220826009670' bot.gateway.fetchMembers(guild_id, channel_id, method="overlap", startIndex=50, reset=False) #overlap method means multiplier is 100, reset is False because you want to keep previous data @bot.gateway.command def memberTest(resp): if bot.gateway.finishedMemberFetching('322850917248663552'): lenmembersfetched = len(bot.gateway.session.guild('322850917248663552').members) print(str(lenmembersfetched)+' members fetched') bot.gateway.removeCommand(memberTest) bot.gateway.close() bot.gateway.run() for memberID in bot.gateway.session.guild('322850917248663552').members: print(memberID) ``` -------------------------------- ### Setting User Streaming Status (Python) Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Gateway_Actions.md Shows how to set a "Streaming" status using `bot.gateway.setStreamingStatus`, including the stream name and URL. This example sets the activity upon receiving the `READY_SUPPLEMENTAL` event. It requires `stream` and `url` parameters. ```python @bot.gateway.command def setStatusTest(resp): if resp.event.ready_supplemental: bot.gateway.setStreamingStatus("pycraft", "https://github.com/ammaraskar/pyCraft") ``` -------------------------------- ### Logging in via Remote Authentication Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Remote_Authentication.md Initializes the remote authentication module and starts the login process, typically involving displaying a QR code. It returns the user token and user data upon successful authentication. An optional parameter allows saving the QR code image to a specified file. ```python bot.remoteAuthLogin('qrcodefile.png') ``` -------------------------------- ### Fetching Guild Members Backwards (Python) Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Gateway_Actions.md Shows how to use `bot.gateway.getMemberFetchingParams` with a list of target starts to calculate appropriate `startIndex` and `method` values for fetching members in reverse order. These calculated parameters are then passed to `bot.gateway.fetchMembers` along with guild/channel IDs to perform the fetch. ```python startIndex, method = bot.gateway.getMemberFetchingParams([600, 500, 400]) bot.gateway.fetchMembers("guildID","channelID",startIndex=startIndex, method=method, wait=3) ``` -------------------------------- ### Get Report Menu Info - Discord API - Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Retrieves information about the version and variant of the report menu interface. ```python bot.getReportMenu() ``` -------------------------------- ### Get Build Overrides - Discord API - Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Retrieves information about build overrides, potentially related to client versions or features. ```python bot.getBuildOverrides() ``` -------------------------------- ### Logging Online Friends with Gateway Events Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Get_Started.md Shows how to use the `discum` gateway to listen for `ready_supplemental` and `presence_updated` events to maintain a list of online friend IDs. It specifically targets non-guild presence updates with 'online' status. Requires the `discum` library installed and a valid user token. ```python import discum bot = discum.Client(token = 'user token here') bot.usersOnline = [] @bot.gateway.command def logOnlineUsers(resp): if resp.event.ready_supplemental: bot.usersOnline = list(bot.gateway.session.onlineFriendIDs) if resp.event.presence_updated: data = resp.raw['d'] if "guild_id" not in data and data['status']=='online': bot.usersOnline.append(data['user']['id']) bot.gateway.run() ``` -------------------------------- ### Uninstalling discum library with pip (Shell) Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/contributing.md This command demonstrates how to uninstall the `discum` library from a Python environment using the standard `pip` command. It is recommended as a troubleshooting step to ensure a clean state before installing a different version. ```Shell pip uninstall discum ``` -------------------------------- ### Getting Live Stages Discord Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Retrieves a list of live stage channels. An optional boolean parameter allows fetching extra information. ```python bot.getLiveStages() ``` -------------------------------- ### Getting Discoverable Discord Guilds Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Retrieves a list of discoverable Discord guilds. Optional parameters control pagination using offset and limit. ```python bot.getDiscoverableGuilds() ``` -------------------------------- ### Getting Discord Guild Templates Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Retrieves templates available for a specified guild. Requires the guild ID. ```python bot.getGuildTemplates('guildID00000000000') ``` -------------------------------- ### Get Payment Sources - Discord API - Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Fetches the payment sources associated with the user's account. ```python bot.getPaymentSources() ``` -------------------------------- ### Getting Discord Guild Invites Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Retrieves all invites for a specified guild. Requires the guild ID. ```python bot.getGuildInvites('guildID00000000000') ``` -------------------------------- ### Getting Discord Guild Activities Config Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Retrieves the activities configuration for a specified guild. Requires the guild ID. ```python bot.getGuildActivitiesConfig('guildID0000000') ``` -------------------------------- ### Get Billing Subscriptions - Discord API - Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Retrieves the user's current billing subscriptions. ```python bot.getBillingSubscriptions() ``` -------------------------------- ### Getting Discord Channel Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Retrieves details for a specific channel. Requires the channel ID. ```python bot.getChannel('channelID0000000') ``` -------------------------------- ### Getting Stickers using Discord Bot API (Python) Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Demonstrates how to retrieve available stickers. It supports optional parameters like directory ID (defaulting to "758482250722574376"), whether to include store listings (defaulting to False), and locale (defaulting to "en-US"). ```python bot.getStickers() ``` -------------------------------- ### Running Remote Authentication Process Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Remote_Authentication.md Starts the remote authentication gateway connection and process, which typically involves displaying a QR code and waiting for user interaction on the Discord app. It returns the authenticated user's token and data upon completion. ```python bot.ra.run() ``` -------------------------------- ### Bulk Acknowledging Messages using Discord Bot API (Python) Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Provides an example of acknowledging multiple messages simultaneously. It accepts a list of dictionaries, where each dictionary maps a channel ID to a message ID. ```python bot.bulkAck([{"channelID0000000":"msgID000000000"},{"channelID111111":"msgID11111111"}]) ``` -------------------------------- ### Getting Sticker File using Discord Bot API (Python) Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Explains how to download the file content of a specific sticker asset. It requires the sticker ID and the sticker asset identifier, both obtainable using the `getStickers` method. ```python bot.getStickerFile("749052944682582036", "5bc6cc8f8002e733e612ef548e7cbe0c") ``` -------------------------------- ### Get Application Data - Discord API - Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Retrieves data for a specific application using its ID. Optionally includes guild information by setting 'with_guild' to True (defaults to False). ```python bot.getApplicationData('10101010101010') ``` -------------------------------- ### Getting Discord Guild Integrations Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Retrieves integrations configured for a specified guild. Requires the guild ID. An optional boolean parameter determines whether bot information is included. ```python bot.getGuildIntegrations('guildID00000000000') ``` -------------------------------- ### Getting Sticker Pack using Discord Bot API (Python) Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Illustrates how to fetch details about a specific sticker pack. It requires the sticker pack ID, which can be found using the `getStickers` method. ```python bot.stickerPackID('749043879713701898') ``` -------------------------------- ### Wrapping Internal Gateway Combo Wrapper | Discum | Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/extending.md Example function in `gateway/gateway.py` that demonstrates how to wrap and register an internal Gateway combo function. It constructs a command dictionary specifying the function to call (a method from `Guild`), its priority, and its parameters, and then adds this definition to the internal command list using `self.command` for execution by the Gateway handler. ```Python def testfuncPOG(self, pog): self.command({'function': Guild(self).testfuncPOG, 'priority': 0, 'params': {'pog': pog}}) ``` -------------------------------- ### Getting Discord Guild Roles Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Retrieves all roles defined in a specified guild. Requires the guild ID. ```python bot.getGuildRoles('guildID00000000000') ``` -------------------------------- ### Setting User Custom Status (Python) Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Gateway_Actions.md Shows how to set a custom status message using `bot.gateway.setCustomStatus`. The function requires the `customstatus` string and optionally supports `emoji`, `animatedEmoji`, and `expires_at`. This example sets the text to "Discording" upon the `READY_SUPPLEMENTAL` event. ```python @bot.gateway.command def setStatusTest(resp): if resp.event.ready_supplemental: bot.gateway.setCustomStatus("Discording") ``` -------------------------------- ### Getting Discord Guild Channels Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Retrieves all channels within a specified guild. Requires the guild ID. ```python bot.getGuildChannels('guildID00000000000') ``` -------------------------------- ### Running the Gateway Connection - Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/General.md This method starts the gateway connection. The `auto_reconnect` parameter controls whether the bot attempts to automatically reconnect upon disconnection, except for explicit closure or interrupt signals. ```python bot.gateway.run() ``` -------------------------------- ### Getting Discord Guild Regions Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Retrieves the available voice regions for a specified guild. Requires the guild ID. ```python bot.getGuildRegions('guildID00000000000') ``` -------------------------------- ### Getting School Hub Guilds Discord Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Retrieves guilds associated with a specific School Hub. Requires the School Hub ID. ```python bot.getSchoolHubGuilds('hubID0000000000') ``` -------------------------------- ### Getting School Hub Directory Counts Discord Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Retrieves directory counts for a specific School Hub. Requires the School Hub ID. ```python bot.getSchoolHubDirectoryCounts('hubID0000000000') ``` -------------------------------- ### Getting Discord Guilds Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Retrieves the list of guilds the bot/user is a member of. An optional boolean parameter determines if approximate online and member counts are included. ```python bot.getGuilds() ``` -------------------------------- ### Creating Discord Thread Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Creates a new thread in a channel. Requires the channel ID and the thread name. Optional parameters include a message ID to start the thread from, visibility (public), and archive duration. ```python bot.createThread('channelID0000000', 'test') ``` -------------------------------- ### Get Billing History - Discord API - Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Retrieves the user's billing history. An optional limit can be specified to control the number of history entries returned, defaulting to 20. ```python bot.getBillingHistory() ``` -------------------------------- ### Getting Sticker JSON using Discord Bot API (Python) Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Shows how to retrieve the JSON metadata for a specific sticker asset. It requires the sticker ID and the sticker asset identifier, both obtainable using the `getStickers` method. ```python bot.getStickerJson("749052944682582036", "5bc6cc8f8002e733e612ef548e7cbe0c") ``` -------------------------------- ### Wrapping Internal Gateway Request Wrapper | Discum | Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/extending.md Example function in `gateway/request.py` that wraps an internal Gateway request method (`lazyGuild`) from a request class (`GuildRequest`). It instantiates the specific request class with the gateway object (`self.gatewayobject`) and then calls the underlying request method with the provided parameters, serving as a public entry point for initiating this Gateway request. ```Python def lazyGuild(self, guild_id, channel_ranges, typing=None, threads=None, activities=None, members=None): GuildRequest(self.gatewayobject).lazyGuild(guild_id, channel_ranges, typing, threads, activities, members) ``` -------------------------------- ### Get Info from Invite Code - Discord API - Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Retrieves information about a guild or resource associated with an invite code. Requires the 'inviteCode' string (just the code, not the full URL). Optional parameters control whether to include approximate member counts ('with_counts'), invite expiration ('with_expiration'), and indicate if joining from within the app ('fromJoinGuildNav'). ```python bot.getInfoFromInviteCode('minecraft') ``` -------------------------------- ### Get Stripe Client Secret - Discord API - Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Obtains a Stripe client secret, likely used for handling payments via the Stripe platform integration. ```python bot.getStripeClientSecret() ``` -------------------------------- ### Setting User Listening Status (Python) Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Gateway_Actions.md Demonstrates setting the user's activity to "Listening to pycraft" using `bot.gateway.setListeningStatus`. The action is performed when the `READY_SUPPLEMENTAL` event occurs. It requires the `song` parameter. ```python @bot.gateway.command def setStatusTest(resp): if resp.event.ready_supplemental: bot.gateway.setListeningStatus("pycraft") ``` -------------------------------- ### Getting My School Hub Guilds Discord Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Retrieves guilds owned by the user that are either potentially addable to or already within a specific School Hub. Requires the School Hub ID. ```python bot.getMySchoolHubGuilds('hubID0000000000') ``` -------------------------------- ### Getting Trending Gifs using Discord Bot API (Python) Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Shows how to fetch trending GIFs using the Discord bot API. It allows optional parameters for provider, locale, and media format, defaulting to 'tenor', 'en-US', and 'mp4' respectively. ```python bot.getTrendingGifs() ``` -------------------------------- ### Getting Discord Slash Commands Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Retrieves available slash commands for a specific bot/application ID. This method only works if you already have a DM with the bot; otherwise, use `bot.gateway.searchGuildMembers` if sharing a guild. ```python bot.getSlashCommands("botID") ``` -------------------------------- ### Creating Gateway Parse Wrapper | Discum | Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/extending.md Example of a static internal Gateway parse function (`message_create`). This method processes a raw response received from the Discord Gateway (specifically the `MESSAGE_CREATE` event). It extracts the relevant data, converts the integer 'type' field into a human-readable string using a lookup list, and returns the modified message dictionary. ```Python @staticmethod def message_create(response): message = response["d"] types = [ "default", "recipient_added", "recipient_removed", "call", "channel_name_changed", "channel_icon_changed", "channel_message_pinned", "guild_member_joined", "user_premium_guild_subscription", "user_premium_guild_subscription_tier_1", "user_premium_guild_subscription_tier_2", "user_premium_guild_subscription_tier_3", "channel_follow_added", "guild_discovery_disqualified", "guild_discovery_requalified", "reply", "application_command" ] message["type"] = types[response["d"]["type"]] #number to str return message ``` -------------------------------- ### Wrapping Internal HTTP Wrapper | Discum | Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/extending.md Example function in `discum.py` that acts as a public interface for an internal HTTP wrapper (like creating a DM). It instantiates the internal wrapper class (`Messages`) with necessary context (Discord URL, session, log flag) and calls the specific wrapper method (`createDM`), providing a clean public entry point. ```Python def createDM(self,recipients): return Messages(self.discord,self.s,self.log).createDM(recipients) ``` -------------------------------- ### Creating Gateway Request Wrapper | Discum | Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/extending.md Example of an internal Gateway request wrapper function, specifically `searchGuildMembers`. It constructs a Discord Gateway payload (opcode 8) based on input parameters like guild IDs, query, limit, presences, and user IDs, handling different input types. The function's core action is sending this data via the active Gateway connection using `self.gatewayobject.send`. ```Python def searchGuildMembers(self, guild_ids, query, limit, presences, user_ids): #note that query can only be "" if you have admin perms (otherwise you'll get inconsistent responses from discord) if isinstance(guild_ids, str): guild_ids = [guild_ids] data = { "op": self.gatewayobject.OPCODE.REQUEST_GUILD_MEMBERS, "d": {"guild_id": guild_ids}, } if isinstance(user_ids, list): #there are 2 types of op8 that the client can send data["d"]["user_ids"] = user_ids else: data["d"]["query"] = query data["d"]["limit"] = limit data["d"]["presences"] = presences self.gatewayobject.send(data) ``` -------------------------------- ### Handling READY_SUPPLEMENTAL Event (Python) Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Gateway_Actions.md Defines a command handler `readySuppTest` that listens for the `READY_SUPPLEMENTAL` event. This event is used by the library to indicate a successful connection and readiness state, often preceding operations that require a fully established session. ```python @bot.gateway.command def readySuppTest(resp): if resp.event.ready_supplemental: print("received ready supplemental event") ``` -------------------------------- ### Setting User Watching Status (Python) Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Gateway_Actions.md Illustrates setting the user's activity to "Watching pycraft" using `bot.gateway.setWatchingStatus`. This activity is set upon receiving the `READY_SUPPLEMENTAL` event. It requires the `show` parameter. ```python @bot.gateway.command def setStatusTest(resp): if resp.event.ready_supplemental: bot.gateway.setWatchingStatus("pycraft") ``` -------------------------------- ### Initializing Client, Sending Message, and Handling Gateway Events in Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/readme.md This snippet demonstrates how to initialize a discum client using a user token, send a basic text message to a specific channel via an HTTP request, and set up a gateway event listener to process incoming messages and other gateway events like 'ready_supplemental'. It shows how to access session data and parsed message content. ```python import discum bot = discum.Client(token='420tokentokentokentoken.token.tokentokentokentokentoken', log=False) bot.sendMessage("238323948859439", "Hello :)") @bot.gateway.command def helloworld(resp): if resp.event.ready_supplemental: #ready_supplemental is sent after ready user = bot.gateway.session.user print("Logged in as {}#{}".format(user['username'], user['discriminator'])) if resp.event.message: m = resp.parsed.auto() guildID = m['guild_id'] if 'guild_id' in m else None #because DMs are technically channels too channelID = m['channel_id'] username = m['author']['username'] discriminator = m['author']['discriminator'] content = m['content'] print("> guild {} channel {} | {}#{}: {}".format(guildID, channelID, username, discriminator, content)) bot.gateway.run(auto_reconnect=True) ``` -------------------------------- ### Checking Guild Search Status with Discum Gateway Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Gateway_Actions.md This snippet shows examples of using the `bot.gateway.finishedGuildSearch` method directly. It checks if a guild member search initiated with specific parameters (either a query string or a list of user IDs) has completed for the given list of guild IDs. ```python print(bot.gateway.finishedGuildSearch(['guildID'], 'a')) print(bot.gateway.finishedGuildSearch(['guildID'], userIDs=['userID1', 'userID2'])) ``` -------------------------------- ### Getting Discord Member Verification Data Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Retrieves member verification data for a specified guild, which is needed to agree to guild rules. Requires the guild ID. Optional parameters include whether to include guild information and an invite code. ```python memberVerificationData = bot.getMemberVerificationData("guildID000000000000").json() ``` -------------------------------- ### Wrapping Internal Gateway Parse Wrapper | Discum | Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/extending.md Example function in `gateway/parse.py` that serves as a higher-level wrapper for a specific internal static parse method (`guild_member_list_update`) from a parse class (`GuildParse`). It simply calls the underlying static method, passing the Gateway response object (`self.response`) for processing, providing a structured way to access the parser. ```Python def guild_member_list_update(self): return GuildParse.guild_member_list_update(self.response) ``` -------------------------------- ### Setting User Playing Status (Python) Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Gateway_Actions.md Illustrates setting the user's activity to "Playing Minecraft" using `bot.gateway.setPlayingStatus`. This action is executed when the `READY_SUPPLEMENTAL` event is received. It requires the `game` parameter. ```python @bot.gateway.command def setStatusTest(resp): if resp.event.ready_supplemental: bot.gateway.setPlayingStatus("Minecraft") ``` -------------------------------- ### Handling READY Event (Python) Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Gateway_Actions.md Defines a command handler `readyTest` using the `@bot.gateway.command` decorator. It checks if the received response (`resp`) contains the `READY` event and prints a confirmation message when received. This confirms a basic gateway connection has been established. ```python @bot.gateway.command def readyTest(resp): if resp.event.ready: print("received ready event") ``` -------------------------------- ### Initiating Voice Call with Discum Gateway Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Gateway_Actions.md This snippet demonstrates how to use `bot.gateway.request.call` to initiate or join a voice call in a specified channel upon receiving the `ready_supplemental` event. It allows specifying the channel ID and optionally the guild ID, as well as initial mute, deaf, and video states. ```python @bot.gateway.command def callTest(resp): if resp.event.ready_supplemental: bot.gateway.request.call("channelID000000") ``` -------------------------------- ### Cloning Discord-S.C.U.M repository with Git (Shell) Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/contributing.md This command uses the Git version control system to clone the Discord-S.C.U.M project repository from its GitHub URL. It creates a local copy of the entire project codebase, which is the essential first step for contributing code or documentation. ```Shell git clone https://github.com/Merubokkusu/Discord-S.C.U.M ``` -------------------------------- ### Querying Guild Members by Prefix (Python) Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Gateway_Actions.md Demonstrates querying guild members by username or nickname prefix using `bot.gateway.queryGuildMembers`. It shows how to initiate the query on `READY_SUPPLEMENTAL`, handle received chunks (`guild_members_chunk`), check for completion (`finishedGuildSearch`), close the gateway, and access the stored results in `bot.gateway.guildMemberSearches` and `bot.gateway.session.guild('guildID').members`. Requires `guildIDs` (list) and `query` (str), with optional `saveAsQueryOverride`, `limit`, `presences`, and `keep` parameters. ```python @bot.gateway.command def queryTest(resp): if resp.event.ready_supplemental: bot.gateway.queryGuildMembers(['guildID'], 'a', limit=100, keep="all") if resp.event.guild_members_chunk and bot.gateway.finishedGuildSearch(['guildID'], 'a'): #optional; close gateway after finished bot.gateway.close() #optional bot.gateway.run() print(bot.gateway.guildMemberSearches['guildID']['queries']['a']) #user IDs of results print(bot.gateway.session.guild('guildID').members) #member data ``` -------------------------------- ### Initializing Remote Authentication Module Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Remote_Authentication.md Initializes the remote authentication module within the bot instance. This prepares the bot to handle the RA process. ```python bot.initRA() ``` -------------------------------- ### School Hub Waitlist Signup Discord Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Signs up for a School Hub waitlist. Requires the email address and the school name. ```python bot.schoolHubWaitlistSignup('school@school.edu', 'wowow') ``` -------------------------------- ### Setting User Status (online) (Python) Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Gateway_Actions.md Demonstrates setting the user's status to "online" using `bot.gateway.setStatus`. The call is triggered upon receiving the `READY_SUPPLEMENTAL` event, ensuring the gateway is ready to accept status updates. Requires the `status` parameter ('online', 'idle', 'dnd', or 'invisible'). ```python @bot.gateway.command def setStatusTest(resp): if resp.event.ready_supplemental: bot.gateway.setStatus("online") ``` -------------------------------- ### Getting Discord Role Member Counts Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Retrieves the number of members associated with each role in a specified guild. Requires the guild ID. ```python bot.getRoleMemberCounts('guildID00000000000') ``` -------------------------------- ### Clearing All User Activities (Python) Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Gateway_Actions.md Demonstrates clearing all currently set user activities (Playing, Streaming, Listening, Watching) using `bot.gateway.clearActivities`. The action is performed upon receiving the `READY_SUPPLEMENTAL` event. It takes no parameters. ```python @bot.gateway.command def setStatusTest(resp): if resp.event.ready_supplemental: bot.gateway.clearActivities() ``` -------------------------------- ### School Hub Signup Discord Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Signs up for a School Hub. Requires the email address and the School Hub ID (which is a guild ID). ```python bot.schoolHubSignup('school@school.edu', 'hubID0000000000') ``` -------------------------------- ### Changing directory to project root (Shell) Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/contributing.md This command changes the current working directory in the terminal to the newly cloned `Discord-S.C.U.M` folder. It is the standard next step after cloning a repository to navigate into the project's local copy. ```Shell cd Discord-S.C.U.M ``` -------------------------------- ### Checking Guild Members with Discum Gateway Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Gateway_Actions.md This snippet demonstrates how to use `bot.gateway.checkGuildMembers` to check for the existence of specific users in guilds upon receiving the `ready_supplemental` event. It also shows how to use `bot.gateway.finishedGuildSearch` to determine when the search is complete and optionally close the gateway. Finally, it shows how to access the results. ```python @bot.gateway.command def checkTest(resp): if resp.event.ready_supplemental: bot.gateway.checkGuildMembers(['guildID'], ['userID1', 'userID2'], keep="all") if resp.event.guild_members_chunk and bot.gateway.finishedGuildSearch(['guildID'], userIDs=['userID1', 'userID2']): #optional; close gateway after finished bot.gateway.close() #optional bot.gateway.run() print(bot.gateway.guildMemberSearches['guildID']['ids']) #user IDs of results print(bot.gateway.session.guild('guildID').members) #member data ``` -------------------------------- ### Creating Discord Guild Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Creates a new Discord guild. Requires a name for the guild. Optional parameters allow specifying an icon image path, a list of channels, a system channel ID, and a template. ```python bot.createGuild('hello world', icon='cat.jpg') ``` -------------------------------- ### Initiating Discord Gateway Call - Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/changelog.md Demonstrates how to initiate a voice call with a friend using the `_Client__gateway_server.runIt` method. It sends an OP code 4 (Voice State Update) payload to join a voice channel and stops the asyncio loop upon receiving a `VOICE_SERVER_UPDATE` event. Requires an initialized `bot` object with a `_Client__gateway_server` attribute. ```python bot._Client__gateway_server.runIt({ 1: { "send": [{ "op": 4, "d": { "guild_id": None, "channel_id": 21154535154122752, "self_mute": False, "self_deaf": False, "self_video": False } }], "receive": [{ "t": "VOICE_SERVER_UPDATE" }] } }) ``` -------------------------------- ### Subscribing to Large Guild Events (Python) Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Gateway_Actions.md Shows how to subscribe to events (like messages, voice states) from large guilds using `bot.gateway.subscribeToGuildEvents`. This is often necessary to receive such events from guilds with many members. The subscription is triggered upon `READY_SUPPLEMENTAL`. It optionally takes `onlyLarge` (boolean) and `wait` (int) parameters. ```python @bot.gateway.command def subTest(resp): if resp.event.ready_supplemental: bot.gateway.subscribeToGuildEvents(wait=1) ``` -------------------------------- ### Joining Guild from School Hub Discord Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Joins a guild specifically from within a School Hub context. Requires the School Hub ID and the guild ID. ```python bot.joinGuildFromSchoolHub('hubID0000000000', 'guildID000000000') ``` -------------------------------- ### Searching Guild Members with Discum Gateway Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Gateway_Actions.md This snippet shows how to use `bot.gateway.request.searchGuildMembers` to search for members within specified guilds upon receiving the `ready_supplemental` event. It allows searching by a query string and limiting the number of results. ```python @bot.gateway.command def searchGuildMembersTest(resp): if resp.event.ready_supplemental: bot.gateway.request.searchGuildMembers(['guildID000000000'], "test", 100) ``` -------------------------------- ### Setting School Hub Guild Details Discord Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Sets details like description and directory ID for a guild within a School Hub. Requires the School Hub ID, the guild ID, the description string, and the directory ID integer. ```python bot.setSchoolHubGuildDetails('hubID0000000000', 'guildID000000000', 'cats and dogs', 1) ``` -------------------------------- ### Getting Discord Role Member IDs Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Retrieves the user IDs of members assigned to a specific role in a guild. Requires the guild ID and role ID. This method does not work for the @everyone role. ```python bot.getRoleMemberIDs('guildID00000000000', 'roleID000000000000') ``` -------------------------------- ### GatewayServer runIt Input Structure Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/changelog.md Illustrates the expected JSON-like structure for the input dictionary passed to the `_Client__gateway_server.runIt` method. It shows how sequential tasks (identified by keys like 1, 2) are defined, each containing 'send' (list of payloads to send) and 'receive' (list of criteria for stopping or moving to the next task) sections. ```json { 1: { "send": [{...}, {...}, {...}], "receive": [{...}] }, 2: { "send": [{...}], "receive": [{...}, {...}] } } ``` -------------------------------- ### Parsing Gateway Response Data - Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/General.md This method accesses the parsed data from a gateway response object. The `.auto()` method attempts to automatically parse the data structure, for example, extracting message details from a message event. ```python @bot.gateway.command def test(resp): if resp.event.message: m = resp.parsed.auto() print(m['type']) ``` -------------------------------- ### Set User Theme - Discord API - Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Configures the user's Discord theme. Accepts either 'light' or 'dark' as the theme parameter. ```python bot.setTheme("dark") ``` -------------------------------- ### Searching and Triggering Slash Commands with Discum Gateway Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Gateway_Actions.md This snippet demonstrates a two-step process for using slash commands: first, searching for available slash commands in a guild using `bot.gateway.request.searchSlashCommands`, and then, upon receiving the command list update event, using `discum.utils.slash.SlashCommander` to format the command data and `bot.triggerSlashCommand` to execute a specific command. ```python from discum.utils.slash import SlashCommander @bot.gateway.command def slashCommandTest(resp): if resp.event.ready_supplemental: bot.gateway.request.searchSlashCommands('guildID', limit=10, query="queue") if resp.event.guild_application_commands_updated: bot.gateway.removeCommand(slashCommandTest) slashCmds = resp.parsed.auto()['application_commands'] s = SlashCommander(slashCmds, application_id='botID') data = s.get(['queue']) bot.triggerSlashCommand("botID", "channelID", "guildID", data=data) ``` -------------------------------- ### Verifying School Hub Signup Discord Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Verifies a School Hub signup using a code sent to the email. Requires the School Hub ID, the email address, and the verification code. ```python bot.verifySchoolHubSignup('hubID0000000000', 'school@school.edu', '12345') ``` -------------------------------- ### Initializing Multiple discum Clients - Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/changelog.md This snippet demonstrates how to initialize multiple discum client instances efficiently by obtaining the client build number from the first client and reusing it for subsequent clients. This method is particularly useful for scenarios involving multiple bot or user accounts. ```python bot = discum.Client(token=tokenlist[0]) build_num = bot._Client__super_properties['client_build_number'] clients = [bot] for token in tokenlist[1:]: clients.append(discum.Client(token=token, build_num=build_num)) ``` -------------------------------- ### Uninstalling discum library with pip3 (Shell) Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/contributing.md This command demonstrates how to uninstall the `discum` library using the `pip3` command, typically used for Python 3 environments. It serves the same troubleshooting purpose as `pip uninstall discum`. ```Shell pip3 uninstall discum ``` -------------------------------- ### Enable Source Maps - Discord API - Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Toggles the enabling of source maps, a feature primarily for developers debugging the Discord client. Note that this only works for Discord staff. ```python bot.enableSourceMaps() ``` -------------------------------- ### Requesting Lazy Guild Data with Discum Gateway Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Gateway_Actions.md This snippet demonstrates how to use `bot.gateway.request.lazyGuild` to request initial 'lazy-loaded' guild data from the Discord gateway upon receiving the `ready_supplemental` event. It includes specifying channel ranges to load members within those ranges. ```python @bot.gateway.command def guildTest(resp): if resp.event.ready_supplemental: bot.gateway.request.lazyGuild('guildID000000000', {'channelID0000000': [[0,99]]}) ``` -------------------------------- ### Get Handoff Token - Discord API - Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Retrieves a 'handoff token' using a UUID key. The exact purpose of this token is unknown, and it does not return the user's authentication token. Any randomly generated version 4 UUID appears to work. ```python bot.getHandoffToken('b909e096-f16e-4c75-9da6-4a237354ca4f') ``` -------------------------------- ### Join Guild - Discord API - Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Attempts to join a guild using an invite code. This is labeled as a risky action. Requires the invite code and accepts an optional 'location' parameter. ```python bot.joinGuild('1a1a1') #or bot.joinGuild('1a1a1', location='markdown') ``` -------------------------------- ### Requesting DM Channel Data with Discum Gateway Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Gateway_Actions.md This snippet demonstrates how to use `bot.gateway.request.DMchannel` to request data for a specific DM channel from the Discord gateway upon receiving the `ready_supplemental` event. ```python @bot.gateway.command def dmTest(resp): if resp.event.ready_supplemental: bot.gateway.request.DMchannel("channelID000000000") ``` -------------------------------- ### Creating Discord Invite Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Creates an invite for a specific channel. Requires the channel ID. Optional parameters allow configuring the invite's max age, max uses, temporary membership, checking against an existing invite code, and target type. ```python bot.createInvite('channelID00000000000') ``` -------------------------------- ### Enable Link Preview - Discord API - Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Toggles the automatic generation and display of link previews in chat. The 'enable' parameter is optional and defaults to True. ```python bot.enableLinkPreview() ``` -------------------------------- ### Parsing Channel Create Event with Discum Gateway Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Gateway_Actions.md This snippet shows how to use `bot.gateway.parse(savedEvent).channel_create` to process a raw gateway event dictionary (`savedEvent`) of type `channel_create`, making the new channel data easily accessible. ```python bot.gateway.parse(savedEvent).channel_create ``` -------------------------------- ### Triggering Discord Slash Command Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/REST_Actions.md Demonstrates the process of triggering a slash command: first, retrieve available commands; second, use `SlashCommander` to parse and structure the command data; finally, send the command using the bot object. Requires the bot ID, channel ID, and optionally guild ID, along with the prepared command data. ```python #first, lets see what slash commands we can run. slashCmds = bot.getSlashCommands("botID").json() #next, let's parse that and create some slash command data from discum.utils.slash import SlashCommander s = SlashCommander(slashCmds) #slashCmds can be either a list of cmds or just 1 cmd. Each cmd is of type dict. data = s.get(['saved', 'queues', 'create'], {'name':'hi'}) #finally, lets send the slash command bot.triggerSlashCommand("botID", "channelID", guildID="guildID", data=data) ``` -------------------------------- ### Adding HTTP API Wrappers - discum Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/changelog.md This snippet lists numerous new methods added to the bot object, providing wrappers for various Discord HTTP API endpoints. These methods allow performing actions like logging in, fetching user/guild data, setting user settings, and managing payments through simple function calls. Dependencies include the discum library and a configured bot instance. ```python bot.login(email, password, undelete=False, captcha=None, source=None, gift_code_sku_id=None, secret="", code="") bot.getXFingerprint() bot.getBuildNumber() bot.getSuperProperties(user_agent, buildnum="request") bot.getGatewayUrl() bot.getDiscordStatus() bot.getDetectables() bot.getOauth2Tokens() bot.getVersionStableHash(underscore=None) bot.bulkAck(data) bot.getTrendingGifs(provider="tenor", locale="en-US", media_format="mp4") bot.getStickers(directoryID="758482250722574376", store_listings=False, locale="en-US") bot.getStickerFile(stickerID, stickerAsset) bot.getStickerJson(stickerID, stickerAsset) bot.getStickerPack(stickerPackID) bot.setUsername(username) bot.setEmail(email) bot.setPassword(new_password) bot.setDiscriminator(discriminator) bot.getProfile(userID) bot.info(with_analytics_token=None) bot.getUserAffinities() bot.getGuildAffinities() bot.getMentions(limit=25, roleMentions=True, everyoneMentions=True) bot.removeMentionFromInbox(messageID) bot.setHypesquad(house) bot.leaveHypesquad() bot.setLocale(locale) bot.calculateTOTPcode(secret="default") bot.getTOTPurl(secret): #use this to store your totp secret/qr pic; btw url format is otpauth://totp/Discord bot.enable2FA() bot.disable2FA(code="calculate", clearSecretAfter=False) bot.getRTCregions() bot.setAFKtimeout(timeout_seconds) bot.setTheme(theme) bot.setMessageDisplay(CozyOrCompact) bot.enableDevMode(enable) bot.activateApplicationTestMode(applicationID) bot.getApplicationData(applicationID, with_guild=False) bot.getBackupCodes(regenerate=False) bot.enableInlineMedia(enable) bot.enableLargeImagePreview(enable) bot.enableGifAutoPlay(enable) bot.enableLinkPreview(enable) bot.enableReactionRendering(enable) bot.enableAnimatedEmoji(enable) bot.enableEmoticonConversion(enable) bot.setStickerAnimation(setting) bot.enableTTS(enable) bot.getBillingHistory(limit=20) bot.getPaymentSources() bot.getBillingSubscriptions() bot.getStripeClientSecret() bot.logout(provider=None, voip_provider=None) bot.getMemberVerificationData(guildID, with_guild=False, invite_code=None) bot.agreeGuildRules(guildID, form_fields, version="2021-01-31T02:41:24.540000+00:00") ``` -------------------------------- ### Ending Voice Call with Discum Gateway Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/Gateway_Actions.md This snippet demonstrates how to use `bot.gateway.request.endCall` to leave the current voice call upon receiving the `ready_supplemental` event. This method does not require parameters as a client is typically only in one call at a time. ```python @bot.gateway.command def callTest(resp): if resp.event.ready_supplemental: bot.gateway.request.endCall() ``` -------------------------------- ### Sending Data to Gateway - Python Source: https://github.com/merubokkusu/discord-s.c.u.m/blob/master/docs/using/General.md This method sends a payload (dictionary) directly to the gateway. It is demonstrated here sending an Opcode 1 (Heartbeat) payload when the `ready_supplemental` event occurs. ```python @bot.gateway.command def test(resp): if resp.event.ready_supplemental: bot.gateway.send({"op": 1,"d": 0}) ```