docker fixes & libsodium patch

This commit is contained in:
Matthieu 2021-09-08 19:24:58 +04:00
parent 125c0b5dc0
commit cc498ba549
152 changed files with 3470 additions and 3115 deletions

View file

@ -1,2 +1,2 @@
startup --windows_enable_symlinks
startup --windows_enable_symlinks
build --enable_runfiles

View file

@ -1,69 +1,70 @@
# This is a basic workflow to help you get started with Actions
name: Build
# Controls when the workflow will run
on:
push:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: docker-practice/actions-setup-docker@master
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Bazelisk
# You may pin to the exact commit or the version.
# uses: bazelbuild/setup-bazelisk@2351cf5a7584ce72638fbce7c22e5128a5fcd5b2
uses: bazelbuild/setup-bazelisk@v1.0.1
with:
# The Bazelisk version to download (if necessary) and use. Supports semver spec and ranges.
bazelisk-version: 1.x # optional, default is 1.x
# Used to query bazelisk releases. Since there's a default, this is typically not supplied by the user.
token: ${{ github.token }}
# Runs a single command using the runners shell
- name: Mount bazel cache # Optional
uses: actions/cache@v2
with:
path: "~/.cache/bazel"
key: bazel-${{ matrix.os }}
- name: Execute Bazel tests
shell: bash
run: |
bazel test ...:all
# Runs a set of commands using the runners shell
- name: Execute build script
shell: bash
run: |
bazel build //:package
- name: Bazel artifacts
uses: actions/upload-artifact@v2
with:
name: all-${{ matrix.os }}
path: |
bazel-bin*/package_*
bazel-bin*/package_zip.zip
bazel-bin*/package_tar.tar.gz
- name: Setup docker
- name: Publish docker images
shell: bash
run: |
bazel run //:publish
# This is a basic workflow to help you get started with Actions
name: Build
# Controls when the workflow will run
on:
push:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: docker-practice/actions-setup-docker@master
if: ${{ matrix.os == "ubuntu-latest" }}
- uses: docker/login-action@v1
if: ${{ matrix.os === "ubuntu-latest" }}
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Bazelisk
# You may pin to the exact commit or the version.
# uses: bazelbuild/setup-bazelisk@2351cf5a7584ce72638fbce7c22e5128a5fcd5b2
uses: bazelbuild/setup-bazelisk@v1.0.1
with:
# The Bazelisk version to download (if necessary) and use. Supports semver spec and ranges.
bazelisk-version: 1.x # optional, default is 1.x
# Used to query bazelisk releases. Since there's a default, this is typically not supplied by the user.
token: ${{ github.token }}
# Runs a single command using the runners shell
- name: Mount bazel cache # Optional
uses: actions/cache@v2
with:
path: "~/.cache/bazel"
key: bazel-${{ matrix.os }}
- name: Execute Bazel tests
shell: bash
run: |
bazel test //:test
# Runs a set of commands using the runners shell
- name: Execute build script
shell: bash
run: |
bazel build //:package
- name: Bazel artifacts
uses: actions/upload-artifact@v2
with:
name: all-${{ matrix.os }}
path: |
bazel-bin*/package_*
bazel-bin*/package_zip.zip
bazel-bin*/package_tar.tar.gz
- name: Publish docker images
shell: bash
run: |
bazel run //:publish
if: ${{ matrix.os === "ubuntu-latest" }}

6
.gitignore vendored
View file

@ -1,4 +1,4 @@
bazel-*
.vscode
ratelimiter/target
bazel-*
.vscode
ratelimiter/target
target/

8
BUILD
View file

@ -10,10 +10,10 @@ filegroup(
name = "package_bin",
srcs = [
"//novactl",
] + select({
"@bazel_tools//src/conditions:windows": [],
"//conditions:default": ["//webhook", "//gateway", "//ratelimiter"],
}),
"//webhook",
"//gateway",
"//ratelimiter"
]
)
container_bundle(

View file

@ -1,47 +1,50 @@
[workspace]
members = [
"webhook",
"ratelimiter",
"gateway"
]
[package]
name = "nova"
version = "0.1.0"
edition = "2018"
[[bin]]
name = "nova"
path = "src/main.rs"
[dependencies]
libc = "0.2.101"
[package.metadata.raze]
workspace_path = "//cargo"
genmode = "Remote"
default_gen_buildrs = true
package_aliases_dir = "cargo"
experimental_api = true
[package.metadata.raze.crates.cpufeatures.'*']
skipped_deps = ["libc-0.2.101"]
additional_deps = ["@raze__libc__0_2_101//:libc"]
[package.metadata.raze.crates.ring.'*']
compile_data_attr = "glob([\"*/**\"])"
skipped_deps = ["once_cell-1.8.0"]
additional_deps = ["@raze__once_cell__1_8_0//:once_cell"]
[package.metadata.raze.crates.flate2.'*']
compile_data_attr = "glob([\"*/**\"])"
skipped_deps = ["miniz_oxide-0.4.4"]
additional_deps = ["@raze__miniz_oxide__0_4_4//:miniz_oxide"]
[package.metadata.raze.crates.webpki.'*']
compile_data_attr = "glob([\"*/**\"])"
[package.metadata.raze.crates.libsodium-sys.'*']
buildrs_additional_environment_variables = { PATH = "/usr/sbin:/usr/bin:/sbin:/bin", "NUM_JOBS" = "2" }
[workspace]
members = [
"webhook",
"ratelimiter",
"gateway"
]
[package]
name = "nova"
version = "0.1.0"
edition = "2018"
[[bin]]
name = "nova"
path = "src/main.rs"
[dependencies]
libc = "0.2.101"
[package.metadata.raze]
workspace_path = "//cargo"
genmode = "Remote"
default_gen_buildrs = true
package_aliases_dir = "cargo"
experimental_api = true
[package.metadata.raze.crates.cpufeatures.'*']
skipped_deps = ["libc-0.2.101"]
additional_deps = ["@raze__libc__0_2_101//:libc"]
[package.metadata.raze.crates.ring.'*']
compile_data_attr = "glob([\"*/**\"])"
skipped_deps = ["once_cell-1.8.0"]
additional_deps = ["@raze__once_cell__1_8_0//:once_cell"]
[package.metadata.raze.crates.flate2.'*']
compile_data_attr = "glob([\"*/**\"])"
skipped_deps = ["miniz_oxide-0.4.4"]
additional_deps = ["@raze__miniz_oxide__0_4_4//:miniz_oxide"]
[package.metadata.raze.crates.webpki.'*']
compile_data_attr = "glob([\"*/**\"])"
[package.metadata.raze.crates.libsodium-sys.'*']
buildrs_additional_environment_variables = { PATH = "/usr/sbin:/usr/bin:/sbin:/bin", "NUM_JOBS" = "2" }
compile_data_attr = "glob([\"*/**\"])"
gen_buildrs = false
additional_build_file = ["bazel/patch/libsodium_buildrs.rs"]

402
LICENSE
View file

@ -1,201 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2021 Developer's House
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2021 Developer's House
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View file

@ -1,32 +1,32 @@
# Nova
Nova is an open source Discord framework for creating high-performance app.
Nova is built upon [Go](https://github.com/golang/go) and [Rust](https://github.com/rust-lang/rust) and uses [Bazel](https://github.com/bazelbuild/bazel) as a build system to maintain an effective, safe and production-ready solution.
With Nova you can be sure to build reliable and efficient Discord bots.
### Disclaimer
Nova requires a good infrastructure to operate and may consume lot of resources. It's not made for small Discord Bots but for those who are present on many servers and want to ensure excellent performance.
---
## Features
- **Scalability**
- **High-Performance**
- **Reliability**
- **Production-ready**
## Quick Start
> SOON
## Contributing
If you wish to contribute to Nova, go to [CONTRIBUTING]().
## License
Nova is distributed under the Apache 2.0 license, see [LICENSE](LICENSE) for more information.
# Nova
Nova is an open source Discord framework for creating high-performance app.
Nova is built upon [Go](https://github.com/golang/go) and [Rust](https://github.com/rust-lang/rust) and uses [Bazel](https://github.com/bazelbuild/bazel) as a build system to maintain an effective, safe and production-ready solution.
With Nova you can be sure to build reliable and efficient Discord bots.
### Disclaimer
Nova requires a good infrastructure to operate and may consume lot of resources. It's not made for small Discord Bots but for those who are present on many servers and want to ensure excellent performance.
---
## Features
- **Scalability**
- **High-Performance**
- **Reliability**
- **Production-ready**
## Quick Start
> SOON
## Contributing
If you wish to contribute to Nova, go to [CONTRIBUTING]().
## License
Nova is distributed under the Apache 2.0 license, see [LICENSE](LICENSE) for more information.

26
TODO.md
View file

@ -1,14 +1,14 @@
# Todo
## GitHub
- PR and Issue template
- Contributing GUIDE
### Readme
- Features
- Explaination of each components
- How to use (dev, prod)
- Contributing
# Todo
## GitHub
- PR and Issue template
- Contributing GUIDE
### Readme
- Features
- Explaination of each components
- How to use (dev, prod)
- Contributing
- Sponsor?

View file

@ -19,6 +19,7 @@ http_archive(
"https://github.com/bazelbuild/rules_pkg/releases/download/0.5.1/rules_pkg-0.5.1.tar.gz",
],
)
http_archive(
name = "rules_rust",
sha256 = "531bdd470728b61ce41cf7604dc4f9a115983e455d46ac1d0c1632f613ab9fc3",
@ -52,19 +53,24 @@ http_archive(
sha256 = "1f4e59843b61981a96835dc4ac377ad4da9f8c334ebe5e0bb3f58f80c09735f4",
strip_prefix = "rules_docker-0.19.0",
urls = [
"https://github.com/bazelbuild/rules_docker/releases/download/v0.19.0/rules_docker-v0.19.0.tar.gz"
"https://github.com/bazelbuild/rules_docker/releases/download/v0.19.0/rules_docker-v0.19.0.tar.gz",
],
)
load("//bazel:utils.bzl", "get_toolchain_utils_protocolbuffers", "get_toolchain_utils_rules_pkg")
get_toolchain_utils_protocolbuffers()
get_toolchain_utils_rules_pkg()
load("//bazel:rust.bzl", "load_rust_toolchains")
load_rust_toolchains()
load("//bazel:go.bzl", "load_golang_toolchains")
load_golang_toolchains()
load("//bazel:docker.bzl", "load_docker")
load_docker()
load_docker()

View file

@ -13,7 +13,6 @@ def go_dependencies():
sum = "h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk=",
version = "v1.0.3",
)
go_repository(
name = "com_github_afex_hystrix_go",
importpath = "github.com/afex/hystrix-go",
@ -38,13 +37,6 @@ def go_dependencies():
sum = "h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA=",
version = "v0.0.0-20161002113705-648efa622239",
)
go_repository(
name = "com_github_antihax_optional",
importpath = "github.com/antihax/optional",
sum = "h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg=",
version = "v1.0.0",
)
go_repository(
name = "com_github_apache_thrift",
importpath = "github.com/apache/thrift",
@ -75,7 +67,6 @@ def go_dependencies():
sum = "h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=",
version = "v0.0.0-20160902184237-e75332964ef5",
)
go_repository(
name = "com_github_aryann_difflib",
importpath = "github.com/aryann/difflib",
@ -112,12 +103,6 @@ def go_dependencies():
sum = "h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY=",
version = "v0.1.0",
)
go_repository(
name = "com_github_boz_go_throttle",
importpath = "github.com/boz/go-throttle",
sum = "h1:1fx+RA5lk1ZkzPAUP7DEgZnVHYxEcHO77vQO/V8z/2Q=",
version = "v0.0.0-20160922054636-fdc4eab740c1",
)
go_repository(
name = "com_github_burntsushi_toml",
importpath = "github.com/BurntSushi/toml",
@ -142,13 +127,6 @@ def go_dependencies():
sum = "h1:glEXhBS5PSLLv4IXzLA5yPRVX4bilULVyxxbrfOtDAk=",
version = "v0.2.1",
)
go_repository(
name = "com_github_cespare_xxhash",
importpath = "github.com/cespare/xxhash",
sum = "h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=",
version = "v1.1.0",
)
go_repository(
name = "com_github_cespare_xxhash_v2",
importpath = "github.com/cespare/xxhash/v2",
@ -167,19 +145,6 @@ def go_dependencies():
sum = "h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI=",
version = "v0.3.4",
)
go_repository(
name = "com_github_cncf_udpa_go",
importpath = "github.com/cncf/udpa/go",
sum = "h1:cqQfy1jclcSy/FwLjemeg3SR1yaINm74aQyupQ0Bl8M=",
version = "v0.0.0-20201120205902-5459f2c99403",
)
go_repository(
name = "com_github_cncf_xds_go",
importpath = "github.com/cncf/xds/go",
sum = "h1:OZmjad4L3H8ncOIR8rnb5MREYqG8ixi5+WbeUsquF0c=",
version = "v0.0.0-20210312221358-fbca930ec8ed",
)
go_repository(
name = "com_github_cockroachdb_datadriven",
importpath = "github.com/cockroachdb/datadriven",
@ -276,7 +241,6 @@ def go_dependencies():
sum = "h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=",
version = "v1.12.0",
)
go_repository(
name = "com_github_envoyproxy_go_control_plane",
importpath = "github.com/envoyproxy/go-control-plane",
@ -301,7 +265,6 @@ def go_dependencies():
sum = "h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ=",
version = "v0.0.0-20150515145356-3f9db97f8568",
)
go_repository(
name = "com_github_franela_goblin",
importpath = "github.com/franela/goblin",
@ -356,7 +319,6 @@ def go_dependencies():
sum = "h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY4=",
version = "v5.4.2",
)
go_repository(
name = "com_github_go_kit_kit",
importpath = "github.com/go-kit/kit",
@ -453,13 +415,6 @@ def go_dependencies():
sum = "h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA=",
version = "v0.1.0",
)
go_repository(
name = "com_github_google_shlex",
importpath = "github.com/google/shlex",
sum = "h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=",
version = "v0.0.0-20191202100458-e7afc7fbc510",
)
go_repository(
name = "com_github_google_uuid",
importpath = "github.com/google/uuid",
@ -634,7 +589,6 @@ def go_dependencies():
sum = "h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=",
version = "v0.3.12",
)
go_repository(
name = "com_github_inconshreveable_mousetrap",
importpath = "github.com/inconshreveable/mousetrap",
@ -659,7 +613,6 @@ def go_dependencies():
sum = "h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc=",
version = "v1.5.0",
)
go_repository(
name = "com_github_jmespath_go_jmespath",
importpath = "github.com/jmespath/go-jmespath",
@ -702,7 +655,6 @@ def go_dependencies():
sum = "h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck=",
version = "v0.0.0-20201106050909-4977a11b4351",
)
go_repository(
name = "com_github_kisielk_errcheck",
importpath = "github.com/kisielk/errcheck",
@ -751,13 +703,6 @@ def go_dependencies():
sum = "h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=",
version = "v0.2.0",
)
go_repository(
name = "com_github_libgit2_git2go_v31",
importpath = "github.com/libgit2/git2go/v31",
sum = "h1:6GOd3965D9e/+gjxCwZF4eQ+vB9kKB4yKFqdQr6XZ2E=",
version = "v31.4.14",
)
go_repository(
name = "com_github_lightstep_lightstep_tracer_common_golang_gogo",
importpath = "github.com/lightstep/lightstep-tracer-common/golang/gogo",
@ -782,7 +727,6 @@ def go_dependencies():
sum = "h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A=",
version = "v1.2.0",
)
go_repository(
name = "com_github_mattn_go_colorable",
importpath = "github.com/mattn/go-colorable",
@ -813,7 +757,6 @@ def go_dependencies():
sum = "h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk=",
version = "v0.4.16",
)
go_repository(
name = "com_github_miekg_dns",
importpath = "github.com/miekg/dns",
@ -910,7 +853,6 @@ def go_dependencies():
sum = "h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=",
version = "v0.0.0-20200227124842-a10e7caefd8e",
)
go_repository(
name = "com_github_oklog_oklog",
importpath = "github.com/oklog/oklog",
@ -929,13 +871,6 @@ def go_dependencies():
sum = "h1:58+kh9C6jJVXYjt8IE48G2eWl6BjwU5Gj0gqY84fy78=",
version = "v0.0.0-20170122224234-a0225b3f23b5",
)
go_repository(
name = "com_github_oneofone_xxhash",
importpath = "github.com/OneOfOne/xxhash",
sum = "h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=",
version = "v1.2.2",
)
go_repository(
name = "com_github_onsi_ginkgo",
importpath = "github.com/onsi/ginkgo",
@ -1068,7 +1003,6 @@ def go_dependencies():
sum = "h1:YoJbenK9C67SkzkDfmQuVln04ygHj3vjZfd9FL+GmQQ=",
version = "v0.0.0-20210428141323-04723f9f07d7",
)
go_repository(
name = "com_github_rcrowley_go_metrics",
importpath = "github.com/rcrowley/go-metrics",
@ -1129,7 +1063,6 @@ def go_dependencies():
sum = "h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=",
version = "v1.1.0",
)
go_repository(
name = "com_github_shopify_sarama",
importpath = "github.com/Shopify/sarama",
@ -1178,13 +1111,6 @@ def go_dependencies():
sum = "h1:oMnRNZXX5j85zso6xCPRNPtmAycat+WcoKbklScLDgQ=",
version = "v0.4.1",
)
go_repository(
name = "com_github_spaolacci_murmur3",
importpath = "github.com/spaolacci/murmur3",
sum = "h1:qLC7fQah7D6K1B0ujays3HV9gkFtllcxhzImRR7ArPQ=",
version = "v0.0.0-20180118202830-f09979ecbc72",
)
go_repository(
name = "com_github_spf13_cobra",
importpath = "github.com/spf13/cobra",
@ -1233,7 +1159,6 @@ def go_dependencies():
sum = "h1:8n59tqmLmt8jyRsY44RPy2ixPDDw0FcVoAhlYeyz3Jw=",
version = "v1.0.0",
)
go_repository(
name = "com_github_urfave_cli",
importpath = "github.com/urfave/cli",
@ -1252,7 +1177,6 @@ def go_dependencies():
sum = "h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI=",
version = "v0.3.0",
)
go_repository(
name = "com_github_xiang90_probing",
importpath = "github.com/xiang90/probing",
@ -1343,7 +1267,6 @@ def go_dependencies():
sum = "h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=",
version = "v3.0.0-20200313102051-9f266ea9e77c",
)
go_repository(
name = "io_etcd_go_bbolt",
importpath = "go.etcd.io/bbolt",
@ -1368,13 +1291,6 @@ def go_dependencies():
sum = "h1:75k/FF0Q2YM8QYo07VPddOLBslDt1MZOdEslOHvmzAs=",
version = "v0.22.2",
)
go_repository(
name = "io_opentelemetry_go_proto_otlp",
importpath = "go.opentelemetry.io/proto/otlp",
sum = "h1:rwOQPCuKAKmwGKq2aVNnYIibI6wnV7EvzgfTCzcdGg8=",
version = "v0.7.0",
)
go_repository(
name = "org_golang_google_api",
importpath = "google.golang.org/api",
@ -1393,6 +1309,12 @@ def go_dependencies():
sum = "h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE=",
version = "v0.0.0-20190819201941-24fa4b261c55",
)
go_repository(
name = "org_golang_google_grpc",
importpath = "google.golang.org/grpc",
sum = "h1:2dTRdpdFEEhJYQD8EMLB61nnrzSCTbG38PhqdhvOltg=",
version = "v1.26.0",
)
go_repository(
name = "org_golang_google_protobuf",
importpath = "google.golang.org/protobuf",
@ -1453,7 +1375,6 @@ def go_dependencies():
sum = "h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=",
version = "v0.0.0-20201126162022-7de9c90e9dd1",
)
go_repository(
name = "org_golang_x_text",
importpath = "golang.org/x/text",

View file

@ -4,6 +4,7 @@ load("@io_bazel_rules_docker//toolchains/docker:toolchain.bzl", "toolchain_confi
load("@io_bazel_rules_docker//repositories:repositories.bzl", "repositories")
load("@io_bazel_rules_docker//repositories:deps.bzl", "deps")
load("@io_bazel_rules_docker//container:container.bzl", "container_pull")
load(
"@io_bazel_rules_docker//go:image.bzl",
_go_image_repos = "repositories",
@ -27,8 +28,14 @@ def load_docker():
_rust_image_repos()
container_pull(
name = "io_docker_index_library_debian_stable_slim",
digest = "sha256:7bb9de2067f4e4e3e2377070e180a05d33a0bc4289c66b9e71504063cf18da15",
registry = "index.docker.io",
repository = "library/debian",
tag = "stable-slim",
)
digest = "sha256:2c4bb6b7236db0a55ec54ba8845e4031f5db2be957ac61867872bf42e56c4deb",
registry = "gcr.io",
repository = "distroless/cc-debian10",
tag = "latest",
)
container_pull(
name = "ubuntu1604",
registry = "l.gcr.io",
repository = "google/ubuntu1604",
tag = "latest",
)

View file

@ -1,7 +1,7 @@
"""
Utilities used by the workspace to load the golang toolchain
"""
load("//:deps.bzl", "go_dependencies")
load("//bazel:deps.bzl", "go_dependencies")
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
@ -14,8 +14,6 @@ def load_golang_toolchains():
go_rules_dependencies()
# Used to generate the go dependencies & build files
# gazelle:repository_macro deps.bzl%go_dependencies
go_dependencies()
gazelle_dependencies()

5
bazel/images.bzl Normal file
View file

@ -0,0 +1,5 @@
"""
"""
def images():

View file

@ -0,0 +1,407 @@
#[cfg(not(windows))]
extern crate cc;
#[cfg(target_env = "msvc")]
extern crate libc;
extern crate pkg_config;
extern crate walkdir;
use std::{
env,
path::{Path, PathBuf},
};
static VERSION: &str = "1.0.18";
fn main() {
println!("cargo:rerun-if-env-changed=SODIUM_LIB_DIR");
println!("cargo:rerun-if-env-changed=SODIUM_SHARED");
println!("cargo:rerun-if-env-changed=SODIUM_USE_PKG_CONFIG");
if cfg!(not(windows)) {
println!("cargo:rerun-if-env-changed=SODIUM_DISABLE_PIE");
}
if env::var("SODIUM_STATIC").is_ok() {
panic!("SODIUM_STATIC is deprecated. Use SODIUM_SHARED instead.");
}
let lib_dir_isset = env::var("SODIUM_LIB_DIR").is_ok();
let use_pkg_isset = if cfg!(feature = "use-pkg-config") {
true
} else {
env::var("SODIUM_USE_PKG_CONFIG").is_ok()
};
let shared_isset = env::var("SODIUM_SHARED").is_ok();
if lib_dir_isset && use_pkg_isset {
panic!("SODIUM_LIB_DIR is incompatible with SODIUM_USE_PKG_CONFIG. Set the only one env variable");
}
if lib_dir_isset {
find_libsodium_env();
} else if use_pkg_isset {
if shared_isset {
println!("cargo:warning=SODIUM_SHARED has no effect with SODIUM_USE_PKG_CONFIG");
}
find_libsodium_pkg();
} else {
if shared_isset {
println!(
"cargo:warning=SODIUM_SHARED has no effect for building libsodium from source"
);
}
build_libsodium();
}
}
/* Must be called when SODIUM_LIB_DIR is set to any value
This function will set `cargo` flags.
*/
fn find_libsodium_env() {
let lib_dir = env::var("SODIUM_LIB_DIR").unwrap(); // cannot fail
println!("cargo:rustc-link-search=native={}", lib_dir);
let mode = if env::var("SODIUM_SHARED").is_ok() {
"dylib"
} else {
"static"
};
let name = if cfg!(target_env = "msvc") {
"libsodium"
} else {
"sodium"
};
println!("cargo:rustc-link-lib={}={}", mode, name);
println!(
"cargo:warning=Using unknown libsodium version. This crate is tested against \
{} and may not be fully compatible with other versions.",
VERSION
);
}
/* Must be called when no SODIUM_USE_PKG_CONFIG env var is set
This function will set `cargo` flags.
*/
#[cfg(target_env = "msvc")]
fn find_libsodium_pkg() {
panic!("SODIUM_USE_PKG_CONFIG is not supported on msvc");
}
/* Must be called when SODIUM_USE_PKG_CONFIG env var is set
This function will set `cargo` flags.
*/
#[cfg(not(target_env = "msvc"))]
fn find_libsodium_pkg() {
match pkg_config::Config::new().probe("libsodium") {
Ok(lib) => {
if lib.version != VERSION {
println!(
"cargo:warning=Using libsodium version {}. This crate is tested against {} \
and may not be fully compatible with {}.",
lib.version, VERSION, lib.version
);
}
for lib_dir in &lib.link_paths {
println!("cargo:lib={}", lib_dir.to_str().unwrap());
}
for include_dir in &lib.include_paths {
println!("cargo:include={}", include_dir.to_str().unwrap());
}
}
Err(e) => {
panic!(
"
Failed to run pkg-config:
{:?}
You can try fixing this by installing pkg-config:
# On Ubuntu
sudo apt install pkg-config
# On Arch Linux
sudo pacman -S pkgconf
# On Fedora
sudo dnf install pkgconf-pkg-config
",
e
);
}
}
}
#[cfg(windows)]
fn make_libsodium(_: &str, _: &Path, _: &Path) -> PathBuf {
// We don't build anything on windows, we simply linked to precompiled
// libs.
get_lib_dir()
}
#[cfg(not(windows))]
fn make_libsodium(target: &str, source_dir: &Path, install_dir: &Path) -> PathBuf {
use std::{fs, process::Command, str};
// Decide on CC, CFLAGS and the --host configure argument
let build_compiler = cc::Build::new().get_compiler();
let mut compiler = build_compiler.path().to_str().unwrap().to_string();
let mut cflags = build_compiler.cflags_env().into_string().unwrap();
let mut host_arg = format!("--host={}", target);
let mut cross_compiling = target != env::var("HOST").unwrap();
if target.contains("-ios") {
// Determine Xcode directory path
let xcode_select_output = Command::new("xcode-select").arg("-p").output().unwrap();
if !xcode_select_output.status.success() {
panic!("Failed to run xcode-select -p");
}
let xcode_dir = str::from_utf8(&xcode_select_output.stdout)
.unwrap()
.trim()
.to_string();
// Determine SDK directory paths
let sdk_dir_simulator = Path::new(&xcode_dir)
.join("Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk")
.to_str()
.unwrap()
.to_string();
let sdk_dir_ios = Path::new(&xcode_dir)
.join("Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk")
.to_str()
.unwrap()
.to_string();
// Min versions
let ios_simulator_version_min = "6.0.0";
let ios_version_min = "6.0.0";
// Roughly based on `dist-build/ios.sh` in the libsodium sources
match &*target {
"aarch64-apple-ios" => {
cflags += " -arch arm64";
cflags += &format!(" -isysroot {}", sdk_dir_ios);
cflags += &format!(" -mios-version-min={}", ios_version_min);
cflags += " -fembed-bitcode";
host_arg = "--host=arm-apple-darwin10".to_string();
}
"armv7-apple-ios" => {
cflags += " -arch armv7";
cflags += &format!(" -isysroot {}", sdk_dir_ios);
cflags += &format!(" -mios-version-min={}", ios_version_min);
cflags += " -mthumb";
host_arg = "--host=arm-apple-darwin10".to_string();
}
"armv7s-apple-ios" => {
cflags += " -arch armv7s";
cflags += &format!(" -isysroot {}", sdk_dir_ios);
cflags += &format!(" -mios-version-min={}", ios_version_min);
cflags += " -mthumb";
host_arg = "--host=arm-apple-darwin10".to_string();
}
"i386-apple-ios" => {
cflags += " -arch i386";
cflags += &format!(" -isysroot {}", sdk_dir_simulator);
cflags += &format!(" -mios-simulator-version-min={}", ios_simulator_version_min);
host_arg = "--host=i686-apple-darwin10".to_string();
}
"x86_64-apple-ios" => {
cflags += " -arch x86_64";
cflags += &format!(" -isysroot {}", sdk_dir_simulator);
cflags += &format!(" -mios-simulator-version-min={}", ios_simulator_version_min);
host_arg = "--host=x86_64-apple-darwin10".to_string();
}
_ => panic!("Unknown iOS build target: {}", target),
}
cross_compiling = true;
} else if target.contains("i686") {
compiler += " -m32 -maes";
cflags += " -march=i686";
}
let help = if cross_compiling {
"***********************************************************\n\
Possible missing dependencies.\n\
See https://github.com/sodiumoxide/sodiumoxide#cross-compiling\n\
***********************************************************\n\n"
} else {
""
};
// Run `./configure`
let prefix_arg = format!("--prefix={}", install_dir.to_str().unwrap());
let libdir_arg = format!("--libdir={}/lib", install_dir.to_str().unwrap());
let mut configure_cmd = Command::new(fs::canonicalize(source_dir.join("configure")).expect("Failed to find configure script! Did you clone the submodule at `libsodium-sys/libsodium`?"));
if !compiler.is_empty() {
configure_cmd.env("CC", &compiler);
}
if !cflags.is_empty() {
configure_cmd.env("CFLAGS", &cflags);
}
if env::var("SODIUM_DISABLE_PIE").is_ok() {
configure_cmd.arg("--disable-pie");
}
let configure_status = configure_cmd
.current_dir(&source_dir)
.arg(&prefix_arg)
.arg(&libdir_arg)
.arg(&host_arg)
.arg("--enable-shared=no")
.status()
.unwrap_or_else(|error| {
panic!("Failed to run './configure': {}\n{}", error, help);
});
if !configure_status.success() {
panic!(
"\nFailed to configure libsodium using {:?}\nCFLAGS={}\nCC={}\n{}\n",
configure_cmd, cflags, compiler, help
);
}
// Run `make check`, or `make all` if we're cross-compiling
let j_arg = format!("-j{}", env::var("NUM_JOBS").unwrap());
let make_arg = if cross_compiling { "all" } else { "check" };
let mut make_cmd = Command::new("make");
let make_status = make_cmd
.current_dir(&source_dir)
.env("V", "1")
.arg(make_arg)
.arg(&j_arg)
.status()
.unwrap_or_else(|error| {
panic!("Failed to run 'make {}': {}\n{}", make_arg, error, help);
});
if !make_status.success() {
panic!("\nFailed to build libsodium using {:?}\n{}", make_cmd, help);
}
// Run `make install`
let mut install_cmd = Command::new("make");
let install_status = install_cmd
.current_dir(&source_dir)
.arg("install")
.status()
.unwrap_or_else(|error| {
panic!("Failed to run 'make install': {}", error);
});
if !install_status.success() {
panic!("\nFailed to install libsodium using {:?}", install_cmd);
}
install_dir.join("lib")
}
#[cfg(any(windows, target_env = "msvc"))]
fn get_crate_dir() -> PathBuf {
env::var("CARGO_MANIFEST_DIR").unwrap().into()
}
#[cfg(target_env = "msvc")]
fn is_release_profile() -> bool {
env::var("PROFILE").unwrap() == "release"
}
#[cfg(all(target_env = "msvc", target_pointer_width = "32"))]
fn get_lib_dir() -> PathBuf {
if is_release_profile() {
get_crate_dir().join("msvc/Win32/Release/v142/")
} else {
get_crate_dir().join("msvc/Win32/Debug/v142/")
}
}
#[cfg(all(target_env = "msvc", target_pointer_width = "64"))]
fn get_lib_dir() -> PathBuf {
if is_release_profile() {
get_crate_dir().join("msvc/x64/Release/v142/")
} else {
get_crate_dir().join("msvc/x64/Debug/v142/")
}
}
#[cfg(all(windows, not(target_env = "msvc"), target_pointer_width = "32"))]
fn get_lib_dir() -> PathBuf {
get_crate_dir().join("mingw/win32/")
}
#[cfg(all(windows, not(target_env = "msvc"), target_pointer_width = "64"))]
fn get_lib_dir() -> PathBuf {
get_crate_dir().join("mingw/win64/")
}
fn build_libsodium() {
use std::{ffi::OsStr, fs};
// Determine build target triple
let mut out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
let target = env::var("TARGET").unwrap();
let profile = env::var("PROFILE").unwrap();
// Avoid issues with paths containing spaces by falling back to using a tempfile.
// See https://github.com/jedisct1/libsodium/issues/207
if out_dir.to_str().unwrap().contains(' ') {
out_dir = env::temp_dir()
.join("libsodium-sys")
.join(&target)
.join(&profile);
println!(
"cargo:warning=The path to the usual build directory contains spaces and hence \
can't be used to build libsodium. Falling back to use {}. If running `cargo \
clean`, ensure you also delete this fallback directory",
out_dir.display()
);
}
// Determine source and install dir
let install_dir = out_dir.join("installed");
let source_dir = out_dir.join("source").join("libsodium");
// Create directories
fs::create_dir_all(&install_dir).unwrap();
fs::create_dir_all(&source_dir).unwrap();
let paths = std::fs::read_dir("./libsodium").unwrap();
for path in paths {
println!("Name: {}", path.unwrap().path().display())
}
if !target.contains("msvc") {
// Copy sources into build directory
// Skip .git because it's marked read-only and that causes problems re-building
for entry in walkdir::WalkDir::new("libsodium")
.into_iter()
.filter_entry(|e| e.file_name() != OsStr::new(".git"))
.filter_map(Result::ok)
{
let outpath = out_dir.join("source").join(entry.path());
if let Err(e) = if entry.file_type().is_dir() {
fs::create_dir_all(outpath)
} else {
fs::copy(entry.path(), outpath).map(|_| ())
} {
panic!("Failed to copy sources into build directory: {}", e);
}
}
}
let lib_dir = make_libsodium(&target, &source_dir, &install_dir);
if target.contains("msvc") {
println!("cargo:rustc-link-lib=static=libsodium");
} else {
println!("cargo:rustc-link-lib=static=sodium");
}
println!(
"cargo:rustc-link-search=native={}",
lib_dir.to_str().unwrap()
);
let include_dir = source_dir.join("src/libsodium/include");
println!("cargo:include={}", include_dir.to_str().unwrap());
println!("cargo:lib={}", lib_dir.to_str().unwrap());
}

View file

@ -108,6 +108,7 @@ rust_library(
crate_root = "src/lib.rs",
crate_type = "lib",
data = [],
compile_data = glob(["*/**"]),
edition = "2015",
rustc_flags = [
"--cap-lints=allow",

View file

@ -1,6 +1,6 @@
package commands
// GatewayCommandHeartbeat is used to maintain an active gateway connection.
// Must be sent every heartbeat_interval milliseconds after the Opcode 10 Hello payload is received.
// The inner d key is the last sequence number—s—received by the client. If you have not yet received one, send null.
type GatewayCommandHeartbeat int
package commands
// GatewayCommandHeartbeat is used to maintain an active gateway connection.
// Must be sent every heartbeat_interval milliseconds after the Opcode 10 Hello payload is received.
// The inner d key is the last sequence number—s—received by the client. If you have not yet received one, send null.
type GatewayCommandHeartbeat int

View file

@ -1,30 +1,30 @@
package commands
import (
"github.com/discordnova/nova/common/discord/types/structures"
"github.com/discordnova/nova/common/discord/types/types"
)
// GatewayCommandIdentifyPayload is used to trigger the initial handshake with the gateway.
type GatewayCommandIdentifyPayload struct {
// authentication token
Token string `json:"token"`
// connection properties
Properties structures.IdentifyConnectionProperties `json:"properties"`
// whether this connection supports compression of packets
// Default to false
Compress bool `json:"compress,omitempty"`
// value between 50 and 250, total number of members where the gateway will stop sending offline members in the
// guild member list
// Default to 50
LargeThreshold int `json:"large_threshold,omitempty"`
// used for Guild Sharding. array of two integers (shard_id, num_shards)
Shard []int `json:"shard,omitempty"`
// presence structure for initial presence information
Presence GatewayCommandUpdateStatusPayload `json:"presence,omitempty"`
// enables dispatching of guild subscription events (presence and typing events)
// Default to true
GuildSubscriptions bool `json:"guild_subscriptions,omitempty"`
// the Gateway Intents you wish to receive
Intents types.GatewayIntents `json:"intents"`
}
package commands
import (
"github.com/discordnova/nova/common/discord/types/structures"
"github.com/discordnova/nova/common/discord/types/types"
)
// GatewayCommandIdentifyPayload is used to trigger the initial handshake with the gateway.
type GatewayCommandIdentifyPayload struct {
// authentication token
Token string `json:"token"`
// connection properties
Properties structures.IdentifyConnectionProperties `json:"properties"`
// whether this connection supports compression of packets
// Default to false
Compress bool `json:"compress,omitempty"`
// value between 50 and 250, total number of members where the gateway will stop sending offline members in the
// guild member list
// Default to 50
LargeThreshold int `json:"large_threshold,omitempty"`
// used for Guild Sharding. array of two integers (shard_id, num_shards)
Shard []int `json:"shard,omitempty"`
// presence structure for initial presence information
Presence GatewayCommandUpdateStatusPayload `json:"presence,omitempty"`
// enables dispatching of guild subscription events (presence and typing events)
// Default to true
GuildSubscriptions bool `json:"guild_subscriptions,omitempty"`
// the Gateway Intents you wish to receive
Intents types.GatewayIntents `json:"intents"`
}

View file

@ -1,35 +1,35 @@
package commands
// GatewayCommandRequestGuildMembersPayload is used o request all members for a guild or a list of guilds.
// When initially connecting,the gateway will only send offline members if a guild has less than the large_threshold
// members (value in the Gateway Identify).
// If a client wishes to receive additional members, they need to explicitly request them via this operation.
// The server will send Guild Members Chunk events in response with up to 1000 members per chunk until all members
// that match the request have been sent.
// Due to our privacy and infrastructural concerns with this feature, there are some limitations that apply:
// GUILD_PRESENCES intent is required to set presences = true. Otherwise, it will always be false
// GUILD_MEMBERS intent is required to request the entire member list—(query=, limit=0<=n)
// You will be limited to requesting 1 guild_id per request
// Requesting a prefix (query parameter) will return a maximum of 100 members
// Requesting user_ids will continue to be limited to returning 100 members
type GatewayCommandRequestGuildMembersPayload struct {
// id of the guild to get members for
// Required: true
GuildID string `json:"guild_id"`
// string that username starts with, or an empty string to return all members
// Required: one of query or user_ids
Query string `json:"query,omitempty"`
// maximum number of members to send matching the query; a limit of 0 can be used with an empty string query to return
// all members
// Required: true when specifying query
Limit int `json:"limit,omitempty"`
// used to specify if we want the presences of the matched members
// Required: false
Presences bool `json:"presences,omitempty"`
// used to specify which users you wish to fetch
// Required: one of query or user_ids
UserIDs string `json:"user_ids,omitempty"`
// nonce to identify the Guild Members Chunk response
// Required: false
Nonce string `json:"nonce,omitempty"`
}
package commands
// GatewayCommandRequestGuildMembersPayload is used o request all members for a guild or a list of guilds.
// When initially connecting,the gateway will only send offline members if a guild has less than the large_threshold
// members (value in the Gateway Identify).
// If a client wishes to receive additional members, they need to explicitly request them via this operation.
// The server will send Guild Members Chunk events in response with up to 1000 members per chunk until all members
// that match the request have been sent.
// Due to our privacy and infrastructural concerns with this feature, there are some limitations that apply:
// GUILD_PRESENCES intent is required to set presences = true. Otherwise, it will always be false
// GUILD_MEMBERS intent is required to request the entire member list—(query=, limit=0<=n)
// You will be limited to requesting 1 guild_id per request
// Requesting a prefix (query parameter) will return a maximum of 100 members
// Requesting user_ids will continue to be limited to returning 100 members
type GatewayCommandRequestGuildMembersPayload struct {
// id of the guild to get members for
// Required: true
GuildID string `json:"guild_id"`
// string that username starts with, or an empty string to return all members
// Required: one of query or user_ids
Query string `json:"query,omitempty"`
// maximum number of members to send matching the query; a limit of 0 can be used with an empty string query to return
// all members
// Required: true when specifying query
Limit int `json:"limit,omitempty"`
// used to specify if we want the presences of the matched members
// Required: false
Presences bool `json:"presences,omitempty"`
// used to specify which users you wish to fetch
// Required: one of query or user_ids
UserIDs string `json:"user_ids,omitempty"`
// nonce to identify the Guild Members Chunk response
// Required: false
Nonce string `json:"nonce,omitempty"`
}

View file

@ -1,11 +1,11 @@
package commands
// GatewayCommandResumePayload is used to replay missed events when a disconnected client resumes
type GatewayCommandResumePayload struct {
// session token
Token string `json:"token"`
// session id
SessionID string `json:"session_id"`
// last sequence number received
Seq int64 `json:"seq"`
}
package commands
// GatewayCommandResumePayload is used to replay missed events when a disconnected client resumes
type GatewayCommandResumePayload struct {
// session token
Token string `json:"token"`
// session id
SessionID string `json:"session_id"`
// last sequence number received
Seq int64 `json:"seq"`
}

View file

@ -1,18 +1,18 @@
package commands
import (
"github.com/discordnova/nova/common/discord/types/structures"
"github.com/discordnova/nova/common/discord/types/types"
)
// GatewayCommandUpdateStatusPayload is sent by the client to indicate a presence or status update.
type GatewayCommandUpdateStatusPayload struct {
// unix time (in milliseconds) of when the client went idle, or null if the client is not idle
Since int `json:"since,omitempty"`
// null, or the user's activities
Activities []structures.Activity `json:"activities,omitempty"`
// the user's new status
Status types.UpdateStatusStatuses `json:"status"`
// whether or not the client is afk
AFK bool `json:"afk"`
}
package commands
import (
"github.com/discordnova/nova/common/discord/types/structures"
"github.com/discordnova/nova/common/discord/types/types"
)
// GatewayCommandUpdateStatusPayload is sent by the client to indicate a presence or status update.
type GatewayCommandUpdateStatusPayload struct {
// unix time (in milliseconds) of when the client went idle, or null if the client is not idle
Since int `json:"since,omitempty"`
// null, or the user's activities
Activities []structures.Activity `json:"activities,omitempty"`
// the user's new status
Status types.UpdateStatusStatuses `json:"status"`
// whether or not the client is afk
AFK bool `json:"afk"`
}

View file

@ -1,13 +1,13 @@
package commands
// GatewayCommandUpdateVoiceStatePayload is sent when a client wants to join, move, or disconnect from a voice channel.
type GatewayCommandUpdateVoiceStatePayload struct {
// id of the guild
GuildID string `json:"guild_id"`
// id of the voice channel client wants to join (null if disconnecting)
ChannelID string `json:"channel_id,omitempty"`
// is the client muted
SelfMute bool `json:"self_mute"`
// is the client deafened
SelfDeaf bool `json:"self_deaf"`
}
package commands
// GatewayCommandUpdateVoiceStatePayload is sent when a client wants to join, move, or disconnect from a voice channel.
type GatewayCommandUpdateVoiceStatePayload struct {
// id of the guild
GuildID string `json:"guild_id"`
// id of the voice channel client wants to join (null if disconnecting)
ChannelID string `json:"channel_id,omitempty"`
// is the client muted
SelfMute bool `json:"self_mute"`
// is the client deafened
SelfDeaf bool `json:"self_deaf"`
}

View file

@ -1,7 +1,7 @@
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventChannelCreatePayload is sent when a new guild channel is created, relevant to the current user.
// The inner payload is a channel object.
type GatewayEventChannelCreatePayload structures.Channel
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventChannelCreatePayload is sent when a new guild channel is created, relevant to the current user.
// The inner payload is a channel object.
type GatewayEventChannelCreatePayload structures.Channel

View file

@ -1,7 +1,7 @@
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventChannelDeletePayload is sent when a channel relevant to the current user is deleted.
// The inner payload is a channel object.
type GatewayEventChannelDeletePayload structures.Channel
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventChannelDeletePayload is sent when a channel relevant to the current user is deleted.
// The inner payload is a channel object.
type GatewayEventChannelDeletePayload structures.Channel

View file

@ -1,12 +1,12 @@
package events
// GatewayEventChannelPinsUpdatePayload is sent when a message is pinned or unpinned in a text channel.
// This is not sent when a pinned message is deleted.
type GatewayEventChannelPinsUpdatePayload struct {
// the id of the guild
GuildID string `json:"guild_id,omitempty"`
// the id of the channel
ChannelID string `json:"channel_id"`
// the time at which the most recent pinned message was pinned
LastPinTimestamp string `json:"last_pin_timestamp,omitempty"`
}
package events
// GatewayEventChannelPinsUpdatePayload is sent when a message is pinned or unpinned in a text channel.
// This is not sent when a pinned message is deleted.
type GatewayEventChannelPinsUpdatePayload struct {
// the id of the guild
GuildID string `json:"guild_id,omitempty"`
// the id of the channel
ChannelID string `json:"channel_id"`
// the time at which the most recent pinned message was pinned
LastPinTimestamp string `json:"last_pin_timestamp,omitempty"`
}

View file

@ -1,8 +1,8 @@
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventChannelUpdatePayload is sent when a channel is updated. The inner payload is a channel object.
// This is not sent when the field last_message_id is altered.
// To keep track of the last_message_id changes, we should listen for Message Create events.
type GatewayEventChannelUpdatePayload structures.Channel
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventChannelUpdatePayload is sent when a channel is updated. The inner payload is a channel object.
// This is not sent when the field last_message_id is altered.
// To keep track of the last_message_id changes, we should listen for Message Create events.
type GatewayEventChannelUpdatePayload structures.Channel

View file

@ -1,11 +1,11 @@
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventGuildBanAddPayload is sent when a user is banned from a guild.
type GatewayEventGuildBanAddPayload struct {
// id of the guild
GuildID string `json:"guild_id"`
// the banned user
User structures.User `json:"user"`
}
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventGuildBanAddPayload is sent when a user is banned from a guild.
type GatewayEventGuildBanAddPayload struct {
// id of the guild
GuildID string `json:"guild_id"`
// the banned user
User structures.User `json:"user"`
}

View file

@ -1,11 +1,11 @@
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventGuildBanRemovePayload is sent when a user is unbanned from a guild.
type GatewayEventGuildBanRemovePayload struct {
// id of the guild
GuildID string `json:"guild_id"`
// the unbanned user
User structures.User `json:"user"`
}
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventGuildBanRemovePayload is sent when a user is unbanned from a guild.
type GatewayEventGuildBanRemovePayload struct {
// id of the guild
GuildID string `json:"guild_id"`
// the unbanned user
User structures.User `json:"user"`
}

View file

@ -1,12 +1,12 @@
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventGuildCreatePayload can be sent in three different scenarios:
// When a user is initially connecting,
// to lazily load and back fill information for all unavailable guilds sent in the Ready event.
// Guilds that are unavailable due to an outage will send a Guild Delete event.
// When a Guild becomes available again to the client.
// When the current user joins a new Guild.
// The inner payload is a guild object, with all the extra fields specified. (Nothing on the doc)
type GatewayEventGuildCreatePayload structures.Guild
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventGuildCreatePayload can be sent in three different scenarios:
// When a user is initially connecting,
// to lazily load and back fill information for all unavailable guilds sent in the Ready event.
// Guilds that are unavailable due to an outage will send a Guild Delete event.
// When a Guild becomes available again to the client.
// When the current user joins a new Guild.
// The inner payload is a guild object, with all the extra fields specified. (Nothing on the doc)
type GatewayEventGuildCreatePayload structures.Guild

View file

@ -1,9 +1,9 @@
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventGuildDeletePayload is sent when a guild becomes or was already unavailable due to an outage,
// or when the user leaves or is removed from a guild.
// The inner payload is an unavailable guild object.
// If the unavailable field is not set, the user was removed from the guild.
type GatewayEventGuildDeletePayload structures.Guild
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventGuildDeletePayload is sent when a guild becomes or was already unavailable due to an outage,
// or when the user leaves or is removed from a guild.
// The inner payload is an unavailable guild object.
// If the unavailable field is not set, the user was removed from the guild.
type GatewayEventGuildDeletePayload structures.Guild

View file

@ -1,11 +1,11 @@
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventGuildEmojisUpdatePayload is sent when when a guild's emojis have been updated.
type GatewayEventGuildEmojisUpdatePayload struct {
// id of the guild
GuildID string `json:"guild_id"`
// array of emojis
Emojis []structures.Emoji `json:"emojis"`
}
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventGuildEmojisUpdatePayload is sent when when a guild's emojis have been updated.
type GatewayEventGuildEmojisUpdatePayload struct {
// id of the guild
GuildID string `json:"guild_id"`
// array of emojis
Emojis []structures.Emoji `json:"emojis"`
}

View file

@ -1,7 +1,7 @@
package events
// GatewayEventGuildIntegrationsUpdatePayload is sent when a guild integration is updated.
type GatewayEventGuildIntegrationsUpdatePayload struct {
// id of the guild whose integrations were updated
GuildID string `json:"guild_id"`
}
package events
// GatewayEventGuildIntegrationsUpdatePayload is sent when a guild integration is updated.
type GatewayEventGuildIntegrationsUpdatePayload struct {
// id of the guild whose integrations were updated
GuildID string `json:"guild_id"`
}

View file

@ -1,12 +1,12 @@
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventGuildMemberAddPayload is sent when a new user joins a guild.
// The inner payload is a guild member object with an extra guild_id key
// If using Gateway Intents, the GUILD_MEMBERS intent will be required to receive this event.
type GatewayEventGuildMemberAddPayload struct {
structures.GuildMember
// id of the guild
GuildID string `json:"guild_id"`
}
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventGuildMemberAddPayload is sent when a new user joins a guild.
// The inner payload is a guild member object with an extra guild_id key
// If using Gateway Intents, the GUILD_MEMBERS intent will be required to receive this event.
type GatewayEventGuildMemberAddPayload struct {
structures.GuildMember
// id of the guild
GuildID string `json:"guild_id"`
}

View file

@ -1,12 +1,12 @@
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventGuildMemberRemovePayload is sent when a user is removed from a guild (leave/kick/ban).
// If using Gateway Intents, the GUILD_MEMBERS intent will be required to receive this event.
type GatewayEventGuildMemberRemovePayload struct {
// the id of the guild
GuildID string `json:"guild_id"`
// the user who was removed
User structures.User `json:"user"`
}
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventGuildMemberRemovePayload is sent when a user is removed from a guild (leave/kick/ban).
// If using Gateway Intents, the GUILD_MEMBERS intent will be required to receive this event.
type GatewayEventGuildMemberRemovePayload struct {
// the id of the guild
GuildID string `json:"guild_id"`
// the user who was removed
User structures.User `json:"user"`
}

View file

@ -1,23 +1,23 @@
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventGuildMemberUpdatePayload is sent when a guild member is updated.
// This will also fire when the user object of a guild member changes.
// If using Gateway Intents, the GUILD_MEMBERS intent will be required to receive this event.
type GatewayEventGuildMemberUpdatePayload struct {
// the id of the guild
GuildID string `json:"guild_id"`
// user role ids
Roles []string `json:"roles"`
// the user
User structures.User `json:"user"`
// nickname of the user in the guild
Nick string `json:"nick,omitempty"`
// when the user joined the guild
JoinedAt string `json:"joined_at"`
// when the user starting boosting the guild
PremiumSince string `json:"premium_since,omitempty"`
// whether the user has not yet passed the guild's Membership Screening requirements
Pending bool `json:"pending"`
}
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventGuildMemberUpdatePayload is sent when a guild member is updated.
// This will also fire when the user object of a guild member changes.
// If using Gateway Intents, the GUILD_MEMBERS intent will be required to receive this event.
type GatewayEventGuildMemberUpdatePayload struct {
// the id of the guild
GuildID string `json:"guild_id"`
// user role ids
Roles []string `json:"roles"`
// the user
User structures.User `json:"user"`
// nickname of the user in the guild
Nick string `json:"nick,omitempty"`
// when the user joined the guild
JoinedAt string `json:"joined_at"`
// when the user starting boosting the guild
PremiumSince string `json:"premium_since,omitempty"`
// whether the user has not yet passed the guild's Membership Screening requirements
Pending bool `json:"pending"`
}

View file

@ -1,22 +1,22 @@
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventGuildMembersChunkPayload is sent in response to Guild Request Members.
// You can use the chunk_index and chunk_count to calculate how many chunks are left for your request.
type GatewayEventGuildMembersChunkPayload struct {
// the id of the guild
GuildID string `json:"guild_id"`
// set of guild members
Members []structures.GuildMember `json:"members"`
// the chunk index in the expected chunks for this response (0 <= chunk_index < chunk_count)
ChunkIndex int `json:"chunk_index"`
// the total number of expected chunks for this response
ChunkCount int `json:"chunk_count"`
// if passing an invalid id to REQUEST_GUILD_MEMBERS, it will be returned here
NotFound []string `json:"not_found,omitempty"`
// if passing true to REQUEST_GUILD_MEMBERS, presences of the returned members will be here
Presences []structures.Presence `json:"presences"`
// the nonce used in the Guild Members Request
Nonce string `json:"nonce"`
}
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventGuildMembersChunkPayload is sent in response to Guild Request Members.
// You can use the chunk_index and chunk_count to calculate how many chunks are left for your request.
type GatewayEventGuildMembersChunkPayload struct {
// the id of the guild
GuildID string `json:"guild_id"`
// set of guild members
Members []structures.GuildMember `json:"members"`
// the chunk index in the expected chunks for this response (0 <= chunk_index < chunk_count)
ChunkIndex int `json:"chunk_index"`
// the total number of expected chunks for this response
ChunkCount int `json:"chunk_count"`
// if passing an invalid id to REQUEST_GUILD_MEMBERS, it will be returned here
NotFound []string `json:"not_found,omitempty"`
// if passing true to REQUEST_GUILD_MEMBERS, presences of the returned members will be here
Presences []structures.Presence `json:"presences"`
// the nonce used in the Guild Members Request
Nonce string `json:"nonce"`
}

View file

@ -1,11 +1,11 @@
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventGuildRoleCreatePayload is sent when a guild role is created.
type GatewayEventGuildRoleCreatePayload struct {
// the id of the guild
GuildID string `json:"guild_id"`
// the role created
Role structures.Role `json:"role"`
}
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventGuildRoleCreatePayload is sent when a guild role is created.
type GatewayEventGuildRoleCreatePayload struct {
// the id of the guild
GuildID string `json:"guild_id"`
// the role created
Role structures.Role `json:"role"`
}

View file

@ -1,9 +1,9 @@
package events
// GatewayEventGuildRoleDeletePayload is sent when a guild role is updated.
type GatewayEventGuildRoleDeletePayload struct {
// the id of the guild
GuildID string `json:"guild_id"`
// id of the role
RoleID string `json:"role_id"`
}
package events
// GatewayEventGuildRoleDeletePayload is sent when a guild role is updated.
type GatewayEventGuildRoleDeletePayload struct {
// the id of the guild
GuildID string `json:"guild_id"`
// id of the role
RoleID string `json:"role_id"`
}

View file

@ -1,11 +1,11 @@
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventGuildRoleUpdatePayload is sent when a guild role is updated.
type GatewayEventGuildRoleUpdatePayload struct {
// the id of the guild
GuildID string `json:"guild_id"`
// the role updated
Role structures.Role `json:"role"`
}
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventGuildRoleUpdatePayload is sent when a guild role is updated.
type GatewayEventGuildRoleUpdatePayload struct {
// the id of the guild
GuildID string `json:"guild_id"`
// the role updated
Role structures.Role `json:"role"`
}

View file

@ -1,6 +1,6 @@
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventGuildUpdatePayload is sent when a guild is updated. The inner payload is a guild object.
type GatewayEventGuildUpdatePayload structures.Guild
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventGuildUpdatePayload is sent when a guild is updated. The inner payload is a guild object.
type GatewayEventGuildUpdatePayload structures.Guild

View file

@ -1,9 +1,9 @@
package events
// GatewayEventHelloPayload is sent on connection to the websocket.
// Defines the heartbeat interval that the client should heartbeat to.
type GatewayEventHelloPayload struct {
// HeartbeatInterval is the interval (in milliseconds)
// the client should heartbeat with
HeartbeatInterval int `json:"heartbeat_interval"`
}
package events
// GatewayEventHelloPayload is sent on connection to the websocket.
// Defines the heartbeat interval that the client should heartbeat to.
type GatewayEventHelloPayload struct {
// HeartbeatInterval is the interval (in milliseconds)
// the client should heartbeat with
HeartbeatInterval int `json:"heartbeat_interval"`
}

View file

@ -1,8 +1,8 @@
package events
// GatewayEventInvalidSessionPayload is sent to indicate one of at least three different situations:the gateway could
// not initialize a session after receiving an Opcode 2 Identify the gateway could not resume un anterior session
// after receiving an Opcode 6 Resume the gateway has invalidated an active session and is requesting client
// actionThe inner d key is a boolean that indicates whether the session may be resumable.
// See Connecting and Resuming for more information.
type GatewayEventInvalidSessionPayload bool
package events
// GatewayEventInvalidSessionPayload is sent to indicate one of at least three different situations:the gateway could
// not initialize a session after receiving an Opcode 2 Identify the gateway could not resume un anterior session
// after receiving an Opcode 6 Resume the gateway has invalidated an active session and is requesting client
// actionThe inner d key is a boolean that indicates whether the session may be resumable.
// See Connecting and Resuming for more information.
type GatewayEventInvalidSessionPayload bool

View file

@ -1,32 +1,32 @@
package events
import (
"github.com/discordnova/nova/common/discord/types/structures"
"github.com/discordnova/nova/common/discord/types/types"
)
// GatewayEventInviteCreatePayload is sent when a new invite to a channel is created.
type GatewayEventInviteCreatePayload struct {
// the channel the invite is for
ChannelID string `json:"channel_id"`
// the unique invite code
Code string `json:"code"`
// the time at which the invite was created
CreatedAt string `json:"created_at"`
// the guild of the invite
GuildID string `json:"guild_id,omitempty"`
// the user that created the invite
Inviter structures.User `json:"inviter,omitempty"`
// how long the invite is valid for (in seconds)
MaxAge int `json:"max_age"`
// the maximum number of times the invite can be used
MaxUses int `json:"max_uses"`
// the target user for this invite
TargetUser structures.User `json:"target_user,omitempty"`
// the type of user target for this invite
TargetUserType types.TargetUserTypes `json:"target_user_type"`
// whether or not the invite is temporary (invited users will be kicked on disconnect unless they're assigned a role)
Temporary bool `json:"temporary"`
// how many times the invite has been used (always will be 0)
Uses int `json:"uses"`
}
package events
import (
"github.com/discordnova/nova/common/discord/types/structures"
"github.com/discordnova/nova/common/discord/types/types"
)
// GatewayEventInviteCreatePayload is sent when a new invite to a channel is created.
type GatewayEventInviteCreatePayload struct {
// the channel the invite is for
ChannelID string `json:"channel_id"`
// the unique invite code
Code string `json:"code"`
// the time at which the invite was created
CreatedAt string `json:"created_at"`
// the guild of the invite
GuildID string `json:"guild_id,omitempty"`
// the user that created the invite
Inviter structures.User `json:"inviter,omitempty"`
// how long the invite is valid for (in seconds)
MaxAge int `json:"max_age"`
// the maximum number of times the invite can be used
MaxUses int `json:"max_uses"`
// the target user for this invite
TargetUser structures.User `json:"target_user,omitempty"`
// the type of user target for this invite
TargetUserType types.TargetUserTypes `json:"target_user_type"`
// whether or not the invite is temporary (invited users will be kicked on disconnect unless they're assigned a role)
Temporary bool `json:"temporary"`
// how many times the invite has been used (always will be 0)
Uses int `json:"uses"`
}

View file

@ -1,11 +1,11 @@
package events
// GatewayEventInviteDeletePayload is sent when an invite is deleted.
type GatewayEventInviteDeletePayload struct {
// the channel of the invite
ChannelID string `json:"channel_id"`
// the guild of the invite
GuildID string `json:"guild_id"`
// the unique invite code
Code string `json:"code"`
}
package events
// GatewayEventInviteDeletePayload is sent when an invite is deleted.
type GatewayEventInviteDeletePayload struct {
// the channel of the invite
ChannelID string `json:"channel_id"`
// the guild of the invite
GuildID string `json:"guild_id"`
// the unique invite code
Code string `json:"code"`
}

View file

@ -1,11 +1,11 @@
package events
// GatewayEventMessageBulkDeletePayload is sent when multiple messages are deleted at once.
type GatewayEventMessageBulkDeletePayload struct {
// the ids of the messages
IDs []string `json:"ids"`
// the id of the channel
ChannelID string `json:"channel_id"`
// the id of the guild
GuildID string `json:"guild_id,omitempty"`
}
package events
// GatewayEventMessageBulkDeletePayload is sent when multiple messages are deleted at once.
type GatewayEventMessageBulkDeletePayload struct {
// the ids of the messages
IDs []string `json:"ids"`
// the id of the channel
ChannelID string `json:"channel_id"`
// the id of the guild
GuildID string `json:"guild_id,omitempty"`
}

View file

@ -1,6 +1,6 @@
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventMessageCreatePayload is sent when a message is created. The inner payload is a message object.
type GatewayEventMessageCreatePayload structures.Message
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventMessageCreatePayload is sent when a message is created. The inner payload is a message object.
type GatewayEventMessageCreatePayload structures.Message

View file

@ -1,11 +1,11 @@
package events
// GatewayEventMessageDeletePayload is sent when a message is deleted.
type GatewayEventMessageDeletePayload struct {
// the id of the message
ID string `json:"id"`
// the id of the channel
ChannelID string `json:"channel_id"`
// the id of the guild
GuildID string `json:"guild_id"`
}
package events
// GatewayEventMessageDeletePayload is sent when a message is deleted.
type GatewayEventMessageDeletePayload struct {
// the id of the message
ID string `json:"id"`
// the id of the channel
ChannelID string `json:"channel_id"`
// the id of the guild
GuildID string `json:"guild_id"`
}

View file

@ -1,19 +1,19 @@
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventMessageReactionAdd is sent when a user adds a reaction to a message.
type GatewayEventMessageReactionAdd struct {
// the id of the user
UserID string `json:"user_id"`
// the id of the channel
ChannelID string `json:"channel_id"`
// the id of the message
MessageID string `json:"message_id"`
// the id of the guild
GuildID string `json:"guild_id,omitempty"`
// the member who reacted if this happened in a guild
Member structures.GuildMember `json:"member"`
// the emoji used to react
Emoji structures.Emoji `json:"emoji"`
}
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventMessageReactionAdd is sent when a user adds a reaction to a message.
type GatewayEventMessageReactionAdd struct {
// the id of the user
UserID string `json:"user_id"`
// the id of the channel
ChannelID string `json:"channel_id"`
// the id of the message
MessageID string `json:"message_id"`
// the id of the guild
GuildID string `json:"guild_id,omitempty"`
// the member who reacted if this happened in a guild
Member structures.GuildMember `json:"member"`
// the emoji used to react
Emoji structures.Emoji `json:"emoji"`
}

View file

@ -1,11 +1,11 @@
package events
// GatewayEventMessageReactionRemoveAll is sent when a user explicitly removes all reactions from a message.
type GatewayEventMessageReactionRemoveAll struct {
// the id of the channel
ChannelID string `json:"channel_id"`
// the id of the message
MessageID string `json:"message_id"`
// the id of the guild
GuildID string `json:"guild_id,omitempty"`
}
package events
// GatewayEventMessageReactionRemoveAll is sent when a user explicitly removes all reactions from a message.
type GatewayEventMessageReactionRemoveAll struct {
// the id of the channel
ChannelID string `json:"channel_id"`
// the id of the message
MessageID string `json:"message_id"`
// the id of the guild
GuildID string `json:"guild_id,omitempty"`
}

View file

@ -1,16 +1,16 @@
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventMessageReactionRemoveEmojiPayload is sent when a bot removes all instances of a given emoji from the
// reactions of a message.
type GatewayEventMessageReactionRemoveEmojiPayload struct {
// the id of the channel
ChannelID string `json:"channel_id"`
// the id of the guild
GuildID string `json:"guild_id,omitempty"`
// the id of the message
MessageID string `json:"message_id"`
// the emoji that was removed
Emoji structures.Emoji `json:"emoji"`
}
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventMessageReactionRemoveEmojiPayload is sent when a bot removes all instances of a given emoji from the
// reactions of a message.
type GatewayEventMessageReactionRemoveEmojiPayload struct {
// the id of the channel
ChannelID string `json:"channel_id"`
// the id of the guild
GuildID string `json:"guild_id,omitempty"`
// the id of the message
MessageID string `json:"message_id"`
// the emoji that was removed
Emoji structures.Emoji `json:"emoji"`
}

View file

@ -1,17 +1,17 @@
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventMessageReactionRemove is sent when a user removes a reaction from a message.
type GatewayEventMessageReactionRemove struct {
// the id of the user
UserID string `json:"user_id"`
// the id of the channel
ChannelID string `json:"channel_id"`
// the id of the message
MessageID string `json:"message_id"`
// the id of the guild
GuildID string `json:"guild_id,omitempty"`
// the emoji used to react
Emoji structures.Emoji `json:"emoji"`
}
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventMessageReactionRemove is sent when a user removes a reaction from a message.
type GatewayEventMessageReactionRemove struct {
// the id of the user
UserID string `json:"user_id"`
// the id of the channel
ChannelID string `json:"channel_id"`
// the id of the message
MessageID string `json:"message_id"`
// the id of the guild
GuildID string `json:"guild_id,omitempty"`
// the emoji used to react
Emoji structures.Emoji `json:"emoji"`
}

View file

@ -1,8 +1,8 @@
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventMessageUpdatePayload is sent when a message is updated. The inner payload is a message object.
// Unlike creates, message updates may contain only a subset of the full message object payload
// (but will always contain an id and channel_id).
type GatewayEventMessageUpdatePayload structures.Message
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventMessageUpdatePayload is sent when a message is updated. The inner payload is a message object.
// Unlike creates, message updates may contain only a subset of the full message object payload
// (but will always contain an id and channel_id).
type GatewayEventMessageUpdatePayload structures.Message

View file

@ -1,26 +1,26 @@
package events
import (
"github.com/discordnova/nova/common/discord/types/structures"
"github.com/discordnova/nova/common/discord/types/types"
)
// GatewayEventPresenceUpdatePayload is sent when a user's presence or info, such as name or avatar, is updated.
// If you are using Gateway Intents, you must specify the GUILD_PRESENCES intent in order to receive
// Presence Update events
// The user object within this event can be partial, the only field which must be sent is the id field,
// everything else is optional. Along with this limitation, no fields are required,
// and the types of the fields are not validated.
// Your client should expect any combination of fields and types within this event.
type GatewayEventPresenceUpdatePayload struct {
// the user presence is being updated for
User structures.User `json:"user"`
// id of the guild
GuildID string `json:"guild_id"`
// either "idle", "dnd", "online", or "offline"
Status types.Statuses `json:"status"`
// user's current activities
Activities []structures.Activity `json:"activities"`
// user's platform-dependent status
ClientStatus types.ClientStatuses `json:"client_status"`
}
package events
import (
"github.com/discordnova/nova/common/discord/types/structures"
"github.com/discordnova/nova/common/discord/types/types"
)
// GatewayEventPresenceUpdatePayload is sent when a user's presence or info, such as name or avatar, is updated.
// If you are using Gateway Intents, you must specify the GUILD_PRESENCES intent in order to receive
// Presence Update events
// The user object within this event can be partial, the only field which must be sent is the id field,
// everything else is optional. Along with this limitation, no fields are required,
// and the types of the fields are not validated.
// Your client should expect any combination of fields and types within this event.
type GatewayEventPresenceUpdatePayload struct {
// the user presence is being updated for
User structures.User `json:"user"`
// id of the guild
GuildID string `json:"guild_id"`
// either "idle", "dnd", "online", or "offline"
Status types.Statuses `json:"status"`
// user's current activities
Activities []structures.Activity `json:"activities"`
// user's platform-dependent status
ClientStatus types.ClientStatuses `json:"client_status"`
}

View file

@ -1,27 +1,27 @@
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventReadyPayload is the ready event is dispatched when a client has
// completed the initial handshake with the gateway (for new sessions).
// The ready event can be the largest and most complex event the gateway
// will send, as it contains all the state required for a client
// to begin interacting with the rest of the platform.
type GatewayEventReadyPayload struct {
// V is the gateway version
V int `json:"v"`
// User is information about the user including email
User structures.User `json:"user"`
// PrivateChannels is an empty array
PrivateChannels []string `json:"private_channels"`
// Guilds are the guilds the user is in
// Note: they are only sent as unavailable guilds
Guilds []structures.Guild `json:"guilds"`
// SessionID is used for resuming connections
SessionID string `json:"session_id"`
// Shard is the shard information associated with the session, if sent
// when identifying. This is an array of two integers (shard_id, num_shards)
Shard []int `json:"shard,omitempty"`
// contains id and flags
Application structures.Application `json:"application"`
}
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventReadyPayload is the ready event is dispatched when a client has
// completed the initial handshake with the gateway (for new sessions).
// The ready event can be the largest and most complex event the gateway
// will send, as it contains all the state required for a client
// to begin interacting with the rest of the platform.
type GatewayEventReadyPayload struct {
// V is the gateway version
V int `json:"v"`
// User is information about the user including email
User structures.User `json:"user"`
// PrivateChannels is an empty array
PrivateChannels []string `json:"private_channels"`
// Guilds are the guilds the user is in
// Note: they are only sent as unavailable guilds
Guilds []structures.Guild `json:"guilds"`
// SessionID is used for resuming connections
SessionID string `json:"session_id"`
// Shard is the shard information associated with the session, if sent
// when identifying. This is an array of two integers (shard_id, num_shards)
Shard []int `json:"shard,omitempty"`
// contains id and flags
Application structures.Application `json:"application"`
}

View file

@ -1,5 +1,5 @@
package events
// GatewayEventReconnectPayload is the payload sent when receiving a Reconnect event
// There is nothing...
type GatewayEventReconnectPayload struct{}
package events
// GatewayEventReconnectPayload is the payload sent when receiving a Reconnect event
// There is nothing...
type GatewayEventReconnectPayload struct{}

View file

@ -1,5 +1,5 @@
package events
// GatewayEventResumedPayload is the payload sent when receiving a Resumed event
// There is nothing...
type GatewayEventResumedPayload struct{}
package events
// GatewayEventResumedPayload is the payload sent when receiving a Resumed event
// There is nothing...
type GatewayEventResumedPayload struct{}

View file

@ -1,17 +1,17 @@
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventTypingStartPayload is sent when a user starts typing in a channel.
type GatewayEventTypingStartPayload struct {
// id of the channel
ChannelID string `json:"channel_id"`
// id of the guild
GuildID string `json:"guild_id,omitempty"`
// id of the user
UserID string `json:"user_id"`
// unix time (in seconds) of when the user started typing
Timestamp int `json:"timestamp"`
// the member who started typing if this happened in a guild
Member structures.GuildMember `json:"member,omitempty"`
}
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventTypingStartPayload is sent when a user starts typing in a channel.
type GatewayEventTypingStartPayload struct {
// id of the channel
ChannelID string `json:"channel_id"`
// id of the guild
GuildID string `json:"guild_id,omitempty"`
// id of the user
UserID string `json:"user_id"`
// unix time (in seconds) of when the user started typing
Timestamp int `json:"timestamp"`
// the member who started typing if this happened in a guild
Member structures.GuildMember `json:"member,omitempty"`
}

View file

@ -1,6 +1,6 @@
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventUserUpdatePayload is sent when properties about the user change.
type GatewayEventUserUpdatePayload structures.User
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventUserUpdatePayload is sent when properties about the user change.
type GatewayEventUserUpdatePayload structures.User

View file

@ -1,11 +1,11 @@
package events
// GatewayEventVoiceServerUpdate is sent when a guild's voice server is updated.
type GatewayEventVoiceServerUpdate struct {
// voice connection token
Token string `json:"token"`
// the guild this voice server update is for
GuildID string `json:"guild_id"`
// the voice server host
Endpoint string `json:"endpoint"`
}
package events
// GatewayEventVoiceServerUpdate is sent when a guild's voice server is updated.
type GatewayEventVoiceServerUpdate struct {
// voice connection token
Token string `json:"token"`
// the guild this voice server update is for
GuildID string `json:"guild_id"`
// the voice server host
Endpoint string `json:"endpoint"`
}

View file

@ -1,6 +1,6 @@
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventVoiceStateUpdatePayload is sent when someone joins/leaves/moves voice channels
type GatewayEventVoiceStateUpdatePayload structures.VoiceState
package events
import "github.com/discordnova/nova/common/discord/types/structures"
// GatewayEventVoiceStateUpdatePayload is sent when someone joins/leaves/moves voice channels
type GatewayEventVoiceStateUpdatePayload structures.VoiceState

View file

@ -1,9 +1,9 @@
package events
// GatewayEventWebhookUpdatePayload is sent when a guild channel's webhook is created, updated, or deleted.
type GatewayEventWebhookUpdatePayload struct {
// id of the guild
GuildID string `json:"guild_id"`
// id of the channel
ChannelID string `json:"channel_id"`
}
package events
// GatewayEventWebhookUpdatePayload is sent when a guild channel's webhook is created, updated, or deleted.
type GatewayEventWebhookUpdatePayload struct {
// id of the guild
GuildID string `json:"guild_id"`
// id of the channel
ChannelID string `json:"channel_id"`
}

View file

@ -1,20 +1,20 @@
package gateway
import (
"encoding/json"
"github.com/discordnova/nova/common/discord/types/types"
)
// Payload is the base of each payload sent to the Gateway, everything
// else is in the d property.
type Payload struct {
// Op is the opcode for the payload
Op types.GatewayOpCodes `json:"op"`
// D is the event data
D json.RawMessage `json:"d"`
// S is a sequence number used for resuming sessions and heartbeats
S int64 `json:"s"`
// T is the event name for this payload
T string `json:"t"`
}
package gateway
import (
"encoding/json"
"github.com/discordnova/nova/common/discord/types/types"
)
// Payload is the base of each payload sent to the Gateway, everything
// else is in the d property.
type Payload struct {
// Op is the opcode for the payload
Op types.GatewayOpCodes `json:"op"`
// D is the event data
D json.RawMessage `json:"d"`
// S is a sequence number used for resuming sessions and heartbeats
S int64 `json:"s"`
// T is the event name for this payload
T string `json:"t"`
}

View file

@ -1,13 +1,13 @@
package structures
// ActivityAssets is a representation of the assets object sent in an Activity
type ActivityAssets struct {
// the id for a large asset of the activity, usually a snowflake
LargeImage string `json:"large_image,omitempty"`
// text displayed when hovering over the large image of the activity
LargeText string `json:"large_text,omitempty"`
// the id for a small asset of the activity, usually a snowflake
SmallImage string `json:"small_image,omitempty"`
// text displayed when hovering over the small image of the activity
SmallText string `json:"small_text,omitempty"`
}
package structures
// ActivityAssets is a representation of the assets object sent in an Activity
type ActivityAssets struct {
// the id for a large asset of the activity, usually a snowflake
LargeImage string `json:"large_image,omitempty"`
// text displayed when hovering over the large image of the activity
LargeText string `json:"large_text,omitempty"`
// the id for a small asset of the activity, usually a snowflake
SmallImage string `json:"small_image,omitempty"`
// text displayed when hovering over the small image of the activity
SmallText string `json:"small_text,omitempty"`
}

View file

@ -1,11 +1,11 @@
package structures
// ActivityEmoji is the representation of an Emoji object sent for Activities
type ActivityEmoji struct {
// the name of the emoji
Name string `json:"name"`
// the id of the emoji
ID string `json:"id,omitempty"`
// whether this emoji is animated
Animated bool `json:"animated,omitempty"`
}
package structures
// ActivityEmoji is the representation of an Emoji object sent for Activities
type ActivityEmoji struct {
// the name of the emoji
Name string `json:"name"`
// the id of the emoji
ID string `json:"id,omitempty"`
// whether this emoji is animated
Animated bool `json:"animated,omitempty"`
}

View file

@ -1,10 +1,10 @@
package structures
// ActivityParty is a representation of a party sent in an Activity
type ActivityParty struct {
// the id of the party
ID string `json:"id,omitempty"`
// used to show the party's current and maximum size
// This is an array of two integers (current_size, max_size)
Size []int `json:"size,omitempty"`
}
package structures
// ActivityParty is a representation of a party sent in an Activity
type ActivityParty struct {
// the id of the party
ID string `json:"id,omitempty"`
// used to show the party's current and maximum size
// This is an array of two integers (current_size, max_size)
Size []int `json:"size,omitempty"`
}

View file

@ -1,11 +1,11 @@
package structures
// ActivitySecrets is a representation of the secrets object sent in an Activity
type ActivitySecrets struct {
// the secret for joining a party
Join string `json:"join,omitempty"`
// the secret for spectating a game
Spectate string `json:"spectate,omitempty"`
// the secret for a specific instanced match
Match string `json:"match,omitempty"`
}
package structures
// ActivitySecrets is a representation of the secrets object sent in an Activity
type ActivitySecrets struct {
// the secret for joining a party
Join string `json:"join,omitempty"`
// the secret for spectating a game
Spectate string `json:"spectate,omitempty"`
// the secret for a specific instanced match
Match string `json:"match,omitempty"`
}

View file

@ -1,9 +1,9 @@
package structures
// ActivityTimestamps are the timestamps of an activity
type ActivityTimestamps struct {
// unix time (in milliseconds) of when the activity started
Start int `json:"start,omitempty"`
// unix time (in milliseconds) of when the activity ends
End int `json:"end,omitempty"`
}
package structures
// ActivityTimestamps are the timestamps of an activity
type ActivityTimestamps struct {
// unix time (in milliseconds) of when the activity started
Start int `json:"start,omitempty"`
// unix time (in milliseconds) of when the activity ends
End int `json:"end,omitempty"`
}

View file

@ -1,36 +1,36 @@
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// Activity represents a presence's activity
// Bots are only able to send name, type, and optionally url.
type Activity struct {
// the activity's name
Name string `json:"name"`
// activity type
Type int `json:"type"`
// stream url, is validated when type is 1
URL string `json:"url,omitempty"`
// unix timestamp of when the activity was added to the user's session
CreatedAt int `json:"created_at"`
// unix timestamps for start and/or end of the game
Timestamps ActivityTimestamps `json:"timestamps,omitempty"`
// application id for the game
ApplicationID string `json:"application_id,omitempty"`
// what the player is currently doing
Details string `json:"details,omitempty"`
// the user's current party status
State string `json:"state,omitempty"`
// the emoji used for a custom status
Emoji ActivityEmoji `json:"emoji,omitempty"`
// information for the current party of the player
Party ActivityParty `json:"party,omitempty"`
// images for the presence and their hover texts
Assets ActivityAssets `json:"assets,omitempty"`
// secrets for Rich Presence joining and spectating
Secrets ActivitySecrets `json:"secrets,omitempty"`
// whether or not the activity is an instanced game session
Instance bool `json:"instance,omitempty"`
// activity flags ORd together, describes what the payload includes
Flags types.ActivityFlags `json:"flags,omitempty"`
}
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// Activity represents a presence's activity
// Bots are only able to send name, type, and optionally url.
type Activity struct {
// the activity's name
Name string `json:"name"`
// activity type
Type int `json:"type"`
// stream url, is validated when type is 1
URL string `json:"url,omitempty"`
// unix timestamp of when the activity was added to the user's session
CreatedAt int `json:"created_at"`
// unix timestamps for start and/or end of the game
Timestamps ActivityTimestamps `json:"timestamps,omitempty"`
// application id for the game
ApplicationID string `json:"application_id,omitempty"`
// what the player is currently doing
Details string `json:"details,omitempty"`
// the user's current party status
State string `json:"state,omitempty"`
// the emoji used for a custom status
Emoji ActivityEmoji `json:"emoji,omitempty"`
// information for the current party of the player
Party ActivityParty `json:"party,omitempty"`
// images for the presence and their hover texts
Assets ActivityAssets `json:"assets,omitempty"`
// secrets for Rich Presence joining and spectating
Secrets ActivitySecrets `json:"secrets,omitempty"`
// whether or not the activity is an instanced game session
Instance bool `json:"instance,omitempty"`
// activity flags ORd together, describes what the payload includes
Flags types.ActivityFlags `json:"flags,omitempty"`
}

View file

@ -1,38 +1,38 @@
package structures
// Application represents a Discord Application
type Application struct {
// the id of the app
ID string `json:"id"`
// the name of the app
Name string `json:"name"`
// the icon hash of the app
Icon string `json:"icon,omitempty"`
// the description of the app
Description string `json:"description"`
// an array of rpc origin urls, if rpc is enabled
RPCOrigins []string `json:"rpc_origins,omitempty"`
// when false only app owner can join the app's bot to guilds
BotPublic bool `json:"bot_public"`
// when true the app's bot will only join upon completion of the full oauth2 code grant flow
BotRequireCodeGrant bool `json:"bot_require_code_grant"`
// partial user object containing info on the owner of the application
Owner User `json:"owner"`
// if this application is a game sold on Discord, this field will be the summary field for the store page of its sku
Summary string `json:"summary"`
// the base64 encoded key for the GameSDK's GetTicket
VerifyKey string `json:"verify_key"`
// if the application belongs to a team, this will be a list of the members of that team
Team Team `json:"team"`
// if this application is a game sold on Discord, this field will be the guild to which it has been linked
GuildID string `json:"guild_id,omitempty"`
// if this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created,
// if exists
PrimarySKUID string `json:"primary_sku_id,omitempty"`
// if this application is a game sold on Discord, this field will be the URL slug that links to the store page
Slug string `json:"slug,omitempty"`
// if this application is a game sold on Discord, this field will be the hash of the image on store embeds
CoverImage string `json:"cover_image,omitempty"`
// the application's public flags
Flags int `json:"flags"`
}
package structures
// Application represents a Discord Application
type Application struct {
// the id of the app
ID string `json:"id"`
// the name of the app
Name string `json:"name"`
// the icon hash of the app
Icon string `json:"icon,omitempty"`
// the description of the app
Description string `json:"description"`
// an array of rpc origin urls, if rpc is enabled
RPCOrigins []string `json:"rpc_origins,omitempty"`
// when false only app owner can join the app's bot to guilds
BotPublic bool `json:"bot_public"`
// when true the app's bot will only join upon completion of the full oauth2 code grant flow
BotRequireCodeGrant bool `json:"bot_require_code_grant"`
// partial user object containing info on the owner of the application
Owner User `json:"owner"`
// if this application is a game sold on Discord, this field will be the summary field for the store page of its sku
Summary string `json:"summary"`
// the base64 encoded key for the GameSDK's GetTicket
VerifyKey string `json:"verify_key"`
// if the application belongs to a team, this will be a list of the members of that team
Team Team `json:"team"`
// if this application is a game sold on Discord, this field will be the guild to which it has been linked
GuildID string `json:"guild_id,omitempty"`
// if this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created,
// if exists
PrimarySKUID string `json:"primary_sku_id,omitempty"`
// if this application is a game sold on Discord, this field will be the URL slug that links to the store page
Slug string `json:"slug,omitempty"`
// if this application is a game sold on Discord, this field will be the hash of the image on store embeds
CoverImage string `json:"cover_image,omitempty"`
// the application's public flags
Flags int `json:"flags"`
}

View file

@ -1,19 +1,19 @@
package structures
// Attachment is the representation of a message attachment
type Attachment struct {
// attachment id
ID string `json:"id"`
// name of file attached
Filename string `json:"filename"`
// size of file in bytes
Size int `json:"size"`
// source url of file
URL string `json:"url"`
// a proxied url of file
ProxyURL string `json:"proxy_url"`
// height of file (if image)
Height int `json:"height,omitempty"`
// width of file (if image)
Width int `json:"width,omitempty"`
}
package structures
// Attachment is the representation of a message attachment
type Attachment struct {
// attachment id
ID string `json:"id"`
// name of file attached
Filename string `json:"filename"`
// size of file in bytes
Size int `json:"size"`
// source url of file
URL string `json:"url"`
// a proxied url of file
ProxyURL string `json:"proxy_url"`
// height of file (if image)
Height int `json:"height,omitempty"`
// width of file (if image)
Width int `json:"width,omitempty"`
}

View file

@ -1,15 +1,15 @@
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// ChannelMention is a representation of a Channel mention
type ChannelMention struct {
// id of the channel
ID string `json:"id"`
// id of the guild containing the channel
GuildID string `json:"guild_id"`
// the type of channel
Type types.ChannelTypes `json:"type"`
// the name of the channel
Name string `json:"name"`
}
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// ChannelMention is a representation of a Channel mention
type ChannelMention struct {
// id of the channel
ID string `json:"id"`
// id of the guild containing the channel
GuildID string `json:"guild_id"`
// the type of channel
Type types.ChannelTypes `json:"type"`
// the name of the channel
Name string `json:"name"`
}

View file

@ -1,45 +1,45 @@
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// Channel represents a guild or DM channel
type Channel struct {
// the id of this channel
ID string `json:"id"`
// the type of channel
Type types.ChannelTypes `json:"type"`
// the id of the guild
GuildID string `json:"guild_id,omitempty"`
// sorting position of the channel
Position int `json:"position,omitempty"`
// explicit permission overwrites for members and roles
PermissionOverwrites []Overwrite `json:"permission_overwrites,omitempty"`
// the name of the channel (2-100 characters)
Name string `json:"name,omitempty"`
// the channel topic (0-1024 characters)
Topic string `json:"topic,omitempty"`
// whether the channel is nsfw
NSFW bool `json:"nsfw,omitempty"`
// the id of the last message sent in this channel (may not point to an existing or valid message)
LastMessageID string `json:"last_message_id,omitempty"`
// the bitrate (in bits) of the voice channel
Bitrate int `json:"bitrate,omitempty"`
// the user limit of the voice channel
UserLimit int `json:"user_limit,omitempty"`
// amount of seconds a user has to wait before sending another message (0-21600);
// bots, as well as users with the permission manage_messages or manage_channel, are unaffected
RateLimitPerUser int `json:"rate_limit_per_user,omitempty"`
// the recipients of the DM
Recipients []User `json:"recipients,omitempty"`
// icon hash
Icon string `json:"icon,omitempty"`
// id of the DM creator
OwnerID string `json:"owner_id,omitempty"`
// application id of the group DM creator if it is bot-created
ApplicationID string `json:"application_id,omitempty"`
// id of the parent category for a channel (each parent category can contain up to 50 channels)
ParentID string `json:"parent_id,omitempty"`
// when the last pinned message was pinned. This may be null in events such as GUILD_CREATE when a
// message is not pinned.
LastPinTimestamp string `json:"last_pin_timestamp,omitempty"`
}
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// Channel represents a guild or DM channel
type Channel struct {
// the id of this channel
ID string `json:"id"`
// the type of channel
Type types.ChannelTypes `json:"type"`
// the id of the guild
GuildID string `json:"guild_id,omitempty"`
// sorting position of the channel
Position int `json:"position,omitempty"`
// explicit permission overwrites for members and roles
PermissionOverwrites []Overwrite `json:"permission_overwrites,omitempty"`
// the name of the channel (2-100 characters)
Name string `json:"name,omitempty"`
// the channel topic (0-1024 characters)
Topic string `json:"topic,omitempty"`
// whether the channel is nsfw
NSFW bool `json:"nsfw,omitempty"`
// the id of the last message sent in this channel (may not point to an existing or valid message)
LastMessageID string `json:"last_message_id,omitempty"`
// the bitrate (in bits) of the voice channel
Bitrate int `json:"bitrate,omitempty"`
// the user limit of the voice channel
UserLimit int `json:"user_limit,omitempty"`
// amount of seconds a user has to wait before sending another message (0-21600);
// bots, as well as users with the permission manage_messages or manage_channel, are unaffected
RateLimitPerUser int `json:"rate_limit_per_user,omitempty"`
// the recipients of the DM
Recipients []User `json:"recipients,omitempty"`
// icon hash
Icon string `json:"icon,omitempty"`
// id of the DM creator
OwnerID string `json:"owner_id,omitempty"`
// application id of the group DM creator if it is bot-created
ApplicationID string `json:"application_id,omitempty"`
// id of the parent category for a channel (each parent category can contain up to 50 channels)
ParentID string `json:"parent_id,omitempty"`
// when the last pinned message was pinned. This may be null in events such as GUILD_CREATE when a
// message is not pinned.
LastPinTimestamp string `json:"last_pin_timestamp,omitempty"`
}

View file

@ -1,13 +1,13 @@
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// ClientStatus is the representation of a Client Status, for sessions indication
type ClientStatus struct {
// the user's status set for an active desktop (Windows, Linux, Mac) application session
Desktop types.ClientStatuses `json:"desktop,omitempty"`
// the user's status set for an active mobile (iOS, Android) application session
Mobile types.ClientStatuses `json:"mobile,omitempty"`
// the user's status set for an active web (browser, bot account) application session
Web types.ClientStatuses `json:"web,omitempty"`
}
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// ClientStatus is the representation of a Client Status, for sessions indication
type ClientStatus struct {
// the user's status set for an active desktop (Windows, Linux, Mac) application session
Desktop types.ClientStatuses `json:"desktop,omitempty"`
// the user's status set for an active mobile (iOS, Android) application session
Mobile types.ClientStatuses `json:"mobile,omitempty"`
// the user's status set for an active web (browser, bot account) application session
Web types.ClientStatuses `json:"web,omitempty"`
}

View file

@ -1,13 +1,13 @@
package structures
// EmbedAuthor represents the author object of an embed
type EmbedAuthor struct {
// name of author
Name string `json:"name,omitempty"`
// url of author
URL string `json:"url,omitempty"`
// url of author icon (only supports http(s) and attachments)
IconURL string `json:"icon_url,omitempty"`
// a proxied url of author icon
ProxyIconURL string `json:"proxy_icon_url,omitempty"`
}
package structures
// EmbedAuthor represents the author object of an embed
type EmbedAuthor struct {
// name of author
Name string `json:"name,omitempty"`
// url of author
URL string `json:"url,omitempty"`
// url of author icon (only supports http(s) and attachments)
IconURL string `json:"icon_url,omitempty"`
// a proxied url of author icon
ProxyIconURL string `json:"proxy_icon_url,omitempty"`
}

View file

@ -1,11 +1,11 @@
package structures
// EmbedField is the representation of a field in an embed
type EmbedField struct {
// name of the field
Name string `json:"name"`
// value of the field
Value string `json:"value"`
// whether or not this field should display inline
Inline bool `json:"inline,omitempty"`
}
package structures
// EmbedField is the representation of a field in an embed
type EmbedField struct {
// name of the field
Name string `json:"name"`
// value of the field
Value string `json:"value"`
// whether or not this field should display inline
Inline bool `json:"inline,omitempty"`
}

View file

@ -1,11 +1,11 @@
package structures
// EmbedFooter represents the footer of an embed
type EmbedFooter struct {
// footer text
Text string `json:"text"`
// url of footer icon (only supports http(s) and attachments)
IconURL string `json:"icon_url,omitempty"`
// a proxied url of footer icon
ProxyIconURL string `json:"proxy_icon_url,omitempty"`
}
package structures
// EmbedFooter represents the footer of an embed
type EmbedFooter struct {
// footer text
Text string `json:"text"`
// url of footer icon (only supports http(s) and attachments)
IconURL string `json:"icon_url,omitempty"`
// a proxied url of footer icon
ProxyIconURL string `json:"proxy_icon_url,omitempty"`
}

View file

@ -1,13 +1,13 @@
package structures
// EmbedImage represents the image object of an embed
type EmbedImage struct {
// source url of image (only supports http(s) and attachments)
URL string `json:"url,omitempty"`
// a proxied url of the image
ProxyURL string `json:"proxy_url,omitempty"`
// height of image
Height int `json:"height,omitempty"`
// width of image
Width int `json:"width,omitempty"`
}
package structures
// EmbedImage represents the image object of an embed
type EmbedImage struct {
// source url of image (only supports http(s) and attachments)
URL string `json:"url,omitempty"`
// a proxied url of the image
ProxyURL string `json:"proxy_url,omitempty"`
// height of image
Height int `json:"height,omitempty"`
// width of image
Width int `json:"width,omitempty"`
}

View file

@ -1,9 +1,9 @@
package structures
// EmbedProvider represents the provider object of an embed
type EmbedProvider struct {
// name of provider
Name string `json:"name,omitempty"`
// url of provider
URL string `json:"url,omitempty"`
}
package structures
// EmbedProvider represents the provider object of an embed
type EmbedProvider struct {
// name of provider
Name string `json:"name,omitempty"`
// url of provider
URL string `json:"url,omitempty"`
}

View file

@ -1,13 +1,13 @@
package structures
// EmbedThumbnail represents the thumbnail object of an embed
type EmbedThumbnail struct {
// source url of thumbnail (only supports http(s) and attachments)
URL string `json:"url,omitempty"`
// a proxied url of the thumbnail
ProxyURL string `json:"proxy_url,omitempty"`
// height of thumbnail
Height int `json:"height,omitempty"`
// width of thumbnail
Width int `json:"width,omitempty"`
}
package structures
// EmbedThumbnail represents the thumbnail object of an embed
type EmbedThumbnail struct {
// source url of thumbnail (only supports http(s) and attachments)
URL string `json:"url,omitempty"`
// a proxied url of the thumbnail
ProxyURL string `json:"proxy_url,omitempty"`
// height of thumbnail
Height int `json:"height,omitempty"`
// width of thumbnail
Width int `json:"width,omitempty"`
}

View file

@ -1,13 +1,13 @@
package structures
// EmbedVideo represents the video object of an embed
type EmbedVideo struct {
// source url of video
URL string `json:"url,omitempty"`
// a proxied url of the video
ProxyURL string `json:"proxy_url,omitempty"`
// height of video
Height int `json:"height,omitempty"`
// width of video
Width int `json:"width,omitempty"`
}
package structures
// EmbedVideo represents the video object of an embed
type EmbedVideo struct {
// source url of video
URL string `json:"url,omitempty"`
// a proxied url of the video
ProxyURL string `json:"proxy_url,omitempty"`
// height of video
Height int `json:"height,omitempty"`
// width of video
Width int `json:"width,omitempty"`
}

View file

@ -1,33 +1,33 @@
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// Embed is the representation of an Embed
type Embed struct {
// title of embed
Title string `json:"title,omitempty"`
// type of embed (always "rich" for webhook embeds)
Type types.EmbedTypes `json:"type,omitempty"`
// description of embed
Description string `json:"description,omitempty"`
// url of embed
URL string `json:"url,omitempty"`
// timestamp of embed content
Timestamp string `json:"timestamp,omitempty"`
// color code of the embed
Color int `json:"color,omitempty"`
// footer information
Footer EmbedFooter `json:"footer,omitempty"`
// image information
Image EmbedImage `json:"image,omitempty"`
// thumbnail information
Thumbnail EmbedThumbnail `json:"thumbnail,omitempty"`
// video information
Video EmbedVideo `json:"video,omitempty"`
// provider information
Provider EmbedProvider `json:"provider,omitempty"`
// author information
Author EmbedAuthor `json:"author,omitempty"`
// fields information
Fields []EmbedField `json:"fields,omitempty"`
}
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// Embed is the representation of an Embed
type Embed struct {
// title of embed
Title string `json:"title,omitempty"`
// type of embed (always "rich" for webhook embeds)
Type types.EmbedTypes `json:"type,omitempty"`
// description of embed
Description string `json:"description,omitempty"`
// url of embed
URL string `json:"url,omitempty"`
// timestamp of embed content
Timestamp string `json:"timestamp,omitempty"`
// color code of the embed
Color int `json:"color,omitempty"`
// footer information
Footer EmbedFooter `json:"footer,omitempty"`
// image information
Image EmbedImage `json:"image,omitempty"`
// thumbnail information
Thumbnail EmbedThumbnail `json:"thumbnail,omitempty"`
// video information
Video EmbedVideo `json:"video,omitempty"`
// provider information
Provider EmbedProvider `json:"provider,omitempty"`
// author information
Author EmbedAuthor `json:"author,omitempty"`
// fields information
Fields []EmbedField `json:"fields,omitempty"`
}

View file

@ -1,21 +1,21 @@
package structures
// Emoji is a representation of a Discord Emoji
type Emoji struct {
// ID is the emoji id and can be null for default Discord emojis
ID string `json:"id,omitempty"`
// Name is the emoji name and can only be nil in Reaction Emoji objects
Name string `json:"name,omitempty"`
// roles this emoji is whitelisted to
Roles string `json:"roles,omitempty"`
// user that created this emoji
User User `json:"user,omitempty"`
// whether this emoji must be wrapped in colons
RequireColons bool `json:"require_colons,omitempty"`
// whether this emoji is managed
Managed bool `json:"managed,omitempty"`
// whether this emoji is animated
Animated bool `json:"animated,omitempty"`
// whether this emoji can be used, may be false due to loss of Server Boosts
Available bool `json:"available,omitempty"`
}
package structures
// Emoji is a representation of a Discord Emoji
type Emoji struct {
// ID is the emoji id and can be null for default Discord emojis
ID string `json:"id,omitempty"`
// Name is the emoji name and can only be nil in Reaction Emoji objects
Name string `json:"name,omitempty"`
// roles this emoji is whitelisted to
Roles string `json:"roles,omitempty"`
// user that created this emoji
User User `json:"user,omitempty"`
// whether this emoji must be wrapped in colons
RequireColons bool `json:"require_colons,omitempty"`
// whether this emoji is managed
Managed bool `json:"managed,omitempty"`
// whether this emoji is animated
Animated bool `json:"animated,omitempty"`
// whether this emoji can be used, may be false due to loss of Server Boosts
Available bool `json:"available,omitempty"`
}

View file

@ -1,27 +1,27 @@
package structures
// GuildMember is the representation of a Guild member
type GuildMember struct {
// the user this guild member represents
// The field user won't be included in the member object attached to MESSAGE_CREATE and MESSAGE_UPDATE gateway
// events.
User User `json:"user,omitempty"`
// this users guild nickname
Nick string `json:"nick"`
// array of role object ids
Roles []string `json:"roles"`
// when the user joined the guild
JoinedAt string `json:"joined_at"`
// when the user started boosting the guild
PremiumSince string `json:"premium_since,omitempty"`
// whether the user is deafened in voice channels
Deaf bool `json:"deaf"`
// whether the user is muted in voice channels
Mute bool `json:"mute"`
// whether the user has not yet passed the guild's Membership Screening requirements
// In GUILD_ events, pending will always be included as true or false. In non GUILD_ events which can only be
// triggered by non-pending users, pending will not be included.
Pending bool `json:"pending,omitempty"`
// total permissions of the member in the channel, including overrides, returned when in the interaction object
Permissions string `json:"permissions,omitempty"`
}
package structures
// GuildMember is the representation of a Guild member
type GuildMember struct {
// the user this guild member represents
// The field user won't be included in the member object attached to MESSAGE_CREATE and MESSAGE_UPDATE gateway
// events.
User User `json:"user,omitempty"`
// this users guild nickname
Nick string `json:"nick"`
// array of role object ids
Roles []string `json:"roles"`
// when the user joined the guild
JoinedAt string `json:"joined_at"`
// when the user started boosting the guild
PremiumSince string `json:"premium_since,omitempty"`
// whether the user is deafened in voice channels
Deaf bool `json:"deaf"`
// whether the user is muted in voice channels
Mute bool `json:"mute"`
// whether the user has not yet passed the guild's Membership Screening requirements
// In GUILD_ events, pending will always be included as true or false. In non GUILD_ events which can only be
// triggered by non-pending users, pending will not be included.
Pending bool `json:"pending,omitempty"`
// total permissions of the member in the channel, including overrides, returned when in the interaction object
Permissions string `json:"permissions,omitempty"`
}

View file

@ -1,117 +1,117 @@
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// Guild is the representation of a Discord Guild, AKA server
type Guild struct {
// ID is the guild id
ID string `json:"id"`
// Name is the guild name (2-100 characters, excluding trailing and
// leading whitespace)
Name string `json:"name"`
// Icon is the icon hash
Icon string `json:"icon,omitempty"`
// IconHash is the icon hash, returned when in the template object
IconHash string `json:"icon_hash,omitempty"`
// Splash is the splash hash
Splash string `json:"splash,omitempty"`
// DiscoverySplash is discovery splash hash; only present for
// guilds with the "DISCOVERABLE" feature
DiscoverySplash string `json:"discovery_splash,omitempty"`
// Owner is true if the user is the owner of the guild.
// It is only sent when using the GET Current User Guilds endpoint
// and is relative to the requested user
Owner bool `json:"owner,omitempty"`
// OwnerID is the id of owner
OwnerID string `json:"owner_id,omitempty"`
// Permissions are the total permissions for the user in the guild
// (excludes overrides)
// It is only sent when using the GET Current User Guilds endpoint
// and is relative to the requested user
Permissions string `json:"permissions,omitempty"`
// Region is the voice region id for the guild
Region string `json:"region"`
// AFKChannelID is the id of the afk channel
AFKChannelID string `json:"afk_channel_id,omitempty"`
// AFKTimeout is the afk timeout in seconds
AFKTimeout int `json:"afk_timeout"`
// true if the server widget is enabled
WidgetEnabled bool `json:"widget_enabled,omitempty"`
// the channel id that the widget will generate an invite to, or null if set to no invite
WidgetChannelID string `json:"widget_channel_id,omitempty"`
// verification level required for the guild
VerificationLevel types.VerificationLevels `json:"verification_level"`
// default message notifications level
DefaultMessageNotifications types.DefaultMessageNotificationLevels `json:"default_message_notifications"`
// explicit content filter level
ExplicitContentFilter types.ExplicitContentFilterLevels `json:"explicit_content_filter"`
// roles in the guild
Roles []Role `json:"roles"`
// custom guild emojis
Emojis []Emoji `json:"emojis"`
// enabled guild features
Features []types.GuildFeatures `json:"features"`
// required MFA level for the guild
MFALevel types.MFALevels `json:"mfa_level"`
// application id of the guild creator if it is bot-created
ApplicationID string `json:"application_id,omitempty"`
// the id of the channel where guild notices such as welcome messages and boost events are posted
SystemChannelID string `json:"system_channel_id,omitempty"`
// system channel flags
SystemChannelFlags types.SystemChannelFlags `json:"system_channel_flags,omitempty"`
// the id of the channel where Community guilds can display rules and/or guidelines
RulesChannelID string `json:"rules_channel_id,omitempty"`
// when this guild was joined at
// This field is only sent within the GUILD_CREATE event
JoinedAt string `json:"joined_at,omitempty"`
// true if this is considered a large guild
// This field is only sent within the GUILD_CREATE event
Large bool `json:"large,omitempty"`
// true if this guild is unavailable due to an outage
// This field is only sent within the GUILD_CREATE event
Unavailable bool `json:"unavailable,omitempty"`
// total number of members in this guild
// This field is only sent within the GUILD_CREATE event
MemberCount int `json:"member_count,omitempty"`
// states of members currently in voice channels; lacks the guild_id key
// This field is only sent within the GUILD_CREATE event
VoiceStates []VoiceState `json:"voice_states,omitempty"`
// users in the guild
// This field is only sent within the GUILD_CREATE event
Members []GuildMember `json:"members,omitempty"`
// channels in the guild
// This field is only sent within the GUILD_CREATE event
Channels []Channel `json:"channels,omitempty"`
// presences of the members in the guild, will only include non-offline members if the size is greater than
// large threshold
// This field is only sent within the GUILD_CREATE event
Presences []Presence `json:"presences,omitempty"`
// the maximum number of presences for the guild (the default value, currently 25000,
// is in effect when null is returned)
MaxPresences int `json:"max_presences,omitempty"`
// the maximum number of members for the guild
MaxMembers int `json:"max_members,omitempty"`
// the vanity url code for the guild
VanityURLCode string `json:"vanity_url_code,omitempty"`
// the description for the guild, if the guild is discoverable
Description string `json:"description,omitempty"`
// banner hash
Banner string `json:"banner,omitempty"`
// premium tier (Server Boost level)
PremiumTier types.PremiumTiers `json:"premium_tier"`
// the number of boosts this guild currently has
PremiumSubscriptionCount int `json:"premium_subscription_count,omitempty"`
// the preferred locale of a Community guild; used in server discovery and notices from Discord; defaults to "en-US"
PreferredLocale string `json:"preferred_locale"`
// the id of the channel where admins and moderators of Community guilds receive notices from Discord
PublicUpdatesChannelID string `json:"public_updates_channel_id,omitempty"`
// the maximum amount of users in a video channel
MaxVideoChannelUsers int `json:"max_video_channel_users,omitempty"`
// approximate number of members in this guild, returned from the GET /guilds/<id> endpoint when with_counts is true
ApproximateMemberCount int `json:"approximate_member_count,omitempty"`
// approximate number of non-offline members in this guild, returned from the GET /guilds/<id> endpoint when
// with_counts is true
ApproximatePresenceCount int `json:"approximate_presence_count,omitempty"`
// the welcome screen of a Community guild, shown to new members, returned when in the invite object
WelcomeScreen WelcomeScreen `json:"welcome_screen,omitempty"`
}
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// Guild is the representation of a Discord Guild, AKA server
type Guild struct {
// ID is the guild id
ID string `json:"id"`
// Name is the guild name (2-100 characters, excluding trailing and
// leading whitespace)
Name string `json:"name"`
// Icon is the icon hash
Icon string `json:"icon,omitempty"`
// IconHash is the icon hash, returned when in the template object
IconHash string `json:"icon_hash,omitempty"`
// Splash is the splash hash
Splash string `json:"splash,omitempty"`
// DiscoverySplash is discovery splash hash; only present for
// guilds with the "DISCOVERABLE" feature
DiscoverySplash string `json:"discovery_splash,omitempty"`
// Owner is true if the user is the owner of the guild.
// It is only sent when using the GET Current User Guilds endpoint
// and is relative to the requested user
Owner bool `json:"owner,omitempty"`
// OwnerID is the id of owner
OwnerID string `json:"owner_id,omitempty"`
// Permissions are the total permissions for the user in the guild
// (excludes overrides)
// It is only sent when using the GET Current User Guilds endpoint
// and is relative to the requested user
Permissions string `json:"permissions,omitempty"`
// Region is the voice region id for the guild
Region string `json:"region"`
// AFKChannelID is the id of the afk channel
AFKChannelID string `json:"afk_channel_id,omitempty"`
// AFKTimeout is the afk timeout in seconds
AFKTimeout int `json:"afk_timeout"`
// true if the server widget is enabled
WidgetEnabled bool `json:"widget_enabled,omitempty"`
// the channel id that the widget will generate an invite to, or null if set to no invite
WidgetChannelID string `json:"widget_channel_id,omitempty"`
// verification level required for the guild
VerificationLevel types.VerificationLevels `json:"verification_level"`
// default message notifications level
DefaultMessageNotifications types.DefaultMessageNotificationLevels `json:"default_message_notifications"`
// explicit content filter level
ExplicitContentFilter types.ExplicitContentFilterLevels `json:"explicit_content_filter"`
// roles in the guild
Roles []Role `json:"roles"`
// custom guild emojis
Emojis []Emoji `json:"emojis"`
// enabled guild features
Features []types.GuildFeatures `json:"features"`
// required MFA level for the guild
MFALevel types.MFALevels `json:"mfa_level"`
// application id of the guild creator if it is bot-created
ApplicationID string `json:"application_id,omitempty"`
// the id of the channel where guild notices such as welcome messages and boost events are posted
SystemChannelID string `json:"system_channel_id,omitempty"`
// system channel flags
SystemChannelFlags types.SystemChannelFlags `json:"system_channel_flags,omitempty"`
// the id of the channel where Community guilds can display rules and/or guidelines
RulesChannelID string `json:"rules_channel_id,omitempty"`
// when this guild was joined at
// This field is only sent within the GUILD_CREATE event
JoinedAt string `json:"joined_at,omitempty"`
// true if this is considered a large guild
// This field is only sent within the GUILD_CREATE event
Large bool `json:"large,omitempty"`
// true if this guild is unavailable due to an outage
// This field is only sent within the GUILD_CREATE event
Unavailable bool `json:"unavailable,omitempty"`
// total number of members in this guild
// This field is only sent within the GUILD_CREATE event
MemberCount int `json:"member_count,omitempty"`
// states of members currently in voice channels; lacks the guild_id key
// This field is only sent within the GUILD_CREATE event
VoiceStates []VoiceState `json:"voice_states,omitempty"`
// users in the guild
// This field is only sent within the GUILD_CREATE event
Members []GuildMember `json:"members,omitempty"`
// channels in the guild
// This field is only sent within the GUILD_CREATE event
Channels []Channel `json:"channels,omitempty"`
// presences of the members in the guild, will only include non-offline members if the size is greater than
// large threshold
// This field is only sent within the GUILD_CREATE event
Presences []Presence `json:"presences,omitempty"`
// the maximum number of presences for the guild (the default value, currently 25000,
// is in effect when null is returned)
MaxPresences int `json:"max_presences,omitempty"`
// the maximum number of members for the guild
MaxMembers int `json:"max_members,omitempty"`
// the vanity url code for the guild
VanityURLCode string `json:"vanity_url_code,omitempty"`
// the description for the guild, if the guild is discoverable
Description string `json:"description,omitempty"`
// banner hash
Banner string `json:"banner,omitempty"`
// premium tier (Server Boost level)
PremiumTier types.PremiumTiers `json:"premium_tier"`
// the number of boosts this guild currently has
PremiumSubscriptionCount int `json:"premium_subscription_count,omitempty"`
// the preferred locale of a Community guild; used in server discovery and notices from Discord; defaults to "en-US"
PreferredLocale string `json:"preferred_locale"`
// the id of the channel where admins and moderators of Community guilds receive notices from Discord
PublicUpdatesChannelID string `json:"public_updates_channel_id,omitempty"`
// the maximum amount of users in a video channel
MaxVideoChannelUsers int `json:"max_video_channel_users,omitempty"`
// approximate number of members in this guild, returned from the GET /guilds/<id> endpoint when with_counts is true
ApproximateMemberCount int `json:"approximate_member_count,omitempty"`
// approximate number of non-offline members in this guild, returned from the GET /guilds/<id> endpoint when
// with_counts is true
ApproximatePresenceCount int `json:"approximate_presence_count,omitempty"`
// the welcome screen of a Community guild, shown to new members, returned when in the invite object
WelcomeScreen WelcomeScreen `json:"welcome_screen,omitempty"`
}

View file

@ -1,11 +1,11 @@
package structures
// IdentifyConnectionProperties is the identify connection properties object of an identify command
type IdentifyConnectionProperties struct {
// your operating system
OS string `json:"$os"`
// your library name
Browser string `json:"$browser"`
// your library name
Device string `json:"$device"`
}
package structures
// IdentifyConnectionProperties is the identify connection properties object of an identify command
type IdentifyConnectionProperties struct {
// your operating system
OS string `json:"$os"`
// your library name
Browser string `json:"$browser"`
// your library name
Device string `json:"$device"`
}

View file

@ -1,23 +1,23 @@
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// Invite is the representation of a Discord Invite
type Invite struct {
// the invite code (unique ID)
Code string `json:"code"`
// the guild this invite is for
Guild Guild `json:"guild,omitempty"`
// the channel this invite is for
Channel Channel `json:"channel"`
// the user who created the invite
Inviter User `json:"inviter,omitempty"`
// the target user for this invite
TargetUser User `json:"target_user,omitempty"`
// the type of user target for this invite
TargetUserType types.TargetUserTypes `json:"target_user_type,omitempty"`
// approximate count of online members (only present when target_user is set)
ApproximatePresenceCount int `json:"approximate_presence_count,omitempty"`
// approximate count of total members
ApproximateMemberCount int `json:"approximate_member_count"`
}
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// Invite is the representation of a Discord Invite
type Invite struct {
// the invite code (unique ID)
Code string `json:"code"`
// the guild this invite is for
Guild Guild `json:"guild,omitempty"`
// the channel this invite is for
Channel Channel `json:"channel"`
// the user who created the invite
Inviter User `json:"inviter,omitempty"`
// the target user for this invite
TargetUser User `json:"target_user,omitempty"`
// the type of user target for this invite
TargetUserType types.TargetUserTypes `json:"target_user_type,omitempty"`
// approximate count of online members (only present when target_user is set)
ApproximatePresenceCount int `json:"approximate_presence_count,omitempty"`
// approximate count of total members
ApproximateMemberCount int `json:"approximate_member_count"`
}

View file

@ -1,11 +1,11 @@
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// MessageActivity is the message activity
type MessageActivity struct {
// type of message activity
Type types.MessageActivityTypes `json:"type"`
// party_id from a Rich Presence event
PartyID string `json:"party_id"`
}
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// MessageActivity is the message activity
type MessageActivity struct {
// type of message activity
Type types.MessageActivityTypes `json:"type"`
// party_id from a Rich Presence event
PartyID string `json:"party_id"`
}

View file

@ -1,15 +1,15 @@
package structures
// MessageApplication is the application object of a message
type MessageApplication struct {
// id of the application
ID string `json:"id"`
// id of the embed's image asset
CoverImage string `json:"cover_image,omitempty"`
// application's description
Description string `json:"description"`
// id of the application's icon
Icon string `json:"icon,omitempty"`
// name of the application
Name string `json:"name"`
}
package structures
// MessageApplication is the application object of a message
type MessageApplication struct {
// id of the application
ID string `json:"id"`
// id of the embed's image asset
CoverImage string `json:"cover_image,omitempty"`
// application's description
Description string `json:"description"`
// id of the application's icon
Icon string `json:"icon,omitempty"`
// name of the application
Name string `json:"name"`
}

View file

@ -1,16 +1,16 @@
package structures
// MessageReference is the reference object of a message
type MessageReference struct {
// id of the originating message
MessageID string `json:"message_id,omitempty"`
// id of the originating message's channel
// channel_id is optional when creating a reply, but will always be present when receiving an event/response
// that includes this data model.
ChannelID string `json:"channel_id,omitempty"`
// id of the originating message's guild
GuildID string `json:"guild_id,omitempty"`
// when sending, whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply)
// message, default true
FailIfNotExists bool `json:"fail_if_not_exists,omitempty"`
}
package structures
// MessageReference is the reference object of a message
type MessageReference struct {
// id of the originating message
MessageID string `json:"message_id,omitempty"`
// id of the originating message's channel
// channel_id is optional when creating a reply, but will always be present when receiving an event/response
// that includes this data model.
ChannelID string `json:"channel_id,omitempty"`
// id of the originating message's guild
GuildID string `json:"guild_id,omitempty"`
// when sending, whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply)
// message, default true
FailIfNotExists bool `json:"fail_if_not_exists,omitempty"`
}

View file

@ -1,71 +1,71 @@
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// Message is the representation of a Discord Message
type Message struct {
// id of the message
ID string `json:"id"`
// id of the channel the message was sent in
ChannelID string `json:"channel_id"`
// id of the guild the message was sent in
GuildID string `json:"guild_id,omitempty"`
// the author of this message (not guaranteed to be a valid user, see below)
// The author object follows the structure of the user object,
// but is only a valid user in the case where the message is generated by a user or bot user.
// If the message is generated by a webhook, the author object corresponds to the webhook's id, username, and avatar.
// ou can tell if a message is generated by a webhook by checking for the webhook_id on the message object.
Author User `json:"author"`
// member properties for this message's author
// The member object exists in MESSAGE_CREATE and MESSAGE_UPDATE events from text-based guild channels.
// This allows bots to obtain real-time member data without requiring bots to store member state in memory.
Member GuildMember `json:"member,omitempty"`
// contents of the message
Content string `json:"content"`
// when this message was sent
Timestamp string `json:"timestamp"`
// when this message was edited (or null if never)
EditedTimestamp string `json:"edited_timestamp,omitempty"`
// whether this was a TTS message
TTS bool `json:"tts"`
// whether this message mentions everyone
MentionEveryone bool `json:"mention_everyone"`
// users specifically mentioned in the message
// The user objects in the mentions array will only have the partial member field present in MESSAGE_CREATE and
// MESSAGE_UPDATE events from text-based guild channels.
Mentions []User `json:"mentions"`
// roles specifically mentioned in this message
MentionRoles []string `json:"mention_roles"`
// channels specifically mentioned in this message
MentionChannels []ChannelMention `json:"mention_channels"`
// any attached files
Attachments []Attachment `json:"attachments"`
// any embedded content
Embeds []Embed `json:"embeds"`
// reactions to the message
Reactions []Reaction `json:"reactions,omitempty"`
// used for validating a message was sent
Nonce string `json:"nonce,omitempty"`
// whether this message is pinned
Pinned bool `json:"pinned"`
// if the message is generated by a webhook, this is the webhook's id
WebhookID string `json:"webhook_id,omitempty"`
// type of message
Type types.MessageTypes `json:"type"`
// sent with Rich Presence-related chat embeds
Activity MessageActivity `json:"activity,omitempty"`
// sent with Rich Presence-related chat embeds
Application MessageApplication `json:"application,omitempty"`
// reference data sent with cross posted messages and replies
MessageReference MessageReference `json:"message_reference,omitempty"`
// message flags combined as a bitfield
Flags types.MessageFlags `json:"flags,omitempty"`
// the stickers sent with the message (bots currently can only receive messages with stickers, not send)
Stickers []Sticker `json:"stickers"`
// the message associated with the message_reference
// This field is only returned for messages with a type of 19 (REPLY).
// If the message is a reply but the referenced_message field is not present, the backend did not attempt to fetch
// the message that was being replied to, so its state is unknown.
// If the field exists but is null, the referenced message was deleted.
ReferencedMessage *Message `json:"referenced_message,omitempty"`
}
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// Message is the representation of a Discord Message
type Message struct {
// id of the message
ID string `json:"id"`
// id of the channel the message was sent in
ChannelID string `json:"channel_id"`
// id of the guild the message was sent in
GuildID string `json:"guild_id,omitempty"`
// the author of this message (not guaranteed to be a valid user, see below)
// The author object follows the structure of the user object,
// but is only a valid user in the case where the message is generated by a user or bot user.
// If the message is generated by a webhook, the author object corresponds to the webhook's id, username, and avatar.
// ou can tell if a message is generated by a webhook by checking for the webhook_id on the message object.
Author User `json:"author"`
// member properties for this message's author
// The member object exists in MESSAGE_CREATE and MESSAGE_UPDATE events from text-based guild channels.
// This allows bots to obtain real-time member data without requiring bots to store member state in memory.
Member GuildMember `json:"member,omitempty"`
// contents of the message
Content string `json:"content"`
// when this message was sent
Timestamp string `json:"timestamp"`
// when this message was edited (or null if never)
EditedTimestamp string `json:"edited_timestamp,omitempty"`
// whether this was a TTS message
TTS bool `json:"tts"`
// whether this message mentions everyone
MentionEveryone bool `json:"mention_everyone"`
// users specifically mentioned in the message
// The user objects in the mentions array will only have the partial member field present in MESSAGE_CREATE and
// MESSAGE_UPDATE events from text-based guild channels.
Mentions []User `json:"mentions"`
// roles specifically mentioned in this message
MentionRoles []string `json:"mention_roles"`
// channels specifically mentioned in this message
MentionChannels []ChannelMention `json:"mention_channels"`
// any attached files
Attachments []Attachment `json:"attachments"`
// any embedded content
Embeds []Embed `json:"embeds"`
// reactions to the message
Reactions []Reaction `json:"reactions,omitempty"`
// used for validating a message was sent
Nonce string `json:"nonce,omitempty"`
// whether this message is pinned
Pinned bool `json:"pinned"`
// if the message is generated by a webhook, this is the webhook's id
WebhookID string `json:"webhook_id,omitempty"`
// type of message
Type types.MessageTypes `json:"type"`
// sent with Rich Presence-related chat embeds
Activity MessageActivity `json:"activity,omitempty"`
// sent with Rich Presence-related chat embeds
Application MessageApplication `json:"application,omitempty"`
// reference data sent with cross posted messages and replies
MessageReference MessageReference `json:"message_reference,omitempty"`
// message flags combined as a bitfield
Flags types.MessageFlags `json:"flags,omitempty"`
// the stickers sent with the message (bots currently can only receive messages with stickers, not send)
Stickers []Sticker `json:"stickers"`
// the message associated with the message_reference
// This field is only returned for messages with a type of 19 (REPLY).
// If the message is a reply but the referenced_message field is not present, the backend did not attempt to fetch
// the message that was being replied to, so its state is unknown.
// If the field exists but is null, the referenced message was deleted.
ReferencedMessage *Message `json:"referenced_message,omitempty"`
}

View file

@ -1,13 +1,13 @@
package structures
// Overwrite is a representation of Overwrite in Discord permissions system
type Overwrite struct {
// role or user id
ID string `json:"id"`
// either 0 (role) or 1 (member)
Type int `json:"type"`
// permission bit set
Allow string `json:"allow"`
// permission bit set
Deny string `json:"deny"`
}
package structures
// Overwrite is a representation of Overwrite in Discord permissions system
type Overwrite struct {
// role or user id
ID string `json:"id"`
// either 0 (role) or 1 (member)
Type int `json:"type"`
// permission bit set
Allow string `json:"allow"`
// permission bit set
Deny string `json:"deny"`
}

View file

@ -1,17 +1,17 @@
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// Presence is the representation of a user's presence on a guild.
type Presence struct {
// the user presence is being updated for
User User `json:"user"`
// id of the guild
GuildID string `json:"guild_id"`
// either "idle", "dnd", "online", or "offline"
Status types.Statuses `json:"status"`
// user's current activities
Activities []Activity `json:"activities"`
// user's platform-dependent status
ClientStatus ClientStatus `json:"client_status"`
}
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// Presence is the representation of a user's presence on a guild.
type Presence struct {
// the user presence is being updated for
User User `json:"user"`
// id of the guild
GuildID string `json:"guild_id"`
// either "idle", "dnd", "online", or "offline"
Status types.Statuses `json:"status"`
// user's current activities
Activities []Activity `json:"activities"`
// user's platform-dependent status
ClientStatus ClientStatus `json:"client_status"`
}

View file

@ -1,11 +1,11 @@
package structures
// Reaction represents a message reaction
type Reaction struct {
// times this emoji has been used to react
Count int `json:"count"`
// whether the current user reacted using this emoji
Me bool `json:"me"`
// emoji information
Emoji Emoji `json:"emoji"`
}
package structures
// Reaction represents a message reaction
type Reaction struct {
// times this emoji has been used to react
Count int `json:"count"`
// whether the current user reacted using this emoji
Me bool `json:"me"`
// emoji information
Emoji Emoji `json:"emoji"`
}

View file

@ -1,9 +1,9 @@
package structures
// RoleTags is the tag a role has
type RoleTags struct {
BotID string `json:"bot_id,omitempty"`
IntegrationID string `json:"integration_id,omitempty"`
// ALWAYS NULL YET
PremiumSubscriber struct{} `json:"premium_subscriber"`
}
package structures
// RoleTags is the tag a role has
type RoleTags struct {
BotID string `json:"bot_id,omitempty"`
IntegrationID string `json:"integration_id,omitempty"`
// ALWAYS NULL YET
PremiumSubscriber struct{} `json:"premium_subscriber"`
}

View file

@ -1,14 +1,14 @@
package structures
// Role is a Discord Role
type Role struct {
ID string `json:"id"`
Name string `json:"name"`
Color int `json:"color"`
Hoist bool `json:"hoist"`
Position int `json:"position"`
Permissions string `json:"permissions"`
Managed bool `json:"managed"`
Mentionable bool `json:"mentionable"`
Tags RoleTags `json:"tags,omitempty"`
}
package structures
// Role is a Discord Role
type Role struct {
ID string `json:"id"`
Name string `json:"name"`
Color int `json:"color"`
Hoist bool `json:"hoist"`
Position int `json:"position"`
Permissions string `json:"permissions"`
Managed bool `json:"managed"`
Mentionable bool `json:"mentionable"`
Tags RoleTags `json:"tags,omitempty"`
}

View file

@ -1,23 +1,23 @@
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// Sticker represents a Discord message sticker
type Sticker struct {
// id of the sticker
ID string `json:"id"`
// id of the pack the sticker is from
PackID string `json:"pack_id"`
// name of the sticker
Name string `json:"name"`
// description of the sticker
Description string `json:"description"`
// a comma-separated list of tags for the sticker
Tags string `json:"tags,omitempty"`
// sticker asset hash
Asset string `json:"asset"`
// sticker preview asset hash
PreviewAsset string `json:"preview_asset,omitempty"`
// type of sticker format
FormatType types.StickerTypes `json:"format_type"`
}
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// Sticker represents a Discord message sticker
type Sticker struct {
// id of the sticker
ID string `json:"id"`
// id of the pack the sticker is from
PackID string `json:"pack_id"`
// name of the sticker
Name string `json:"name"`
// description of the sticker
Description string `json:"description"`
// a comma-separated list of tags for the sticker
Tags string `json:"tags,omitempty"`
// sticker asset hash
Asset string `json:"asset"`
// sticker preview asset hash
PreviewAsset string `json:"preview_asset,omitempty"`
// type of sticker format
FormatType types.StickerTypes `json:"format_type"`
}

View file

@ -1,15 +1,15 @@
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// TeamMember represents a member of a Discord Team
type TeamMember struct {
// the user's membership state on the team
MembershipState types.MembershipStates `json:"membership_state"`
// will always be ["*"]
Permissions []string `json:"permissions"`
// the id of the parent team of which they are a member
TeamID string `json:"team_id"`
// the avatar, discriminator, id, and username of the user
User User `json:"user"`
}
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// TeamMember represents a member of a Discord Team
type TeamMember struct {
// the user's membership state on the team
MembershipState types.MembershipStates `json:"membership_state"`
// will always be ["*"]
Permissions []string `json:"permissions"`
// the id of the parent team of which they are a member
TeamID string `json:"team_id"`
// the avatar, discriminator, id, and username of the user
User User `json:"user"`
}

View file

@ -1,13 +1,13 @@
package structures
// Team represents a Discord Team
type Team struct {
// a hash of the image of the team's icon
Icon string `json:"icon,omitempty"`
// the unique id of the team
ID string `json:"id"`
// the members of the team
Members []TeamMember `json:"members"`
// the user id of the current team owner
OwnerUserID string `json:"owner_user_id"`
}
package structures
// Team represents a Discord Team
type Team struct {
// a hash of the image of the team's icon
Icon string `json:"icon,omitempty"`
// the unique id of the team
ID string `json:"id"`
// the members of the team
Members []TeamMember `json:"members"`
// the user id of the current team owner
OwnerUserID string `json:"owner_user_id"`
}

View file

@ -1,20 +1,20 @@
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// User represents the User Structure sent by the Discord API
type User struct {
ID string `json:"id"`
Username string `json:"username"`
Discriminator string `json:"discriminator"`
Avatar string `json:"avatar,omitempty"`
Bot bool `json:"bot,omitempty"`
System bool `json:"system,omitempty"`
MFAEnabled bool `json:"mfa_enabled,omitempty"`
Locale string `json:"locale,omitempty"`
Verified bool `json:"verified,omitempty"`
Email string `json:"email,omitempty"`
Flags types.UserFlags `json:"flags,omitempty"`
PremiumType types.PremiumTypes `json:"premium_type,omitempty"`
PublicFlags types.UserFlags `json:"public_flags,omitempty"`
}
package structures
import "github.com/discordnova/nova/common/discord/types/types"
// User represents the User Structure sent by the Discord API
type User struct {
ID string `json:"id"`
Username string `json:"username"`
Discriminator string `json:"discriminator"`
Avatar string `json:"avatar,omitempty"`
Bot bool `json:"bot,omitempty"`
System bool `json:"system,omitempty"`
MFAEnabled bool `json:"mfa_enabled,omitempty"`
Locale string `json:"locale,omitempty"`
Verified bool `json:"verified,omitempty"`
Email string `json:"email,omitempty"`
Flags types.UserFlags `json:"flags,omitempty"`
PremiumType types.PremiumTypes `json:"premium_type,omitempty"`
PublicFlags types.UserFlags `json:"public_flags,omitempty"`
}

View file

@ -1,29 +1,29 @@
package structures
// VoiceState is a representation of a user's voice connection status
type VoiceState struct {
// the guild id this voice state is for
GuildID string `json:"guild_id,omitempty"`
// the channel id this user is connected to
ChannelID string `json:"channel_id,omitempty"`
// the user id this voice state is for
UserID string `json:"user_id,omitempty"`
// the guild member this voice state is for
Member GuildMember `json:"member,omitempty"`
// the session id for this voice state
SessionID string `json:"session_id"`
// whether this user is deafened by the server
Deaf bool `json:"deaf"`
// whether this user is muted by the server
Mute bool `json:"mute"`
// whether this user is locally deafened
SelfDeaf bool `json:"self_deaf"`
// whether this user is locally muted
SelfMute bool `json:"self_mute"`
// whether this user is streaming using "Go Live"
SelfStream bool `json:"self_stream,omitempty"`
// whether this user's camera is enabled
SelfVideo bool `json:"self_video"`
// whether this user is muted by the current user
Suppress bool `json:"suppress"`
}
package structures
// VoiceState is a representation of a user's voice connection status
type VoiceState struct {
// the guild id this voice state is for
GuildID string `json:"guild_id,omitempty"`
// the channel id this user is connected to
ChannelID string `json:"channel_id,omitempty"`
// the user id this voice state is for
UserID string `json:"user_id,omitempty"`
// the guild member this voice state is for
Member GuildMember `json:"member,omitempty"`
// the session id for this voice state
SessionID string `json:"session_id"`
// whether this user is deafened by the server
Deaf bool `json:"deaf"`
// whether this user is muted by the server
Mute bool `json:"mute"`
// whether this user is locally deafened
SelfDeaf bool `json:"self_deaf"`
// whether this user is locally muted
SelfMute bool `json:"self_mute"`
// whether this user is streaming using "Go Live"
SelfStream bool `json:"self_stream,omitempty"`
// whether this user's camera is enabled
SelfVideo bool `json:"self_video"`
// whether this user is muted by the current user
Suppress bool `json:"suppress"`
}

View file

@ -1,13 +1,13 @@
package structures
// WelcomeScreenChannel is a representation of a channel in a welcome screen
type WelcomeScreenChannel struct {
// the channel's id
ChannelID string `json:"channel_id"`
// the description shown for the channel
Description string `json:"description"`
// the emoji id, if the emoji is custom
EmojiID string `json:"emoji_id,omitempty"`
// the emoji name if custom, the unicode character if standard, or null if no emoji is set
EmojiName string `json:"emoji_name,omitempty"`
}
package structures
// WelcomeScreenChannel is a representation of a channel in a welcome screen
type WelcomeScreenChannel struct {
// the channel's id
ChannelID string `json:"channel_id"`
// the description shown for the channel
Description string `json:"description"`
// the emoji id, if the emoji is custom
EmojiID string `json:"emoji_id,omitempty"`
// the emoji name if custom, the unicode character if standard, or null if no emoji is set
EmojiName string `json:"emoji_name,omitempty"`
}

Some files were not shown because too many files have changed in this diff Show more