├── .github └── workflows │ └── update.yml ├── .gitignore ├── .npmignore ├── .prettierrc.yml ├── LICENSE ├── MANIFEST.in ├── README.md ├── discord_protos ├── __init__.py ├── discord_experimentation │ └── v1 │ │ ├── Experiment.proto │ │ └── Experiment_pb2.py ├── discord_kkv_store_value_models │ └── v1 │ │ ├── AcknowledgedApplicationDisclosures.proto │ │ ├── AcknowledgedApplicationDisclosures_pb2.py │ │ ├── ApplicationUserRoleConnection.proto │ │ └── ApplicationUserRoleConnection_pb2.py ├── discord_users │ └── v1 │ │ ├── FrecencyUserSettings.proto │ │ ├── FrecencyUserSettings_pb2.py │ │ ├── PreloadedUserSettings.proto │ │ └── PreloadedUserSettings_pb2.py └── premium_marketing │ └── v1 │ ├── PremiumMarketingComponentProperties.proto │ └── PremiumMarketingComponentProperties_pb2.py ├── package.json ├── pyproject.toml ├── requirements.txt ├── scripts ├── parse.js └── preload.js ├── setup.py ├── src ├── discord_protos │ ├── discord_experimentation │ │ └── v1 │ │ │ └── Experiment.ts │ ├── discord_kkv_store_value_models │ │ └── v1 │ │ │ ├── AcknowledgedApplicationDisclosures.ts │ │ │ └── ApplicationUserRoleConnection.ts │ ├── discord_users │ │ └── v1 │ │ │ ├── FrecencyUserSettings.ts │ │ │ └── PreloadedUserSettings.ts │ ├── google │ │ └── protobuf │ │ │ ├── timestamp.ts │ │ │ └── wrappers.ts │ └── premium_marketing │ │ └── v1 │ │ └── PremiumMarketingComponentProperties.ts ├── index.ts └── load.ts └── tsconfig.json /.github/workflows/update.yml: -------------------------------------------------------------------------------- 1 | name: Update protobuf definitions 2 | 3 | on: 4 | workflow_dispatch: 5 | schedule: 6 | - cron: "0 */3 * * *" 7 | 8 | jobs: 9 | update: 10 | runs-on: ubuntu-latest 11 | 12 | permissions: 13 | # Give the default GITHUB_TOKEN write permission to commit and push the changed files back to the repository 14 | contents: write 15 | id-token: write 16 | 17 | steps: 18 | - name: Checkout repository 19 | uses: actions/checkout@v4 20 | with: 21 | ref: ${{ github.head_ref }} 22 | 23 | - name: Install Node.js 24 | uses: actions/setup-node@v4 25 | with: 26 | node-version: 'latest' 27 | registry-url: 'https://registry.npmjs.org' 28 | 29 | - name: Install protoc 30 | uses: arduino/setup-protoc@v3 31 | with: 32 | version: '28.x' 33 | 34 | - name: Install dependencies 35 | run: npm install 36 | 37 | - name: Load protobuf definitions 38 | run: | 39 | # Fix puppeteer on Ubuntu 23.10+ 40 | # See https://github.com/puppeteer/puppeteer/issues/12818 41 | echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns 42 | npm run load 43 | shell: bash 44 | 45 | - name: Build protobuf definitions 46 | run: | 47 | npm run js 48 | npm run py 49 | 50 | - name: Commit changes 51 | id: changes 52 | run: | 53 | git config --global user.name "github-actions[bot]" 54 | git config --global user.email "github-actions[bot]@users.noreply.github.com" 55 | if git diff --quiet; then 56 | echo "has_changes=false" >> "$GITHUB_OUTPUT" 57 | else 58 | echo "has_changes=true" >> "$GITHUB_OUTPUT" 59 | fi 60 | git add . 61 | git commit -m "Update protobuf definitions" || exit 0 62 | git push 63 | env: 64 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 65 | 66 | - name: Publish to NPM 67 | if: steps.changes.outputs.has_changes == 'true' 68 | run: npm publish --provenance --access public 69 | env: 70 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 71 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | __pycache__/ 3 | node_modules/ 4 | yarn* 5 | package-lock.json 6 | .DS_STORE 7 | dist/ 8 | *.egg-info -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | src/ 2 | -------------------------------------------------------------------------------- /.prettierrc.yml: -------------------------------------------------------------------------------- 1 | trailingComma: "all" 2 | tabWidth: 4 3 | maxLineLength: 120 4 | printWidth: 140 -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022-present dolfies 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include README.md 2 | include LICENSE 3 | include requirements.txt 4 | include discord_protos/*.proto 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Discord Protocol Buffers 2 | Reverse-engineering Discord's protobufs. 3 | 4 | This repository provides protocol buffer files for all protobufs found in Discord's client source, automatically generated and automatically updated. The protobufs are provided as .proto files in the `out/` directory. 5 | 6 | These protobufs are used by Discord clients for transmitting data like user settings and premium marketing. 7 | 8 | Provided for educational purposes only. 9 | 10 | ### Credits 11 | 12 | - [arHSM](https://github.com/arHSM) for originally reverse-engineering the technology behind Discord's protobuf implementation. 13 | 14 | ## Usage 15 | 16 | ### Note 17 | Automating user accounts is against the Discord ToS. This repository is a proof of concept and I cannot recommend using it. Do so at your own risk. 18 | 19 | ### Installation 20 | ``` 21 | # with npm 22 | npm install discord-protos 23 | 24 | # with yarn 25 | yarn add discord-protos 26 | 27 | # with pnpm 28 | pnpm add discord-protos 29 | 30 | # with pip 31 | pip install discord-protos 32 | ``` 33 | 34 | ### Example 35 | JavaScript: 36 | ```js 37 | const { PreloadedUserSettings } = require('discord-protos'); 38 | 39 | const encoded = PreloadedUserSettings.toBase64({ 40 | status: { 41 | status: { 42 | value: "online", 43 | }, 44 | customStatus: { 45 | text: "Hello World", 46 | emojiId: 0n, 47 | emojiName: "", 48 | expiresAtMs: 0n, 49 | }, 50 | }, 51 | }); 52 | 53 | const decoded = PreloadedUserSettings.fromBase64(encoded); 54 | 55 | console.log(encoded, decoded); 56 | ``` 57 | 58 | Python: 59 | ```py 60 | import base64 61 | from discord_protos import PreloadedUserSettings 62 | 63 | settings = PreloadedUserSettings() 64 | encoded = base64.b64encode(settings.ParseDict({ 65 | 'status': { 66 | 'status': { 67 | 'value': 'online', 68 | }, 69 | 'custom_status': { 70 | 'text': 'Hello World', 71 | 'emoji_id': 0, 72 | 'emoji_name': '', 73 | 'expires_at_ms': 0, 74 | }, 75 | }, 76 | }).SerializeToString()) 77 | 78 | decoded = PreloadedUserSettings.FromString(base64.b64decode(encoded)) 79 | 80 | print(encoded, decoded) 81 | ``` 82 | 83 | The following table shows which protobuf user settings correspond to which .proto file (the Python package also provides a `UserSettingsType` enum for convenience). 84 | 85 | | Type | Value | File | Use | 86 | | ---- | --------------------------------- | --------------------------- | -------------------------------------------------- | 87 | | 1 | `PRELOADED_USER_SETTINGS` | PreloadedUserSettings.proto | General Discord user settings. | 88 | | 2 | `FRECENCY_AND_FAVORITES_SETTINGS` | FrecencyUserSettings.proto | Frecency and favorites storage for various things. | 89 | | 3 | `TEST_SETTINGS` | - | Unknown. | 90 | 91 | Base64-encoded data for these protobufs are provided by the `GET /users/@me/settings-proto/{type}` endpoint. For preloaded user settings, base64-encoded data is provided in the `user_settings_proto` key of the `READY` event received in the Discord Gateway, as well as in `USER_SETTINGS_PROTO_UPDATE` events. 92 | 93 | ### Protobufs 94 | The .proto files can be compiled down to Python or JavaScript files by running `npm run py` or `npm run js`. This requires protoc to be installed. 95 | 96 | 97 | ### Development 98 | Running `pnpm load` will extract and save the latest protobufs to the `discord_protos/` directory. 99 | -------------------------------------------------------------------------------- /discord_protos/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from enum import Enum as _Enum 4 | from typing import TYPE_CHECKING 5 | 6 | __version__ = '1.2.73' 7 | 8 | if TYPE_CHECKING: 9 | from google.protobuf.message import Message as _Message 10 | 11 | PreloadedUserSettings = FrecencyUserSettings = ApplicationUserRoleConnection = AcknowledgedApplicationDisclosures = Experiment = PremiumMarketingComponentProperties = _Message 12 | else: 13 | from .discord_users.v1.PreloadedUserSettings_pb2 import * 14 | from .discord_users.v1.FrecencyUserSettings_pb2 import * 15 | from .discord_kkv_store_value_models.v1.ApplicationUserRoleConnection_pb2 import * 16 | from .discord_kkv_store_value_models.v1.AcknowledgedApplicationDisclosures_pb2 import * 17 | from .discord_experimentation.v1.Experiment_pb2 import * 18 | from .premium_marketing.v1.PremiumMarketingComponentProperties_pb2 import * 19 | 20 | __all__ = ( 21 | '__version__', 22 | 'UserSettingsType', 23 | 'PreloadedUserSettings', 24 | 'FrecencyUserSettings', 25 | 'ApplicationUserRoleConnection', 26 | 'AcknowledgedApplicationDisclosures', 27 | 'Experiment', 28 | 'PremiumMarketingComponentProperties', 29 | ) 30 | 31 | 32 | class UserSettingsType(_Enum): 33 | preloaded_user_settings = 1 34 | frecency_user_settings = 2 35 | test_settings = 3 36 | 37 | 38 | UserSettingsImpl = { 39 | UserSettingsType.preloaded_user_settings: PreloadedUserSettings, 40 | UserSettingsType.frecency_user_settings: FrecencyUserSettings, 41 | UserSettingsType.test_settings: None, 42 | } 43 | -------------------------------------------------------------------------------- /discord_protos/discord_experimentation/v1/Experiment.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | import "google/protobuf/wrappers.proto"; 4 | import "google/protobuf/timestamp.proto"; 5 | 6 | package discord_protos.discord_experimentation.v1; 7 | 8 | message Experiment { 9 | enum UnitType { 10 | UNIT_TYPE_UNSPECIFIED = 0; 11 | UNIT_TYPE_USER = 1; 12 | } 13 | 14 | enum Type { 15 | TYPE_UNSPECIFIED = 0; 16 | TYPE_ACTIVE = 1; 17 | TYPE_UNUSED = 2; 18 | TYPE_BURNED = 3; 19 | } 20 | 21 | message Bucket { 22 | int32 start = 1; 23 | int32 stop = 2; 24 | Type type = 3; 25 | } 26 | 27 | message Variation { 28 | int32 id = 1; 29 | string label = 2; 30 | int32 target_allocation = 3; 31 | repeated Bucket buckets = 4; 32 | Type type = 5; 33 | optional google.protobuf.StringValue configuration = 6; 34 | } 35 | 36 | message PlatformVersionSpecifier { 37 | uint32 major = 1; 38 | optional google.protobuf.UInt32Value minor = 2; 39 | optional google.protobuf.UInt64Value build = 3; 40 | } 41 | 42 | message PlatformVersionRangeBound { 43 | optional PlatformVersionSpecifier version = 1; 44 | bool inclusive = 2; 45 | } 46 | 47 | message PlatformVersionRange { 48 | optional PlatformVersionRangeBound lower_bound = 1; 49 | optional PlatformVersionRangeBound upper_bound = 2; 50 | } 51 | 52 | message PlatformVersion { 53 | repeated PlatformVersionRange ranges = 1; 54 | bool work_around_pyoto_bug = 2; 55 | } 56 | 57 | message ClientRequiredChanges { 58 | repeated string commit_hashes = 1 [packed = false]; 59 | repeated int32 pr_numbers = 2; 60 | } 61 | 62 | message ClientPlatform { 63 | optional PlatformVersion ios_version = 1; 64 | optional PlatformVersion android_version = 2; 65 | optional PlatformVersion web_version = 3; 66 | optional PlatformVersion native_version = 4; 67 | bool allow_non_native_web = 6; 68 | optional ClientRequiredChanges client_required_changes = 5; 69 | } 70 | 71 | message SDKVersionSpecifier { 72 | int32 version = 1; 73 | } 74 | 75 | message SDKVersionRangeBound { 76 | optional SDKVersionSpecifier version = 1; 77 | bool inclusive = 2; 78 | } 79 | 80 | message SDKVersionRange { 81 | optional SDKVersionRangeBound lower_bound = 1; 82 | optional SDKVersionRangeBound upper_bound = 2; 83 | } 84 | 85 | message SDKVersion { 86 | repeated SDKVersionRange ranges = 1; 87 | bool work_around_pyoto_bug = 2; 88 | } 89 | 90 | message ClientOperatingSystem { 91 | optional SDKVersion ios_version = 1; 92 | optional SDKVersion android_version = 2; 93 | optional SDKVersion macos_version = 3; 94 | optional SDKVersion windows_version = 4; 95 | optional SDKVersion playstation_version = 5; 96 | optional SDKVersion xbox_version = 6; 97 | optional SDKVersion linux_version = 7; 98 | } 99 | 100 | message StaffUsers { 101 | bool work_accounts = 1; 102 | bool personal_accounts = 2; 103 | } 104 | 105 | message UserInGuild { 106 | repeated fixed64 guild_ids = 1; 107 | } 108 | 109 | message UserIds { 110 | repeated fixed64 user_ids = 1; 111 | } 112 | 113 | message ClientLocale { 114 | repeated string locales = 1 [packed = false]; 115 | } 116 | 117 | message ISORegion { 118 | string iso_country = 1; 119 | string iso_subdivision = 2; 120 | } 121 | 122 | message Place { 123 | string city = 1; 124 | string subdivision = 2; 125 | string country = 3; 126 | } 127 | 128 | message Location { 129 | oneof location { 130 | ISORegion iso_region = 1; 131 | bool is_eu = 2; 132 | Place place = 3; 133 | } 134 | } 135 | 136 | message ClientLocation { 137 | repeated Location locations = 1; 138 | } 139 | 140 | message ClientIP { 141 | repeated string blocks = 1 [packed = false]; 142 | } 143 | 144 | message UserLocale { 145 | repeated string locales = 1 [packed = false]; 146 | } 147 | 148 | message UserIsBot { 149 | bool is_bot = 1; 150 | } 151 | 152 | message UserAgeRange { 153 | optional google.protobuf.UInt32Value min_age_years = 1; 154 | optional google.protobuf.UInt32Value max_age_years = 2; 155 | } 156 | 157 | message Fixed64Value { 158 | fixed64 value = 1; 159 | } 160 | 161 | message UserIDRange { 162 | optional Fixed64Value min_id = 1; 163 | optional Fixed64Value max_id = 2; 164 | } 165 | 166 | message UserHasFlag { 167 | fixed64 mask = 1; 168 | } 169 | 170 | message UnitIdInRangeByHash { 171 | string hash_key = 1; 172 | uint32 target = 2; 173 | } 174 | 175 | message ClientReleaseChannel { 176 | repeated string release_channels = 1 [packed = false]; 177 | } 178 | 179 | message Always { 180 | bool value = 1; 181 | } 182 | 183 | message ClientSystemLocale { 184 | repeated string locales = 1 [packed = false]; 185 | } 186 | 187 | message UnitIdInExperiment { 188 | fixed64 experiment_id = 1; 189 | repeated int32 variation_ids = 2; 190 | } 191 | 192 | message UserPremiumType { 193 | repeated int32 premium_types = 1; 194 | } 195 | 196 | message Filter { 197 | oneof filter { 198 | ClientPlatform client_version = 2; 199 | ClientOperatingSystem client_os = 3; 200 | StaffUsers staff = 4; 201 | UserInGuild user_in_guild = 5; 202 | UserIds user_ids = 6; 203 | ClientLocale client_locale = 7; 204 | ClientLocation client_location = 8; 205 | ClientIP client_ip = 9; 206 | UserLocale user_locale = 10; 207 | UserIsBot bot = 11; 208 | UserAgeRange user_age_range = 12; 209 | UserIDRange user_id_range = 13; 210 | UserHasFlag user_has_flag = 14; 211 | UnitIdInRangeByHash unit_id_in_range_by_hash = 15; 212 | ClientReleaseChannel client_release_channel = 16; 213 | Always always = 17; 214 | ClientSystemLocale client_system_locale = 18; 215 | UnitIdInExperiment unit_id_in_experiment = 19; 216 | UserPremiumType user_premium_type = 20; 217 | } 218 | } 219 | 220 | message Override { 221 | int32 variation_id = 1; 222 | } 223 | 224 | message Rule { 225 | Type type = 1; 226 | repeated Filter filters = 2; 227 | optional Override override = 3; 228 | bool is_sunset_rule = 4; 229 | } 230 | 231 | enum Phase { 232 | PHASE_UNSPECIFIED = 0; 233 | PHASE_DRAFT = 1; 234 | PHASE_MEASUREMENT = 2; 235 | PHASE_MEASUREMENT_ENDED = 3; 236 | PHASE_ROLLING_OUT = 4; 237 | PHASE_ROLLED_OUT = 5; 238 | PHASE_ARCHIVED = 6; 239 | PHASE_AA_MODE = 7; 240 | } 241 | 242 | enum Surface { 243 | SURFACE_UNSPECIFIED = 0; 244 | SURFACE_API = 1; 245 | SURFACE_APP = 2; 246 | SURFACE_DEVELOPER_PORTAL = 3; 247 | SURFACE_ADMIN_PANEL = 4; 248 | SURFACE_ADS_BUDGET_AB = 5; 249 | } 250 | 251 | enum ExposureTracking { 252 | EXPOSURE_TRACKING_ENABLED = 0; 253 | EXPOSURE_TRACKING_DISABLED = 1; 254 | } 255 | 256 | enum AssignmentMode { 257 | ASSIGNMENT_MODE_FULL = 0; 258 | ASSIGNMENT_MODE_FORCE_DEFAULT = 1; 259 | ASSIGNMENT_MODE_OVERRIDE_ONLY = 2; 260 | } 261 | 262 | fixed64 id = 1; 263 | string name = 2; 264 | optional google.protobuf.Timestamp created_at = 3; 265 | fixed64 creator_id = 4; 266 | int32 version = 5; 267 | optional google.protobuf.Timestamp edited_at = 6; 268 | fixed64 editor_id = 7; 269 | string title = 8; 270 | string description = 9; 271 | optional google.protobuf.StringValue hypothesis = 10; 272 | optional google.protobuf.StringValue tech_spec_link = 11; 273 | int32 revision = 12; 274 | string hash_key = 13; 275 | UnitType unit_type = 14; 276 | repeated Variation variations = 15; 277 | repeated Rule rules = 16; 278 | Phase phase = 18; 279 | repeated Surface surfaces = 19; 280 | string owning_team_id = 20; 281 | fixed64 cached_notification_channel_id = 21; 282 | ExposureTracking exposure_tracking = 22; 283 | AssignmentMode assignment_mode = 25; 284 | bool enable_edit_raw_json_ui = 23; 285 | int32 winning_variation_id = 24; 286 | Type type = 26; 287 | bool is_template = 27; 288 | repeated int32 field_numbers_to_copy = 28; 289 | } 290 | -------------------------------------------------------------------------------- /discord_protos/discord_experimentation/v1/Experiment_pb2.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by the protocol buffer compiler. DO NOT EDIT! 3 | # NO CHECKED-IN PROTOBUF GENCODE 4 | # source: discord_experimentation/v1/Experiment.proto 5 | # Protobuf Python Version: 5.28.3 6 | """Generated protocol buffer code.""" 7 | from google.protobuf import descriptor as _descriptor 8 | from google.protobuf import descriptor_pool as _descriptor_pool 9 | from google.protobuf import runtime_version as _runtime_version 10 | from google.protobuf import symbol_database as _symbol_database 11 | from google.protobuf.internal import builder as _builder 12 | _runtime_version.ValidateProtobufRuntimeVersion( 13 | _runtime_version.Domain.PUBLIC, 14 | 5, 15 | 28, 16 | 3, 17 | '', 18 | 'discord_experimentation/v1/Experiment.proto' 19 | ) 20 | # @@protoc_insertion_point(imports) 21 | 22 | _sym_db = _symbol_database.Default() 23 | 24 | 25 | from google.protobuf import wrappers_pb2 as google_dot_protobuf_dot_wrappers__pb2 26 | from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 27 | 28 | 29 | DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n+discord_experimentation/v1/Experiment.proto\x12)discord_protos.discord_experimentation.v1\x1a\x1egoogle/protobuf/wrappers.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xe9\x44\n\nExperiment\x12\n\n\x02id\x18\x01 \x01(\x06\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x33\n\ncreated_at\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x88\x01\x01\x12\x12\n\ncreator_id\x18\x04 \x01(\x06\x12\x0f\n\x07version\x18\x05 \x01(\x05\x12\x32\n\tedited_at\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x01\x88\x01\x01\x12\x11\n\teditor_id\x18\x07 \x01(\x06\x12\r\n\x05title\x18\x08 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\t \x01(\t\x12\x35\n\nhypothesis\x18\n \x01(\x0b\x32\x1c.google.protobuf.StringValueH\x02\x88\x01\x01\x12\x39\n\x0etech_spec_link\x18\x0b \x01(\x0b\x32\x1c.google.protobuf.StringValueH\x03\x88\x01\x01\x12\x10\n\x08revision\x18\x0c \x01(\x05\x12\x10\n\x08hash_key\x18\r \x01(\t\x12Q\n\tunit_type\x18\x0e \x01(\x0e\x32>.discord_protos.discord_experimentation.v1.Experiment.UnitType\x12S\n\nvariations\x18\x0f \x03(\x0b\x32?.discord_protos.discord_experimentation.v1.Experiment.Variation\x12I\n\x05rules\x18\x10 \x03(\x0b\x32:.discord_protos.discord_experimentation.v1.Experiment.Rule\x12J\n\x05phase\x18\x12 \x01(\x0e\x32;.discord_protos.discord_experimentation.v1.Experiment.Phase\x12O\n\x08surfaces\x18\x13 \x03(\x0e\x32=.discord_protos.discord_experimentation.v1.Experiment.Surface\x12\x16\n\x0eowning_team_id\x18\x14 \x01(\t\x12&\n\x1e\x63\x61\x63hed_notification_channel_id\x18\x15 \x01(\x06\x12\x61\n\x11\x65xposure_tracking\x18\x16 \x01(\x0e\x32\x46.discord_protos.discord_experimentation.v1.Experiment.ExposureTracking\x12]\n\x0f\x61ssignment_mode\x18\x19 \x01(\x0e\x32\x44.discord_protos.discord_experimentation.v1.Experiment.AssignmentMode\x12\x1f\n\x17\x65nable_edit_raw_json_ui\x18\x17 \x01(\x08\x12\x1c\n\x14winning_variation_id\x18\x18 \x01(\x05\x12H\n\x04type\x18\x1a \x01(\x0e\x32:.discord_protos.discord_experimentation.v1.Experiment.Type\x12\x13\n\x0bis_template\x18\x1b \x01(\x08\x12\x1d\n\x15\x66ield_numbers_to_copy\x18\x1c \x03(\x05\x1ao\n\x06\x42ucket\x12\r\n\x05start\x18\x01 \x01(\x05\x12\x0c\n\x04stop\x18\x02 \x01(\x05\x12H\n\x04type\x18\x03 \x01(\x0e\x32:.discord_protos.discord_experimentation.v1.Experiment.Type\x1a\xa6\x02\n\tVariation\x12\n\n\x02id\x18\x01 \x01(\x05\x12\r\n\x05label\x18\x02 \x01(\t\x12\x19\n\x11target_allocation\x18\x03 \x01(\x05\x12M\n\x07\x62uckets\x18\x04 \x03(\x0b\x32<.discord_protos.discord_experimentation.v1.Experiment.Bucket\x12H\n\x04type\x18\x05 \x01(\x0e\x32:.discord_protos.discord_experimentation.v1.Experiment.Type\x12\x38\n\rconfiguration\x18\x06 \x01(\x0b\x32\x1c.google.protobuf.StringValueH\x00\x88\x01\x01\x42\x10\n\x0e_configuration\x1a\xa1\x01\n\x18PlatformVersionSpecifier\x12\r\n\x05major\x18\x01 \x01(\r\x12\x30\n\x05minor\x18\x02 \x01(\x0b\x32\x1c.google.protobuf.UInt32ValueH\x00\x88\x01\x01\x12\x30\n\x05\x62uild\x18\x03 \x01(\x0b\x32\x1c.google.protobuf.UInt64ValueH\x01\x88\x01\x01\x42\x08\n\x06_minorB\x08\n\x06_build\x1a\xa0\x01\n\x19PlatformVersionRangeBound\x12\x64\n\x07version\x18\x01 \x01(\x0b\x32N.discord_protos.discord_experimentation.v1.Experiment.PlatformVersionSpecifierH\x00\x88\x01\x01\x12\x11\n\tinclusive\x18\x02 \x01(\x08\x42\n\n\x08_version\x1a\x8c\x02\n\x14PlatformVersionRange\x12i\n\x0blower_bound\x18\x01 \x01(\x0b\x32O.discord_protos.discord_experimentation.v1.Experiment.PlatformVersionRangeBoundH\x00\x88\x01\x01\x12i\n\x0bupper_bound\x18\x02 \x01(\x0b\x32O.discord_protos.discord_experimentation.v1.Experiment.PlatformVersionRangeBoundH\x01\x88\x01\x01\x42\x0e\n\x0c_lower_boundB\x0e\n\x0c_upper_bound\x1a\x8c\x01\n\x0fPlatformVersion\x12Z\n\x06ranges\x18\x01 \x03(\x0b\x32J.discord_protos.discord_experimentation.v1.Experiment.PlatformVersionRange\x12\x1d\n\x15work_around_pyoto_bug\x18\x02 \x01(\x08\x1a\x46\n\x15\x43lientRequiredChanges\x12\x19\n\rcommit_hashes\x18\x01 \x03(\tB\x02\x10\x00\x12\x12\n\npr_numbers\x18\x02 \x03(\x05\x1a\x8f\x05\n\x0e\x43lientPlatform\x12_\n\x0bios_version\x18\x01 \x01(\x0b\x32\x45.discord_protos.discord_experimentation.v1.Experiment.PlatformVersionH\x00\x88\x01\x01\x12\x63\n\x0f\x61ndroid_version\x18\x02 \x01(\x0b\x32\x45.discord_protos.discord_experimentation.v1.Experiment.PlatformVersionH\x01\x88\x01\x01\x12_\n\x0bweb_version\x18\x03 \x01(\x0b\x32\x45.discord_protos.discord_experimentation.v1.Experiment.PlatformVersionH\x02\x88\x01\x01\x12\x62\n\x0enative_version\x18\x04 \x01(\x0b\x32\x45.discord_protos.discord_experimentation.v1.Experiment.PlatformVersionH\x03\x88\x01\x01\x12\x1c\n\x14\x61llow_non_native_web\x18\x06 \x01(\x08\x12q\n\x17\x63lient_required_changes\x18\x05 \x01(\x0b\x32K.discord_protos.discord_experimentation.v1.Experiment.ClientRequiredChangesH\x04\x88\x01\x01\x42\x0e\n\x0c_ios_versionB\x12\n\x10_android_versionB\x0e\n\x0c_web_versionB\x11\n\x0f_native_versionB\x1a\n\x18_client_required_changes\x1a&\n\x13SDKVersionSpecifier\x12\x0f\n\x07version\x18\x01 \x01(\x05\x1a\x96\x01\n\x14SDKVersionRangeBound\x12_\n\x07version\x18\x01 \x01(\x0b\x32I.discord_protos.discord_experimentation.v1.Experiment.SDKVersionSpecifierH\x00\x88\x01\x01\x12\x11\n\tinclusive\x18\x02 \x01(\x08\x42\n\n\x08_version\x1a\xfd\x01\n\x0fSDKVersionRange\x12\x64\n\x0blower_bound\x18\x01 \x01(\x0b\x32J.discord_protos.discord_experimentation.v1.Experiment.SDKVersionRangeBoundH\x00\x88\x01\x01\x12\x64\n\x0bupper_bound\x18\x02 \x01(\x0b\x32J.discord_protos.discord_experimentation.v1.Experiment.SDKVersionRangeBoundH\x01\x88\x01\x01\x42\x0e\n\x0c_lower_boundB\x0e\n\x0c_upper_bound\x1a\x82\x01\n\nSDKVersion\x12U\n\x06ranges\x18\x01 \x03(\x0b\x32\x45.discord_protos.discord_experimentation.v1.Experiment.SDKVersionRange\x12\x1d\n\x15work_around_pyoto_bug\x18\x02 \x01(\x08\x1a\xb5\x06\n\x15\x43lientOperatingSystem\x12Z\n\x0bios_version\x18\x01 \x01(\x0b\x32@.discord_protos.discord_experimentation.v1.Experiment.SDKVersionH\x00\x88\x01\x01\x12^\n\x0f\x61ndroid_version\x18\x02 \x01(\x0b\x32@.discord_protos.discord_experimentation.v1.Experiment.SDKVersionH\x01\x88\x01\x01\x12\\\n\rmacos_version\x18\x03 \x01(\x0b\x32@.discord_protos.discord_experimentation.v1.Experiment.SDKVersionH\x02\x88\x01\x01\x12^\n\x0fwindows_version\x18\x04 \x01(\x0b\x32@.discord_protos.discord_experimentation.v1.Experiment.SDKVersionH\x03\x88\x01\x01\x12\x62\n\x13playstation_version\x18\x05 \x01(\x0b\x32@.discord_protos.discord_experimentation.v1.Experiment.SDKVersionH\x04\x88\x01\x01\x12[\n\x0cxbox_version\x18\x06 \x01(\x0b\x32@.discord_protos.discord_experimentation.v1.Experiment.SDKVersionH\x05\x88\x01\x01\x12\\\n\rlinux_version\x18\x07 \x01(\x0b\x32@.discord_protos.discord_experimentation.v1.Experiment.SDKVersionH\x06\x88\x01\x01\x42\x0e\n\x0c_ios_versionB\x12\n\x10_android_versionB\x10\n\x0e_macos_versionB\x12\n\x10_windows_versionB\x16\n\x14_playstation_versionB\x0f\n\r_xbox_versionB\x10\n\x0e_linux_version\x1a>\n\nStaffUsers\x12\x15\n\rwork_accounts\x18\x01 \x01(\x08\x12\x19\n\x11personal_accounts\x18\x02 \x01(\x08\x1a \n\x0bUserInGuild\x12\x11\n\tguild_ids\x18\x01 \x03(\x06\x1a\x1b\n\x07UserIds\x12\x10\n\x08user_ids\x18\x01 \x03(\x06\x1a#\n\x0c\x43lientLocale\x12\x13\n\x07locales\x18\x01 \x03(\tB\x02\x10\x00\x1a\x39\n\tISORegion\x12\x13\n\x0biso_country\x18\x01 \x01(\t\x12\x17\n\x0fiso_subdivision\x18\x02 \x01(\t\x1a;\n\x05Place\x12\x0c\n\x04\x63ity\x18\x01 \x01(\t\x12\x13\n\x0bsubdivision\x18\x02 \x01(\t\x12\x0f\n\x07\x63ountry\x18\x03 \x01(\t\x1a\xcc\x01\n\x08Location\x12U\n\niso_region\x18\x01 \x01(\x0b\x32?.discord_protos.discord_experimentation.v1.Experiment.ISORegionH\x00\x12\x0f\n\x05is_eu\x18\x02 \x01(\x08H\x00\x12L\n\x05place\x18\x03 \x01(\x0b\x32;.discord_protos.discord_experimentation.v1.Experiment.PlaceH\x00\x42\n\n\x08location\x1a\x63\n\x0e\x43lientLocation\x12Q\n\tlocations\x18\x01 \x03(\x0b\x32>.discord_protos.discord_experimentation.v1.Experiment.Location\x1a\x1e\n\x08\x43lientIP\x12\x12\n\x06\x62locks\x18\x01 \x03(\tB\x02\x10\x00\x1a!\n\nUserLocale\x12\x13\n\x07locales\x18\x01 \x03(\tB\x02\x10\x00\x1a\x1b\n\tUserIsBot\x12\x0e\n\x06is_bot\x18\x01 \x01(\x08\x1a\xa6\x01\n\x0cUserAgeRange\x12\x38\n\rmin_age_years\x18\x01 \x01(\x0b\x32\x1c.google.protobuf.UInt32ValueH\x00\x88\x01\x01\x12\x38\n\rmax_age_years\x18\x02 \x01(\x0b\x32\x1c.google.protobuf.UInt32ValueH\x01\x88\x01\x01\x42\x10\n\x0e_min_age_yearsB\x10\n\x0e_max_age_years\x1a\x1d\n\x0c\x46ixed64Value\x12\r\n\x05value\x18\x01 \x01(\x06\x1a\xd5\x01\n\x0bUserIDRange\x12W\n\x06min_id\x18\x01 \x01(\x0b\x32\x42.discord_protos.discord_experimentation.v1.Experiment.Fixed64ValueH\x00\x88\x01\x01\x12W\n\x06max_id\x18\x02 \x01(\x0b\x32\x42.discord_protos.discord_experimentation.v1.Experiment.Fixed64ValueH\x01\x88\x01\x01\x42\t\n\x07_min_idB\t\n\x07_max_id\x1a\x1b\n\x0bUserHasFlag\x12\x0c\n\x04mask\x18\x01 \x01(\x06\x1a\x37\n\x13UnitIdInRangeByHash\x12\x10\n\x08hash_key\x18\x01 \x01(\t\x12\x0e\n\x06target\x18\x02 \x01(\r\x1a\x34\n\x14\x43lientReleaseChannel\x12\x1c\n\x10release_channels\x18\x01 \x03(\tB\x02\x10\x00\x1a\x17\n\x06\x41lways\x12\r\n\x05value\x18\x01 \x01(\x08\x1a)\n\x12\x43lientSystemLocale\x12\x13\n\x07locales\x18\x01 \x03(\tB\x02\x10\x00\x1a\x42\n\x12UnitIdInExperiment\x12\x15\n\rexperiment_id\x18\x01 \x01(\x06\x12\x15\n\rvariation_ids\x18\x02 \x03(\x05\x1a(\n\x0fUserPremiumType\x12\x15\n\rpremium_types\x18\x01 \x03(\x05\x1a\x8e\x0e\n\x06\x46ilter\x12^\n\x0e\x63lient_version\x18\x02 \x01(\x0b\x32\x44.discord_protos.discord_experimentation.v1.Experiment.ClientPlatformH\x00\x12`\n\tclient_os\x18\x03 \x01(\x0b\x32K.discord_protos.discord_experimentation.v1.Experiment.ClientOperatingSystemH\x00\x12Q\n\x05staff\x18\x04 \x01(\x0b\x32@.discord_protos.discord_experimentation.v1.Experiment.StaffUsersH\x00\x12Z\n\ruser_in_guild\x18\x05 \x01(\x0b\x32\x41.discord_protos.discord_experimentation.v1.Experiment.UserInGuildH\x00\x12Q\n\x08user_ids\x18\x06 \x01(\x0b\x32=.discord_protos.discord_experimentation.v1.Experiment.UserIdsH\x00\x12[\n\rclient_locale\x18\x07 \x01(\x0b\x32\x42.discord_protos.discord_experimentation.v1.Experiment.ClientLocaleH\x00\x12_\n\x0f\x63lient_location\x18\x08 \x01(\x0b\x32\x44.discord_protos.discord_experimentation.v1.Experiment.ClientLocationH\x00\x12S\n\tclient_ip\x18\t \x01(\x0b\x32>.discord_protos.discord_experimentation.v1.Experiment.ClientIPH\x00\x12W\n\x0buser_locale\x18\n \x01(\x0b\x32@.discord_protos.discord_experimentation.v1.Experiment.UserLocaleH\x00\x12N\n\x03\x62ot\x18\x0b \x01(\x0b\x32?.discord_protos.discord_experimentation.v1.Experiment.UserIsBotH\x00\x12\\\n\x0euser_age_range\x18\x0c \x01(\x0b\x32\x42.discord_protos.discord_experimentation.v1.Experiment.UserAgeRangeH\x00\x12Z\n\ruser_id_range\x18\r \x01(\x0b\x32\x41.discord_protos.discord_experimentation.v1.Experiment.UserIDRangeH\x00\x12Z\n\ruser_has_flag\x18\x0e \x01(\x0b\x32\x41.discord_protos.discord_experimentation.v1.Experiment.UserHasFlagH\x00\x12m\n\x18unit_id_in_range_by_hash\x18\x0f \x01(\x0b\x32I.discord_protos.discord_experimentation.v1.Experiment.UnitIdInRangeByHashH\x00\x12l\n\x16\x63lient_release_channel\x18\x10 \x01(\x0b\x32J.discord_protos.discord_experimentation.v1.Experiment.ClientReleaseChannelH\x00\x12N\n\x06\x61lways\x18\x11 \x01(\x0b\x32<.discord_protos.discord_experimentation.v1.Experiment.AlwaysH\x00\x12h\n\x14\x63lient_system_locale\x18\x12 \x01(\x0b\x32H.discord_protos.discord_experimentation.v1.Experiment.ClientSystemLocaleH\x00\x12i\n\x15unit_id_in_experiment\x18\x13 \x01(\x0b\x32H.discord_protos.discord_experimentation.v1.Experiment.UnitIdInExperimentH\x00\x12\x62\n\x11user_premium_type\x18\x14 \x01(\x0b\x32\x45.discord_protos.discord_experimentation.v1.Experiment.UserPremiumTypeH\x00\x42\x08\n\x06\x66ilter\x1a \n\x08Override\x12\x14\n\x0cvariation_id\x18\x01 \x01(\x05\x1a\x9b\x02\n\x04Rule\x12H\n\x04type\x18\x01 \x01(\x0e\x32:.discord_protos.discord_experimentation.v1.Experiment.Type\x12M\n\x07\x66ilters\x18\x02 \x03(\x0b\x32<.discord_protos.discord_experimentation.v1.Experiment.Filter\x12U\n\x08override\x18\x03 \x01(\x0b\x32>.discord_protos.discord_experimentation.v1.Experiment.OverrideH\x00\x88\x01\x01\x12\x16\n\x0eis_sunset_rule\x18\x04 \x01(\x08\x42\x0b\n\t_override\"9\n\x08UnitType\x12\x19\n\x15UNIT_TYPE_UNSPECIFIED\x10\x00\x12\x12\n\x0eUNIT_TYPE_USER\x10\x01\"O\n\x04Type\x12\x14\n\x10TYPE_UNSPECIFIED\x10\x00\x12\x0f\n\x0bTYPE_ACTIVE\x10\x01\x12\x0f\n\x0bTYPE_UNUSED\x10\x02\x12\x0f\n\x0bTYPE_BURNED\x10\x03\"\xb7\x01\n\x05Phase\x12\x15\n\x11PHASE_UNSPECIFIED\x10\x00\x12\x0f\n\x0bPHASE_DRAFT\x10\x01\x12\x15\n\x11PHASE_MEASUREMENT\x10\x02\x12\x1b\n\x17PHASE_MEASUREMENT_ENDED\x10\x03\x12\x15\n\x11PHASE_ROLLING_OUT\x10\x04\x12\x14\n\x10PHASE_ROLLED_OUT\x10\x05\x12\x12\n\x0ePHASE_ARCHIVED\x10\x06\x12\x11\n\rPHASE_AA_MODE\x10\x07\"\x96\x01\n\x07Surface\x12\x17\n\x13SURFACE_UNSPECIFIED\x10\x00\x12\x0f\n\x0bSURFACE_API\x10\x01\x12\x0f\n\x0bSURFACE_APP\x10\x02\x12\x1c\n\x18SURFACE_DEVELOPER_PORTAL\x10\x03\x12\x17\n\x13SURFACE_ADMIN_PANEL\x10\x04\x12\x19\n\x15SURFACE_ADS_BUDGET_AB\x10\x05\"Q\n\x10\x45xposureTracking\x12\x1d\n\x19\x45XPOSURE_TRACKING_ENABLED\x10\x00\x12\x1e\n\x1a\x45XPOSURE_TRACKING_DISABLED\x10\x01\"p\n\x0e\x41ssignmentMode\x12\x18\n\x14\x41SSIGNMENT_MODE_FULL\x10\x00\x12!\n\x1d\x41SSIGNMENT_MODE_FORCE_DEFAULT\x10\x01\x12!\n\x1d\x41SSIGNMENT_MODE_OVERRIDE_ONLY\x10\x02\x42\r\n\x0b_created_atB\x0c\n\n_edited_atB\r\n\x0b_hypothesisB\x11\n\x0f_tech_spec_linkb\x06proto3') 30 | 31 | _globals = globals() 32 | _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) 33 | _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'discord_experimentation.v1.Experiment_pb2', _globals) 34 | if not _descriptor._USE_C_DESCRIPTORS: 35 | DESCRIPTOR._loaded_options = None 36 | _globals['_EXPERIMENT_CLIENTREQUIREDCHANGES'].fields_by_name['commit_hashes']._loaded_options = None 37 | _globals['_EXPERIMENT_CLIENTREQUIREDCHANGES'].fields_by_name['commit_hashes']._serialized_options = b'\020\000' 38 | _globals['_EXPERIMENT_CLIENTLOCALE'].fields_by_name['locales']._loaded_options = None 39 | _globals['_EXPERIMENT_CLIENTLOCALE'].fields_by_name['locales']._serialized_options = b'\020\000' 40 | _globals['_EXPERIMENT_CLIENTIP'].fields_by_name['blocks']._loaded_options = None 41 | _globals['_EXPERIMENT_CLIENTIP'].fields_by_name['blocks']._serialized_options = b'\020\000' 42 | _globals['_EXPERIMENT_USERLOCALE'].fields_by_name['locales']._loaded_options = None 43 | _globals['_EXPERIMENT_USERLOCALE'].fields_by_name['locales']._serialized_options = b'\020\000' 44 | _globals['_EXPERIMENT_CLIENTRELEASECHANNEL'].fields_by_name['release_channels']._loaded_options = None 45 | _globals['_EXPERIMENT_CLIENTRELEASECHANNEL'].fields_by_name['release_channels']._serialized_options = b'\020\000' 46 | _globals['_EXPERIMENT_CLIENTSYSTEMLOCALE'].fields_by_name['locales']._loaded_options = None 47 | _globals['_EXPERIMENT_CLIENTSYSTEMLOCALE'].fields_by_name['locales']._serialized_options = b'\020\000' 48 | _globals['_EXPERIMENT']._serialized_start=156 49 | _globals['_EXPERIMENT']._serialized_end=8965 50 | _globals['_EXPERIMENT_BUCKET']._serialized_start=1390 51 | _globals['_EXPERIMENT_BUCKET']._serialized_end=1501 52 | _globals['_EXPERIMENT_VARIATION']._serialized_start=1504 53 | _globals['_EXPERIMENT_VARIATION']._serialized_end=1798 54 | _globals['_EXPERIMENT_PLATFORMVERSIONSPECIFIER']._serialized_start=1801 55 | _globals['_EXPERIMENT_PLATFORMVERSIONSPECIFIER']._serialized_end=1962 56 | _globals['_EXPERIMENT_PLATFORMVERSIONRANGEBOUND']._serialized_start=1965 57 | _globals['_EXPERIMENT_PLATFORMVERSIONRANGEBOUND']._serialized_end=2125 58 | _globals['_EXPERIMENT_PLATFORMVERSIONRANGE']._serialized_start=2128 59 | _globals['_EXPERIMENT_PLATFORMVERSIONRANGE']._serialized_end=2396 60 | _globals['_EXPERIMENT_PLATFORMVERSION']._serialized_start=2399 61 | _globals['_EXPERIMENT_PLATFORMVERSION']._serialized_end=2539 62 | _globals['_EXPERIMENT_CLIENTREQUIREDCHANGES']._serialized_start=2541 63 | _globals['_EXPERIMENT_CLIENTREQUIREDCHANGES']._serialized_end=2611 64 | _globals['_EXPERIMENT_CLIENTPLATFORM']._serialized_start=2614 65 | _globals['_EXPERIMENT_CLIENTPLATFORM']._serialized_end=3269 66 | _globals['_EXPERIMENT_SDKVERSIONSPECIFIER']._serialized_start=3271 67 | _globals['_EXPERIMENT_SDKVERSIONSPECIFIER']._serialized_end=3309 68 | _globals['_EXPERIMENT_SDKVERSIONRANGEBOUND']._serialized_start=3312 69 | _globals['_EXPERIMENT_SDKVERSIONRANGEBOUND']._serialized_end=3462 70 | _globals['_EXPERIMENT_SDKVERSIONRANGE']._serialized_start=3465 71 | _globals['_EXPERIMENT_SDKVERSIONRANGE']._serialized_end=3718 72 | _globals['_EXPERIMENT_SDKVERSION']._serialized_start=3721 73 | _globals['_EXPERIMENT_SDKVERSION']._serialized_end=3851 74 | _globals['_EXPERIMENT_CLIENTOPERATINGSYSTEM']._serialized_start=3854 75 | _globals['_EXPERIMENT_CLIENTOPERATINGSYSTEM']._serialized_end=4675 76 | _globals['_EXPERIMENT_STAFFUSERS']._serialized_start=4677 77 | _globals['_EXPERIMENT_STAFFUSERS']._serialized_end=4739 78 | _globals['_EXPERIMENT_USERINGUILD']._serialized_start=4741 79 | _globals['_EXPERIMENT_USERINGUILD']._serialized_end=4773 80 | _globals['_EXPERIMENT_USERIDS']._serialized_start=4775 81 | _globals['_EXPERIMENT_USERIDS']._serialized_end=4802 82 | _globals['_EXPERIMENT_CLIENTLOCALE']._serialized_start=4804 83 | _globals['_EXPERIMENT_CLIENTLOCALE']._serialized_end=4839 84 | _globals['_EXPERIMENT_ISOREGION']._serialized_start=4841 85 | _globals['_EXPERIMENT_ISOREGION']._serialized_end=4898 86 | _globals['_EXPERIMENT_PLACE']._serialized_start=4900 87 | _globals['_EXPERIMENT_PLACE']._serialized_end=4959 88 | _globals['_EXPERIMENT_LOCATION']._serialized_start=4962 89 | _globals['_EXPERIMENT_LOCATION']._serialized_end=5166 90 | _globals['_EXPERIMENT_CLIENTLOCATION']._serialized_start=5168 91 | _globals['_EXPERIMENT_CLIENTLOCATION']._serialized_end=5267 92 | _globals['_EXPERIMENT_CLIENTIP']._serialized_start=5269 93 | _globals['_EXPERIMENT_CLIENTIP']._serialized_end=5299 94 | _globals['_EXPERIMENT_USERLOCALE']._serialized_start=5301 95 | _globals['_EXPERIMENT_USERLOCALE']._serialized_end=5334 96 | _globals['_EXPERIMENT_USERISBOT']._serialized_start=5336 97 | _globals['_EXPERIMENT_USERISBOT']._serialized_end=5363 98 | _globals['_EXPERIMENT_USERAGERANGE']._serialized_start=5366 99 | _globals['_EXPERIMENT_USERAGERANGE']._serialized_end=5532 100 | _globals['_EXPERIMENT_FIXED64VALUE']._serialized_start=5534 101 | _globals['_EXPERIMENT_FIXED64VALUE']._serialized_end=5563 102 | _globals['_EXPERIMENT_USERIDRANGE']._serialized_start=5566 103 | _globals['_EXPERIMENT_USERIDRANGE']._serialized_end=5779 104 | _globals['_EXPERIMENT_USERHASFLAG']._serialized_start=5781 105 | _globals['_EXPERIMENT_USERHASFLAG']._serialized_end=5808 106 | _globals['_EXPERIMENT_UNITIDINRANGEBYHASH']._serialized_start=5810 107 | _globals['_EXPERIMENT_UNITIDINRANGEBYHASH']._serialized_end=5865 108 | _globals['_EXPERIMENT_CLIENTRELEASECHANNEL']._serialized_start=5867 109 | _globals['_EXPERIMENT_CLIENTRELEASECHANNEL']._serialized_end=5919 110 | _globals['_EXPERIMENT_ALWAYS']._serialized_start=5921 111 | _globals['_EXPERIMENT_ALWAYS']._serialized_end=5944 112 | _globals['_EXPERIMENT_CLIENTSYSTEMLOCALE']._serialized_start=5946 113 | _globals['_EXPERIMENT_CLIENTSYSTEMLOCALE']._serialized_end=5987 114 | _globals['_EXPERIMENT_UNITIDINEXPERIMENT']._serialized_start=5989 115 | _globals['_EXPERIMENT_UNITIDINEXPERIMENT']._serialized_end=6055 116 | _globals['_EXPERIMENT_USERPREMIUMTYPE']._serialized_start=6057 117 | _globals['_EXPERIMENT_USERPREMIUMTYPE']._serialized_end=6097 118 | _globals['_EXPERIMENT_FILTER']._serialized_start=6100 119 | _globals['_EXPERIMENT_FILTER']._serialized_end=7906 120 | _globals['_EXPERIMENT_OVERRIDE']._serialized_start=7908 121 | _globals['_EXPERIMENT_OVERRIDE']._serialized_end=7940 122 | _globals['_EXPERIMENT_RULE']._serialized_start=7943 123 | _globals['_EXPERIMENT_RULE']._serialized_end=8226 124 | _globals['_EXPERIMENT_UNITTYPE']._serialized_start=8228 125 | _globals['_EXPERIMENT_UNITTYPE']._serialized_end=8285 126 | _globals['_EXPERIMENT_TYPE']._serialized_start=8287 127 | _globals['_EXPERIMENT_TYPE']._serialized_end=8366 128 | _globals['_EXPERIMENT_PHASE']._serialized_start=8369 129 | _globals['_EXPERIMENT_PHASE']._serialized_end=8552 130 | _globals['_EXPERIMENT_SURFACE']._serialized_start=8555 131 | _globals['_EXPERIMENT_SURFACE']._serialized_end=8705 132 | _globals['_EXPERIMENT_EXPOSURETRACKING']._serialized_start=8707 133 | _globals['_EXPERIMENT_EXPOSURETRACKING']._serialized_end=8788 134 | _globals['_EXPERIMENT_ASSIGNMENTMODE']._serialized_start=8790 135 | _globals['_EXPERIMENT_ASSIGNMENTMODE']._serialized_end=8902 136 | # @@protoc_insertion_point(module_scope) 137 | -------------------------------------------------------------------------------- /discord_protos/discord_kkv_store_value_models/v1/AcknowledgedApplicationDisclosures.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | import "google/protobuf/wrappers.proto"; 4 | import "google/protobuf/timestamp.proto"; 5 | 6 | package discord_protos.discord_kkv_store_value_models.v1; 7 | 8 | message AcknowledgedApplicationDisclosures { 9 | enum ApplicationDisclosureType { 10 | APPLICATION_DISCLOSURE_TYPE_UNSPECIFIED_DISCLOSURE = 0; 11 | APPLICATION_DISCLOSURE_TYPE_IP_LOCATION = 1; 12 | APPLICATION_DISCLOSURE_TYPE_DISPLAYS_ADVERTISEMENTS = 2; 13 | APPLICATION_DISCLOSURE_TYPE_PARTNER_SDK_DATA_SHARING_MESSAGE = 3; 14 | } 15 | 16 | message AcknowledgedApplicationDisclosure { 17 | ApplicationDisclosureType disclosure_type = 1; 18 | optional google.protobuf.Timestamp acked_at = 2; 19 | } 20 | 21 | repeated AcknowledgedApplicationDisclosure acked_disclosures = 1; 22 | } 23 | -------------------------------------------------------------------------------- /discord_protos/discord_kkv_store_value_models/v1/AcknowledgedApplicationDisclosures_pb2.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by the protocol buffer compiler. DO NOT EDIT! 3 | # NO CHECKED-IN PROTOBUF GENCODE 4 | # source: discord_kkv_store_value_models/v1/AcknowledgedApplicationDisclosures.proto 5 | # Protobuf Python Version: 5.28.3 6 | """Generated protocol buffer code.""" 7 | from google.protobuf import descriptor as _descriptor 8 | from google.protobuf import descriptor_pool as _descriptor_pool 9 | from google.protobuf import runtime_version as _runtime_version 10 | from google.protobuf import symbol_database as _symbol_database 11 | from google.protobuf.internal import builder as _builder 12 | _runtime_version.ValidateProtobufRuntimeVersion( 13 | _runtime_version.Domain.PUBLIC, 14 | 5, 15 | 28, 16 | 3, 17 | '', 18 | 'discord_kkv_store_value_models/v1/AcknowledgedApplicationDisclosures.proto' 19 | ) 20 | # @@protoc_insertion_point(imports) 21 | 22 | _sym_db = _symbol_database.Default() 23 | 24 | 25 | from google.protobuf import wrappers_pb2 as google_dot_protobuf_dot_wrappers__pb2 26 | from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 27 | 28 | 29 | DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\nJdiscord_kkv_store_value_models/v1/AcknowledgedApplicationDisclosures.proto\x12\x30\x64iscord_protos.discord_kkv_store_value_models.v1\x1a\x1egoogle/protobuf/wrappers.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xa6\x05\n\"AcknowledgedApplicationDisclosures\x12\x91\x01\n\x11\x61\x63ked_disclosures\x18\x01 \x03(\x0b\x32v.discord_protos.discord_kkv_store_value_models.v1.AcknowledgedApplicationDisclosures.AcknowledgedApplicationDisclosure\x1a\xed\x01\n!AcknowledgedApplicationDisclosure\x12\x87\x01\n\x0f\x64isclosure_type\x18\x01 \x01(\x0e\x32n.discord_protos.discord_kkv_store_value_models.v1.AcknowledgedApplicationDisclosures.ApplicationDisclosureType\x12\x31\n\x08\x61\x63ked_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x88\x01\x01\x42\x0b\n\t_acked_at\"\xfb\x01\n\x19\x41pplicationDisclosureType\x12\x36\n2APPLICATION_DISCLOSURE_TYPE_UNSPECIFIED_DISCLOSURE\x10\x00\x12+\n\'APPLICATION_DISCLOSURE_TYPE_IP_LOCATION\x10\x01\x12\x37\n3APPLICATION_DISCLOSURE_TYPE_DISPLAYS_ADVERTISEMENTS\x10\x02\x12@\n metadata = 1; 7 | string platform_name = 2; 8 | string platform_username = 3; 9 | fixed64 version = 4; 10 | } 11 | -------------------------------------------------------------------------------- /discord_protos/discord_kkv_store_value_models/v1/ApplicationUserRoleConnection_pb2.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by the protocol buffer compiler. DO NOT EDIT! 3 | # NO CHECKED-IN PROTOBUF GENCODE 4 | # source: discord_kkv_store_value_models/v1/ApplicationUserRoleConnection.proto 5 | # Protobuf Python Version: 5.28.3 6 | """Generated protocol buffer code.""" 7 | from google.protobuf import descriptor as _descriptor 8 | from google.protobuf import descriptor_pool as _descriptor_pool 9 | from google.protobuf import runtime_version as _runtime_version 10 | from google.protobuf import symbol_database as _symbol_database 11 | from google.protobuf.internal import builder as _builder 12 | _runtime_version.ValidateProtobufRuntimeVersion( 13 | _runtime_version.Domain.PUBLIC, 14 | 5, 15 | 28, 16 | 3, 17 | '', 18 | 'discord_kkv_store_value_models/v1/ApplicationUserRoleConnection.proto' 19 | ) 20 | # @@protoc_insertion_point(imports) 21 | 22 | _sym_db = _symbol_database.Default() 23 | 24 | 25 | 26 | 27 | DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\nEdiscord_kkv_store_value_models/v1/ApplicationUserRoleConnection.proto\x12\x30\x64iscord_protos.discord_kkv_store_value_models.v1\"\x84\x02\n\x1d\x41pplicationUserRoleConnection\x12o\n\x08metadata\x18\x01 \x03(\x0b\x32].discord_protos.discord_kkv_store_value_models.v1.ApplicationUserRoleConnection.MetadataEntry\x12\x15\n\rplatform_name\x18\x02 \x01(\t\x12\x19\n\x11platform_username\x18\x03 \x01(\t\x12\x0f\n\x07version\x18\x04 \x01(\x06\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x62\x06proto3') 28 | 29 | _globals = globals() 30 | _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) 31 | _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'discord_kkv_store_value_models.v1.ApplicationUserRoleConnection_pb2', _globals) 32 | if not _descriptor._USE_C_DESCRIPTORS: 33 | DESCRIPTOR._loaded_options = None 34 | _globals['_APPLICATIONUSERROLECONNECTION_METADATAENTRY']._loaded_options = None 35 | _globals['_APPLICATIONUSERROLECONNECTION_METADATAENTRY']._serialized_options = b'8\001' 36 | _globals['_APPLICATIONUSERROLECONNECTION']._serialized_start=124 37 | _globals['_APPLICATIONUSERROLECONNECTION']._serialized_end=384 38 | _globals['_APPLICATIONUSERROLECONNECTION_METADATAENTRY']._serialized_start=337 39 | _globals['_APPLICATIONUSERROLECONNECTION_METADATAENTRY']._serialized_end=384 40 | # @@protoc_insertion_point(module_scope) 41 | -------------------------------------------------------------------------------- /discord_protos/discord_users/v1/FrecencyUserSettings.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package discord_protos.discord_users.v1; 4 | 5 | message FrecencyUserSettings { 6 | message Versions { 7 | uint32 client_version = 1; 8 | uint32 server_version = 2; 9 | uint32 data_version = 3; 10 | } 11 | 12 | enum GIFType { 13 | GIF_TYPE_NONE = 0; 14 | GIF_TYPE_IMAGE = 1; 15 | GIF_TYPE_VIDEO = 2; 16 | } 17 | 18 | message FavoriteGIF { 19 | GIFType format = 1; 20 | string src = 2; 21 | uint32 width = 3; 22 | uint32 height = 4; 23 | uint32 order = 5; 24 | } 25 | 26 | message FavoriteGIFs { 27 | map gifs = 1; 28 | bool hide_tooltip = 2; 29 | } 30 | 31 | message FavoriteStickers { 32 | repeated fixed64 sticker_ids = 1; 33 | } 34 | 35 | message FrecencyItem { 36 | uint32 total_uses = 1; 37 | repeated uint64 recent_uses = 2; 38 | int32 frecency = 3; 39 | int32 score = 4; 40 | } 41 | 42 | message StickerFrecency { 43 | map stickers = 1; 44 | } 45 | 46 | message FavoriteEmojis { 47 | repeated string emojis = 1 [packed = false]; 48 | } 49 | 50 | message EmojiFrecency { 51 | map emojis = 1; 52 | } 53 | 54 | message ApplicationCommandFrecency { 55 | map application_commands = 1; 56 | } 57 | 58 | message FavoriteSoundboardSounds { 59 | repeated fixed64 sound_ids = 1; 60 | } 61 | 62 | message ApplicationFrecency { 63 | map applications = 1; 64 | } 65 | 66 | message HeardSoundFrecency { 67 | map heard_sounds = 1; 68 | } 69 | 70 | message PlayedSoundFrecency { 71 | map played_sounds = 1; 72 | } 73 | 74 | message GuildAndChannelFrecency { 75 | map guild_and_channels = 1; 76 | } 77 | 78 | optional Versions versions = 1; 79 | optional FavoriteGIFs favorite_gifs = 2; 80 | optional FavoriteStickers favorite_stickers = 3; 81 | optional StickerFrecency sticker_frecency = 4; 82 | optional FavoriteEmojis favorite_emojis = 5; 83 | optional EmojiFrecency emoji_frecency = 6; 84 | optional ApplicationCommandFrecency application_command_frecency = 7; 85 | optional FavoriteSoundboardSounds favorite_soundboard_sounds = 8; 86 | optional ApplicationFrecency application_frecency = 9; 87 | optional HeardSoundFrecency heard_sound_frecency = 10; 88 | optional PlayedSoundFrecency played_sound_frecency = 11; 89 | optional GuildAndChannelFrecency guild_and_channel_frecency = 12; 90 | optional EmojiFrecency emoji_reaction_frecency = 13; 91 | } 92 | -------------------------------------------------------------------------------- /discord_protos/discord_users/v1/FrecencyUserSettings_pb2.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by the protocol buffer compiler. DO NOT EDIT! 3 | # NO CHECKED-IN PROTOBUF GENCODE 4 | # source: discord_users/v1/FrecencyUserSettings.proto 5 | # Protobuf Python Version: 5.28.3 6 | """Generated protocol buffer code.""" 7 | from google.protobuf import descriptor as _descriptor 8 | from google.protobuf import descriptor_pool as _descriptor_pool 9 | from google.protobuf import runtime_version as _runtime_version 10 | from google.protobuf import symbol_database as _symbol_database 11 | from google.protobuf.internal import builder as _builder 12 | _runtime_version.ValidateProtobufRuntimeVersion( 13 | _runtime_version.Domain.PUBLIC, 14 | 5, 15 | 28, 16 | 3, 17 | '', 18 | 'discord_users/v1/FrecencyUserSettings.proto' 19 | ) 20 | # @@protoc_insertion_point(imports) 21 | 22 | _sym_db = _symbol_database.Default() 23 | 24 | 25 | 26 | 27 | DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n+discord_users/v1/FrecencyUserSettings.proto\x12\x1f\x64iscord_protos.discord_users.v1\"\xdb!\n\x14\x46recencyUserSettings\x12U\n\x08versions\x18\x01 \x01(\x0b\x32>.discord_protos.discord_users.v1.FrecencyUserSettings.VersionsH\x00\x88\x01\x01\x12^\n\rfavorite_gifs\x18\x02 \x01(\x0b\x32\x42.discord_protos.discord_users.v1.FrecencyUserSettings.FavoriteGIFsH\x01\x88\x01\x01\x12\x66\n\x11\x66\x61vorite_stickers\x18\x03 \x01(\x0b\x32\x46.discord_protos.discord_users.v1.FrecencyUserSettings.FavoriteStickersH\x02\x88\x01\x01\x12\x64\n\x10sticker_frecency\x18\x04 \x01(\x0b\x32\x45.discord_protos.discord_users.v1.FrecencyUserSettings.StickerFrecencyH\x03\x88\x01\x01\x12\x62\n\x0f\x66\x61vorite_emojis\x18\x05 \x01(\x0b\x32\x44.discord_protos.discord_users.v1.FrecencyUserSettings.FavoriteEmojisH\x04\x88\x01\x01\x12`\n\x0e\x65moji_frecency\x18\x06 \x01(\x0b\x32\x43.discord_protos.discord_users.v1.FrecencyUserSettings.EmojiFrecencyH\x05\x88\x01\x01\x12{\n\x1c\x61pplication_command_frecency\x18\x07 \x01(\x0b\x32P.discord_protos.discord_users.v1.FrecencyUserSettings.ApplicationCommandFrecencyH\x06\x88\x01\x01\x12w\n\x1a\x66\x61vorite_soundboard_sounds\x18\x08 \x01(\x0b\x32N.discord_protos.discord_users.v1.FrecencyUserSettings.FavoriteSoundboardSoundsH\x07\x88\x01\x01\x12l\n\x14\x61pplication_frecency\x18\t \x01(\x0b\x32I.discord_protos.discord_users.v1.FrecencyUserSettings.ApplicationFrecencyH\x08\x88\x01\x01\x12k\n\x14heard_sound_frecency\x18\n \x01(\x0b\x32H.discord_protos.discord_users.v1.FrecencyUserSettings.HeardSoundFrecencyH\t\x88\x01\x01\x12m\n\x15played_sound_frecency\x18\x0b \x01(\x0b\x32I.discord_protos.discord_users.v1.FrecencyUserSettings.PlayedSoundFrecencyH\n\x88\x01\x01\x12v\n\x1aguild_and_channel_frecency\x18\x0c \x01(\x0b\x32M.discord_protos.discord_users.v1.FrecencyUserSettings.GuildAndChannelFrecencyH\x0b\x88\x01\x01\x12i\n\x17\x65moji_reaction_frecency\x18\r \x01(\x0b\x32\x43.discord_protos.discord_users.v1.FrecencyUserSettings.EmojiFrecencyH\x0c\x88\x01\x01\x1aP\n\x08Versions\x12\x16\n\x0e\x63lient_version\x18\x01 \x01(\r\x12\x16\n\x0eserver_version\x18\x02 \x01(\r\x12\x14\n\x0c\x64\x61ta_version\x18\x03 \x01(\r\x1a\x97\x01\n\x0b\x46\x61voriteGIF\x12M\n\x06\x66ormat\x18\x01 \x01(\x0e\x32=.discord_protos.discord_users.v1.FrecencyUserSettings.GIFType\x12\x0b\n\x03src\x18\x02 \x01(\t\x12\r\n\x05width\x18\x03 \x01(\r\x12\x0e\n\x06height\x18\x04 \x01(\r\x12\r\n\x05order\x18\x05 \x01(\r\x1a\xf0\x01\n\x0c\x46\x61voriteGIFs\x12Z\n\x04gifs\x18\x01 \x03(\x0b\x32L.discord_protos.discord_users.v1.FrecencyUserSettings.FavoriteGIFs.GifsEntry\x12\x14\n\x0chide_tooltip\x18\x02 \x01(\x08\x1an\n\tGifsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12P\n\x05value\x18\x02 \x01(\x0b\x32\x41.discord_protos.discord_users.v1.FrecencyUserSettings.FavoriteGIF:\x02\x38\x01\x1a\'\n\x10\x46\x61voriteStickers\x12\x13\n\x0bsticker_ids\x18\x01 \x03(\x06\x1aX\n\x0c\x46recencyItem\x12\x12\n\ntotal_uses\x18\x01 \x01(\r\x12\x13\n\x0brecent_uses\x18\x02 \x03(\x04\x12\x10\n\x08\x66recency\x18\x03 \x01(\x05\x12\r\n\x05score\x18\x04 \x01(\x05\x1a\xed\x01\n\x0fStickerFrecency\x12\x65\n\x08stickers\x18\x01 \x03(\x0b\x32S.discord_protos.discord_users.v1.FrecencyUserSettings.StickerFrecency.StickersEntry\x1as\n\rStickersEntry\x12\x0b\n\x03key\x18\x01 \x01(\x06\x12Q\n\x05value\x18\x02 \x01(\x0b\x32\x42.discord_protos.discord_users.v1.FrecencyUserSettings.FrecencyItem:\x02\x38\x01\x1a$\n\x0e\x46\x61voriteEmojis\x12\x12\n\x06\x65mojis\x18\x01 \x03(\tB\x02\x10\x00\x1a\xe3\x01\n\rEmojiFrecency\x12_\n\x06\x65mojis\x18\x01 \x03(\x0b\x32O.discord_protos.discord_users.v1.FrecencyUserSettings.EmojiFrecency.EmojisEntry\x1aq\n\x0b\x45mojisEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12Q\n\x05value\x18\x02 \x01(\x0b\x32\x42.discord_protos.discord_users.v1.FrecencyUserSettings.FrecencyItem:\x02\x38\x01\x1a\xa6\x02\n\x1a\x41pplicationCommandFrecency\x12\x87\x01\n\x14\x61pplication_commands\x18\x01 \x03(\x0b\x32i.discord_protos.discord_users.v1.FrecencyUserSettings.ApplicationCommandFrecency.ApplicationCommandsEntry\x1a~\n\x18\x41pplicationCommandsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12Q\n\x05value\x18\x02 \x01(\x0b\x32\x42.discord_protos.discord_users.v1.FrecencyUserSettings.FrecencyItem:\x02\x38\x01\x1a-\n\x18\x46\x61voriteSoundboardSounds\x12\x11\n\tsound_ids\x18\x01 \x03(\x06\x1a\x81\x02\n\x13\x41pplicationFrecency\x12q\n\x0c\x61pplications\x18\x01 \x03(\x0b\x32[.discord_protos.discord_users.v1.FrecencyUserSettings.ApplicationFrecency.ApplicationsEntry\x1aw\n\x11\x41pplicationsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12Q\n\x05value\x18\x02 \x01(\x0b\x32\x42.discord_protos.discord_users.v1.FrecencyUserSettings.FrecencyItem:\x02\x38\x01\x1a\xfd\x01\n\x12HeardSoundFrecency\x12o\n\x0cheard_sounds\x18\x01 \x03(\x0b\x32Y.discord_protos.discord_users.v1.FrecencyUserSettings.HeardSoundFrecency.HeardSoundsEntry\x1av\n\x10HeardSoundsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12Q\n\x05value\x18\x02 \x01(\x0b\x32\x42.discord_protos.discord_users.v1.FrecencyUserSettings.FrecencyItem:\x02\x38\x01\x1a\x82\x02\n\x13PlayedSoundFrecency\x12r\n\rplayed_sounds\x18\x01 \x03(\x0b\x32[.discord_protos.discord_users.v1.FrecencyUserSettings.PlayedSoundFrecency.PlayedSoundsEntry\x1aw\n\x11PlayedSoundsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12Q\n\x05value\x18\x02 \x01(\x0b\x32\x42.discord_protos.discord_users.v1.FrecencyUserSettings.FrecencyItem:\x02\x38\x01\x1a\x97\x02\n\x17GuildAndChannelFrecency\x12\x7f\n\x12guild_and_channels\x18\x01 \x03(\x0b\x32\x63.discord_protos.discord_users.v1.FrecencyUserSettings.GuildAndChannelFrecency.GuildAndChannelsEntry\x1a{\n\x15GuildAndChannelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\x06\x12Q\n\x05value\x18\x02 \x01(\x0b\x32\x42.discord_protos.discord_users.v1.FrecencyUserSettings.FrecencyItem:\x02\x38\x01\"D\n\x07GIFType\x12\x11\n\rGIF_TYPE_NONE\x10\x00\x12\x12\n\x0eGIF_TYPE_IMAGE\x10\x01\x12\x12\n\x0eGIF_TYPE_VIDEO\x10\x02\x42\x0b\n\t_versionsB\x10\n\x0e_favorite_gifsB\x14\n\x12_favorite_stickersB\x13\n\x11_sticker_frecencyB\x12\n\x10_favorite_emojisB\x11\n\x0f_emoji_frecencyB\x1f\n\x1d_application_command_frecencyB\x1d\n\x1b_favorite_soundboard_soundsB\x17\n\x15_application_frecencyB\x17\n\x15_heard_sound_frecencyB\x18\n\x16_played_sound_frecencyB\x1d\n\x1b_guild_and_channel_frecencyB\x1a\n\x18_emoji_reaction_frecencyb\x06proto3') 28 | 29 | _globals = globals() 30 | _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) 31 | _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'discord_users.v1.FrecencyUserSettings_pb2', _globals) 32 | if not _descriptor._USE_C_DESCRIPTORS: 33 | DESCRIPTOR._loaded_options = None 34 | _globals['_FRECENCYUSERSETTINGS_FAVORITEGIFS_GIFSENTRY']._loaded_options = None 35 | _globals['_FRECENCYUSERSETTINGS_FAVORITEGIFS_GIFSENTRY']._serialized_options = b'8\001' 36 | _globals['_FRECENCYUSERSETTINGS_STICKERFRECENCY_STICKERSENTRY']._loaded_options = None 37 | _globals['_FRECENCYUSERSETTINGS_STICKERFRECENCY_STICKERSENTRY']._serialized_options = b'8\001' 38 | _globals['_FRECENCYUSERSETTINGS_FAVORITEEMOJIS'].fields_by_name['emojis']._loaded_options = None 39 | _globals['_FRECENCYUSERSETTINGS_FAVORITEEMOJIS'].fields_by_name['emojis']._serialized_options = b'\020\000' 40 | _globals['_FRECENCYUSERSETTINGS_EMOJIFRECENCY_EMOJISENTRY']._loaded_options = None 41 | _globals['_FRECENCYUSERSETTINGS_EMOJIFRECENCY_EMOJISENTRY']._serialized_options = b'8\001' 42 | _globals['_FRECENCYUSERSETTINGS_APPLICATIONCOMMANDFRECENCY_APPLICATIONCOMMANDSENTRY']._loaded_options = None 43 | _globals['_FRECENCYUSERSETTINGS_APPLICATIONCOMMANDFRECENCY_APPLICATIONCOMMANDSENTRY']._serialized_options = b'8\001' 44 | _globals['_FRECENCYUSERSETTINGS_APPLICATIONFRECENCY_APPLICATIONSENTRY']._loaded_options = None 45 | _globals['_FRECENCYUSERSETTINGS_APPLICATIONFRECENCY_APPLICATIONSENTRY']._serialized_options = b'8\001' 46 | _globals['_FRECENCYUSERSETTINGS_HEARDSOUNDFRECENCY_HEARDSOUNDSENTRY']._loaded_options = None 47 | _globals['_FRECENCYUSERSETTINGS_HEARDSOUNDFRECENCY_HEARDSOUNDSENTRY']._serialized_options = b'8\001' 48 | _globals['_FRECENCYUSERSETTINGS_PLAYEDSOUNDFRECENCY_PLAYEDSOUNDSENTRY']._loaded_options = None 49 | _globals['_FRECENCYUSERSETTINGS_PLAYEDSOUNDFRECENCY_PLAYEDSOUNDSENTRY']._serialized_options = b'8\001' 50 | _globals['_FRECENCYUSERSETTINGS_GUILDANDCHANNELFRECENCY_GUILDANDCHANNELSENTRY']._loaded_options = None 51 | _globals['_FRECENCYUSERSETTINGS_GUILDANDCHANNELFRECENCY_GUILDANDCHANNELSENTRY']._serialized_options = b'8\001' 52 | _globals['_FRECENCYUSERSETTINGS']._serialized_start=81 53 | _globals['_FRECENCYUSERSETTINGS']._serialized_end=4396 54 | _globals['_FRECENCYUSERSETTINGS_VERSIONS']._serialized_start=1495 55 | _globals['_FRECENCYUSERSETTINGS_VERSIONS']._serialized_end=1575 56 | _globals['_FRECENCYUSERSETTINGS_FAVORITEGIF']._serialized_start=1578 57 | _globals['_FRECENCYUSERSETTINGS_FAVORITEGIF']._serialized_end=1729 58 | _globals['_FRECENCYUSERSETTINGS_FAVORITEGIFS']._serialized_start=1732 59 | _globals['_FRECENCYUSERSETTINGS_FAVORITEGIFS']._serialized_end=1972 60 | _globals['_FRECENCYUSERSETTINGS_FAVORITEGIFS_GIFSENTRY']._serialized_start=1862 61 | _globals['_FRECENCYUSERSETTINGS_FAVORITEGIFS_GIFSENTRY']._serialized_end=1972 62 | _globals['_FRECENCYUSERSETTINGS_FAVORITESTICKERS']._serialized_start=1974 63 | _globals['_FRECENCYUSERSETTINGS_FAVORITESTICKERS']._serialized_end=2013 64 | _globals['_FRECENCYUSERSETTINGS_FRECENCYITEM']._serialized_start=2015 65 | _globals['_FRECENCYUSERSETTINGS_FRECENCYITEM']._serialized_end=2103 66 | _globals['_FRECENCYUSERSETTINGS_STICKERFRECENCY']._serialized_start=2106 67 | _globals['_FRECENCYUSERSETTINGS_STICKERFRECENCY']._serialized_end=2343 68 | _globals['_FRECENCYUSERSETTINGS_STICKERFRECENCY_STICKERSENTRY']._serialized_start=2228 69 | _globals['_FRECENCYUSERSETTINGS_STICKERFRECENCY_STICKERSENTRY']._serialized_end=2343 70 | _globals['_FRECENCYUSERSETTINGS_FAVORITEEMOJIS']._serialized_start=2345 71 | _globals['_FRECENCYUSERSETTINGS_FAVORITEEMOJIS']._serialized_end=2381 72 | _globals['_FRECENCYUSERSETTINGS_EMOJIFRECENCY']._serialized_start=2384 73 | _globals['_FRECENCYUSERSETTINGS_EMOJIFRECENCY']._serialized_end=2611 74 | _globals['_FRECENCYUSERSETTINGS_EMOJIFRECENCY_EMOJISENTRY']._serialized_start=2498 75 | _globals['_FRECENCYUSERSETTINGS_EMOJIFRECENCY_EMOJISENTRY']._serialized_end=2611 76 | _globals['_FRECENCYUSERSETTINGS_APPLICATIONCOMMANDFRECENCY']._serialized_start=2614 77 | _globals['_FRECENCYUSERSETTINGS_APPLICATIONCOMMANDFRECENCY']._serialized_end=2908 78 | _globals['_FRECENCYUSERSETTINGS_APPLICATIONCOMMANDFRECENCY_APPLICATIONCOMMANDSENTRY']._serialized_start=2782 79 | _globals['_FRECENCYUSERSETTINGS_APPLICATIONCOMMANDFRECENCY_APPLICATIONCOMMANDSENTRY']._serialized_end=2908 80 | _globals['_FRECENCYUSERSETTINGS_FAVORITESOUNDBOARDSOUNDS']._serialized_start=2910 81 | _globals['_FRECENCYUSERSETTINGS_FAVORITESOUNDBOARDSOUNDS']._serialized_end=2955 82 | _globals['_FRECENCYUSERSETTINGS_APPLICATIONFRECENCY']._serialized_start=2958 83 | _globals['_FRECENCYUSERSETTINGS_APPLICATIONFRECENCY']._serialized_end=3215 84 | _globals['_FRECENCYUSERSETTINGS_APPLICATIONFRECENCY_APPLICATIONSENTRY']._serialized_start=3096 85 | _globals['_FRECENCYUSERSETTINGS_APPLICATIONFRECENCY_APPLICATIONSENTRY']._serialized_end=3215 86 | _globals['_FRECENCYUSERSETTINGS_HEARDSOUNDFRECENCY']._serialized_start=3218 87 | _globals['_FRECENCYUSERSETTINGS_HEARDSOUNDFRECENCY']._serialized_end=3471 88 | _globals['_FRECENCYUSERSETTINGS_HEARDSOUNDFRECENCY_HEARDSOUNDSENTRY']._serialized_start=3353 89 | _globals['_FRECENCYUSERSETTINGS_HEARDSOUNDFRECENCY_HEARDSOUNDSENTRY']._serialized_end=3471 90 | _globals['_FRECENCYUSERSETTINGS_PLAYEDSOUNDFRECENCY']._serialized_start=3474 91 | _globals['_FRECENCYUSERSETTINGS_PLAYEDSOUNDFRECENCY']._serialized_end=3732 92 | _globals['_FRECENCYUSERSETTINGS_PLAYEDSOUNDFRECENCY_PLAYEDSOUNDSENTRY']._serialized_start=3613 93 | _globals['_FRECENCYUSERSETTINGS_PLAYEDSOUNDFRECENCY_PLAYEDSOUNDSENTRY']._serialized_end=3732 94 | _globals['_FRECENCYUSERSETTINGS_GUILDANDCHANNELFRECENCY']._serialized_start=3735 95 | _globals['_FRECENCYUSERSETTINGS_GUILDANDCHANNELFRECENCY']._serialized_end=4014 96 | _globals['_FRECENCYUSERSETTINGS_GUILDANDCHANNELFRECENCY_GUILDANDCHANNELSENTRY']._serialized_start=3891 97 | _globals['_FRECENCYUSERSETTINGS_GUILDANDCHANNELFRECENCY_GUILDANDCHANNELSENTRY']._serialized_end=4014 98 | _globals['_FRECENCYUSERSETTINGS_GIFTYPE']._serialized_start=4016 99 | _globals['_FRECENCYUSERSETTINGS_GIFTYPE']._serialized_end=4084 100 | # @@protoc_insertion_point(module_scope) 101 | -------------------------------------------------------------------------------- /discord_protos/discord_users/v1/PreloadedUserSettings.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | import "google/protobuf/wrappers.proto"; 4 | import "google/protobuf/timestamp.proto"; 5 | 6 | package discord_protos.discord_users.v1; 7 | 8 | message PreloadedUserSettings { 9 | message Versions { 10 | uint32 client_version = 1; 11 | uint32 server_version = 2; 12 | uint32 data_version = 3; 13 | } 14 | 15 | enum InboxTab { 16 | INBOX_TAB_UNSPECIFIED = 0; 17 | INBOX_TAB_MENTIONS = 1; 18 | INBOX_TAB_UNREADS = 2; 19 | INBOX_TAB_TODOS = 3; 20 | INBOX_TAB_FOR_YOU = 4; 21 | INBOX_TAB_GAME_INVITES = 5; 22 | INBOX_TAB_BOOKMARKS = 6; 23 | INBOX_TAB_SCHEDULED = 7; 24 | } 25 | 26 | message InboxSettings { 27 | InboxTab current_tab = 1; 28 | bool viewed_tutorial = 2; 29 | } 30 | 31 | message ChannelIconEmoji { 32 | optional google.protobuf.UInt64Value id = 1; 33 | optional google.protobuf.StringValue name = 2; 34 | optional google.protobuf.UInt64Value color = 3; 35 | } 36 | 37 | message CustomNotificationSoundConfig { 38 | optional google.protobuf.StringValue notification_sound_pack_id = 1; 39 | } 40 | 41 | message ChannelSettings { 42 | bool collapsed_in_inbox = 1; 43 | optional ChannelIconEmoji icon_emoji = 2; 44 | optional CustomNotificationSoundConfig custom_notification_sound_config = 3; 45 | } 46 | 47 | message CustomCallSound { 48 | fixed64 sound_id = 1; 49 | fixed64 guild_id = 2; 50 | } 51 | 52 | message ChannelListSettings { 53 | optional google.protobuf.StringValue layout = 1; 54 | optional google.protobuf.StringValue message_previews = 2; 55 | } 56 | 57 | message GuildDismissibleContentState { 58 | bool dismissed = 1; 59 | uint32 last_dismissed_version = 2; 60 | uint64 last_dismissed_at_ms = 3; 61 | uint64 last_dismissed_object_id = 4; 62 | uint32 num_times_dismissed = 5; 63 | } 64 | 65 | message GuildSettings { 66 | map channels = 1; 67 | uint32 hub_progress = 2; 68 | uint32 guild_onboarding_progress = 3; 69 | optional google.protobuf.Timestamp guild_recents_dismissed_at = 4; 70 | bytes dismissed_guild_content = 5; 71 | optional CustomCallSound join_sound = 6; 72 | optional ChannelListSettings mobile_redesign_channel_list_settings = 7; 73 | bool disable_raid_alert_push = 8; 74 | bool disable_raid_alert_nag = 9; 75 | optional CustomNotificationSoundConfig custom_notification_sound_config = 10; 76 | bool leaderboards_disabled = 11; 77 | map guild_dismissible_content_states = 12; 78 | } 79 | 80 | message AllGuildSettings { 81 | map guilds = 1; 82 | } 83 | 84 | message RecurringDismissibleContentState { 85 | uint32 last_dismissed_version = 1; 86 | uint64 last_dismissed_at_ms = 2; 87 | uint64 last_dismissed_object_id = 3; 88 | uint32 num_times_dismissed = 4; 89 | } 90 | 91 | message UserContentSettings { 92 | bytes dismissed_contents = 1; 93 | optional google.protobuf.StringValue last_dismissed_outbound_promotion_start_date = 2; 94 | optional google.protobuf.Timestamp premium_tier_0_modal_dismissed_at = 3; 95 | optional google.protobuf.Timestamp guild_onboarding_upsell_dismissed_at = 4; 96 | optional google.protobuf.Timestamp safety_user_sentiment_notice_dismissed_at = 5; 97 | fixed64 last_received_changelog_id = 6; 98 | map recurring_dismissible_content_states = 7; 99 | } 100 | 101 | message VideoFilterBackgroundBlur { 102 | bool use_blur = 1; 103 | } 104 | 105 | message VideoFilterAsset { 106 | fixed64 id = 1; 107 | string asset_hash = 2; 108 | } 109 | 110 | message SoundboardSettings { 111 | float volume = 1; 112 | } 113 | 114 | message VoiceAndVideoSettings { 115 | oneof video_background_filter_desktop { 116 | VideoFilterBackgroundBlur blur = 1; 117 | uint32 preset_option = 2; 118 | VideoFilterAsset custom_asset = 3; 119 | } 120 | optional google.protobuf.BoolValue always_preview_video = 5; 121 | optional google.protobuf.UInt32Value afk_timeout = 6; 122 | optional google.protobuf.BoolValue stream_notifications_enabled = 7; 123 | optional google.protobuf.BoolValue native_phone_integration_enabled = 8; 124 | optional SoundboardSettings soundboard_settings = 9; 125 | optional google.protobuf.BoolValue disable_stream_previews = 10; 126 | optional google.protobuf.FloatValue soundmoji_volume = 11; 127 | } 128 | 129 | enum DmSpamFilterV2 { 130 | DM_SPAM_FILTER_V2_DEFAULT_UNSET = 0; 131 | DM_SPAM_FILTER_V2_DISABLED = 1; 132 | DM_SPAM_FILTER_V2_NON_FRIENDS = 2; 133 | DM_SPAM_FILTER_V2_FRIENDS_AND_NON_FRIENDS = 3; 134 | } 135 | 136 | enum ExplicitContentRedaction { 137 | EXPLICIT_CONTENT_REDACTION_UNSET_EXPLICIT_CONTENT_REDACTION = 0; 138 | EXPLICIT_CONTENT_REDACTION_SHOW = 1; 139 | EXPLICIT_CONTENT_REDACTION_BLUR = 2; 140 | EXPLICIT_CONTENT_REDACTION_BLOCK = 3; 141 | } 142 | 143 | message ExplicitContentSettings { 144 | ExplicitContentRedaction explicit_content_guilds = 1; 145 | ExplicitContentRedaction explicit_content_friend_dm = 2; 146 | ExplicitContentRedaction explicit_content_non_friend_dm = 3; 147 | } 148 | 149 | message KeywordFilterSettings { 150 | optional google.protobuf.BoolValue profanity = 1; 151 | optional google.protobuf.BoolValue sexual_content = 2; 152 | optional google.protobuf.BoolValue slurs = 3; 153 | } 154 | 155 | message GoreContentSettings { 156 | ExplicitContentRedaction gore_content_guilds = 1; 157 | ExplicitContentRedaction gore_content_friend_dm = 2; 158 | ExplicitContentRedaction gore_content_non_friend_dm = 3; 159 | } 160 | 161 | message DefaultReactionEmoji { 162 | optional google.protobuf.UInt64Value emoji_id = 1; 163 | optional google.protobuf.StringValue emoji_name = 2; 164 | optional google.protobuf.BoolValue animated = 3; 165 | } 166 | 167 | message TextAndImagesSettings { 168 | optional google.protobuf.StringValue diversity_surrogate = 1; 169 | optional google.protobuf.BoolValue use_rich_chat_input = 2; 170 | optional google.protobuf.BoolValue use_thread_sidebar = 3; 171 | optional google.protobuf.StringValue render_spoilers = 4; 172 | repeated string emoji_picker_collapsed_sections = 5 [packed = false]; 173 | repeated string sticker_picker_collapsed_sections = 6 [packed = false]; 174 | optional google.protobuf.BoolValue view_image_descriptions = 7; 175 | optional google.protobuf.BoolValue show_command_suggestions = 8; 176 | optional google.protobuf.BoolValue inline_attachment_media = 9; 177 | optional google.protobuf.BoolValue inline_embed_media = 10; 178 | optional google.protobuf.BoolValue gif_auto_play = 11; 179 | optional google.protobuf.BoolValue render_embeds = 12; 180 | optional google.protobuf.BoolValue render_reactions = 13; 181 | optional google.protobuf.BoolValue animate_emoji = 14; 182 | optional google.protobuf.UInt32Value animate_stickers = 15; 183 | optional google.protobuf.BoolValue enable_tts_command = 16; 184 | optional google.protobuf.BoolValue message_display_compact = 17; 185 | optional google.protobuf.UInt32Value explicit_content_filter = 19; 186 | optional google.protobuf.BoolValue view_nsfw_guilds = 20; 187 | optional google.protobuf.BoolValue convert_emoticons = 21; 188 | optional google.protobuf.BoolValue expression_suggestions_enabled = 22; 189 | optional google.protobuf.BoolValue view_nsfw_commands = 23; 190 | optional google.protobuf.BoolValue use_legacy_chat_input = 24; 191 | repeated string soundboard_picker_collapsed_sections = 25 [packed = false]; 192 | optional google.protobuf.UInt32Value dm_spam_filter = 26; 193 | DmSpamFilterV2 dm_spam_filter_v2 = 27; 194 | optional google.protobuf.BoolValue include_stickers_in_autocomplete = 28; 195 | optional ExplicitContentSettings explicit_content_settings = 29; 196 | optional KeywordFilterSettings keyword_filter_settings = 30; 197 | optional google.protobuf.BoolValue include_soundmoji_in_autocomplete = 31; 198 | optional GoreContentSettings gore_content_settings = 32; 199 | optional DefaultReactionEmoji default_reaction_emoji = 33; 200 | optional google.protobuf.BoolValue show_mention_suggestions = 34; 201 | } 202 | 203 | enum ReactionNotificationType { 204 | REACTION_NOTIFICATION_TYPE_NOTIFICATIONS_ENABLED = 0; 205 | REACTION_NOTIFICATION_TYPE_ONLY_DMS = 1; 206 | REACTION_NOTIFICATION_TYPE_NOTIFICATIONS_DISABLED = 2; 207 | } 208 | 209 | enum GameActivityNotificationType { 210 | GAME_ACTIVITY_NOTIFICATION_TYPE_ACTIVITY_NOTIFICATIONS_UNSET = 0; 211 | GAME_ACTIVITY_NOTIFICATION_TYPE_ACTIVITY_NOTIFICATIONS_DISABLED = 1; 212 | GAME_ACTIVITY_NOTIFICATION_TYPE_ACTIVITY_NOTIFICATIONS_ENABLED = 2; 213 | GAME_ACTIVITY_NOTIFICATION_TYPE_ONLY_GAMES_PLAYED = 3; 214 | } 215 | 216 | enum CustomStatusPushNotificationType { 217 | CUSTOM_STATUS_PUSH_NOTIFICATION_TYPE_STATUS_PUSH_UNSET = 0; 218 | CUSTOM_STATUS_PUSH_NOTIFICATION_TYPE_STATUS_PUSH_ENABLED = 1; 219 | CUSTOM_STATUS_PUSH_NOTIFICATION_TYPE_STATUS_PUSH_DISABLED = 2; 220 | } 221 | 222 | message NotificationSettings { 223 | optional google.protobuf.BoolValue show_in_app_notifications = 1; 224 | optional google.protobuf.BoolValue notify_friends_on_go_live = 2; 225 | fixed64 notification_center_acked_before_id = 3; 226 | optional google.protobuf.BoolValue enable_burst_reaction_notifications = 4; 227 | optional google.protobuf.BoolValue quiet_mode = 5; 228 | fixed64 focus_mode_expires_at_ms = 6; 229 | ReactionNotificationType reaction_notifications = 7; 230 | GameActivityNotificationType game_activity_notifications = 8; 231 | CustomStatusPushNotificationType custom_status_push_notifications = 9; 232 | optional google.protobuf.BoolValue game_activity_exclude_steam_notifications = 10; 233 | optional google.protobuf.BoolValue enable_voice_activity_notifications = 11; 234 | } 235 | 236 | enum GuildActivityStatusRestrictionDefault { 237 | GUILD_ACTIVITY_STATUS_RESTRICTION_DEFAULT_OFF = 0; 238 | GUILD_ACTIVITY_STATUS_RESTRICTION_DEFAULT_ON_FOR_LARGE_GUILDS = 1; 239 | GUILD_ACTIVITY_STATUS_RESTRICTION_DEFAULT_ON = 2; 240 | } 241 | 242 | enum GuildsLeaderboardOptOutDefault { 243 | GUILDS_LEADERBOARD_OPT_OUT_DEFAULT_OFF_FOR_NEW_GUILDS = 0; 244 | GUILDS_LEADERBOARD_OPT_OUT_DEFAULT_ON_FOR_NEW_GUILDS = 1; 245 | } 246 | 247 | enum SlayerSDKReceiveInGameDMs { 248 | SLAYER_SDK_RECEIVE_IN_GAME_DMS_UNSET = 0; 249 | SLAYER_SDK_RECEIVE_IN_GAME_DMS_ALL = 1; 250 | SLAYER_SDK_RECEIVE_IN_GAME_DMS_USERS_WITH_GAME = 2; 251 | SLAYER_SDK_RECEIVE_IN_GAME_DMS_NONE = 3; 252 | } 253 | 254 | enum GuildActivityStatusRestrictionDefaultV2 { 255 | GUILD_ACTIVITY_STATUS_RESTRICTION_DEFAULT_V2_ACTIVITY_STATUS_UNSET = 0; 256 | GUILD_ACTIVITY_STATUS_RESTRICTION_DEFAULT_V2_ACTIVITY_STATUS_OFF = 1; 257 | GUILD_ACTIVITY_STATUS_RESTRICTION_DEFAULT_V2_ACTIVITY_STATUS_ON_FOR_LARGE_GUILDS = 2; 258 | GUILD_ACTIVITY_STATUS_RESTRICTION_DEFAULT_V2_ACTIVITY_STATUS_ON = 3; 259 | } 260 | 261 | message PrivacySettings { 262 | optional google.protobuf.BoolValue allow_activity_party_privacy_friends = 1; 263 | optional google.protobuf.BoolValue allow_activity_party_privacy_voice_channel = 2; 264 | repeated fixed64 restricted_guild_ids = 3; 265 | bool default_guilds_restricted = 4; 266 | bool allow_accessibility_detection = 7; 267 | optional google.protobuf.BoolValue detect_platform_accounts = 8; 268 | optional google.protobuf.BoolValue passwordless = 9; 269 | optional google.protobuf.BoolValue contact_sync_enabled = 10; 270 | optional google.protobuf.UInt32Value friend_source_flags = 11; 271 | optional google.protobuf.UInt32Value friend_discovery_flags = 12; 272 | repeated fixed64 activity_restricted_guild_ids = 13; 273 | GuildActivityStatusRestrictionDefault default_guilds_activity_restricted = 14; 274 | repeated fixed64 activity_joining_restricted_guild_ids = 15; 275 | repeated fixed64 message_request_restricted_guild_ids = 16; 276 | optional google.protobuf.BoolValue default_message_request_restricted = 17; 277 | optional google.protobuf.BoolValue drops_opted_out = 18; 278 | optional google.protobuf.BoolValue non_spam_retraining_opt_in = 19; 279 | optional google.protobuf.BoolValue family_center_enabled = 20; 280 | optional google.protobuf.BoolValue family_center_enabled_v2 = 21; 281 | optional google.protobuf.BoolValue hide_legacy_username = 22; 282 | optional google.protobuf.BoolValue inappropriate_conversation_warnings = 23; 283 | optional google.protobuf.BoolValue recent_games_enabled = 24; 284 | GuildsLeaderboardOptOutDefault guilds_leaderboard_opt_out_default = 25; 285 | optional google.protobuf.BoolValue allow_game_friend_dms_in_discord = 26; 286 | optional google.protobuf.BoolValue default_guilds_restricted_v2 = 27; 287 | SlayerSDKReceiveInGameDMs slayer_sdk_receive_dms_in_game = 28; 288 | GuildActivityStatusRestrictionDefaultV2 default_guilds_activity_restricted_v2 = 29; 289 | optional google.protobuf.BoolValue quests_3p_data_opted_out = 30; 290 | } 291 | 292 | message DebugSettings { 293 | optional google.protobuf.BoolValue rtc_panel_show_voice_states = 1; 294 | } 295 | 296 | message GameLibrarySettings { 297 | optional google.protobuf.BoolValue install_shortcut_desktop = 1; 298 | optional google.protobuf.BoolValue install_shortcut_start_menu = 2; 299 | optional google.protobuf.BoolValue disable_games_tab = 3; 300 | } 301 | 302 | message CustomStatus { 303 | string text = 1; 304 | fixed64 emoji_id = 2; 305 | string emoji_name = 3; 306 | fixed64 expires_at_ms = 4; 307 | fixed64 created_at_ms = 5; 308 | optional google.protobuf.StringValue label = 6; 309 | } 310 | 311 | message StatusSettings { 312 | optional google.protobuf.StringValue status = 1; 313 | optional CustomStatus custom_status = 2; 314 | optional google.protobuf.BoolValue show_current_game = 3; 315 | fixed64 status_expires_at_ms = 4; 316 | optional google.protobuf.UInt64Value status_created_at_ms = 5; 317 | } 318 | 319 | message LocalizationSettings { 320 | optional google.protobuf.StringValue locale = 1; 321 | optional google.protobuf.Int32Value timezone_offset = 2; 322 | } 323 | 324 | enum Theme { 325 | THEME_UNSET = 0; 326 | THEME_DARK = 1; 327 | THEME_LIGHT = 2; 328 | THEME_DARKER = 3; 329 | THEME_MIDNIGHT = 4; 330 | } 331 | 332 | message CustomUserThemeSettings { 333 | repeated string colors = 1 [packed = false]; 334 | repeated float gradient_color_stops = 2; 335 | int32 gradient_angle = 3; 336 | int32 base_mix = 4; 337 | } 338 | 339 | message ClientThemeSettings { 340 | optional google.protobuf.UInt32Value background_gradient_preset_id = 2; 341 | optional CustomUserThemeSettings custom_user_theme_settings = 4; 342 | } 343 | 344 | enum TimestampHourCycle { 345 | TIMESTAMP_HOUR_CYCLE_AUTO = 0; 346 | TIMESTAMP_HOUR_CYCLE_H12 = 1; 347 | TIMESTAMP_HOUR_CYCLE_H23 = 2; 348 | } 349 | 350 | enum LaunchPadMode { 351 | LAUNCH_PAD_MODE_LAUNCH_PAD_DISABLED = 0; 352 | LAUNCH_PAD_MODE_LAUNCH_PAD_GESTURE_FULL_SCREEN = 1; 353 | LAUNCH_PAD_MODE_LAUNCH_PAD_GESTURE_RIGHT_EDGE = 2; 354 | LAUNCH_PAD_MODE_LAUNCH_PAD_PULL_TAB = 3; 355 | } 356 | 357 | enum UIDensity { 358 | UI_DENSITY_UNSET_UI_DENSITY = 0; 359 | UI_DENSITY_COMPACT = 1; 360 | UI_DENSITY_COZY = 2; 361 | UI_DENSITY_RESPONSIVE = 3; 362 | UI_DENSITY_DEFAULT = 4; 363 | } 364 | 365 | enum SwipeRightToLeftMode { 366 | SWIPE_RIGHT_TO_LEFT_MODE_SWIPE_RIGHT_TO_LEFT_UNSET = 0; 367 | SWIPE_RIGHT_TO_LEFT_MODE_SWIPE_RIGHT_TO_LEFT_CHANNEL_DETAILS = 1; 368 | SWIPE_RIGHT_TO_LEFT_MODE_SWIPE_RIGHT_TO_LEFT_REPLY = 2; 369 | } 370 | 371 | message AppearanceSettings { 372 | Theme theme = 1; 373 | bool developer_mode = 2; 374 | optional ClientThemeSettings client_theme_settings = 3; 375 | bool mobile_redesign_disabled = 4; 376 | optional google.protobuf.StringValue channel_list_layout = 6; 377 | optional google.protobuf.StringValue message_previews = 7; 378 | optional google.protobuf.BoolValue search_result_exact_count_enabled = 8; 379 | TimestampHourCycle timestamp_hour_cycle = 9; 380 | optional google.protobuf.BoolValue happening_now_cards_disabled = 10; 381 | LaunchPadMode launch_pad_mode = 11; 382 | UIDensity ui_density = 12; 383 | SwipeRightToLeftMode swipe_right_to_left_mode = 13; 384 | } 385 | 386 | message GuildFolder { 387 | repeated fixed64 guild_ids = 1; 388 | optional google.protobuf.Int64Value id = 2; 389 | optional google.protobuf.StringValue name = 3; 390 | optional google.protobuf.UInt64Value color = 4; 391 | } 392 | 393 | message GuildFolders { 394 | repeated GuildFolder folders = 1; 395 | repeated fixed64 guild_positions = 2; 396 | } 397 | 398 | enum FavoriteChannelType { 399 | FAVORITE_CHANNEL_TYPE_UNSET_FAVORITE_CHANNEL_TYPE = 0; 400 | FAVORITE_CHANNEL_TYPE_REFERENCE_ORIGINAL = 1; 401 | FAVORITE_CHANNEL_TYPE_CATEGORY = 2; 402 | } 403 | 404 | message FavoriteChannel { 405 | string nickname = 1; 406 | FavoriteChannelType type = 2; 407 | uint32 position = 3; 408 | fixed64 parent_id = 4; 409 | } 410 | 411 | message Favorites { 412 | map favorite_channels = 1; 413 | bool muted = 2; 414 | } 415 | 416 | message AudioContextSetting { 417 | bool muted = 1; 418 | float volume = 2; 419 | fixed64 modified_at = 3; 420 | bool soundboard_muted = 4; 421 | } 422 | 423 | message AudioSettings { 424 | map user = 1; 425 | map stream = 2; 426 | } 427 | 428 | message CommunitiesSettings { 429 | optional google.protobuf.BoolValue disable_home_auto_nav = 1; 430 | } 431 | 432 | message BroadcastSettings { 433 | optional google.protobuf.BoolValue allow_friends = 1; 434 | repeated fixed64 allowed_guild_ids = 2; 435 | repeated fixed64 allowed_user_ids = 3; 436 | optional google.protobuf.BoolValue auto_broadcast = 4; 437 | } 438 | 439 | message ClipsSettings { 440 | optional google.protobuf.BoolValue allow_voice_recording = 1; 441 | } 442 | 443 | enum ForLaterTab { 444 | FOR_LATER_TAB_UNSPECIFIED = 0; 445 | FOR_LATER_TAB_ALL = 1; 446 | FOR_LATER_TAB_BOOKMARKS = 2; 447 | FOR_LATER_TAB_REMINDERS = 3; 448 | } 449 | 450 | message ForLaterSettings { 451 | ForLaterTab current_tab = 1; 452 | } 453 | 454 | enum SafetySettingsPresetType { 455 | SAFETY_SETTINGS_PRESET_TYPE_UNSET_SAFETY_SETTINGS_PRESET = 0; 456 | SAFETY_SETTINGS_PRESET_TYPE_BALANCED = 1; 457 | SAFETY_SETTINGS_PRESET_TYPE_STRICT = 2; 458 | SAFETY_SETTINGS_PRESET_TYPE_RELAXED = 3; 459 | SAFETY_SETTINGS_PRESET_TYPE_CUSTOM = 4; 460 | } 461 | 462 | message SafetySettings { 463 | SafetySettingsPresetType safety_settings_preset = 1; 464 | bool ignore_profile_speedbump_disabled = 2; 465 | } 466 | 467 | message ICYMISettings { 468 | fixed64 feed_generated_at = 1; 469 | } 470 | 471 | message ApplicationDMSettings { 472 | bool allow_mobile_push = 2; 473 | } 474 | 475 | message ApplicationSharingSettings { 476 | bool disable_application_activity_sharing = 1; 477 | } 478 | 479 | message ApplicationSettings { 480 | optional ApplicationDMSettings app_dm_settings = 1; 481 | optional ApplicationSharingSettings app_sharing_settings = 2; 482 | } 483 | 484 | message AllApplicationSettings { 485 | map app_settings = 1; 486 | } 487 | 488 | message AdsSettings { 489 | bool always_deliver = 1; 490 | } 491 | 492 | message InAppFeedbackState { 493 | optional google.protobuf.UInt64Value last_impression_time = 1; 494 | optional google.protobuf.UInt64Value opt_out_expiry_time = 2; 495 | } 496 | 497 | message InAppFeedbackSettings { 498 | map in_app_feedback_states = 1; 499 | } 500 | 501 | optional Versions versions = 1; 502 | optional InboxSettings inbox = 2; 503 | optional AllGuildSettings guilds = 3; 504 | optional UserContentSettings user_content = 4; 505 | optional VoiceAndVideoSettings voice_and_video = 5; 506 | optional TextAndImagesSettings text_and_images = 6; 507 | optional NotificationSettings notifications = 7; 508 | optional PrivacySettings privacy = 8; 509 | optional DebugSettings debug = 9; 510 | optional GameLibrarySettings game_library = 10; 511 | optional StatusSettings status = 11; 512 | optional LocalizationSettings localization = 12; 513 | optional AppearanceSettings appearance = 13; 514 | optional GuildFolders guild_folders = 14; 515 | optional Favorites favorites = 15; 516 | optional AudioSettings audio_context_settings = 16; 517 | optional CommunitiesSettings communities = 17; 518 | optional BroadcastSettings broadcast = 18; 519 | optional ClipsSettings clips = 19; 520 | optional ForLaterSettings for_later = 20; 521 | optional SafetySettings safety_settings = 21; 522 | optional ICYMISettings icymi_settings = 22; 523 | optional AllApplicationSettings applications = 23; 524 | optional AdsSettings ads = 24; 525 | optional InAppFeedbackSettings in_app_feedback_settings = 25; 526 | } 527 | -------------------------------------------------------------------------------- /discord_protos/premium_marketing/v1/PremiumMarketingComponentProperties.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package discord_protos.premium_marketing.v1; 4 | 5 | message PremiumMarketingComponentProperties { 6 | message FeatureCard { 7 | string header = 1; 8 | string pill = 2; 9 | string body = 3; 10 | string image_link = 4; 11 | string image_link_light_theme = 5; 12 | } 13 | 14 | enum ButtonAction { 15 | BUTTON_ACTION_UNSPECIFIED = 0; 16 | BUTTON_ACTION_OPEN_MARKETING_PAGE = 1; 17 | BUTTON_ACTION_OPEN_TIER_2_PAYMENT_MODAL = 2; 18 | BUTTON_ACTION_OPEN_TIER_1_PAYMENT_MODAL = 3; 19 | BUTTON_ACTION_OPEN_TIER_2_PAYMENT_MODAL_CUSTOM_CONFIRMATION_FOOTER = 4; 20 | } 21 | 22 | message SubscriptionButton { 23 | string copy = 1; 24 | ButtonAction button_action = 2; 25 | } 26 | 27 | message Subtitle { 28 | string link = 1; 29 | string locale = 2; 30 | bool is_default = 3; 31 | } 32 | 33 | message Variant1Storage { 34 | map hero_art_localized_video_links_dark_theme = 1; 35 | map hero_art_localized_video_links_light_theme = 2; 36 | map hero_art_video_subtitle_links = 3; 37 | } 38 | 39 | message AnnouncementModalVariant1Properties { 40 | string header = 1; 41 | string subheader = 2; 42 | string video_link = 3; 43 | string help_article_id = 4; 44 | repeated FeatureCard feature_cards = 5; 45 | optional SubscriptionButton button = 6; 46 | string dismiss_key = 7; 47 | string hero_art_video_link_light_theme = 8; 48 | string hero_art_image_link_dark_theme = 9; 49 | string hero_art_image_link_light_theme = 10; 50 | string modal_top_pill = 11; 51 | string body = 12; 52 | repeated Subtitle hero_art_video_subtitles = 13; 53 | optional Variant1Storage storage = 14; 54 | } 55 | 56 | string content_identifier = 3; 57 | oneof properties { 58 | string placeholder = 1; 59 | AnnouncementModalVariant1Properties announcement_modal_variant_1 = 2; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /discord_protos/premium_marketing/v1/PremiumMarketingComponentProperties_pb2.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by the protocol buffer compiler. DO NOT EDIT! 3 | # NO CHECKED-IN PROTOBUF GENCODE 4 | # source: premium_marketing/v1/PremiumMarketingComponentProperties.proto 5 | # Protobuf Python Version: 5.28.3 6 | """Generated protocol buffer code.""" 7 | from google.protobuf import descriptor as _descriptor 8 | from google.protobuf import descriptor_pool as _descriptor_pool 9 | from google.protobuf import runtime_version as _runtime_version 10 | from google.protobuf import symbol_database as _symbol_database 11 | from google.protobuf.internal import builder as _builder 12 | _runtime_version.ValidateProtobufRuntimeVersion( 13 | _runtime_version.Domain.PUBLIC, 14 | 5, 15 | 28, 16 | 3, 17 | '', 18 | 'premium_marketing/v1/PremiumMarketingComponentProperties.proto' 19 | ) 20 | # @@protoc_insertion_point(imports) 21 | 22 | _sym_db = _symbol_database.Default() 23 | 24 | 25 | 26 | 27 | DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n>premium_marketing/v1/PremiumMarketingComponentProperties.proto\x12#discord_protos.premium_marketing.v1\"\xc0\x12\n#PremiumMarketingComponentProperties\x12\x1a\n\x12\x63ontent_identifier\x18\x03 \x01(\t\x12\x15\n\x0bplaceholder\x18\x01 \x01(\tH\x00\x12\x94\x01\n\x1c\x61nnouncement_modal_variant_1\x18\x02 \x01(\x0b\x32l.discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.AnnouncementModalVariant1PropertiesH\x00\x1am\n\x0b\x46\x65\x61tureCard\x12\x0e\n\x06header\x18\x01 \x01(\t\x12\x0c\n\x04pill\x18\x02 \x01(\t\x12\x0c\n\x04\x62ody\x18\x03 \x01(\t\x12\x12\n\nimage_link\x18\x04 \x01(\t\x12\x1e\n\x16image_link_light_theme\x18\x05 \x01(\t\x1a\x90\x01\n\x12SubscriptionButton\x12\x0c\n\x04\x63opy\x18\x01 \x01(\t\x12l\n\rbutton_action\x18\x02 \x01(\x0e\x32U.discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.ButtonAction\x1a<\n\x08Subtitle\x12\x0c\n\x04link\x18\x01 \x01(\t\x12\x0e\n\x06locale\x18\x02 \x01(\t\x12\x12\n\nis_default\x18\x03 \x01(\x08\x1a\xff\x05\n\x0fVariant1Storage\x12\xb5\x01\n)hero_art_localized_video_links_dark_theme\x18\x01 \x03(\x0b\x32\x81\x01.discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.Variant1Storage.HeroArtLocalizedVideoLinksDarkThemeEntry\x12\xb7\x01\n*hero_art_localized_video_links_light_theme\x18\x02 \x03(\x0b\x32\x82\x01.discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.Variant1Storage.HeroArtLocalizedVideoLinksLightThemeEntry\x12\x9e\x01\n\x1dhero_art_video_subtitle_links\x18\x03 \x03(\x0b\x32w.discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.Variant1Storage.HeroArtVideoSubtitleLinksEntry\x1aJ\n(HeroArtLocalizedVideoLinksDarkThemeEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1aK\n)HeroArtLocalizedVideoLinksLightThemeEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1a@\n\x1eHeroArtVideoSubtitleLinksEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1a\x85\x06\n#AnnouncementModalVariant1Properties\x12\x0e\n\x06header\x18\x01 \x01(\t\x12\x11\n\tsubheader\x18\x02 \x01(\t\x12\x12\n\nvideo_link\x18\x03 \x01(\t\x12\x17\n\x0fhelp_article_id\x18\x04 \x01(\t\x12k\n\rfeature_cards\x18\x05 \x03(\x0b\x32T.discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.FeatureCard\x12p\n\x06\x62utton\x18\x06 \x01(\x0b\x32[.discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.SubscriptionButtonH\x00\x88\x01\x01\x12\x13\n\x0b\x64ismiss_key\x18\x07 \x01(\t\x12\'\n\x1fhero_art_video_link_light_theme\x18\x08 \x01(\t\x12&\n\x1ehero_art_image_link_dark_theme\x18\t \x01(\t\x12\'\n\x1fhero_art_image_link_light_theme\x18\n \x01(\t\x12\x16\n\x0emodal_top_pill\x18\x0b \x01(\t\x12\x0c\n\x04\x62ody\x18\x0c \x01(\t\x12s\n\x18hero_art_video_subtitles\x18\r \x03(\x0b\x32Q.discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.Subtitle\x12n\n\x07storage\x18\x0e \x01(\x0b\x32X.discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.Variant1StorageH\x01\x88\x01\x01\x42\t\n\x07_buttonB\n\n\x08_storage\"\xf6\x01\n\x0c\x42uttonAction\x12\x1d\n\x19\x42UTTON_ACTION_UNSPECIFIED\x10\x00\x12%\n!BUTTON_ACTION_OPEN_MARKETING_PAGE\x10\x01\x12+\n\'BUTTON_ACTION_OPEN_TIER_2_PAYMENT_MODAL\x10\x02\x12+\n\'BUTTON_ACTION_OPEN_TIER_1_PAYMENT_MODAL\x10\x03\x12\x46\nBBUTTON_ACTION_OPEN_TIER_2_PAYMENT_MODAL_CUSTOM_CONFIRMATION_FOOTER\x10\x04\x42\x0c\n\npropertiesb\x06proto3') 28 | 29 | _globals = globals() 30 | _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) 31 | _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'premium_marketing.v1.PremiumMarketingComponentProperties_pb2', _globals) 32 | if not _descriptor._USE_C_DESCRIPTORS: 33 | DESCRIPTOR._loaded_options = None 34 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES_VARIANT1STORAGE_HEROARTLOCALIZEDVIDEOLINKSDARKTHEMEENTRY']._loaded_options = None 35 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES_VARIANT1STORAGE_HEROARTLOCALIZEDVIDEOLINKSDARKTHEMEENTRY']._serialized_options = b'8\001' 36 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES_VARIANT1STORAGE_HEROARTLOCALIZEDVIDEOLINKSLIGHTTHEMEENTRY']._loaded_options = None 37 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES_VARIANT1STORAGE_HEROARTLOCALIZEDVIDEOLINKSLIGHTTHEMEENTRY']._serialized_options = b'8\001' 38 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES_VARIANT1STORAGE_HEROARTVIDEOSUBTITLELINKSENTRY']._loaded_options = None 39 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES_VARIANT1STORAGE_HEROARTVIDEOSUBTITLELINKSENTRY']._serialized_options = b'8\001' 40 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES']._serialized_start=104 41 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES']._serialized_end=2472 42 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES_FEATURECARD']._serialized_start=345 43 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES_FEATURECARD']._serialized_end=454 44 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES_SUBSCRIPTIONBUTTON']._serialized_start=457 45 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES_SUBSCRIPTIONBUTTON']._serialized_end=601 46 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES_SUBTITLE']._serialized_start=603 47 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES_SUBTITLE']._serialized_end=663 48 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES_VARIANT1STORAGE']._serialized_start=666 49 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES_VARIANT1STORAGE']._serialized_end=1433 50 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES_VARIANT1STORAGE_HEROARTLOCALIZEDVIDEOLINKSDARKTHEMEENTRY']._serialized_start=1216 51 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES_VARIANT1STORAGE_HEROARTLOCALIZEDVIDEOLINKSDARKTHEMEENTRY']._serialized_end=1290 52 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES_VARIANT1STORAGE_HEROARTLOCALIZEDVIDEOLINKSLIGHTTHEMEENTRY']._serialized_start=1292 53 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES_VARIANT1STORAGE_HEROARTLOCALIZEDVIDEOLINKSLIGHTTHEMEENTRY']._serialized_end=1367 54 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES_VARIANT1STORAGE_HEROARTVIDEOSUBTITLELINKSENTRY']._serialized_start=1369 55 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES_VARIANT1STORAGE_HEROARTVIDEOSUBTITLELINKSENTRY']._serialized_end=1433 56 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES_ANNOUNCEMENTMODALVARIANT1PROPERTIES']._serialized_start=1436 57 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES_ANNOUNCEMENTMODALVARIANT1PROPERTIES']._serialized_end=2209 58 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES_BUTTONACTION']._serialized_start=2212 59 | _globals['_PREMIUMMARKETINGCOMPONENTPROPERTIES_BUTTONACTION']._serialized_end=2458 60 | # @@protoc_insertion_point(module_scope) 61 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "discord-protos", 3 | "version": "1.2.73", 4 | "description": "A parser for Discord's protobufs", 5 | "main": "dist/index.js", 6 | "types": "dist/index.d.ts", 7 | "contributors": [ 8 | { 9 | "name": "dolfies", 10 | "email": "me@dolfi.es", 11 | "url": "https://dolfi.es" 12 | }, 13 | { 14 | "name": "Samuel Scheit", 15 | "email": "github@samuelscheit.com", 16 | "url": "https://samuelscheit.com" 17 | } 18 | ], 19 | "repository": { 20 | "url": "https://github.com/discord-userdoccers/discord-protos" 21 | }, 22 | "license": "MIT", 23 | "scripts": { 24 | "py": "protoc --proto_path=./discord_protos/ --python_out=discord_protos ./discord_protos/discord_users/v1/PreloadedUserSettings.proto ./discord_protos/discord_users/v1/FrecencyUserSettings.proto ./discord_protos/discord_kkv_store_value_models/v1/ApplicationUserRoleConnection.proto ./discord_protos/discord_kkv_store_value_models/v1/AcknowledgedApplicationDisclosures.proto ./discord_protos/discord_experimentation/v1/Experiment.proto ./discord_protos/premium_marketing/v1/PremiumMarketingComponentProperties.proto", 25 | "js": "protoc --proto_path=./discord_protos/ --ts_out src/discord_protos ./discord_protos/discord_users/v1/PreloadedUserSettings.proto ./discord_protos/discord_users/v1/FrecencyUserSettings.proto ./discord_protos/discord_kkv_store_value_models/v1/ApplicationUserRoleConnection.proto ./discord_protos/discord_kkv_store_value_models/v1/AcknowledgedApplicationDisclosures.proto ./discord_protos/discord_experimentation/v1/Experiment.proto ./discord_protos/premium_marketing/v1/PremiumMarketingComponentProperties.proto", 26 | "build": "tsc", 27 | "load": "npm run build && node dist/load.js" 28 | }, 29 | "devDependencies": { 30 | "@protobuf-ts/plugin": "^2.9.6", 31 | "@protobuf-ts/protoc": "^2.9.6", 32 | "puppeteer": "^24.6.0", 33 | "typescript": "^5.8.2" 34 | }, 35 | "dependencies": { 36 | "@protobuf-ts/runtime": "^2.9.6" 37 | } 38 | } -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["setuptools", "wheel"] 3 | build-backend = "setuptools.build_meta" 4 | 5 | [tool.black] 6 | line-length = 125 7 | skip-string-normalization = true 8 | 9 | [tool.pyright] 10 | include = ["discord_protos"] 11 | exclude = [ 12 | "**/__pycache__", 13 | "src", 14 | "node_modules", 15 | ] 16 | reportUnnecessaryTypeIgnoreComment = "warning" 17 | reportUnusedImport = "error" 18 | reportShadowedImports = false 19 | pythonVersion = "3.8" 20 | typeCheckingMode = "basic" 21 | useLibraryCodeForTypes = true 22 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | protobuf 2 | -------------------------------------------------------------------------------- /scripts/parse.js: -------------------------------------------------------------------------------- 1 | // Map the type ints to their names 2 | const ScalarType = { 3 | 1: "double", 4 | 2: "float", 5 | 3: "int64", 6 | 4: "uint64", 7 | 5: "int32", 8 | 6: "fixed64", 9 | 7: "fixed32", 10 | 8: "bool", 11 | 9: "string", 12 | 12: "bytes", 13 | 13: "uint32", 14 | 15: "sfixed32", 15 | 16: "sfixed64", 16 | 17: "sint32", 17 | 18: "sint64", 18 | }; 19 | const RepeatType = { 20 | NO: 0, 21 | PACKED: 1, 22 | UNPACKED: 2, 23 | }; 24 | 25 | function parseType(field) { 26 | // We extract the actual field if possible 27 | if (typeof field === "function") { 28 | field = field(); 29 | // If it's a real type, we just return it 30 | } else if (typeof field === "number") { 31 | return [ScalarType[field], []]; 32 | } 33 | 34 | var type, 35 | structs = []; 36 | 37 | // The kind gives us clues on how to find the type 38 | switch (field.kind) { 39 | case "message": 40 | type = field.T().typeName; 41 | if (type.startsWith("discord")) { 42 | [, type] = parseName(type); 43 | } 44 | break; 45 | case "scalar": 46 | type = ScalarType[field.T]; 47 | break; 48 | case "map": 49 | type = `map<${parseType(field.K)[0]}, ${parseType(field.V)[0]}>`; 50 | break; 51 | case "enum": 52 | [, type] = parseName(field.T()[0]); 53 | break; 54 | default: 55 | throw new Error(`Unknown field type: ${field?.kind || field}`); 56 | } 57 | 58 | // Now we lazily discover any protos in the fields 59 | for (let t of [field.T, field.K, field.V]) { 60 | t = t?.T || t; 61 | 62 | if (typeof t === "function" && (!t().typeName || t().typeName.startsWith("discord_protos"))) { 63 | t = t(); 64 | if (Array.isArray(t)) { 65 | structs.push(parseEnum(t)); 66 | } else { 67 | const extraStruct = parseProto(t); 68 | structs.push(...(extraStruct.structs || [])); 69 | delete extraStruct.structs; 70 | structs.push(extraStruct); 71 | } 72 | } 73 | } 74 | 75 | return [type, structs]; 76 | } 77 | 78 | function parseName(name) { 79 | const split = name.split("."); 80 | return [split.slice(0, -1).join("."), split.slice(-1)[0]]; 81 | } 82 | 83 | function convertCase(str) { 84 | // This converts standard EnumType case to ENUM_TYPE 85 | // it must support the special case SlayerSDKReceive to SLAYER_SDK_RECEIVE 86 | return str 87 | // HACK: I can't think of another way to fix this 88 | .replace("DMs", "Dms") 89 | .replace(/([a-z])([A-Z])/g, "$1_$2") 90 | .replace(/([A-Z])([A-Z][a-z])/g, "$1_$2") 91 | .replace(/([a-z])(\d)/g, "$1_$2") 92 | .replace(/([A-Z]+)(?=[A-Z][a-z])/g, "$1_") 93 | .toUpperCase(); 94 | } 95 | 96 | function camelToSnake(str) { 97 | return str.replace(/(([a-z])(?=[A-Z][a-zA-Z])|([A-Z])(?=[A-Z][a-z]))/g,'$1_').toLowerCase() 98 | } 99 | 100 | function flattenField(field) { 101 | const [type, structs] = parseType(field); 102 | return [ 103 | { 104 | number: field.no, 105 | name: field.name, 106 | kind: field.kind, 107 | type: type, 108 | oneof: field.oneof, 109 | optional: field.opt, 110 | repeated: Boolean(field.repeat), 111 | unpacked: field.repeat === RepeatType.UNPACKED, 112 | }, 113 | structs, 114 | ]; 115 | } 116 | 117 | function parseEnum(enun) { 118 | const [name, data] = enun; 119 | 120 | // Protobuf enum values conventionally have a prefix of NAME_ and we must add that back 121 | const [, formattedName] = parseName(name); 122 | const prefix = convertCase(formattedName) + "_"; 123 | 124 | return { 125 | name: formattedName, 126 | kind: "enum", 127 | values: Object.entries(data) 128 | .filter(([k, _]) => isNaN(Number(k))) 129 | .map(([k, v]) => ({ 130 | // Discord shitcode sometimes fails to strip the prefix on the special case 131 | // so we check if it already has it 132 | name: k.startsWith(prefix) ? k : prefix + k, 133 | value: v, 134 | })), 135 | }; 136 | } 137 | 138 | function parseProto(proto) { 139 | const fields = []; 140 | const structs = []; 141 | proto.fields.forEach(function (field) { 142 | const [f, s] = flattenField(field); 143 | fields.push(f); 144 | structs.push(...s); 145 | }); 146 | 147 | const seen = new Set(); 148 | const [package, name] = parseName(proto.typeName); 149 | return { 150 | package, 151 | name, 152 | kind: "message", 153 | fields: fields, 154 | structs: structs.filter((v) => (seen.has(v.name) ? false : seen.add(v.name))), 155 | }; 156 | } 157 | 158 | function extractProtos() { 159 | const results = {}; 160 | 161 | // Populated by preload.js 162 | for (const proto of window.protoObjects) { 163 | if (!proto?.typeName?.startsWith?.("discord_protos")) continue; 164 | const [, name] = parseName(proto.typeName); 165 | console.log(`Parsing ${name}...`); 166 | results[name] = parseProto(proto); 167 | } 168 | 169 | // Remove every proto that is mentioned in another proto 170 | for (const proto of Object.values(results)) { 171 | for (const struct of proto.structs) { 172 | delete results[struct.name]; 173 | } 174 | } 175 | 176 | return results; 177 | } 178 | 179 | function createProtoField(field) { 180 | if (!field.repeated && field.unpacked) 181 | throw new Error(`Field ${field.name} is not repeated but has unpacked set`); 182 | return `${field.optional ? "optional " : field.repeated ? "repeated " : ""}${field.type} ${field.name} = ${field.number}${field.unpacked ? " [packed = false]" : ""};`; 183 | } 184 | 185 | function createProtoFile(proto) { 186 | const lines = [`syntax = "proto3";\n`, `package ${proto.package};\n`, `message ${proto.name} {`]; 187 | 188 | proto.structs.forEach((struct) => { 189 | lines.push(` ${struct.kind} ${struct.name} {`); 190 | 191 | switch (struct.kind) { 192 | case "enum": 193 | struct.values.forEach((value) => { 194 | lines.push(` ${value.name.toUpperCase()} = ${value.value};`); 195 | }); 196 | break; 197 | case "message": 198 | // Group fields by oneof if applicable 199 | const oneofGroups = new Map(); 200 | const normalFields = []; 201 | 202 | struct.fields.forEach((field) => { 203 | if (field.oneof) { 204 | if (!oneofGroups.has(field.oneof)) { 205 | oneofGroups.set(field.oneof, []); 206 | } 207 | oneofGroups.get(field.oneof).push(field); 208 | } else { 209 | normalFields.push(field); 210 | } 211 | }); 212 | 213 | oneofGroups.forEach((fields, oneofName) => { 214 | lines.push(` oneof ${camelToSnake(oneofName)} {`); 215 | fields.forEach((field) => { 216 | lines.push(` ${createProtoField(field)}`); 217 | }); 218 | lines.push(` }`); 219 | }); 220 | 221 | normalFields.forEach((field) => { 222 | lines.push(` ${createProtoField(field)}`); 223 | }); 224 | break; 225 | default: 226 | throw new Error(`Unknown struct kind: ${struct.kind}`); 227 | } 228 | 229 | lines.push(` }\n`); 230 | }); 231 | 232 | const oneofGroups = new Map(); 233 | 234 | proto.fields.forEach((field) => { 235 | if (field.oneof) { 236 | if (!oneofGroups.has(field.oneof)) { 237 | oneofGroups.set(field.oneof, []); 238 | } 239 | oneofGroups.get(field.oneof).push(createProtoField(field)); 240 | } else { 241 | lines.push(` ${createProtoField(field)}`); 242 | } 243 | }); 244 | 245 | oneofGroups.forEach((fields, oneofName) => { 246 | lines.push(` oneof ${camelToSnake(oneofName)} {`); 247 | fields.forEach(field => lines.push(` ${field}`)); 248 | lines.push(` }\n`); 249 | }); 250 | 251 | // Check if we're using the funny Google well-knowns and insert an import statement (I love Discord) 252 | if (lines.some((line) => line.includes("google.protobuf"))) { 253 | lines.splice(1, 0, `import "google/protobuf/wrappers.proto";\nimport "google/protobuf/timestamp.proto";\n`); 254 | } 255 | 256 | lines.push("}\n"); 257 | return lines.join("\n"); 258 | } 259 | 260 | const protos = extractProtos(); 261 | for (const [key, proto] of Object.entries(protos)) { 262 | const data = createProtoFile(proto); 263 | protos[key].data = data; 264 | if (window.DiscordNative?.fileManager) { 265 | window.DiscordNative.fileManager.saveWithDialog(data, `${proto.name}.proto`); 266 | } else { 267 | console.log(data); 268 | } 269 | } 270 | -------------------------------------------------------------------------------- /scripts/preload.js: -------------------------------------------------------------------------------- 1 | window.protoObjects = []; 2 | Object.defineProperty(Object.prototype, "typeName", { 3 | configurable: true, 4 | 5 | set(v) { 6 | if (this.internalBinaryRead != null) { 7 | window.protoObjects.push(this); 8 | } 9 | 10 | Object.defineProperty(this, "typeName", { 11 | value: v, 12 | configurable: true, 13 | enumerable: true, 14 | writable: true 15 | }); 16 | } 17 | }); 18 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | import re 3 | 4 | with open('requirements.txt') as f: 5 | requirements = f.read().splitlines() 6 | 7 | with open('discord_protos/__init__.py') as f: 8 | version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE).group(1) 9 | 10 | with open('README.md') as f: 11 | readme = f.read() 12 | 13 | setup( 14 | name='discord-protos', 15 | author='Dolfies', 16 | url='https://github.com/dolfies/discord-protos', 17 | project_urls={ 18 | 'Issue tracker': 'https://github.com/dolfies/discord-protos/issues', 19 | }, 20 | version=version, 21 | packages=['discord_protos'], 22 | license='MIT', 23 | description='Discord user settings protobufs.', 24 | long_description=readme, 25 | long_description_content_type='text/markdown', 26 | include_package_data=True, 27 | install_requires=requirements, 28 | python_requires='>=3.8.0', 29 | classifiers=[ 30 | 'License :: OSI Approved :: MIT License', 31 | 'Natural Language :: English', 32 | 'Operating System :: OS Independent', 33 | 'Programming Language :: Python :: 3.8', 34 | 'Programming Language :: Python :: 3.9', 35 | 'Programming Language :: Python :: 3.10', 36 | 'Programming Language :: Python :: 3.11', 37 | 'Topic :: Internet', 38 | 'Topic :: Software Development :: Libraries', 39 | 'Topic :: Software Development :: Libraries :: Python Modules', 40 | 'Topic :: Utilities', 41 | ], 42 | ) 43 | -------------------------------------------------------------------------------- /src/discord_protos/discord_kkv_store_value_models/v1/AcknowledgedApplicationDisclosures.ts: -------------------------------------------------------------------------------- 1 | // @generated by protobuf-ts 2.11.1 2 | // @generated from protobuf file "discord_kkv_store_value_models/v1/AcknowledgedApplicationDisclosures.proto" (package "discord_protos.discord_kkv_store_value_models.v1", syntax proto3) 3 | // tslint:disable 4 | import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; 5 | import type { IBinaryWriter } from "@protobuf-ts/runtime"; 6 | import { WireType } from "@protobuf-ts/runtime"; 7 | import type { BinaryReadOptions } from "@protobuf-ts/runtime"; 8 | import type { IBinaryReader } from "@protobuf-ts/runtime"; 9 | import { UnknownFieldHandler } from "@protobuf-ts/runtime"; 10 | import type { PartialMessage } from "@protobuf-ts/runtime"; 11 | import { reflectionMergePartial } from "@protobuf-ts/runtime"; 12 | import { MessageType } from "@protobuf-ts/runtime"; 13 | import { Timestamp } from "../../google/protobuf/timestamp"; 14 | /** 15 | * @generated from protobuf message discord_protos.discord_kkv_store_value_models.v1.AcknowledgedApplicationDisclosures 16 | */ 17 | export interface AcknowledgedApplicationDisclosures { 18 | /** 19 | * @generated from protobuf field: repeated discord_protos.discord_kkv_store_value_models.v1.AcknowledgedApplicationDisclosures.AcknowledgedApplicationDisclosure acked_disclosures = 1 20 | */ 21 | ackedDisclosures: AcknowledgedApplicationDisclosures_AcknowledgedApplicationDisclosure[]; 22 | } 23 | /** 24 | * @generated from protobuf message discord_protos.discord_kkv_store_value_models.v1.AcknowledgedApplicationDisclosures.AcknowledgedApplicationDisclosure 25 | */ 26 | export interface AcknowledgedApplicationDisclosures_AcknowledgedApplicationDisclosure { 27 | /** 28 | * @generated from protobuf field: discord_protos.discord_kkv_store_value_models.v1.AcknowledgedApplicationDisclosures.ApplicationDisclosureType disclosure_type = 1 29 | */ 30 | disclosureType: AcknowledgedApplicationDisclosures_ApplicationDisclosureType; 31 | /** 32 | * @generated from protobuf field: optional google.protobuf.Timestamp acked_at = 2 33 | */ 34 | ackedAt?: Timestamp; 35 | } 36 | /** 37 | * @generated from protobuf enum discord_protos.discord_kkv_store_value_models.v1.AcknowledgedApplicationDisclosures.ApplicationDisclosureType 38 | */ 39 | export enum AcknowledgedApplicationDisclosures_ApplicationDisclosureType { 40 | /** 41 | * @generated from protobuf enum value: APPLICATION_DISCLOSURE_TYPE_UNSPECIFIED_DISCLOSURE = 0; 42 | */ 43 | UNSPECIFIED_DISCLOSURE = 0, 44 | /** 45 | * @generated from protobuf enum value: APPLICATION_DISCLOSURE_TYPE_IP_LOCATION = 1; 46 | */ 47 | IP_LOCATION = 1, 48 | /** 49 | * @generated from protobuf enum value: APPLICATION_DISCLOSURE_TYPE_DISPLAYS_ADVERTISEMENTS = 2; 50 | */ 51 | DISPLAYS_ADVERTISEMENTS = 2, 52 | /** 53 | * @generated from protobuf enum value: APPLICATION_DISCLOSURE_TYPE_PARTNER_SDK_DATA_SHARING_MESSAGE = 3; 54 | */ 55 | PARTNER_SDK_DATA_SHARING_MESSAGE = 3 56 | } 57 | // @generated message type with reflection information, may provide speed optimized methods 58 | class AcknowledgedApplicationDisclosures$Type extends MessageType { 59 | constructor() { 60 | super("discord_protos.discord_kkv_store_value_models.v1.AcknowledgedApplicationDisclosures", [ 61 | { no: 1, name: "acked_disclosures", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => AcknowledgedApplicationDisclosures_AcknowledgedApplicationDisclosure } 62 | ]); 63 | } 64 | create(value?: PartialMessage): AcknowledgedApplicationDisclosures { 65 | const message = globalThis.Object.create((this.messagePrototype!)); 66 | message.ackedDisclosures = []; 67 | if (value !== undefined) 68 | reflectionMergePartial(this, message, value); 69 | return message; 70 | } 71 | internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: AcknowledgedApplicationDisclosures): AcknowledgedApplicationDisclosures { 72 | let message = target ?? this.create(), end = reader.pos + length; 73 | while (reader.pos < end) { 74 | let [fieldNo, wireType] = reader.tag(); 75 | switch (fieldNo) { 76 | case /* repeated discord_protos.discord_kkv_store_value_models.v1.AcknowledgedApplicationDisclosures.AcknowledgedApplicationDisclosure acked_disclosures */ 1: 77 | message.ackedDisclosures.push(AcknowledgedApplicationDisclosures_AcknowledgedApplicationDisclosure.internalBinaryRead(reader, reader.uint32(), options)); 78 | break; 79 | default: 80 | let u = options.readUnknownField; 81 | if (u === "throw") 82 | throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); 83 | let d = reader.skip(wireType); 84 | if (u !== false) 85 | (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); 86 | } 87 | } 88 | return message; 89 | } 90 | internalBinaryWrite(message: AcknowledgedApplicationDisclosures, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { 91 | /* repeated discord_protos.discord_kkv_store_value_models.v1.AcknowledgedApplicationDisclosures.AcknowledgedApplicationDisclosure acked_disclosures = 1; */ 92 | for (let i = 0; i < message.ackedDisclosures.length; i++) 93 | AcknowledgedApplicationDisclosures_AcknowledgedApplicationDisclosure.internalBinaryWrite(message.ackedDisclosures[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join(); 94 | let u = options.writeUnknownFields; 95 | if (u !== false) 96 | (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); 97 | return writer; 98 | } 99 | } 100 | /** 101 | * @generated MessageType for protobuf message discord_protos.discord_kkv_store_value_models.v1.AcknowledgedApplicationDisclosures 102 | */ 103 | export const AcknowledgedApplicationDisclosures = new AcknowledgedApplicationDisclosures$Type(); 104 | // @generated message type with reflection information, may provide speed optimized methods 105 | class AcknowledgedApplicationDisclosures_AcknowledgedApplicationDisclosure$Type extends MessageType { 106 | constructor() { 107 | super("discord_protos.discord_kkv_store_value_models.v1.AcknowledgedApplicationDisclosures.AcknowledgedApplicationDisclosure", [ 108 | { no: 1, name: "disclosure_type", kind: "enum", T: () => ["discord_protos.discord_kkv_store_value_models.v1.AcknowledgedApplicationDisclosures.ApplicationDisclosureType", AcknowledgedApplicationDisclosures_ApplicationDisclosureType, "APPLICATION_DISCLOSURE_TYPE_"] }, 109 | { no: 2, name: "acked_at", kind: "message", T: () => Timestamp } 110 | ]); 111 | } 112 | create(value?: PartialMessage): AcknowledgedApplicationDisclosures_AcknowledgedApplicationDisclosure { 113 | const message = globalThis.Object.create((this.messagePrototype!)); 114 | message.disclosureType = 0; 115 | if (value !== undefined) 116 | reflectionMergePartial(this, message, value); 117 | return message; 118 | } 119 | internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: AcknowledgedApplicationDisclosures_AcknowledgedApplicationDisclosure): AcknowledgedApplicationDisclosures_AcknowledgedApplicationDisclosure { 120 | let message = target ?? this.create(), end = reader.pos + length; 121 | while (reader.pos < end) { 122 | let [fieldNo, wireType] = reader.tag(); 123 | switch (fieldNo) { 124 | case /* discord_protos.discord_kkv_store_value_models.v1.AcknowledgedApplicationDisclosures.ApplicationDisclosureType disclosure_type */ 1: 125 | message.disclosureType = reader.int32(); 126 | break; 127 | case /* optional google.protobuf.Timestamp acked_at */ 2: 128 | message.ackedAt = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.ackedAt); 129 | break; 130 | default: 131 | let u = options.readUnknownField; 132 | if (u === "throw") 133 | throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); 134 | let d = reader.skip(wireType); 135 | if (u !== false) 136 | (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); 137 | } 138 | } 139 | return message; 140 | } 141 | internalBinaryWrite(message: AcknowledgedApplicationDisclosures_AcknowledgedApplicationDisclosure, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { 142 | /* discord_protos.discord_kkv_store_value_models.v1.AcknowledgedApplicationDisclosures.ApplicationDisclosureType disclosure_type = 1; */ 143 | if (message.disclosureType !== 0) 144 | writer.tag(1, WireType.Varint).int32(message.disclosureType); 145 | /* optional google.protobuf.Timestamp acked_at = 2; */ 146 | if (message.ackedAt) 147 | Timestamp.internalBinaryWrite(message.ackedAt, writer.tag(2, WireType.LengthDelimited).fork(), options).join(); 148 | let u = options.writeUnknownFields; 149 | if (u !== false) 150 | (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); 151 | return writer; 152 | } 153 | } 154 | /** 155 | * @generated MessageType for protobuf message discord_protos.discord_kkv_store_value_models.v1.AcknowledgedApplicationDisclosures.AcknowledgedApplicationDisclosure 156 | */ 157 | export const AcknowledgedApplicationDisclosures_AcknowledgedApplicationDisclosure = new AcknowledgedApplicationDisclosures_AcknowledgedApplicationDisclosure$Type(); 158 | -------------------------------------------------------------------------------- /src/discord_protos/discord_kkv_store_value_models/v1/ApplicationUserRoleConnection.ts: -------------------------------------------------------------------------------- 1 | // @generated by protobuf-ts 2.11.1 2 | // @generated from protobuf file "discord_kkv_store_value_models/v1/ApplicationUserRoleConnection.proto" (package "discord_protos.discord_kkv_store_value_models.v1", syntax proto3) 3 | // tslint:disable 4 | import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; 5 | import type { IBinaryWriter } from "@protobuf-ts/runtime"; 6 | import { WireType } from "@protobuf-ts/runtime"; 7 | import type { BinaryReadOptions } from "@protobuf-ts/runtime"; 8 | import type { IBinaryReader } from "@protobuf-ts/runtime"; 9 | import { UnknownFieldHandler } from "@protobuf-ts/runtime"; 10 | import type { PartialMessage } from "@protobuf-ts/runtime"; 11 | import { reflectionMergePartial } from "@protobuf-ts/runtime"; 12 | import { MessageType } from "@protobuf-ts/runtime"; 13 | /** 14 | * @generated from protobuf message discord_protos.discord_kkv_store_value_models.v1.ApplicationUserRoleConnection 15 | */ 16 | export interface ApplicationUserRoleConnection { 17 | /** 18 | * @generated from protobuf field: map metadata = 1 19 | */ 20 | metadata: { 21 | [key: string]: string; 22 | }; 23 | /** 24 | * @generated from protobuf field: string platform_name = 2 25 | */ 26 | platformName: string; 27 | /** 28 | * @generated from protobuf field: string platform_username = 3 29 | */ 30 | platformUsername: string; 31 | /** 32 | * @generated from protobuf field: fixed64 version = 4 33 | */ 34 | version: bigint; 35 | } 36 | // @generated message type with reflection information, may provide speed optimized methods 37 | class ApplicationUserRoleConnection$Type extends MessageType { 38 | constructor() { 39 | super("discord_protos.discord_kkv_store_value_models.v1.ApplicationUserRoleConnection", [ 40 | { no: 1, name: "metadata", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 9 /*ScalarType.STRING*/ } }, 41 | { no: 2, name: "platform_name", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, 42 | { no: 3, name: "platform_username", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, 43 | { no: 4, name: "version", kind: "scalar", T: 6 /*ScalarType.FIXED64*/, L: 0 /*LongType.BIGINT*/ } 44 | ]); 45 | } 46 | create(value?: PartialMessage): ApplicationUserRoleConnection { 47 | const message = globalThis.Object.create((this.messagePrototype!)); 48 | message.metadata = {}; 49 | message.platformName = ""; 50 | message.platformUsername = ""; 51 | message.version = 0n; 52 | if (value !== undefined) 53 | reflectionMergePartial(this, message, value); 54 | return message; 55 | } 56 | internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ApplicationUserRoleConnection): ApplicationUserRoleConnection { 57 | let message = target ?? this.create(), end = reader.pos + length; 58 | while (reader.pos < end) { 59 | let [fieldNo, wireType] = reader.tag(); 60 | switch (fieldNo) { 61 | case /* map metadata */ 1: 62 | this.binaryReadMap1(message.metadata, reader, options); 63 | break; 64 | case /* string platform_name */ 2: 65 | message.platformName = reader.string(); 66 | break; 67 | case /* string platform_username */ 3: 68 | message.platformUsername = reader.string(); 69 | break; 70 | case /* fixed64 version */ 4: 71 | message.version = reader.fixed64().toBigInt(); 72 | break; 73 | default: 74 | let u = options.readUnknownField; 75 | if (u === "throw") 76 | throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); 77 | let d = reader.skip(wireType); 78 | if (u !== false) 79 | (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); 80 | } 81 | } 82 | return message; 83 | } 84 | private binaryReadMap1(map: ApplicationUserRoleConnection["metadata"], reader: IBinaryReader, options: BinaryReadOptions): void { 85 | let len = reader.uint32(), end = reader.pos + len, key: keyof ApplicationUserRoleConnection["metadata"] | undefined, val: ApplicationUserRoleConnection["metadata"][any] | undefined; 86 | while (reader.pos < end) { 87 | let [fieldNo, wireType] = reader.tag(); 88 | switch (fieldNo) { 89 | case 1: 90 | key = reader.string(); 91 | break; 92 | case 2: 93 | val = reader.string(); 94 | break; 95 | default: throw new globalThis.Error("unknown map entry field for discord_protos.discord_kkv_store_value_models.v1.ApplicationUserRoleConnection.metadata"); 96 | } 97 | } 98 | map[key ?? ""] = val ?? ""; 99 | } 100 | internalBinaryWrite(message: ApplicationUserRoleConnection, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { 101 | /* map metadata = 1; */ 102 | for (let k of globalThis.Object.keys(message.metadata)) 103 | writer.tag(1, WireType.LengthDelimited).fork().tag(1, WireType.LengthDelimited).string(k).tag(2, WireType.LengthDelimited).string(message.metadata[k]).join(); 104 | /* string platform_name = 2; */ 105 | if (message.platformName !== "") 106 | writer.tag(2, WireType.LengthDelimited).string(message.platformName); 107 | /* string platform_username = 3; */ 108 | if (message.platformUsername !== "") 109 | writer.tag(3, WireType.LengthDelimited).string(message.platformUsername); 110 | /* fixed64 version = 4; */ 111 | if (message.version !== 0n) 112 | writer.tag(4, WireType.Bit64).fixed64(message.version); 113 | let u = options.writeUnknownFields; 114 | if (u !== false) 115 | (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); 116 | return writer; 117 | } 118 | } 119 | /** 120 | * @generated MessageType for protobuf message discord_protos.discord_kkv_store_value_models.v1.ApplicationUserRoleConnection 121 | */ 122 | export const ApplicationUserRoleConnection = new ApplicationUserRoleConnection$Type(); 123 | -------------------------------------------------------------------------------- /src/discord_protos/google/protobuf/timestamp.ts: -------------------------------------------------------------------------------- 1 | // @generated by protobuf-ts 2.11.1 2 | // @generated from protobuf file "google/protobuf/timestamp.proto" (package "google.protobuf", syntax proto3) 3 | // tslint:disable 4 | // 5 | // Protocol Buffers - Google's data interchange format 6 | // Copyright 2008 Google Inc. All rights reserved. 7 | // https://developers.google.com/protocol-buffers/ 8 | // 9 | // Redistribution and use in source and binary forms, with or without 10 | // modification, are permitted provided that the following conditions are 11 | // met: 12 | // 13 | // * Redistributions of source code must retain the above copyright 14 | // notice, this list of conditions and the following disclaimer. 15 | // * Redistributions in binary form must reproduce the above 16 | // copyright notice, this list of conditions and the following disclaimer 17 | // in the documentation and/or other materials provided with the 18 | // distribution. 19 | // * Neither the name of Google Inc. nor the names of its 20 | // contributors may be used to endorse or promote products derived from 21 | // this software without specific prior written permission. 22 | // 23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 26 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 29 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 30 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | // 35 | import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; 36 | import type { IBinaryWriter } from "@protobuf-ts/runtime"; 37 | import { WireType } from "@protobuf-ts/runtime"; 38 | import type { BinaryReadOptions } from "@protobuf-ts/runtime"; 39 | import type { IBinaryReader } from "@protobuf-ts/runtime"; 40 | import { UnknownFieldHandler } from "@protobuf-ts/runtime"; 41 | import type { PartialMessage } from "@protobuf-ts/runtime"; 42 | import { reflectionMergePartial } from "@protobuf-ts/runtime"; 43 | import { typeofJsonValue } from "@protobuf-ts/runtime"; 44 | import type { JsonValue } from "@protobuf-ts/runtime"; 45 | import type { JsonReadOptions } from "@protobuf-ts/runtime"; 46 | import type { JsonWriteOptions } from "@protobuf-ts/runtime"; 47 | import { PbLong } from "@protobuf-ts/runtime"; 48 | import { MessageType } from "@protobuf-ts/runtime"; 49 | /** 50 | * A Timestamp represents a point in time independent of any time zone or local 51 | * calendar, encoded as a count of seconds and fractions of seconds at 52 | * nanosecond resolution. The count is relative to an epoch at UTC midnight on 53 | * January 1, 1970, in the proleptic Gregorian calendar which extends the 54 | * Gregorian calendar backwards to year one. 55 | * 56 | * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap 57 | * second table is needed for interpretation, using a [24-hour linear 58 | * smear](https://developers.google.com/time/smear). 59 | * 60 | * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By 61 | * restricting to that range, we ensure that we can convert to and from [RFC 62 | * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. 63 | * 64 | * # Examples 65 | * 66 | * Example 1: Compute Timestamp from POSIX `time()`. 67 | * 68 | * Timestamp timestamp; 69 | * timestamp.set_seconds(time(NULL)); 70 | * timestamp.set_nanos(0); 71 | * 72 | * Example 2: Compute Timestamp from POSIX `gettimeofday()`. 73 | * 74 | * struct timeval tv; 75 | * gettimeofday(&tv, NULL); 76 | * 77 | * Timestamp timestamp; 78 | * timestamp.set_seconds(tv.tv_sec); 79 | * timestamp.set_nanos(tv.tv_usec * 1000); 80 | * 81 | * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. 82 | * 83 | * FILETIME ft; 84 | * GetSystemTimeAsFileTime(&ft); 85 | * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; 86 | * 87 | * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z 88 | * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. 89 | * Timestamp timestamp; 90 | * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); 91 | * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); 92 | * 93 | * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. 94 | * 95 | * long millis = System.currentTimeMillis(); 96 | * 97 | * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) 98 | * .setNanos((int) ((millis % 1000) * 1000000)).build(); 99 | * 100 | * Example 5: Compute Timestamp from Java `Instant.now()`. 101 | * 102 | * Instant now = Instant.now(); 103 | * 104 | * Timestamp timestamp = 105 | * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) 106 | * .setNanos(now.getNano()).build(); 107 | * 108 | * Example 6: Compute Timestamp from current time in Python. 109 | * 110 | * timestamp = Timestamp() 111 | * timestamp.GetCurrentTime() 112 | * 113 | * # JSON Mapping 114 | * 115 | * In JSON format, the Timestamp type is encoded as a string in the 116 | * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the 117 | * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" 118 | * where {year} is always expressed using four digits while {month}, {day}, 119 | * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional 120 | * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), 121 | * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone 122 | * is required. A proto3 JSON serializer should always use UTC (as indicated by 123 | * "Z") when printing the Timestamp type and a proto3 JSON parser should be 124 | * able to accept both UTC and other timezones (as indicated by an offset). 125 | * 126 | * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 127 | * 01:30 UTC on January 15, 2017. 128 | * 129 | * In JavaScript, one can convert a Date object to this format using the 130 | * standard 131 | * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) 132 | * method. In Python, a standard `datetime.datetime` object can be converted 133 | * to this format using 134 | * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with 135 | * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use 136 | * the Joda Time's [`ISODateTimeFormat.dateTime()`]( 137 | * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() 138 | * ) to obtain a formatter capable of generating timestamps in this format. 139 | * 140 | * 141 | * @generated from protobuf message google.protobuf.Timestamp 142 | */ 143 | export interface Timestamp { 144 | /** 145 | * Represents seconds of UTC time since Unix epoch 146 | * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 147 | * 9999-12-31T23:59:59Z inclusive. 148 | * 149 | * @generated from protobuf field: int64 seconds = 1 150 | */ 151 | seconds: bigint; 152 | /** 153 | * Non-negative fractions of a second at nanosecond resolution. Negative 154 | * second values with fractions must still have non-negative nanos values 155 | * that count forward in time. Must be from 0 to 999,999,999 156 | * inclusive. 157 | * 158 | * @generated from protobuf field: int32 nanos = 2 159 | */ 160 | nanos: number; 161 | } 162 | // @generated message type with reflection information, may provide speed optimized methods 163 | class Timestamp$Type extends MessageType { 164 | constructor() { 165 | super("google.protobuf.Timestamp", [ 166 | { no: 1, name: "seconds", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, 167 | { no: 2, name: "nanos", kind: "scalar", T: 5 /*ScalarType.INT32*/ } 168 | ]); 169 | } 170 | /** 171 | * Creates a new `Timestamp` for the current time. 172 | */ 173 | now(): Timestamp { 174 | const msg = this.create(); 175 | const ms = Date.now(); 176 | msg.seconds = PbLong.from(Math.floor(ms / 1000)).toBigInt(); 177 | msg.nanos = (ms % 1000) * 1000000; 178 | return msg; 179 | } 180 | /** 181 | * Converts a `Timestamp` to a JavaScript Date. 182 | */ 183 | toDate(message: Timestamp): Date { 184 | return new Date(PbLong.from(message.seconds).toNumber() * 1000 + Math.ceil(message.nanos / 1000000)); 185 | } 186 | /** 187 | * Converts a JavaScript Date to a `Timestamp`. 188 | */ 189 | fromDate(date: Date): Timestamp { 190 | const msg = this.create(); 191 | const ms = date.getTime(); 192 | msg.seconds = PbLong.from(Math.floor(ms / 1000)).toBigInt(); 193 | msg.nanos = ((ms % 1000) + (ms < 0 && ms % 1000 !== 0 ? 1000 : 0)) * 1000000; 194 | return msg; 195 | } 196 | /** 197 | * In JSON format, the `Timestamp` type is encoded as a string 198 | * in the RFC 3339 format. 199 | */ 200 | internalJsonWrite(message: Timestamp, options: JsonWriteOptions): JsonValue { 201 | let ms = PbLong.from(message.seconds).toNumber() * 1000; 202 | if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z")) 203 | throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive."); 204 | if (message.nanos < 0) 205 | throw new Error("Unable to encode invalid Timestamp to JSON. Nanos must not be negative."); 206 | let z = "Z"; 207 | if (message.nanos > 0) { 208 | let nanosStr = (message.nanos + 1000000000).toString().substring(1); 209 | if (nanosStr.substring(3) === "000000") 210 | z = "." + nanosStr.substring(0, 3) + "Z"; 211 | else if (nanosStr.substring(6) === "000") 212 | z = "." + nanosStr.substring(0, 6) + "Z"; 213 | else 214 | z = "." + nanosStr + "Z"; 215 | } 216 | return new Date(ms).toISOString().replace(".000Z", z); 217 | } 218 | /** 219 | * In JSON format, the `Timestamp` type is encoded as a string 220 | * in the RFC 3339 format. 221 | */ 222 | internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Timestamp): Timestamp { 223 | if (typeof json !== "string") 224 | throw new Error("Unable to parse Timestamp from JSON " + typeofJsonValue(json) + "."); 225 | let matches = json.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/); 226 | if (!matches) 227 | throw new Error("Unable to parse Timestamp from JSON. Invalid format."); 228 | let ms = Date.parse(matches[1] + "-" + matches[2] + "-" + matches[3] + "T" + matches[4] + ":" + matches[5] + ":" + matches[6] + (matches[8] ? matches[8] : "Z")); 229 | if (Number.isNaN(ms)) 230 | throw new Error("Unable to parse Timestamp from JSON. Invalid value."); 231 | if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z")) 232 | throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive."); 233 | if (!target) 234 | target = this.create(); 235 | target.seconds = PbLong.from(ms / 1000).toBigInt(); 236 | target.nanos = 0; 237 | if (matches[7]) 238 | target.nanos = (parseInt("1" + matches[7] + "0".repeat(9 - matches[7].length)) - 1000000000); 239 | return target; 240 | } 241 | create(value?: PartialMessage): Timestamp { 242 | const message = globalThis.Object.create((this.messagePrototype!)); 243 | message.seconds = 0n; 244 | message.nanos = 0; 245 | if (value !== undefined) 246 | reflectionMergePartial(this, message, value); 247 | return message; 248 | } 249 | internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Timestamp): Timestamp { 250 | let message = target ?? this.create(), end = reader.pos + length; 251 | while (reader.pos < end) { 252 | let [fieldNo, wireType] = reader.tag(); 253 | switch (fieldNo) { 254 | case /* int64 seconds */ 1: 255 | message.seconds = reader.int64().toBigInt(); 256 | break; 257 | case /* int32 nanos */ 2: 258 | message.nanos = reader.int32(); 259 | break; 260 | default: 261 | let u = options.readUnknownField; 262 | if (u === "throw") 263 | throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); 264 | let d = reader.skip(wireType); 265 | if (u !== false) 266 | (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); 267 | } 268 | } 269 | return message; 270 | } 271 | internalBinaryWrite(message: Timestamp, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { 272 | /* int64 seconds = 1; */ 273 | if (message.seconds !== 0n) 274 | writer.tag(1, WireType.Varint).int64(message.seconds); 275 | /* int32 nanos = 2; */ 276 | if (message.nanos !== 0) 277 | writer.tag(2, WireType.Varint).int32(message.nanos); 278 | let u = options.writeUnknownFields; 279 | if (u !== false) 280 | (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); 281 | return writer; 282 | } 283 | } 284 | /** 285 | * @generated MessageType for protobuf message google.protobuf.Timestamp 286 | */ 287 | export const Timestamp = new Timestamp$Type(); 288 | -------------------------------------------------------------------------------- /src/discord_protos/google/protobuf/wrappers.ts: -------------------------------------------------------------------------------- 1 | // @generated by protobuf-ts 2.11.1 2 | // @generated from protobuf file "google/protobuf/wrappers.proto" (package "google.protobuf", syntax proto3) 3 | // tslint:disable 4 | // 5 | // Protocol Buffers - Google's data interchange format 6 | // Copyright 2008 Google Inc. All rights reserved. 7 | // https://developers.google.com/protocol-buffers/ 8 | // 9 | // Redistribution and use in source and binary forms, with or without 10 | // modification, are permitted provided that the following conditions are 11 | // met: 12 | // 13 | // * Redistributions of source code must retain the above copyright 14 | // notice, this list of conditions and the following disclaimer. 15 | // * Redistributions in binary form must reproduce the above 16 | // copyright notice, this list of conditions and the following disclaimer 17 | // in the documentation and/or other materials provided with the 18 | // distribution. 19 | // * Neither the name of Google Inc. nor the names of its 20 | // contributors may be used to endorse or promote products derived from 21 | // this software without specific prior written permission. 22 | // 23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 26 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 29 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 30 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | // 35 | // Wrappers for primitive (non-message) types. These types are useful 36 | // for embedding primitives in the `google.protobuf.Any` type and for places 37 | // where we need to distinguish between the absence of a primitive 38 | // typed field and its default value. 39 | // 40 | // These wrappers have no meaningful use within repeated fields as they lack 41 | // the ability to detect presence on individual elements. 42 | // These wrappers have no meaningful use within a map or a oneof since 43 | // individual entries of a map or fields of a oneof can already detect presence. 44 | // 45 | import { ScalarType } from "@protobuf-ts/runtime"; 46 | import { LongType } from "@protobuf-ts/runtime"; 47 | import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; 48 | import type { IBinaryWriter } from "@protobuf-ts/runtime"; 49 | import { WireType } from "@protobuf-ts/runtime"; 50 | import type { BinaryReadOptions } from "@protobuf-ts/runtime"; 51 | import type { IBinaryReader } from "@protobuf-ts/runtime"; 52 | import { UnknownFieldHandler } from "@protobuf-ts/runtime"; 53 | import type { PartialMessage } from "@protobuf-ts/runtime"; 54 | import { reflectionMergePartial } from "@protobuf-ts/runtime"; 55 | import type { JsonValue } from "@protobuf-ts/runtime"; 56 | import type { JsonReadOptions } from "@protobuf-ts/runtime"; 57 | import type { JsonWriteOptions } from "@protobuf-ts/runtime"; 58 | import { MessageType } from "@protobuf-ts/runtime"; 59 | /** 60 | * Wrapper message for `double`. 61 | * 62 | * The JSON representation for `DoubleValue` is JSON number. 63 | * 64 | * @generated from protobuf message google.protobuf.DoubleValue 65 | */ 66 | export interface DoubleValue { 67 | /** 68 | * The double value. 69 | * 70 | * @generated from protobuf field: double value = 1 71 | */ 72 | value: number; 73 | } 74 | /** 75 | * Wrapper message for `float`. 76 | * 77 | * The JSON representation for `FloatValue` is JSON number. 78 | * 79 | * @generated from protobuf message google.protobuf.FloatValue 80 | */ 81 | export interface FloatValue { 82 | /** 83 | * The float value. 84 | * 85 | * @generated from protobuf field: float value = 1 86 | */ 87 | value: number; 88 | } 89 | /** 90 | * Wrapper message for `int64`. 91 | * 92 | * The JSON representation for `Int64Value` is JSON string. 93 | * 94 | * @generated from protobuf message google.protobuf.Int64Value 95 | */ 96 | export interface Int64Value { 97 | /** 98 | * The int64 value. 99 | * 100 | * @generated from protobuf field: int64 value = 1 101 | */ 102 | value: bigint; 103 | } 104 | /** 105 | * Wrapper message for `uint64`. 106 | * 107 | * The JSON representation for `UInt64Value` is JSON string. 108 | * 109 | * @generated from protobuf message google.protobuf.UInt64Value 110 | */ 111 | export interface UInt64Value { 112 | /** 113 | * The uint64 value. 114 | * 115 | * @generated from protobuf field: uint64 value = 1 116 | */ 117 | value: bigint; 118 | } 119 | /** 120 | * Wrapper message for `int32`. 121 | * 122 | * The JSON representation for `Int32Value` is JSON number. 123 | * 124 | * @generated from protobuf message google.protobuf.Int32Value 125 | */ 126 | export interface Int32Value { 127 | /** 128 | * The int32 value. 129 | * 130 | * @generated from protobuf field: int32 value = 1 131 | */ 132 | value: number; 133 | } 134 | /** 135 | * Wrapper message for `uint32`. 136 | * 137 | * The JSON representation for `UInt32Value` is JSON number. 138 | * 139 | * @generated from protobuf message google.protobuf.UInt32Value 140 | */ 141 | export interface UInt32Value { 142 | /** 143 | * The uint32 value. 144 | * 145 | * @generated from protobuf field: uint32 value = 1 146 | */ 147 | value: number; 148 | } 149 | /** 150 | * Wrapper message for `bool`. 151 | * 152 | * The JSON representation for `BoolValue` is JSON `true` and `false`. 153 | * 154 | * @generated from protobuf message google.protobuf.BoolValue 155 | */ 156 | export interface BoolValue { 157 | /** 158 | * The bool value. 159 | * 160 | * @generated from protobuf field: bool value = 1 161 | */ 162 | value: boolean; 163 | } 164 | /** 165 | * Wrapper message for `string`. 166 | * 167 | * The JSON representation for `StringValue` is JSON string. 168 | * 169 | * @generated from protobuf message google.protobuf.StringValue 170 | */ 171 | export interface StringValue { 172 | /** 173 | * The string value. 174 | * 175 | * @generated from protobuf field: string value = 1 176 | */ 177 | value: string; 178 | } 179 | /** 180 | * Wrapper message for `bytes`. 181 | * 182 | * The JSON representation for `BytesValue` is JSON string. 183 | * 184 | * @generated from protobuf message google.protobuf.BytesValue 185 | */ 186 | export interface BytesValue { 187 | /** 188 | * The bytes value. 189 | * 190 | * @generated from protobuf field: bytes value = 1 191 | */ 192 | value: Uint8Array; 193 | } 194 | // @generated message type with reflection information, may provide speed optimized methods 195 | class DoubleValue$Type extends MessageType { 196 | constructor() { 197 | super("google.protobuf.DoubleValue", [ 198 | { no: 1, name: "value", kind: "scalar", T: 1 /*ScalarType.DOUBLE*/ } 199 | ]); 200 | } 201 | /** 202 | * Encode `DoubleValue` to JSON number. 203 | */ 204 | internalJsonWrite(message: DoubleValue, options: JsonWriteOptions): JsonValue { 205 | return this.refJsonWriter.scalar(2, message.value, "value", false, true); 206 | } 207 | /** 208 | * Decode `DoubleValue` from JSON number. 209 | */ 210 | internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: DoubleValue): DoubleValue { 211 | if (!target) 212 | target = this.create(); 213 | target.value = this.refJsonReader.scalar(json, 1, undefined, "value") as number; 214 | return target; 215 | } 216 | create(value?: PartialMessage): DoubleValue { 217 | const message = globalThis.Object.create((this.messagePrototype!)); 218 | message.value = 0; 219 | if (value !== undefined) 220 | reflectionMergePartial(this, message, value); 221 | return message; 222 | } 223 | internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: DoubleValue): DoubleValue { 224 | let message = target ?? this.create(), end = reader.pos + length; 225 | while (reader.pos < end) { 226 | let [fieldNo, wireType] = reader.tag(); 227 | switch (fieldNo) { 228 | case /* double value */ 1: 229 | message.value = reader.double(); 230 | break; 231 | default: 232 | let u = options.readUnknownField; 233 | if (u === "throw") 234 | throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); 235 | let d = reader.skip(wireType); 236 | if (u !== false) 237 | (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); 238 | } 239 | } 240 | return message; 241 | } 242 | internalBinaryWrite(message: DoubleValue, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { 243 | /* double value = 1; */ 244 | if (message.value !== 0) 245 | writer.tag(1, WireType.Bit64).double(message.value); 246 | let u = options.writeUnknownFields; 247 | if (u !== false) 248 | (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); 249 | return writer; 250 | } 251 | } 252 | /** 253 | * @generated MessageType for protobuf message google.protobuf.DoubleValue 254 | */ 255 | export const DoubleValue = new DoubleValue$Type(); 256 | // @generated message type with reflection information, may provide speed optimized methods 257 | class FloatValue$Type extends MessageType { 258 | constructor() { 259 | super("google.protobuf.FloatValue", [ 260 | { no: 1, name: "value", kind: "scalar", T: 2 /*ScalarType.FLOAT*/ } 261 | ]); 262 | } 263 | /** 264 | * Encode `FloatValue` to JSON number. 265 | */ 266 | internalJsonWrite(message: FloatValue, options: JsonWriteOptions): JsonValue { 267 | return this.refJsonWriter.scalar(1, message.value, "value", false, true); 268 | } 269 | /** 270 | * Decode `FloatValue` from JSON number. 271 | */ 272 | internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: FloatValue): FloatValue { 273 | if (!target) 274 | target = this.create(); 275 | target.value = this.refJsonReader.scalar(json, 1, undefined, "value") as number; 276 | return target; 277 | } 278 | create(value?: PartialMessage): FloatValue { 279 | const message = globalThis.Object.create((this.messagePrototype!)); 280 | message.value = 0; 281 | if (value !== undefined) 282 | reflectionMergePartial(this, message, value); 283 | return message; 284 | } 285 | internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: FloatValue): FloatValue { 286 | let message = target ?? this.create(), end = reader.pos + length; 287 | while (reader.pos < end) { 288 | let [fieldNo, wireType] = reader.tag(); 289 | switch (fieldNo) { 290 | case /* float value */ 1: 291 | message.value = reader.float(); 292 | break; 293 | default: 294 | let u = options.readUnknownField; 295 | if (u === "throw") 296 | throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); 297 | let d = reader.skip(wireType); 298 | if (u !== false) 299 | (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); 300 | } 301 | } 302 | return message; 303 | } 304 | internalBinaryWrite(message: FloatValue, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { 305 | /* float value = 1; */ 306 | if (message.value !== 0) 307 | writer.tag(1, WireType.Bit32).float(message.value); 308 | let u = options.writeUnknownFields; 309 | if (u !== false) 310 | (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); 311 | return writer; 312 | } 313 | } 314 | /** 315 | * @generated MessageType for protobuf message google.protobuf.FloatValue 316 | */ 317 | export const FloatValue = new FloatValue$Type(); 318 | // @generated message type with reflection information, may provide speed optimized methods 319 | class Int64Value$Type extends MessageType { 320 | constructor() { 321 | super("google.protobuf.Int64Value", [ 322 | { no: 1, name: "value", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ } 323 | ]); 324 | } 325 | /** 326 | * Encode `Int64Value` to JSON string. 327 | */ 328 | internalJsonWrite(message: Int64Value, options: JsonWriteOptions): JsonValue { 329 | return this.refJsonWriter.scalar(ScalarType.INT64, message.value, "value", false, true); 330 | } 331 | /** 332 | * Decode `Int64Value` from JSON string. 333 | */ 334 | internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Int64Value): Int64Value { 335 | if (!target) 336 | target = this.create(); 337 | target.value = this.refJsonReader.scalar(json, ScalarType.INT64, LongType.BIGINT, "value") as any; 338 | return target; 339 | } 340 | create(value?: PartialMessage): Int64Value { 341 | const message = globalThis.Object.create((this.messagePrototype!)); 342 | message.value = 0n; 343 | if (value !== undefined) 344 | reflectionMergePartial(this, message, value); 345 | return message; 346 | } 347 | internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Int64Value): Int64Value { 348 | let message = target ?? this.create(), end = reader.pos + length; 349 | while (reader.pos < end) { 350 | let [fieldNo, wireType] = reader.tag(); 351 | switch (fieldNo) { 352 | case /* int64 value */ 1: 353 | message.value = reader.int64().toBigInt(); 354 | break; 355 | default: 356 | let u = options.readUnknownField; 357 | if (u === "throw") 358 | throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); 359 | let d = reader.skip(wireType); 360 | if (u !== false) 361 | (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); 362 | } 363 | } 364 | return message; 365 | } 366 | internalBinaryWrite(message: Int64Value, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { 367 | /* int64 value = 1; */ 368 | if (message.value !== 0n) 369 | writer.tag(1, WireType.Varint).int64(message.value); 370 | let u = options.writeUnknownFields; 371 | if (u !== false) 372 | (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); 373 | return writer; 374 | } 375 | } 376 | /** 377 | * @generated MessageType for protobuf message google.protobuf.Int64Value 378 | */ 379 | export const Int64Value = new Int64Value$Type(); 380 | // @generated message type with reflection information, may provide speed optimized methods 381 | class UInt64Value$Type extends MessageType { 382 | constructor() { 383 | super("google.protobuf.UInt64Value", [ 384 | { no: 1, name: "value", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ } 385 | ]); 386 | } 387 | /** 388 | * Encode `UInt64Value` to JSON string. 389 | */ 390 | internalJsonWrite(message: UInt64Value, options: JsonWriteOptions): JsonValue { 391 | return this.refJsonWriter.scalar(ScalarType.UINT64, message.value, "value", false, true); 392 | } 393 | /** 394 | * Decode `UInt64Value` from JSON string. 395 | */ 396 | internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: UInt64Value): UInt64Value { 397 | if (!target) 398 | target = this.create(); 399 | target.value = this.refJsonReader.scalar(json, ScalarType.UINT64, LongType.BIGINT, "value") as any; 400 | return target; 401 | } 402 | create(value?: PartialMessage): UInt64Value { 403 | const message = globalThis.Object.create((this.messagePrototype!)); 404 | message.value = 0n; 405 | if (value !== undefined) 406 | reflectionMergePartial(this, message, value); 407 | return message; 408 | } 409 | internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: UInt64Value): UInt64Value { 410 | let message = target ?? this.create(), end = reader.pos + length; 411 | while (reader.pos < end) { 412 | let [fieldNo, wireType] = reader.tag(); 413 | switch (fieldNo) { 414 | case /* uint64 value */ 1: 415 | message.value = reader.uint64().toBigInt(); 416 | break; 417 | default: 418 | let u = options.readUnknownField; 419 | if (u === "throw") 420 | throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); 421 | let d = reader.skip(wireType); 422 | if (u !== false) 423 | (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); 424 | } 425 | } 426 | return message; 427 | } 428 | internalBinaryWrite(message: UInt64Value, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { 429 | /* uint64 value = 1; */ 430 | if (message.value !== 0n) 431 | writer.tag(1, WireType.Varint).uint64(message.value); 432 | let u = options.writeUnknownFields; 433 | if (u !== false) 434 | (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); 435 | return writer; 436 | } 437 | } 438 | /** 439 | * @generated MessageType for protobuf message google.protobuf.UInt64Value 440 | */ 441 | export const UInt64Value = new UInt64Value$Type(); 442 | // @generated message type with reflection information, may provide speed optimized methods 443 | class Int32Value$Type extends MessageType { 444 | constructor() { 445 | super("google.protobuf.Int32Value", [ 446 | { no: 1, name: "value", kind: "scalar", T: 5 /*ScalarType.INT32*/ } 447 | ]); 448 | } 449 | /** 450 | * Encode `Int32Value` to JSON string. 451 | */ 452 | internalJsonWrite(message: Int32Value, options: JsonWriteOptions): JsonValue { 453 | return this.refJsonWriter.scalar(5, message.value, "value", false, true); 454 | } 455 | /** 456 | * Decode `Int32Value` from JSON string. 457 | */ 458 | internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Int32Value): Int32Value { 459 | if (!target) 460 | target = this.create(); 461 | target.value = this.refJsonReader.scalar(json, 5, undefined, "value") as number; 462 | return target; 463 | } 464 | create(value?: PartialMessage): Int32Value { 465 | const message = globalThis.Object.create((this.messagePrototype!)); 466 | message.value = 0; 467 | if (value !== undefined) 468 | reflectionMergePartial(this, message, value); 469 | return message; 470 | } 471 | internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Int32Value): Int32Value { 472 | let message = target ?? this.create(), end = reader.pos + length; 473 | while (reader.pos < end) { 474 | let [fieldNo, wireType] = reader.tag(); 475 | switch (fieldNo) { 476 | case /* int32 value */ 1: 477 | message.value = reader.int32(); 478 | break; 479 | default: 480 | let u = options.readUnknownField; 481 | if (u === "throw") 482 | throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); 483 | let d = reader.skip(wireType); 484 | if (u !== false) 485 | (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); 486 | } 487 | } 488 | return message; 489 | } 490 | internalBinaryWrite(message: Int32Value, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { 491 | /* int32 value = 1; */ 492 | if (message.value !== 0) 493 | writer.tag(1, WireType.Varint).int32(message.value); 494 | let u = options.writeUnknownFields; 495 | if (u !== false) 496 | (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); 497 | return writer; 498 | } 499 | } 500 | /** 501 | * @generated MessageType for protobuf message google.protobuf.Int32Value 502 | */ 503 | export const Int32Value = new Int32Value$Type(); 504 | // @generated message type with reflection information, may provide speed optimized methods 505 | class UInt32Value$Type extends MessageType { 506 | constructor() { 507 | super("google.protobuf.UInt32Value", [ 508 | { no: 1, name: "value", kind: "scalar", T: 13 /*ScalarType.UINT32*/ } 509 | ]); 510 | } 511 | /** 512 | * Encode `UInt32Value` to JSON string. 513 | */ 514 | internalJsonWrite(message: UInt32Value, options: JsonWriteOptions): JsonValue { 515 | return this.refJsonWriter.scalar(13, message.value, "value", false, true); 516 | } 517 | /** 518 | * Decode `UInt32Value` from JSON string. 519 | */ 520 | internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: UInt32Value): UInt32Value { 521 | if (!target) 522 | target = this.create(); 523 | target.value = this.refJsonReader.scalar(json, 13, undefined, "value") as number; 524 | return target; 525 | } 526 | create(value?: PartialMessage): UInt32Value { 527 | const message = globalThis.Object.create((this.messagePrototype!)); 528 | message.value = 0; 529 | if (value !== undefined) 530 | reflectionMergePartial(this, message, value); 531 | return message; 532 | } 533 | internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: UInt32Value): UInt32Value { 534 | let message = target ?? this.create(), end = reader.pos + length; 535 | while (reader.pos < end) { 536 | let [fieldNo, wireType] = reader.tag(); 537 | switch (fieldNo) { 538 | case /* uint32 value */ 1: 539 | message.value = reader.uint32(); 540 | break; 541 | default: 542 | let u = options.readUnknownField; 543 | if (u === "throw") 544 | throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); 545 | let d = reader.skip(wireType); 546 | if (u !== false) 547 | (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); 548 | } 549 | } 550 | return message; 551 | } 552 | internalBinaryWrite(message: UInt32Value, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { 553 | /* uint32 value = 1; */ 554 | if (message.value !== 0) 555 | writer.tag(1, WireType.Varint).uint32(message.value); 556 | let u = options.writeUnknownFields; 557 | if (u !== false) 558 | (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); 559 | return writer; 560 | } 561 | } 562 | /** 563 | * @generated MessageType for protobuf message google.protobuf.UInt32Value 564 | */ 565 | export const UInt32Value = new UInt32Value$Type(); 566 | // @generated message type with reflection information, may provide speed optimized methods 567 | class BoolValue$Type extends MessageType { 568 | constructor() { 569 | super("google.protobuf.BoolValue", [ 570 | { no: 1, name: "value", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } 571 | ]); 572 | } 573 | /** 574 | * Encode `BoolValue` to JSON bool. 575 | */ 576 | internalJsonWrite(message: BoolValue, options: JsonWriteOptions): JsonValue { 577 | return message.value; 578 | } 579 | /** 580 | * Decode `BoolValue` from JSON bool. 581 | */ 582 | internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: BoolValue): BoolValue { 583 | if (!target) 584 | target = this.create(); 585 | target.value = this.refJsonReader.scalar(json, 8, undefined, "value") as boolean; 586 | return target; 587 | } 588 | create(value?: PartialMessage): BoolValue { 589 | const message = globalThis.Object.create((this.messagePrototype!)); 590 | message.value = false; 591 | if (value !== undefined) 592 | reflectionMergePartial(this, message, value); 593 | return message; 594 | } 595 | internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: BoolValue): BoolValue { 596 | let message = target ?? this.create(), end = reader.pos + length; 597 | while (reader.pos < end) { 598 | let [fieldNo, wireType] = reader.tag(); 599 | switch (fieldNo) { 600 | case /* bool value */ 1: 601 | message.value = reader.bool(); 602 | break; 603 | default: 604 | let u = options.readUnknownField; 605 | if (u === "throw") 606 | throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); 607 | let d = reader.skip(wireType); 608 | if (u !== false) 609 | (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); 610 | } 611 | } 612 | return message; 613 | } 614 | internalBinaryWrite(message: BoolValue, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { 615 | /* bool value = 1; */ 616 | if (message.value !== false) 617 | writer.tag(1, WireType.Varint).bool(message.value); 618 | let u = options.writeUnknownFields; 619 | if (u !== false) 620 | (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); 621 | return writer; 622 | } 623 | } 624 | /** 625 | * @generated MessageType for protobuf message google.protobuf.BoolValue 626 | */ 627 | export const BoolValue = new BoolValue$Type(); 628 | // @generated message type with reflection information, may provide speed optimized methods 629 | class StringValue$Type extends MessageType { 630 | constructor() { 631 | super("google.protobuf.StringValue", [ 632 | { no: 1, name: "value", kind: "scalar", T: 9 /*ScalarType.STRING*/ } 633 | ]); 634 | } 635 | /** 636 | * Encode `StringValue` to JSON string. 637 | */ 638 | internalJsonWrite(message: StringValue, options: JsonWriteOptions): JsonValue { 639 | return message.value; 640 | } 641 | /** 642 | * Decode `StringValue` from JSON string. 643 | */ 644 | internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: StringValue): StringValue { 645 | if (!target) 646 | target = this.create(); 647 | target.value = this.refJsonReader.scalar(json, 9, undefined, "value") as string; 648 | return target; 649 | } 650 | create(value?: PartialMessage): StringValue { 651 | const message = globalThis.Object.create((this.messagePrototype!)); 652 | message.value = ""; 653 | if (value !== undefined) 654 | reflectionMergePartial(this, message, value); 655 | return message; 656 | } 657 | internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: StringValue): StringValue { 658 | let message = target ?? this.create(), end = reader.pos + length; 659 | while (reader.pos < end) { 660 | let [fieldNo, wireType] = reader.tag(); 661 | switch (fieldNo) { 662 | case /* string value */ 1: 663 | message.value = reader.string(); 664 | break; 665 | default: 666 | let u = options.readUnknownField; 667 | if (u === "throw") 668 | throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); 669 | let d = reader.skip(wireType); 670 | if (u !== false) 671 | (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); 672 | } 673 | } 674 | return message; 675 | } 676 | internalBinaryWrite(message: StringValue, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { 677 | /* string value = 1; */ 678 | if (message.value !== "") 679 | writer.tag(1, WireType.LengthDelimited).string(message.value); 680 | let u = options.writeUnknownFields; 681 | if (u !== false) 682 | (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); 683 | return writer; 684 | } 685 | } 686 | /** 687 | * @generated MessageType for protobuf message google.protobuf.StringValue 688 | */ 689 | export const StringValue = new StringValue$Type(); 690 | // @generated message type with reflection information, may provide speed optimized methods 691 | class BytesValue$Type extends MessageType { 692 | constructor() { 693 | super("google.protobuf.BytesValue", [ 694 | { no: 1, name: "value", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } 695 | ]); 696 | } 697 | /** 698 | * Encode `BytesValue` to JSON string. 699 | */ 700 | internalJsonWrite(message: BytesValue, options: JsonWriteOptions): JsonValue { 701 | return this.refJsonWriter.scalar(12, message.value, "value", false, true); 702 | } 703 | /** 704 | * Decode `BytesValue` from JSON string. 705 | */ 706 | internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: BytesValue): BytesValue { 707 | if (!target) 708 | target = this.create(); 709 | target.value = this.refJsonReader.scalar(json, 12, undefined, "value") as Uint8Array; 710 | return target; 711 | } 712 | create(value?: PartialMessage): BytesValue { 713 | const message = globalThis.Object.create((this.messagePrototype!)); 714 | message.value = new Uint8Array(0); 715 | if (value !== undefined) 716 | reflectionMergePartial(this, message, value); 717 | return message; 718 | } 719 | internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: BytesValue): BytesValue { 720 | let message = target ?? this.create(), end = reader.pos + length; 721 | while (reader.pos < end) { 722 | let [fieldNo, wireType] = reader.tag(); 723 | switch (fieldNo) { 724 | case /* bytes value */ 1: 725 | message.value = reader.bytes(); 726 | break; 727 | default: 728 | let u = options.readUnknownField; 729 | if (u === "throw") 730 | throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); 731 | let d = reader.skip(wireType); 732 | if (u !== false) 733 | (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); 734 | } 735 | } 736 | return message; 737 | } 738 | internalBinaryWrite(message: BytesValue, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { 739 | /* bytes value = 1; */ 740 | if (message.value.length) 741 | writer.tag(1, WireType.LengthDelimited).bytes(message.value); 742 | let u = options.writeUnknownFields; 743 | if (u !== false) 744 | (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); 745 | return writer; 746 | } 747 | } 748 | /** 749 | * @generated MessageType for protobuf message google.protobuf.BytesValue 750 | */ 751 | export const BytesValue = new BytesValue$Type(); 752 | -------------------------------------------------------------------------------- /src/discord_protos/premium_marketing/v1/PremiumMarketingComponentProperties.ts: -------------------------------------------------------------------------------- 1 | // @generated by protobuf-ts 2.11.1 2 | // @generated from protobuf file "premium_marketing/v1/PremiumMarketingComponentProperties.proto" (package "discord_protos.premium_marketing.v1", syntax proto3) 3 | // tslint:disable 4 | import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; 5 | import type { IBinaryWriter } from "@protobuf-ts/runtime"; 6 | import { WireType } from "@protobuf-ts/runtime"; 7 | import type { BinaryReadOptions } from "@protobuf-ts/runtime"; 8 | import type { IBinaryReader } from "@protobuf-ts/runtime"; 9 | import { UnknownFieldHandler } from "@protobuf-ts/runtime"; 10 | import type { PartialMessage } from "@protobuf-ts/runtime"; 11 | import { reflectionMergePartial } from "@protobuf-ts/runtime"; 12 | import { MessageType } from "@protobuf-ts/runtime"; 13 | /** 14 | * @generated from protobuf message discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties 15 | */ 16 | export interface PremiumMarketingComponentProperties { 17 | /** 18 | * @generated from protobuf field: string content_identifier = 3 19 | */ 20 | contentIdentifier: string; 21 | /** 22 | * @generated from protobuf oneof: properties 23 | */ 24 | properties: { 25 | oneofKind: "placeholder"; 26 | /** 27 | * @generated from protobuf field: string placeholder = 1 28 | */ 29 | placeholder: string; 30 | } | { 31 | oneofKind: "announcementModalVariant1"; 32 | /** 33 | * @generated from protobuf field: discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.AnnouncementModalVariant1Properties announcement_modal_variant_1 = 2 34 | */ 35 | announcementModalVariant1: PremiumMarketingComponentProperties_AnnouncementModalVariant1Properties; 36 | } | { 37 | oneofKind: undefined; 38 | }; 39 | } 40 | /** 41 | * @generated from protobuf message discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.FeatureCard 42 | */ 43 | export interface PremiumMarketingComponentProperties_FeatureCard { 44 | /** 45 | * @generated from protobuf field: string header = 1 46 | */ 47 | header: string; 48 | /** 49 | * @generated from protobuf field: string pill = 2 50 | */ 51 | pill: string; 52 | /** 53 | * @generated from protobuf field: string body = 3 54 | */ 55 | body: string; 56 | /** 57 | * @generated from protobuf field: string image_link = 4 58 | */ 59 | imageLink: string; 60 | /** 61 | * @generated from protobuf field: string image_link_light_theme = 5 62 | */ 63 | imageLinkLightTheme: string; 64 | } 65 | /** 66 | * @generated from protobuf message discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.SubscriptionButton 67 | */ 68 | export interface PremiumMarketingComponentProperties_SubscriptionButton { 69 | /** 70 | * @generated from protobuf field: string copy = 1 71 | */ 72 | copy: string; 73 | /** 74 | * @generated from protobuf field: discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.ButtonAction button_action = 2 75 | */ 76 | buttonAction: PremiumMarketingComponentProperties_ButtonAction; 77 | } 78 | /** 79 | * @generated from protobuf message discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.Subtitle 80 | */ 81 | export interface PremiumMarketingComponentProperties_Subtitle { 82 | /** 83 | * @generated from protobuf field: string link = 1 84 | */ 85 | link: string; 86 | /** 87 | * @generated from protobuf field: string locale = 2 88 | */ 89 | locale: string; 90 | /** 91 | * @generated from protobuf field: bool is_default = 3 92 | */ 93 | isDefault: boolean; 94 | } 95 | /** 96 | * @generated from protobuf message discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.Variant1Storage 97 | */ 98 | export interface PremiumMarketingComponentProperties_Variant1Storage { 99 | /** 100 | * @generated from protobuf field: map hero_art_localized_video_links_dark_theme = 1 101 | */ 102 | heroArtLocalizedVideoLinksDarkTheme: { 103 | [key: string]: string; 104 | }; 105 | /** 106 | * @generated from protobuf field: map hero_art_localized_video_links_light_theme = 2 107 | */ 108 | heroArtLocalizedVideoLinksLightTheme: { 109 | [key: string]: string; 110 | }; 111 | /** 112 | * @generated from protobuf field: map hero_art_video_subtitle_links = 3 113 | */ 114 | heroArtVideoSubtitleLinks: { 115 | [key: string]: string; 116 | }; 117 | } 118 | /** 119 | * @generated from protobuf message discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.AnnouncementModalVariant1Properties 120 | */ 121 | export interface PremiumMarketingComponentProperties_AnnouncementModalVariant1Properties { 122 | /** 123 | * @generated from protobuf field: string header = 1 124 | */ 125 | header: string; 126 | /** 127 | * @generated from protobuf field: string subheader = 2 128 | */ 129 | subheader: string; 130 | /** 131 | * @generated from protobuf field: string video_link = 3 132 | */ 133 | videoLink: string; 134 | /** 135 | * @generated from protobuf field: string help_article_id = 4 136 | */ 137 | helpArticleId: string; 138 | /** 139 | * @generated from protobuf field: repeated discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.FeatureCard feature_cards = 5 140 | */ 141 | featureCards: PremiumMarketingComponentProperties_FeatureCard[]; 142 | /** 143 | * @generated from protobuf field: optional discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.SubscriptionButton button = 6 144 | */ 145 | button?: PremiumMarketingComponentProperties_SubscriptionButton; 146 | /** 147 | * @generated from protobuf field: string dismiss_key = 7 148 | */ 149 | dismissKey: string; 150 | /** 151 | * @generated from protobuf field: string hero_art_video_link_light_theme = 8 152 | */ 153 | heroArtVideoLinkLightTheme: string; 154 | /** 155 | * @generated from protobuf field: string hero_art_image_link_dark_theme = 9 156 | */ 157 | heroArtImageLinkDarkTheme: string; 158 | /** 159 | * @generated from protobuf field: string hero_art_image_link_light_theme = 10 160 | */ 161 | heroArtImageLinkLightTheme: string; 162 | /** 163 | * @generated from protobuf field: string modal_top_pill = 11 164 | */ 165 | modalTopPill: string; 166 | /** 167 | * @generated from protobuf field: string body = 12 168 | */ 169 | body: string; 170 | /** 171 | * @generated from protobuf field: repeated discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.Subtitle hero_art_video_subtitles = 13 172 | */ 173 | heroArtVideoSubtitles: PremiumMarketingComponentProperties_Subtitle[]; 174 | /** 175 | * @generated from protobuf field: optional discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.Variant1Storage storage = 14 176 | */ 177 | storage?: PremiumMarketingComponentProperties_Variant1Storage; 178 | } 179 | /** 180 | * @generated from protobuf enum discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.ButtonAction 181 | */ 182 | export enum PremiumMarketingComponentProperties_ButtonAction { 183 | /** 184 | * @generated from protobuf enum value: BUTTON_ACTION_UNSPECIFIED = 0; 185 | */ 186 | UNSPECIFIED = 0, 187 | /** 188 | * @generated from protobuf enum value: BUTTON_ACTION_OPEN_MARKETING_PAGE = 1; 189 | */ 190 | OPEN_MARKETING_PAGE = 1, 191 | /** 192 | * @generated from protobuf enum value: BUTTON_ACTION_OPEN_TIER_2_PAYMENT_MODAL = 2; 193 | */ 194 | OPEN_TIER_2_PAYMENT_MODAL = 2, 195 | /** 196 | * @generated from protobuf enum value: BUTTON_ACTION_OPEN_TIER_1_PAYMENT_MODAL = 3; 197 | */ 198 | OPEN_TIER_1_PAYMENT_MODAL = 3, 199 | /** 200 | * @generated from protobuf enum value: BUTTON_ACTION_OPEN_TIER_2_PAYMENT_MODAL_CUSTOM_CONFIRMATION_FOOTER = 4; 201 | */ 202 | OPEN_TIER_2_PAYMENT_MODAL_CUSTOM_CONFIRMATION_FOOTER = 4 203 | } 204 | // @generated message type with reflection information, may provide speed optimized methods 205 | class PremiumMarketingComponentProperties$Type extends MessageType { 206 | constructor() { 207 | super("discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties", [ 208 | { no: 3, name: "content_identifier", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, 209 | { no: 1, name: "placeholder", kind: "scalar", oneof: "properties", T: 9 /*ScalarType.STRING*/ }, 210 | { no: 2, name: "announcement_modal_variant_1", kind: "message", oneof: "properties", T: () => PremiumMarketingComponentProperties_AnnouncementModalVariant1Properties } 211 | ]); 212 | } 213 | create(value?: PartialMessage): PremiumMarketingComponentProperties { 214 | const message = globalThis.Object.create((this.messagePrototype!)); 215 | message.contentIdentifier = ""; 216 | message.properties = { oneofKind: undefined }; 217 | if (value !== undefined) 218 | reflectionMergePartial(this, message, value); 219 | return message; 220 | } 221 | internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: PremiumMarketingComponentProperties): PremiumMarketingComponentProperties { 222 | let message = target ?? this.create(), end = reader.pos + length; 223 | while (reader.pos < end) { 224 | let [fieldNo, wireType] = reader.tag(); 225 | switch (fieldNo) { 226 | case /* string content_identifier */ 3: 227 | message.contentIdentifier = reader.string(); 228 | break; 229 | case /* string placeholder */ 1: 230 | message.properties = { 231 | oneofKind: "placeholder", 232 | placeholder: reader.string() 233 | }; 234 | break; 235 | case /* discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.AnnouncementModalVariant1Properties announcement_modal_variant_1 */ 2: 236 | message.properties = { 237 | oneofKind: "announcementModalVariant1", 238 | announcementModalVariant1: PremiumMarketingComponentProperties_AnnouncementModalVariant1Properties.internalBinaryRead(reader, reader.uint32(), options, (message.properties as any).announcementModalVariant1) 239 | }; 240 | break; 241 | default: 242 | let u = options.readUnknownField; 243 | if (u === "throw") 244 | throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); 245 | let d = reader.skip(wireType); 246 | if (u !== false) 247 | (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); 248 | } 249 | } 250 | return message; 251 | } 252 | internalBinaryWrite(message: PremiumMarketingComponentProperties, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { 253 | /* string placeholder = 1; */ 254 | if (message.properties.oneofKind === "placeholder") 255 | writer.tag(1, WireType.LengthDelimited).string(message.properties.placeholder); 256 | /* discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.AnnouncementModalVariant1Properties announcement_modal_variant_1 = 2; */ 257 | if (message.properties.oneofKind === "announcementModalVariant1") 258 | PremiumMarketingComponentProperties_AnnouncementModalVariant1Properties.internalBinaryWrite(message.properties.announcementModalVariant1, writer.tag(2, WireType.LengthDelimited).fork(), options).join(); 259 | /* string content_identifier = 3; */ 260 | if (message.contentIdentifier !== "") 261 | writer.tag(3, WireType.LengthDelimited).string(message.contentIdentifier); 262 | let u = options.writeUnknownFields; 263 | if (u !== false) 264 | (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); 265 | return writer; 266 | } 267 | } 268 | /** 269 | * @generated MessageType for protobuf message discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties 270 | */ 271 | export const PremiumMarketingComponentProperties = new PremiumMarketingComponentProperties$Type(); 272 | // @generated message type with reflection information, may provide speed optimized methods 273 | class PremiumMarketingComponentProperties_FeatureCard$Type extends MessageType { 274 | constructor() { 275 | super("discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.FeatureCard", [ 276 | { no: 1, name: "header", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, 277 | { no: 2, name: "pill", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, 278 | { no: 3, name: "body", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, 279 | { no: 4, name: "image_link", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, 280 | { no: 5, name: "image_link_light_theme", kind: "scalar", T: 9 /*ScalarType.STRING*/ } 281 | ]); 282 | } 283 | create(value?: PartialMessage): PremiumMarketingComponentProperties_FeatureCard { 284 | const message = globalThis.Object.create((this.messagePrototype!)); 285 | message.header = ""; 286 | message.pill = ""; 287 | message.body = ""; 288 | message.imageLink = ""; 289 | message.imageLinkLightTheme = ""; 290 | if (value !== undefined) 291 | reflectionMergePartial(this, message, value); 292 | return message; 293 | } 294 | internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: PremiumMarketingComponentProperties_FeatureCard): PremiumMarketingComponentProperties_FeatureCard { 295 | let message = target ?? this.create(), end = reader.pos + length; 296 | while (reader.pos < end) { 297 | let [fieldNo, wireType] = reader.tag(); 298 | switch (fieldNo) { 299 | case /* string header */ 1: 300 | message.header = reader.string(); 301 | break; 302 | case /* string pill */ 2: 303 | message.pill = reader.string(); 304 | break; 305 | case /* string body */ 3: 306 | message.body = reader.string(); 307 | break; 308 | case /* string image_link */ 4: 309 | message.imageLink = reader.string(); 310 | break; 311 | case /* string image_link_light_theme */ 5: 312 | message.imageLinkLightTheme = reader.string(); 313 | break; 314 | default: 315 | let u = options.readUnknownField; 316 | if (u === "throw") 317 | throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); 318 | let d = reader.skip(wireType); 319 | if (u !== false) 320 | (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); 321 | } 322 | } 323 | return message; 324 | } 325 | internalBinaryWrite(message: PremiumMarketingComponentProperties_FeatureCard, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { 326 | /* string header = 1; */ 327 | if (message.header !== "") 328 | writer.tag(1, WireType.LengthDelimited).string(message.header); 329 | /* string pill = 2; */ 330 | if (message.pill !== "") 331 | writer.tag(2, WireType.LengthDelimited).string(message.pill); 332 | /* string body = 3; */ 333 | if (message.body !== "") 334 | writer.tag(3, WireType.LengthDelimited).string(message.body); 335 | /* string image_link = 4; */ 336 | if (message.imageLink !== "") 337 | writer.tag(4, WireType.LengthDelimited).string(message.imageLink); 338 | /* string image_link_light_theme = 5; */ 339 | if (message.imageLinkLightTheme !== "") 340 | writer.tag(5, WireType.LengthDelimited).string(message.imageLinkLightTheme); 341 | let u = options.writeUnknownFields; 342 | if (u !== false) 343 | (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); 344 | return writer; 345 | } 346 | } 347 | /** 348 | * @generated MessageType for protobuf message discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.FeatureCard 349 | */ 350 | export const PremiumMarketingComponentProperties_FeatureCard = new PremiumMarketingComponentProperties_FeatureCard$Type(); 351 | // @generated message type with reflection information, may provide speed optimized methods 352 | class PremiumMarketingComponentProperties_SubscriptionButton$Type extends MessageType { 353 | constructor() { 354 | super("discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.SubscriptionButton", [ 355 | { no: 1, name: "copy", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, 356 | { no: 2, name: "button_action", kind: "enum", T: () => ["discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.ButtonAction", PremiumMarketingComponentProperties_ButtonAction, "BUTTON_ACTION_"] } 357 | ]); 358 | } 359 | create(value?: PartialMessage): PremiumMarketingComponentProperties_SubscriptionButton { 360 | const message = globalThis.Object.create((this.messagePrototype!)); 361 | message.copy = ""; 362 | message.buttonAction = 0; 363 | if (value !== undefined) 364 | reflectionMergePartial(this, message, value); 365 | return message; 366 | } 367 | internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: PremiumMarketingComponentProperties_SubscriptionButton): PremiumMarketingComponentProperties_SubscriptionButton { 368 | let message = target ?? this.create(), end = reader.pos + length; 369 | while (reader.pos < end) { 370 | let [fieldNo, wireType] = reader.tag(); 371 | switch (fieldNo) { 372 | case /* string copy */ 1: 373 | message.copy = reader.string(); 374 | break; 375 | case /* discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.ButtonAction button_action */ 2: 376 | message.buttonAction = reader.int32(); 377 | break; 378 | default: 379 | let u = options.readUnknownField; 380 | if (u === "throw") 381 | throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); 382 | let d = reader.skip(wireType); 383 | if (u !== false) 384 | (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); 385 | } 386 | } 387 | return message; 388 | } 389 | internalBinaryWrite(message: PremiumMarketingComponentProperties_SubscriptionButton, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { 390 | /* string copy = 1; */ 391 | if (message.copy !== "") 392 | writer.tag(1, WireType.LengthDelimited).string(message.copy); 393 | /* discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.ButtonAction button_action = 2; */ 394 | if (message.buttonAction !== 0) 395 | writer.tag(2, WireType.Varint).int32(message.buttonAction); 396 | let u = options.writeUnknownFields; 397 | if (u !== false) 398 | (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); 399 | return writer; 400 | } 401 | } 402 | /** 403 | * @generated MessageType for protobuf message discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.SubscriptionButton 404 | */ 405 | export const PremiumMarketingComponentProperties_SubscriptionButton = new PremiumMarketingComponentProperties_SubscriptionButton$Type(); 406 | // @generated message type with reflection information, may provide speed optimized methods 407 | class PremiumMarketingComponentProperties_Subtitle$Type extends MessageType { 408 | constructor() { 409 | super("discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.Subtitle", [ 410 | { no: 1, name: "link", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, 411 | { no: 2, name: "locale", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, 412 | { no: 3, name: "is_default", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } 413 | ]); 414 | } 415 | create(value?: PartialMessage): PremiumMarketingComponentProperties_Subtitle { 416 | const message = globalThis.Object.create((this.messagePrototype!)); 417 | message.link = ""; 418 | message.locale = ""; 419 | message.isDefault = false; 420 | if (value !== undefined) 421 | reflectionMergePartial(this, message, value); 422 | return message; 423 | } 424 | internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: PremiumMarketingComponentProperties_Subtitle): PremiumMarketingComponentProperties_Subtitle { 425 | let message = target ?? this.create(), end = reader.pos + length; 426 | while (reader.pos < end) { 427 | let [fieldNo, wireType] = reader.tag(); 428 | switch (fieldNo) { 429 | case /* string link */ 1: 430 | message.link = reader.string(); 431 | break; 432 | case /* string locale */ 2: 433 | message.locale = reader.string(); 434 | break; 435 | case /* bool is_default */ 3: 436 | message.isDefault = reader.bool(); 437 | break; 438 | default: 439 | let u = options.readUnknownField; 440 | if (u === "throw") 441 | throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); 442 | let d = reader.skip(wireType); 443 | if (u !== false) 444 | (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); 445 | } 446 | } 447 | return message; 448 | } 449 | internalBinaryWrite(message: PremiumMarketingComponentProperties_Subtitle, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { 450 | /* string link = 1; */ 451 | if (message.link !== "") 452 | writer.tag(1, WireType.LengthDelimited).string(message.link); 453 | /* string locale = 2; */ 454 | if (message.locale !== "") 455 | writer.tag(2, WireType.LengthDelimited).string(message.locale); 456 | /* bool is_default = 3; */ 457 | if (message.isDefault !== false) 458 | writer.tag(3, WireType.Varint).bool(message.isDefault); 459 | let u = options.writeUnknownFields; 460 | if (u !== false) 461 | (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); 462 | return writer; 463 | } 464 | } 465 | /** 466 | * @generated MessageType for protobuf message discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.Subtitle 467 | */ 468 | export const PremiumMarketingComponentProperties_Subtitle = new PremiumMarketingComponentProperties_Subtitle$Type(); 469 | // @generated message type with reflection information, may provide speed optimized methods 470 | class PremiumMarketingComponentProperties_Variant1Storage$Type extends MessageType { 471 | constructor() { 472 | super("discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.Variant1Storage", [ 473 | { no: 1, name: "hero_art_localized_video_links_dark_theme", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 9 /*ScalarType.STRING*/ } }, 474 | { no: 2, name: "hero_art_localized_video_links_light_theme", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 9 /*ScalarType.STRING*/ } }, 475 | { no: 3, name: "hero_art_video_subtitle_links", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 9 /*ScalarType.STRING*/ } } 476 | ]); 477 | } 478 | create(value?: PartialMessage): PremiumMarketingComponentProperties_Variant1Storage { 479 | const message = globalThis.Object.create((this.messagePrototype!)); 480 | message.heroArtLocalizedVideoLinksDarkTheme = {}; 481 | message.heroArtLocalizedVideoLinksLightTheme = {}; 482 | message.heroArtVideoSubtitleLinks = {}; 483 | if (value !== undefined) 484 | reflectionMergePartial(this, message, value); 485 | return message; 486 | } 487 | internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: PremiumMarketingComponentProperties_Variant1Storage): PremiumMarketingComponentProperties_Variant1Storage { 488 | let message = target ?? this.create(), end = reader.pos + length; 489 | while (reader.pos < end) { 490 | let [fieldNo, wireType] = reader.tag(); 491 | switch (fieldNo) { 492 | case /* map hero_art_localized_video_links_dark_theme */ 1: 493 | this.binaryReadMap1(message.heroArtLocalizedVideoLinksDarkTheme, reader, options); 494 | break; 495 | case /* map hero_art_localized_video_links_light_theme */ 2: 496 | this.binaryReadMap2(message.heroArtLocalizedVideoLinksLightTheme, reader, options); 497 | break; 498 | case /* map hero_art_video_subtitle_links */ 3: 499 | this.binaryReadMap3(message.heroArtVideoSubtitleLinks, reader, options); 500 | break; 501 | default: 502 | let u = options.readUnknownField; 503 | if (u === "throw") 504 | throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); 505 | let d = reader.skip(wireType); 506 | if (u !== false) 507 | (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); 508 | } 509 | } 510 | return message; 511 | } 512 | private binaryReadMap1(map: PremiumMarketingComponentProperties_Variant1Storage["heroArtLocalizedVideoLinksDarkTheme"], reader: IBinaryReader, options: BinaryReadOptions): void { 513 | let len = reader.uint32(), end = reader.pos + len, key: keyof PremiumMarketingComponentProperties_Variant1Storage["heroArtLocalizedVideoLinksDarkTheme"] | undefined, val: PremiumMarketingComponentProperties_Variant1Storage["heroArtLocalizedVideoLinksDarkTheme"][any] | undefined; 514 | while (reader.pos < end) { 515 | let [fieldNo, wireType] = reader.tag(); 516 | switch (fieldNo) { 517 | case 1: 518 | key = reader.string(); 519 | break; 520 | case 2: 521 | val = reader.string(); 522 | break; 523 | default: throw new globalThis.Error("unknown map entry field for discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.Variant1Storage.hero_art_localized_video_links_dark_theme"); 524 | } 525 | } 526 | map[key ?? ""] = val ?? ""; 527 | } 528 | private binaryReadMap2(map: PremiumMarketingComponentProperties_Variant1Storage["heroArtLocalizedVideoLinksLightTheme"], reader: IBinaryReader, options: BinaryReadOptions): void { 529 | let len = reader.uint32(), end = reader.pos + len, key: keyof PremiumMarketingComponentProperties_Variant1Storage["heroArtLocalizedVideoLinksLightTheme"] | undefined, val: PremiumMarketingComponentProperties_Variant1Storage["heroArtLocalizedVideoLinksLightTheme"][any] | undefined; 530 | while (reader.pos < end) { 531 | let [fieldNo, wireType] = reader.tag(); 532 | switch (fieldNo) { 533 | case 1: 534 | key = reader.string(); 535 | break; 536 | case 2: 537 | val = reader.string(); 538 | break; 539 | default: throw new globalThis.Error("unknown map entry field for discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.Variant1Storage.hero_art_localized_video_links_light_theme"); 540 | } 541 | } 542 | map[key ?? ""] = val ?? ""; 543 | } 544 | private binaryReadMap3(map: PremiumMarketingComponentProperties_Variant1Storage["heroArtVideoSubtitleLinks"], reader: IBinaryReader, options: BinaryReadOptions): void { 545 | let len = reader.uint32(), end = reader.pos + len, key: keyof PremiumMarketingComponentProperties_Variant1Storage["heroArtVideoSubtitleLinks"] | undefined, val: PremiumMarketingComponentProperties_Variant1Storage["heroArtVideoSubtitleLinks"][any] | undefined; 546 | while (reader.pos < end) { 547 | let [fieldNo, wireType] = reader.tag(); 548 | switch (fieldNo) { 549 | case 1: 550 | key = reader.string(); 551 | break; 552 | case 2: 553 | val = reader.string(); 554 | break; 555 | default: throw new globalThis.Error("unknown map entry field for discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.Variant1Storage.hero_art_video_subtitle_links"); 556 | } 557 | } 558 | map[key ?? ""] = val ?? ""; 559 | } 560 | internalBinaryWrite(message: PremiumMarketingComponentProperties_Variant1Storage, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { 561 | /* map hero_art_localized_video_links_dark_theme = 1; */ 562 | for (let k of globalThis.Object.keys(message.heroArtLocalizedVideoLinksDarkTheme)) 563 | writer.tag(1, WireType.LengthDelimited).fork().tag(1, WireType.LengthDelimited).string(k).tag(2, WireType.LengthDelimited).string(message.heroArtLocalizedVideoLinksDarkTheme[k]).join(); 564 | /* map hero_art_localized_video_links_light_theme = 2; */ 565 | for (let k of globalThis.Object.keys(message.heroArtLocalizedVideoLinksLightTheme)) 566 | writer.tag(2, WireType.LengthDelimited).fork().tag(1, WireType.LengthDelimited).string(k).tag(2, WireType.LengthDelimited).string(message.heroArtLocalizedVideoLinksLightTheme[k]).join(); 567 | /* map hero_art_video_subtitle_links = 3; */ 568 | for (let k of globalThis.Object.keys(message.heroArtVideoSubtitleLinks)) 569 | writer.tag(3, WireType.LengthDelimited).fork().tag(1, WireType.LengthDelimited).string(k).tag(2, WireType.LengthDelimited).string(message.heroArtVideoSubtitleLinks[k]).join(); 570 | let u = options.writeUnknownFields; 571 | if (u !== false) 572 | (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); 573 | return writer; 574 | } 575 | } 576 | /** 577 | * @generated MessageType for protobuf message discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.Variant1Storage 578 | */ 579 | export const PremiumMarketingComponentProperties_Variant1Storage = new PremiumMarketingComponentProperties_Variant1Storage$Type(); 580 | // @generated message type with reflection information, may provide speed optimized methods 581 | class PremiumMarketingComponentProperties_AnnouncementModalVariant1Properties$Type extends MessageType { 582 | constructor() { 583 | super("discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.AnnouncementModalVariant1Properties", [ 584 | { no: 1, name: "header", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, 585 | { no: 2, name: "subheader", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, 586 | { no: 3, name: "video_link", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, 587 | { no: 4, name: "help_article_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, 588 | { no: 5, name: "feature_cards", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => PremiumMarketingComponentProperties_FeatureCard }, 589 | { no: 6, name: "button", kind: "message", T: () => PremiumMarketingComponentProperties_SubscriptionButton }, 590 | { no: 7, name: "dismiss_key", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, 591 | { no: 8, name: "hero_art_video_link_light_theme", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, 592 | { no: 9, name: "hero_art_image_link_dark_theme", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, 593 | { no: 10, name: "hero_art_image_link_light_theme", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, 594 | { no: 11, name: "modal_top_pill", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, 595 | { no: 12, name: "body", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, 596 | { no: 13, name: "hero_art_video_subtitles", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => PremiumMarketingComponentProperties_Subtitle }, 597 | { no: 14, name: "storage", kind: "message", T: () => PremiumMarketingComponentProperties_Variant1Storage } 598 | ]); 599 | } 600 | create(value?: PartialMessage): PremiumMarketingComponentProperties_AnnouncementModalVariant1Properties { 601 | const message = globalThis.Object.create((this.messagePrototype!)); 602 | message.header = ""; 603 | message.subheader = ""; 604 | message.videoLink = ""; 605 | message.helpArticleId = ""; 606 | message.featureCards = []; 607 | message.dismissKey = ""; 608 | message.heroArtVideoLinkLightTheme = ""; 609 | message.heroArtImageLinkDarkTheme = ""; 610 | message.heroArtImageLinkLightTheme = ""; 611 | message.modalTopPill = ""; 612 | message.body = ""; 613 | message.heroArtVideoSubtitles = []; 614 | if (value !== undefined) 615 | reflectionMergePartial(this, message, value); 616 | return message; 617 | } 618 | internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: PremiumMarketingComponentProperties_AnnouncementModalVariant1Properties): PremiumMarketingComponentProperties_AnnouncementModalVariant1Properties { 619 | let message = target ?? this.create(), end = reader.pos + length; 620 | while (reader.pos < end) { 621 | let [fieldNo, wireType] = reader.tag(); 622 | switch (fieldNo) { 623 | case /* string header */ 1: 624 | message.header = reader.string(); 625 | break; 626 | case /* string subheader */ 2: 627 | message.subheader = reader.string(); 628 | break; 629 | case /* string video_link */ 3: 630 | message.videoLink = reader.string(); 631 | break; 632 | case /* string help_article_id */ 4: 633 | message.helpArticleId = reader.string(); 634 | break; 635 | case /* repeated discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.FeatureCard feature_cards */ 5: 636 | message.featureCards.push(PremiumMarketingComponentProperties_FeatureCard.internalBinaryRead(reader, reader.uint32(), options)); 637 | break; 638 | case /* optional discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.SubscriptionButton button */ 6: 639 | message.button = PremiumMarketingComponentProperties_SubscriptionButton.internalBinaryRead(reader, reader.uint32(), options, message.button); 640 | break; 641 | case /* string dismiss_key */ 7: 642 | message.dismissKey = reader.string(); 643 | break; 644 | case /* string hero_art_video_link_light_theme */ 8: 645 | message.heroArtVideoLinkLightTheme = reader.string(); 646 | break; 647 | case /* string hero_art_image_link_dark_theme */ 9: 648 | message.heroArtImageLinkDarkTheme = reader.string(); 649 | break; 650 | case /* string hero_art_image_link_light_theme */ 10: 651 | message.heroArtImageLinkLightTheme = reader.string(); 652 | break; 653 | case /* string modal_top_pill */ 11: 654 | message.modalTopPill = reader.string(); 655 | break; 656 | case /* string body */ 12: 657 | message.body = reader.string(); 658 | break; 659 | case /* repeated discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.Subtitle hero_art_video_subtitles */ 13: 660 | message.heroArtVideoSubtitles.push(PremiumMarketingComponentProperties_Subtitle.internalBinaryRead(reader, reader.uint32(), options)); 661 | break; 662 | case /* optional discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.Variant1Storage storage */ 14: 663 | message.storage = PremiumMarketingComponentProperties_Variant1Storage.internalBinaryRead(reader, reader.uint32(), options, message.storage); 664 | break; 665 | default: 666 | let u = options.readUnknownField; 667 | if (u === "throw") 668 | throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); 669 | let d = reader.skip(wireType); 670 | if (u !== false) 671 | (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); 672 | } 673 | } 674 | return message; 675 | } 676 | internalBinaryWrite(message: PremiumMarketingComponentProperties_AnnouncementModalVariant1Properties, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { 677 | /* string header = 1; */ 678 | if (message.header !== "") 679 | writer.tag(1, WireType.LengthDelimited).string(message.header); 680 | /* string subheader = 2; */ 681 | if (message.subheader !== "") 682 | writer.tag(2, WireType.LengthDelimited).string(message.subheader); 683 | /* string video_link = 3; */ 684 | if (message.videoLink !== "") 685 | writer.tag(3, WireType.LengthDelimited).string(message.videoLink); 686 | /* string help_article_id = 4; */ 687 | if (message.helpArticleId !== "") 688 | writer.tag(4, WireType.LengthDelimited).string(message.helpArticleId); 689 | /* repeated discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.FeatureCard feature_cards = 5; */ 690 | for (let i = 0; i < message.featureCards.length; i++) 691 | PremiumMarketingComponentProperties_FeatureCard.internalBinaryWrite(message.featureCards[i], writer.tag(5, WireType.LengthDelimited).fork(), options).join(); 692 | /* optional discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.SubscriptionButton button = 6; */ 693 | if (message.button) 694 | PremiumMarketingComponentProperties_SubscriptionButton.internalBinaryWrite(message.button, writer.tag(6, WireType.LengthDelimited).fork(), options).join(); 695 | /* string dismiss_key = 7; */ 696 | if (message.dismissKey !== "") 697 | writer.tag(7, WireType.LengthDelimited).string(message.dismissKey); 698 | /* string hero_art_video_link_light_theme = 8; */ 699 | if (message.heroArtVideoLinkLightTheme !== "") 700 | writer.tag(8, WireType.LengthDelimited).string(message.heroArtVideoLinkLightTheme); 701 | /* string hero_art_image_link_dark_theme = 9; */ 702 | if (message.heroArtImageLinkDarkTheme !== "") 703 | writer.tag(9, WireType.LengthDelimited).string(message.heroArtImageLinkDarkTheme); 704 | /* string hero_art_image_link_light_theme = 10; */ 705 | if (message.heroArtImageLinkLightTheme !== "") 706 | writer.tag(10, WireType.LengthDelimited).string(message.heroArtImageLinkLightTheme); 707 | /* string modal_top_pill = 11; */ 708 | if (message.modalTopPill !== "") 709 | writer.tag(11, WireType.LengthDelimited).string(message.modalTopPill); 710 | /* string body = 12; */ 711 | if (message.body !== "") 712 | writer.tag(12, WireType.LengthDelimited).string(message.body); 713 | /* repeated discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.Subtitle hero_art_video_subtitles = 13; */ 714 | for (let i = 0; i < message.heroArtVideoSubtitles.length; i++) 715 | PremiumMarketingComponentProperties_Subtitle.internalBinaryWrite(message.heroArtVideoSubtitles[i], writer.tag(13, WireType.LengthDelimited).fork(), options).join(); 716 | /* optional discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.Variant1Storage storage = 14; */ 717 | if (message.storage) 718 | PremiumMarketingComponentProperties_Variant1Storage.internalBinaryWrite(message.storage, writer.tag(14, WireType.LengthDelimited).fork(), options).join(); 719 | let u = options.writeUnknownFields; 720 | if (u !== false) 721 | (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); 722 | return writer; 723 | } 724 | } 725 | /** 726 | * @generated MessageType for protobuf message discord_protos.premium_marketing.v1.PremiumMarketingComponentProperties.AnnouncementModalVariant1Properties 727 | */ 728 | export const PremiumMarketingComponentProperties_AnnouncementModalVariant1Properties = new PremiumMarketingComponentProperties_AnnouncementModalVariant1Properties$Type(); 729 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import { MessageType } from "@protobuf-ts/runtime"; 2 | 3 | /** 4 | * Supports both node and web environments, replacement of previous Buffer.from() being node-only. 5 | * This is specific to this package's usage, and not a replacement of Buffer.from() altogether 6 | */ 7 | const compatBuffer = { 8 | from: function (input: string | Uint8Array, encoding?: string) { 9 | if (typeof input === "string" && encoding === "base64") { 10 | const encodedBytes = atob(input); 11 | const bytes = new Uint8Array(encodedBytes.length); 12 | for (let i = 0; i < encodedBytes.length; i++) { 13 | bytes[i] = encodedBytes.charCodeAt(i); 14 | } 15 | return bytes; 16 | } else if (!encoding && input instanceof Uint8Array) { 17 | return input; 18 | } 19 | throw new Error("Invalid input type."); 20 | }, 21 | toBase64String: function (buffer: Uint8Array) { 22 | let encodedBytes = ""; 23 | for (let i = 0; i < buffer.length; i++) { 24 | encodedBytes += String.fromCharCode(buffer[i]); 25 | } 26 | return btoa(encodedBytes); 27 | }, 28 | }; 29 | 30 | function toBase64(this: MessageType, data) { 31 | return compatBuffer.toBase64String(compatBuffer.from(this.toBinary(data))); 32 | } 33 | 34 | function fromBase64(this: MessageType, base64: string) { 35 | return this.fromBinary(compatBuffer.from(base64, "base64")); 36 | } 37 | 38 | declare module "@protobuf-ts/runtime" { 39 | interface MessageType { 40 | toBase64(data: T): string; 41 | fromBase64(base64: string): T; 42 | } 43 | } 44 | 45 | MessageType.prototype.fromBase64 = fromBase64; 46 | MessageType.prototype.toBase64 = toBase64; 47 | 48 | export * from "./discord_protos/discord_users/v1/PreloadedUserSettings"; 49 | export * from "./discord_protos/discord_users/v1/FrecencyUserSettings"; 50 | export * from "./discord_protos/discord_kkv_store_value_models/v1/ApplicationUserRoleConnection"; 51 | export * from "./discord_protos/discord_kkv_store_value_models/v1/AcknowledgedApplicationDisclosures"; 52 | export * from "./discord_protos/discord_experimentation/v1/Experiment"; 53 | export * from "./discord_protos/premium_marketing/v1/PremiumMarketingComponentProperties"; 54 | -------------------------------------------------------------------------------- /src/load.ts: -------------------------------------------------------------------------------- 1 | import puppeteer from "puppeteer"; 2 | import { writeFileSync, readFileSync, mkdirSync, existsSync, readdirSync, rmSync } from "fs"; 3 | import { join } from "path"; 4 | import { execSync } from "child_process"; 5 | 6 | // For the JS template, all we need to do is update the exports at the bottom 7 | const JS_TEMPLATE = `import { MessageType } from "@protobuf-ts/runtime"; 8 | 9 | /** 10 | * Supports both node and web environments, replacement of previous Buffer.from() being node-only. 11 | * This is specific to this package's usage, and not a replacement of Buffer.from() altogether 12 | */ 13 | const compatBuffer = { 14 | from: function (input: string | Uint8Array, encoding?: string) { 15 | if (typeof input === "string" && encoding === "base64") { 16 | const encodedBytes = atob(input); 17 | const bytes = new Uint8Array(encodedBytes.length); 18 | for (let i = 0; i < encodedBytes.length; i++) { 19 | bytes[i] = encodedBytes.charCodeAt(i); 20 | } 21 | return bytes; 22 | } else if (!encoding && input instanceof Uint8Array) { 23 | return input; 24 | } 25 | throw new Error("Invalid input type."); 26 | }, 27 | toBase64String: function (buffer: Uint8Array) { 28 | let encodedBytes = ""; 29 | for (let i = 0; i < buffer.length; i++) { 30 | encodedBytes += String.fromCharCode(buffer[i]); 31 | } 32 | return btoa(encodedBytes); 33 | }, 34 | }; 35 | 36 | function toBase64(this: MessageType, data) { 37 | return compatBuffer.toBase64String(compatBuffer.from(this.toBinary(data))); 38 | } 39 | 40 | function fromBase64(this: MessageType, base64: string) { 41 | return this.fromBinary(compatBuffer.from(base64, "base64")); 42 | } 43 | 44 | declare module "@protobuf-ts/runtime" { 45 | interface MessageType { 46 | toBase64(data: T): string; 47 | fromBase64(base64: string): T; 48 | } 49 | } 50 | 51 | MessageType.prototype.fromBase64 = fromBase64; 52 | MessageType.prototype.toBase64 = toBase64; 53 | 54 | {{ protos_exports }} 55 | `; 56 | 57 | // For the Python template, we need to update both imports and the __all__ variable, as well as bump the version number 58 | const PY_TEMPLATE = `from __future__ import annotations 59 | 60 | from enum import Enum as _Enum 61 | from typing import TYPE_CHECKING 62 | 63 | __version__ = '{{ version }}' 64 | 65 | if TYPE_CHECKING: 66 | from google.protobuf.message import Message as _Message 67 | 68 | {{ protos_equals }} = _Message 69 | else: 70 | {{ protos_imports }} 71 | 72 | __all__ = ( 73 | '__version__', 74 | 'UserSettingsType', 75 | {{ exports }} 76 | ) 77 | 78 | 79 | class UserSettingsType(_Enum): 80 | preloaded_user_settings = 1 81 | frecency_user_settings = 2 82 | test_settings = 3 83 | 84 | 85 | UserSettingsImpl = { 86 | UserSettingsType.preloaded_user_settings: PreloadedUserSettings, 87 | UserSettingsType.frecency_user_settings: FrecencyUserSettings, 88 | UserSettingsType.test_settings: None, 89 | } 90 | `; 91 | 92 | // This must be run early 93 | const PRELOAD_SCRIPT = readFileSync(join(__dirname, "..", "scripts", "preload.js"), "utf8"); 94 | const PARSE_SCRIPT = readFileSync(join(__dirname, "..", "scripts", "parse.js"), "utf8"); 95 | 96 | interface Proto { 97 | package: string; 98 | data: string; 99 | } 100 | 101 | async function main() { 102 | const browser = await puppeteer.launch(); 103 | 104 | const page = await browser.newPage(); 105 | page.on("console", (msg) => console.debug(msg.text())); 106 | 107 | // Preload script grabs the objects 108 | await page.evaluateOnNewDocument(PRELOAD_SCRIPT); 109 | await page.goto("https://canary.discord.com/app", { waitUntil: "networkidle0" }); 110 | 111 | const protos = await page.evaluate(`${PARSE_SCRIPT}; protos`) as unknown as Record; 112 | await browser.close(); 113 | 114 | // Delete all existing files and folders in the discord_protos directory 115 | const outputs = [join(__dirname, "..", "discord_protos"), join(__dirname, "..", "src", "discord_protos")]; 116 | for (const output of outputs) { 117 | if (existsSync(output)) { 118 | for (const file of readdirSync(output)) { 119 | try { 120 | if (readdirSync(join(output, file)).length > 0) { 121 | rmSync(join(output, file), { recursive: true, force: true }); 122 | } 123 | } catch {} 124 | } 125 | } 126 | } 127 | 128 | // Write the protos to disk 129 | const filenames: string[] = []; 130 | for (const [name, proto] of Object.entries(protos)) { 131 | const dir = join(__dirname, "..", ...proto.package.split(".")); 132 | const filename = join(dir, `${name}.proto`); 133 | filenames.push(filename.replace(join(__dirname, ".."), ".").replaceAll("\\", "/")); 134 | 135 | // Ensure the directory exists 136 | if (!existsSync(dir)) { 137 | mkdirSync(dir, { recursive: true }); 138 | } 139 | writeFileSync(filename, proto.data); 140 | } 141 | 142 | // Check if we have any changes using git 143 | const changes = execSync("git status --porcelain").toString().trim(); 144 | if (!changes.includes(".proto")) { 145 | console.log("No changes detected, exiting..."); 146 | return; 147 | } 148 | 149 | const packageJson = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf8")); 150 | 151 | // Bump the version number 152 | const version = packageJson.version.split(".").map((x: string) => parseInt(x)).map((x: number, i: number) => i === 2 ? x + 1 : x).join("."); 153 | packageJson.version = version; 154 | 155 | // This is very cursed 156 | // For protoc to parse any new protos, we have to edit the script in the package.json to include the filenames 157 | const js = packageJson.scripts.js.split(" ").filter((x) => !x.endsWith(".proto")).join(" "); 158 | const py = packageJson.scripts.py.split(" ").filter((x) => !x.endsWith(".proto")).join(" "); 159 | packageJson.scripts.js = `${js} ${filenames.join(" ")}`; 160 | packageJson.scripts.py = `${py} ${filenames.join(" ")}`; 161 | writeFileSync(join(__dirname, "..", "package.json"), JSON.stringify(packageJson, null, 4)); 162 | 163 | // Update the JS template 164 | const jsExports = filenames.map((x) => `export * from "${x.replaceAll("\\", "/").replace(".proto", "")}";`).join("\n"); 165 | writeFileSync(join(__dirname, "..", "src", "index.ts"), JS_TEMPLATE.replace("{{ protos_exports }}", jsExports)); 166 | 167 | // Update the Python template 168 | const pyExports = Object.keys(protos).map((x) => ` '${x}',`).join("\n"); 169 | const pyImports = filenames.map((x) => ` from ${x.replaceAll("\\", "/").replace("./discord_protos", "").replaceAll("/", ".").replace(".proto", "_pb2")} import *`).join("\n"); 170 | const pyEquals = Object.keys(protos).join(" = "); 171 | writeFileSync( 172 | join(__dirname, "..", "discord_protos", "__init__.py"), 173 | PY_TEMPLATE.replace("{{ version }}", version).replace("{{ exports }}", pyExports).replace("{{ protos_imports }}", pyImports).replace("{{ protos_equals }}", pyEquals) 174 | ); 175 | } 176 | 177 | main(); 178 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "module": "commonjs", 5 | "allowJs": true, 6 | "declaration": true, 7 | "strictNullChecks": true, 8 | "outDir": "./dist", 9 | "rootDir": "./src" 10 | }, 11 | "include": ["src/*.ts", "src/*/*.ts"], 12 | } 13 | --------------------------------------------------------------------------------