├── .github └── workflows │ ├── build-and-test.yaml │ └── check-and-lint.yaml ├── .gitignore ├── .npmignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── bin └── devil-bot-rust-cdk.ts ├── build-function.sh ├── cdk.context.json ├── cdk.json ├── clean.sh ├── jest.config.js ├── lib └── devil-bot-rust-cdk-stack.ts ├── package-lock.json ├── package.json ├── resources ├── Cargo.lock ├── Cargo.toml ├── rust.zip ├── rustfmt.toml └── src │ ├── aws.rs │ ├── aws │ └── dynamo.rs │ ├── commands.rs │ ├── commands │ ├── buns.rs │ ├── introduction_reply.rs │ ├── onboard_user.rs │ └── ping.rs │ ├── event_handlers.rs │ ├── event_handlers │ ├── message_event_handler.rs │ ├── reaction_added_event_handler.rs │ └── team_join_event_handler.rs │ ├── main.rs │ ├── slack.rs │ └── slack │ ├── chat.rs │ ├── client.rs │ ├── conversations.rs │ └── reactions.rs ├── test └── devil-bot-rust-cdk.test.ts └── tsconfig.json /.github/workflows/build-and-test.yaml: -------------------------------------------------------------------------------- 1 | on: 2 | pull_request: 3 | branches: 4 | - main 5 | push: 6 | branches: 7 | - main 8 | 9 | name: Test with Code Coverage 10 | 11 | jobs: 12 | test: 13 | name: Test 14 | env: 15 | PROJECT_NAME_UNDERSCORE: bootstrap 16 | CARGO_INCREMENTAL: 0 17 | RUSTFLAGS: -Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort 18 | RUSTDOCFLAGS: -Cpanic=abort 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@v2 22 | - uses: actions-rs/toolchain@v1 23 | with: 24 | profile: minimal 25 | toolchain: nightly 26 | override: true 27 | - name: Cache dependencies 28 | uses: actions/cache@v2 29 | env: 30 | cache-name: cache-dependencies 31 | with: 32 | path: | 33 | ~/.cargo/.crates.toml 34 | ~/.cargo/.crates2.json 35 | ~/.cargo/bin 36 | ~/.cargo/registry/index 37 | ~/.cargo/registry/cache 38 | resources/target 39 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Cargo.lock') }} 40 | - name: Generate test result and coverage report 41 | run: | 42 | cargo install cargo2junit grcov; 43 | cargo test $CARGO_OPTIONS -- -Z unstable-options --format json | cargo2junit > results.xml; 44 | zip -0 ccov.zip `find . \( -name "$PROJECT_NAME_UNDERSCORE*.gc*" \) -print`; 45 | grcov ccov.zip -s . -t lcov --llvm --ignore-not-existing --ignore "/*" --ignore "tests/*" -o lcov.info; 46 | working-directory: resources 47 | - name: Upload test results 48 | uses: EnricoMi/publish-unit-test-result-action@v1 49 | with: 50 | check_name: Test Results 51 | github_token: ${{ secrets.GITHUB_TOKEN }} 52 | files: resources/results.xml 53 | - name: Upload to CodeCov 54 | uses: codecov/codecov-action@v1 55 | with: 56 | # required for private repositories: 57 | # token: ${{ secrets.CODECOV_TOKEN }} 58 | files: resources/lcov.info 59 | fail_ci_if_error: true 60 | -------------------------------------------------------------------------------- /.github/workflows/check-and-lint.yaml: -------------------------------------------------------------------------------- 1 | on: 2 | pull_request: 3 | branches: 4 | - main 5 | push: 6 | branches: 7 | - main 8 | 9 | name: Check and Lint 10 | 11 | jobs: 12 | check: 13 | name: Check 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v2 17 | - uses: actions-rs/toolchain@v1 18 | with: 19 | profile: minimal 20 | toolchain: stable 21 | override: true 22 | - uses: actions-rs/cargo@v1 23 | with: 24 | command: check 25 | args: --manifest-path resources/Cargo.toml 26 | 27 | fmt: 28 | name: Rustfmt 29 | runs-on: ubuntu-latest 30 | steps: 31 | - uses: actions/checkout@v2 32 | - uses: actions-rs/toolchain@v1 33 | with: 34 | profile: minimal 35 | toolchain: stable 36 | override: true 37 | - run: rustup component add rustfmt 38 | - uses: actions-rs/cargo@v1 39 | with: 40 | command: fmt 41 | args: --all --check --manifest-path resources/Cargo.toml 42 | 43 | clippy: 44 | name: Clippy 45 | runs-on: ubuntu-latest 46 | steps: 47 | - uses: actions/checkout@v2 48 | - uses: actions-rs/toolchain@v1 49 | with: 50 | toolchain: stable 51 | components: clippy 52 | override: true 53 | - uses: actions-rs/clippy-check@v1 54 | with: 55 | token: ${{ secrets.GITHUB_TOKEN }} 56 | args: --all-features --manifest-path resources/Cargo.toml 57 | name: Clippy Output 58 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | resources/target 2 | *.js 3 | !jest.config.js 4 | *.d.ts 5 | node_modules 6 | .DS_Store 7 | resources/.DS_Store 8 | 9 | # CDK asset staging directory 10 | .cdk.staging 11 | cdk.out 12 | 13 | # Cargo config 14 | .cargo 15 | resources/.cargo 16 | 17 | # VS Code 18 | .code-workspace 19 | 20 | # IntelliJ 21 | .idea 22 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | *.ts 2 | !*.d.ts 3 | 4 | # CDK asset staging directory 5 | .cdk.staging 6 | cdk.out 7 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing Guidelines and Git Flow 2 | This document plans to outline the following for *all* contributors of the Rust DevilBot project. Please follow these guidelines to the best of your knowledge and understanding, and feel free to message `@Json Michelson` or `@reharri7` in the CodeDevils Slack workspace if you have any questions or need help! 3 | 4 | ### Table of Contents 5 | 1. [Chain of Command](#chain-of-command) 6 | 1. [Git Flow Overview](#git-flow) 7 | 1. [Workflow Contribution Requirements](#contribution-requirements) 8 | 1. [Workflow Examples](#workflow-examples) 9 | 1. [Quality of Code Requirements](#quality-of-code) 10 | 1. [Git Cheatsheet](#git-cheatsheet) 11 | 1. [Rust Commands](#rust-commands) 12 | 1. [Other Resources](#other-resources) 13 | 14 | --- 15 | 16 | # Chain of Command 17 | The Rust DevilBot project managers are Jason Michelson ([@jtmichelson](https://github.com/jtmichelson)) and JRhett Harrison Campbell ([@reharri7](https://github.com/reharri7)). They control the day-to-day operation of this project, with oversight and policy dictated by the CodeDevil Officers. 18 | > To see your CodeDevil officers, visit the `#about` channel of the CodeDevils Slack workspace. 19 | 20 | # Git Flow 21 | Overall, the Git flow is mostly laid back. You, as a contributor, have lots of wiggle room to make your own inputs in your commits to this repo. Forking is not necessary - use the origin repo's branches for your own code bases. You have full control over your own development branches and Git flow. That said, there are some general guidelines you need to follow. 22 | 23 | ## Overview 24 | #### Personal Branch 25 | This is your own branch. You can call it whatever you want locally and push it into the remote repository. Your working commits will be on this branch and when you are ready to create a pull request (PR) for a specific GitHub issue you will use your personal branch for that PR. 26 | 27 | #### Main Branch 28 | The `main` branch is the *production code* that DevilBot is currently operating on. Whatever is in `main` is what will be on Slack. PRs from personal branches to `main` will **require an approved code review from a project manager**. 29 | 30 | ## Contribution Requirements 31 | Observe the following in your git flow: 32 | - Make an Issue prior to working on your code. We don't want you to work on something that is actually banned or already implemented! 33 | - Your personal development branches must start with your name and be consistent. E.g., `bobby-dev`, `bobby-new-feature-here` 34 | - Though there is no limit to the number of reviewers you request, your pull requests to `main` **must** at least include **a project manager**. 35 | - Comment in your code following the functionality and process within it. 36 | - Make sure that you have tested your code using your personal AWS account and personal Slack development bot. Be sure to include in your PR a link to a screen capture of you testing your feature. **NO CODE WILL BE APPROVED WITHOUT BEING TESTED FIRST**. 37 | 38 | ### Workflow Examples 39 | #### Marlee's Quick Patch (Simple) 40 | > My name is Marlee, and I noticed a misspelling in the README. 41 | > 42 | > I would create a GitHub issue for this, then create a branch called `marlee-hotfix`, make the correction, then submit a pull request to `main` making sure to request review from [@jtmichelson](https://github.com/jtmichelson) or [@reharri7](https://github.com/reharri7). 43 | 44 | Good job Marlee! 45 | 46 | #### Clyde & Darryl's Calendar (Collab) 47 | > My name is Clyde, and I'm working with Darryl on a sweet new command that allows something to do with calendars. 48 | > 49 | > I would create a GitHub issue for the new feature, then checkout a new branch entitled `calendar-dev`, acting as the default branch for the calendar between Darryl and I, making sure to keep it updated with `main`. Darryl and I would then have our own branches whatever we want to call them following the guideline, say `darryl-calendar` and `clyde-dev`. We push and pull from `calendar-dev` for development. 50 | > 51 | > When our cool new command is done, *making sure to pull `calendar-dev` from `main` so that there are not merge conflicts*, I would then make a pull request on `main`. Billy-Bob is good with calendars, so I would like his review too. I would request review from `@BillyBobUSA` along with a project manager such as [@jtmichelson](https://github.com/jtmichelson) or [@reharri7](https://github.com/reharri7). 52 | 53 | Nicely done! 54 | 55 | --- 56 | 57 | # Quality of Code 58 | > TODO - TBD by Json and/or Stu 59 | > 60 | > Note: We currently have a Rust unit test framework in place. So we need to increase the coverage to ~100% then we can add code coverage velocity checks for all new changes to prevent uncovered code from being published. See [issue 18](https://github.com/ASU-CodeDevils/devil_bot_rust/issues/18). 61 | 62 | ---- 63 | 64 | # Git Cheatsheet 65 | #### Checkout Existing Branch 66 | ``` 67 | git checkout existing-branch 68 | ``` 69 | 70 | #### Checkout a New Branch 71 | ``` 72 | git checkout -B your-new-branch 73 | ``` 74 | 75 | #### Push to Repo 76 | ``` 77 | git push origin destination-branch 78 | ``` 79 | Pro tip: add `-u` to skip the naming of the branch in future pushes. 80 | 81 | #### Update Current Branch from Repo 82 | ``` 83 | git fetch && git pull 84 | ``` 85 | 86 | #### Update Current Branch from Target Branch 87 | ``` 88 | git fetch ; git merge target-branch 89 | ``` 90 | Use Case: Your development branch (current branch) is behind `dev` and you want to update your branch with the code from `dev` (or some other target branch). 91 | 92 | --- 93 | 94 | # Rust Commands 95 | ``` 96 | cargo fmt --all --check --manifest-path resources/Cargo.toml 97 | ``` 98 | Use Case: We want to make sure you code is formatted correctly to Rustacean standards. This command will run during your pull request, but you can run it each time before you commit code as well. We encourage it! 99 | --- 100 | 101 | ## Other Resources 102 | * Installing Git: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git 103 | * Git Basics: https://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository 104 | * GitHub - Creating a Pull Request: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request 105 | 106 | 107 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Devil Bot Rust 2 | ![devil_bot_rust](https://github.com/ASU-CodeDevils/devil_bot_rust/actions/workflows/check-and-lint.yaml/badge.svg) ![devil_bot_rust](https://github.com/ASU-CodeDevils/devil_bot_rust/actions/workflows/build-and-test.yaml/badge.svg) [![codecov](https://codecov.io/gh/ASU-CodeDevils/devil_bot_rust/branch/main/graph/badge.svg?token=6NS5GOSXZ2)](https://codecov.io/gh/ASU-CodeDevils/devil_bot_rust) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) 3 | 4 | ## Table of Contents 5 | 1. [Overview](#overview) 6 | 2. [Prereqs](#prereqs) 7 | 3. [Getting Started with Git](#getting-started-with-git) 8 | 4. [Set up AWS account](#set-up-aws-account) 9 | 5. [Connecting to your AWS Account to your personal device](#connecting-to-your-aws-account-to-your-personal-device) 10 | 6. [Set up project for AL2 target Mac, Ubuntu (aarch64/x86_64), and Windows (WSL 2 Ubuntu 20.04 LTS)](#set-up-project-for-al2-target-mac-ubuntu-aarch64x86_64-and-windows-wsl-2-ubuntu-2004-lts) 11 | 7. [After your project is set up use the following to build your code and deploy it to AWS test](#after-your-project-is-set-up-use-the-following-to-build-your-code-and-deploy-it-to-aws-test) 12 | 8. [Setting up to test against a personal Slack bot](#setting-up-to-test-against-a-personal-slack-bot) 13 | 9. [Useful CDK commands and their descriptions](#useful-cdk-commands-and-their-descriptions) 14 | 10. [How to Enable API Throttling](#how-to-enable-api-throttling) 15 | 11. [Slack-Morphism](#slack-morphism) 16 | 17 | ## Overview 18 | * A Rust implementation of a Slack bot that will be used by the CodeDevils Slack workspace. 19 | * All resources are managed using AWS CDK. 20 | * The main driver is AWS API Gateway to provide static endpoints and AWS Lambda for serverless compute/request handling. 21 | 22 | ## Prereqs 23 | * Install Rust: https://rustup.rs/ 24 | * Install NodeJS v16 (latest LTS version): https://nodejs.org/en/download/ 25 | * Install AWS CLI: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html 26 | * Install AWS CDK Toolkit: `npm install -g aws-cdk` 27 | * You may get a warning that -g is deprecated and to use --location=global instead 28 | 29 | ## Getting Started with Git 30 | 1. Create a new local directory for this project. 31 | 1. Run `git clone https://github.com/ASU-CodeDevils/devil_bot_rust.git` in that new directory. 32 | 33 | ## Set up AWS account 34 | 1. Create a new AWS account for free: https://aws.amazon.com 35 | 1. Go to the IAM console (type "IAM" in search bar on AWS website after logging in). 36 | 1. Click on "Users" on the left-hand side bar under "Access Management". 37 | 1. Click "Add Users" to the right. 38 | 1. For username choose something like "devil-bot-test-user-${your_asu_alias}" (e.g. "devil-bot-test-user-jtmichel"). 39 | 1. Make sure "Access key - Programmatic access" check box is checked. 40 | 1. Click "Next: Permissions". 41 | 1. Click "Attach existing policies directly". 42 | 1. Check "AdministratorAccess" (you can use less permissions if you know what you're doing, but this should work fine as long as you don't give away your credentials). 43 | 1. Click "Next: Tags". 44 | 1. Click "Next: Review". 45 | 1. Click "Create user". 46 | 1. Copy both your "Access key ID" and your "Secret access key" somewhere locally (only store this temporarily then delete). 47 | 1. Continue to "Connecting to your AWS Account" steps below. 48 | 49 | ## Connecting to your AWS Account to your personal device 50 | 1. Run the following on your personal device's terminal. 51 | 1. `aws configure` 52 | 1. For "access key" use your "Access key ID" from the "Set up AWS account" instructions above. 53 | 1. For "secret access key" use your "Secret access key" from the "Set up AWS account" instructions above. 54 | 1. For "default region name" use: `us-east-1` 55 | 1. For "defaut output format" use: `None` (just leave blank and press enter) 56 | 57 | ## Set up project for AL2 target Mac, Ubuntu (aarch64/x86_64), and Windows (WSL 2 Ubuntu 20.04 LTS) 58 | 1. If on Windows install and configure Ubuntu 20.04 LTS using WSL2 the following step are to be done wihtin that VM 59 | https://docs.microsoft.com/en-us/windows/wsl/install 60 | 1. Ensure you've installed Rust, NPM, AWS-CDK Toolkit, and AWS-CLI 61 | 1. Confirm you've setup your AWS account and Connected it! 62 | 1. `chmod +x build-function.sh` 63 | 1. `sh build-function.sh` 64 | 1. `cdk bootstrap` 65 | 1. `cdk deploy` 66 | 67 | ## After your project is set up use the following to build your code and deploy it to AWS test 68 | ### Note: This will deploy only to dev 69 | 1. `sh build-function.sh` 70 | 2. `cdk diff` (optional, but useful command) 71 | 3. `cdk deploy --app 'cdk.out/' DevilBotRustCdkStack` 72 | 73 | ## Setting up to test against a personal Slack bot 74 | 1. Do the following after creating the above infrastructure (after successfully running `cdk deploy` to your personal AWS account). 75 | 1. Go to the API Gateway console (type "API Gateway" in search bar on AWS website after logging in). 76 | 1. Click on "APIs" on the left-hand side bar under "API Gateway". 77 | 1. Check to make sure you are signed in under us-east-1 78 | 1. Click on "RustSlackEndpoint". 79 | 1. Click on "Stages" on the left-hand side bar under "API: RustSlackEndpoint". 80 | 1. Click on "Prod" under "Stages". 81 | 1. Copy the "Invoke URL" provided. 82 | 1. Contact one of our officers and tell them you have your Slack bot API Gateway endpoint ready for a personal Slack bot app. 83 | 1. Provide the officer with the URL and they will give you a Bot API Token which you can then plug in to the `environment` list in `devil-bot-rust-cdk-stack.ts`. 84 | 1. While you are developing, make sure to limit you testing to the `#devil-bot-test` channel in Slack. Or if you are testing a feture that is not in a channel, reach out to Rhett or Jason for some creative ideas to test. We don't want to spam other public channels. The ID for the test channel is `C0351GJ62Q0` 85 | 1. When you have your code ready for review, remove the environment variable for the Bot token before creating your PR. Follow the instructions found in `CONTRIBUTING.md` for more info on creating your PR. If you don't remove this token before making a commit, Slack will uninstall your bot. 86 | 87 | ## Useful CDK commands and their descriptions 88 | * `npm run build` compile typescript to js 89 | * `npm run watch` watch for changes and compile 90 | * `npm run test` perform the jest unit tests 91 | * `cargo fmt --all --check --manifest-path resources/Cargo.toml` Checks code formatting for Rust 92 | * `rustup update` update Rust 93 | * `cdk diff` compare deployed stack with current state 94 | * `cdk synth` emits the synthesized CloudFormation template 95 | * `cdk deploy --all` deploy all stacks to your default AWS account/region 96 | * `cdk deploy --app 'cdk.out/' DevilBotRustCdkStack` Deploys to the production Stack of your DevilBot (not the real production version) 97 | * `cdk deploy --app 'cdk.out/' DevilBotRustCdkStackDev` Deploys the Dev Stack of your Devil Bot 98 | 99 | Any of these three commands `cdk deploy` `cdk deploy --app 'cdk.out/' DevilBotRustCdkStack` `cdk deploy --app 'cdk.out/' DevilBotRustCdkStackDev` will deploy your DevilBot to AWS. We run this app in two stages so it is essentially like having two separate apps. This is mainly so Rhett can deploy the production version from the same account his dev version is on. You are fine to use either stages or both on your account, but: 100 | 101 | * Make sure that you have the correct API key for that Bot or else it won't function. 102 | * Make sure that the invoke URL you use for that Bot is the same one that is on the Stage you are expecting 103 | 104 | ## Testing with POST requests 105 | Sometimes you may not want to spam messages into the Slack channels when you want to test. In this case you can POST messages directly to your API Gateway endpoint and view CloudWatch logs to troubleshoot problems with your code. 106 | 107 | ### Postman 108 | Postman is a UI alternative to using [`curl`](https://everything.curl.dev). 109 | 1. Download postman for free from https://www.postman.com/downloads/ 110 | 1. Ignore the make an account messages and "workspaces" and just use the "scratchpad" offline feature. This used to be the only way Postman operated, but they are trying to make money so we will forgive them for begging us to use cloud storage on a platform that definitely doesn't need it. 111 | 1. Under the scratchpad menu "Overview" click on the "Create a request" button. 112 | 1. Click on the "GET" dropdown and swap to "POST". 113 | 1. In the "Enter request URL" box insert your API Gateway URL obtained in the [Setting up to test against a personal Slack bot](#setting-up-to-test-against-a-personal-slack-bot) section. 114 | 1. Click on the "Body" tab and enter a modified version of one of the message body from below. 115 | 1. Click on the "raw" radio button, and select "JSON" from the dropdown to the right of the radio buttons. 116 | 1. You can now send requests directly to your endpoint. 117 | 118 | ### Example Message Event Body JSON 119 | ```javascript 120 | { 121 | "api_app_id": "XXXXXXXXXXX", 122 | "authorizations": [ 123 | { 124 | "enterprise_id": "XXXXXXXXX", 125 | "is_bot": false, 126 | "is_enterprise_install": false, 127 | "team_id": "XXXXXXXXX", 128 | "user_id": "XXXXXXXXX" 129 | } 130 | ], 131 | "enterprise_id": "XXXXXXXXX", 132 | "event": { 133 | "blocks": [ 134 | { 135 | "block_id": "xXxx", 136 | "elements": [ 137 | { 138 | "elements": [ 139 | { 140 | "text": "Test message here.", 141 | "type": "text" 142 | } 143 | ], 144 | "type": "rich_text_section" 145 | } 146 | ], 147 | "type": "rich_text" 148 | } 149 | ], 150 | "channel": "XXXXXXXXXXX", 151 | "channel_type": "group", 152 | "client_msg_id": "9173c749-d7b3-4330-9576-590740901793", 153 | "event_ts": "1645903860.916719", 154 | "team": "XXXXXXXXX", 155 | "text": "test", 156 | "ts": "1645903860.916719", 157 | "type": "message", 158 | "user": "XXXXXXXXX" 159 | }, 160 | "event_context": "4-eyJldCI6Im1lc3NhZ2UiLCJ0aWQiOiJUMk43NkZaM1EiLCJhaWQiOiJBMDJVOUc4NUI2WiIsImNpZCI6IkMwMzUxR0o2MlEwIn0", 161 | "event_id": "Ev0356A5S917", 162 | "event_time": 1645903860, 163 | "is_ext_shared_channel": false, 164 | "team_id": "XXXXXXXXX", 165 | "token": "oooooooooooooooooo", 166 | "type": "event_callback" 167 | } 168 | ``` 169 | 170 | ### Example Challenge Body JSON 171 | * https://api.slack.com/events/url_verification 172 | ```javascript 173 | { 174 | "token": "Jhj5dZrVaK7ZwHHjRyZWjbDl", 175 | "challenge": "3eZbrw1aBm2rZgRNFdxV2595E9CY3gmdALWMmHkvFXO7tYXAYM8P", 176 | "type": "url_verification" 177 | } 178 | ``` 179 | 180 | ### How to Enable API Throttling 181 | 1. Sign in to AWS 182 | 2. In the search bar, search for API Gateway 183 | 3. Click on RustSlackEndpoint 184 | 4. In the left menu, click on Usage Plans 185 | 5. In the Usage Plans menu, create a new usage plan 186 | 187 | This is pretty customizable. Recommended to cap your requests per month at 900,000 188 | 189 | ### Slack Morphism 190 | * [Link to Slack-Morphism Documentation](https://slack-rust.abdolence.dev/) 191 | 192 | -------------------------------------------------------------------------------- /bin/devil-bot-rust-cdk.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | import 'source-map-support/register' 3 | import * as cdk from '@aws-cdk/core' 4 | import { DevilBotRustCdkStack } from '../lib/devil-bot-rust-cdk-stack'; 5 | 6 | const app = new cdk.App(); 7 | new DevilBotRustCdkStack(app, 'DevilBotRustCdkStack', { 8 | env: { region: app.node.tryGetContext('region') || 'us-east-1' }, 9 | }); 10 | // Dev stage 11 | new DevilBotRustCdkStack(app, 'DevilBotRustCdkStackDev', { 12 | env: { region: app.node.tryGetContext('region') || 'us-east-1' }, 13 | }); 14 | -------------------------------------------------------------------------------- /build-function.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | kernel="$(uname)" 4 | arch="$(uname -m)" 5 | linker="x86_64-linux-gnu-gcc" 6 | rustflags="" 7 | 8 | case $kernel in 9 | Linux) 10 | echo "OS: Linux\nArch: ${arch}\nLinker: ${linker}" 11 | sudo apt install build-essential -y 12 | sudo apt install musl-tools -y 13 | if [ "${arch}" = "aarch64" ]; then 14 | export CC_x86_64_unknown_linux_musl=${linker} 15 | sudo apt install gcc-x86-64-linux-gnu -y 16 | fi 17 | ;; 18 | 19 | Darwin) 20 | if [ "${arch}" = "x86_64" ]; then 21 | if [ "$(sysctl -n sysctl.proc_translated)" = "1" ]; then 22 | linker="x86_64-linux-musl-gcc" 23 | echo "OS: Mac M1 using Rosetta\nArch: ${arch}\nLinker: ${linker}" 24 | echo "Mac M1 using Rosetta currently WiP... Exiting" 25 | exit 1 26 | # pretty sure this should work akin to normal x86_64, but not sure 27 | # brew install FiloSottile/musl-cross/musl-cross 28 | # ln -s /usr/local/bin/${linker} /usr/local/bin/musl-gcc 29 | else 30 | linker="x86_64-linux-musl-gcc" 31 | echo "OS: Mac Intel\nArch: ${arch}\nLinker: ${linker}" 32 | brew install FiloSottile/musl-cross/musl-cross 33 | ln -s /usr/local/bin/${linker} /usr/local/bin/musl-gcc 34 | fi 35 | elif [ "${arch}" = "arm64" ]; then 36 | linker="x86_64-unknown-linux-gnu-gcc" 37 | echo "OS: Mac M1\nArch: ${arch}\nLinker: ${linker}" 38 | brew tap messense/macos-cross-toolchains 39 | brew install x86_64-unknown-linux-gnu 40 | export CC_x86_64_unknown_linux_musl=${linker} 41 | fi 42 | ;; 43 | 44 | *) 45 | echo "Unknown System: ${kernel} ${arch}" 46 | echo "Exiting..." 47 | exit 1 48 | ;; 49 | esac 50 | 51 | echo "Adding rustup target" 52 | rustup target add x86_64-unknown-linux-musl 53 | 54 | echo "Creating .cargo/config" 55 | mkdir -p .cargo 56 | echo "[target.x86_64-unknown-linux-musl]\nlinker = \"${linker}\"${rustflags}" > .cargo/config 57 | 58 | echo "Creating resources/.cargo/config" 59 | mkdir -p ./resources/.cargo 60 | cp -r .cargo ./resources 61 | 62 | echo "Building Project" 63 | cd resources 64 | cargo build --release --target x86_64-unknown-linux-musl 65 | (cd target/x86_64-unknown-linux-musl/release && mkdir -p lambda && cp bootstrap lambda/) 66 | 67 | echo "NPM Install" 68 | npm install 69 | echo "NPM Run Build" 70 | npm run build 71 | -------------------------------------------------------------------------------- /cdk.context.json: -------------------------------------------------------------------------------- 1 | { 2 | "region": "us-east-1", 3 | "acknowledged-issue-numbers": [ 4 | 19836 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /cdk.json: -------------------------------------------------------------------------------- 1 | { 2 | "app": "npx ts-node --prefer-ts-exts bin/devil-bot-rust-cdk.ts", 3 | "watch": { 4 | "include": [ 5 | "**" 6 | ], 7 | "exclude": [ 8 | "README.md", 9 | "cdk*.json", 10 | "**/*.d.ts", 11 | "**/*.js", 12 | "tsconfig.json", 13 | "package*.json", 14 | "yarn.lock", 15 | "node_modules", 16 | "test" 17 | ] 18 | }, 19 | "context": { 20 | "@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": true, 21 | "@aws-cdk/core:stackRelativeExports": true, 22 | "@aws-cdk/aws-rds:lowercaseDbIdentifier": true, 23 | "@aws-cdk/aws-lambda:recognizeVersionProps": true, 24 | "@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": true, 25 | "@aws-cdk/core:target-partitions": [ 26 | "aws", 27 | "aws-cn" 28 | ] 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | rm -rf .cargo/config 4 | rm -rf resources/.cargo/config 5 | rm -rf node_modules 6 | (cd resources && cargo clean) -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | testEnvironment: 'node', 3 | roots: ['/test'], 4 | testMatch: ['**/*.test.ts'], 5 | transform: { 6 | '^.+\\.tsx?$': 'ts-jest' 7 | } 8 | }; 9 | -------------------------------------------------------------------------------- /lib/devil-bot-rust-cdk-stack.ts: -------------------------------------------------------------------------------- 1 | import { Construct, Stack, StackProps } from '@aws-cdk/core' 2 | import { Architecture, Code, Function, Runtime } from '@aws-cdk/aws-lambda' 3 | import { Policy, PolicyStatement } from '@aws-cdk/aws-iam' 4 | import { LambdaRestApi } from '@aws-cdk/aws-apigateway' 5 | import { AttributeType, Table } from '@aws-cdk/aws-dynamodb' 6 | import { RetentionDays } from '@aws-cdk/aws-logs' 7 | 8 | export class DevilBotRustCdkStack extends Stack { 9 | constructor(scope: Construct, id: string, props?: StackProps) { 10 | super(scope, id, props) 11 | 12 | // Dynamo DB Table for holding persistent data that the lambda will call into. 13 | const bunsTable = new Table(this, 'buns-table', { 14 | partitionKey: { 15 | name: 'user_id', 16 | type: AttributeType.STRING, 17 | }, 18 | }) 19 | 20 | // Lambda function that wraps the Rust binary. 21 | const rustSlackLambda = new Function(this, 'rust-slack-lambda', { 22 | description: 23 | 'Deploying a Rust function on Lambda using the custom runtime to back our Slack bot endpoint.', 24 | code: Code.fromAsset( 25 | 'resources/target/x86_64-unknown-linux-musl/release/lambda' 26 | ), 27 | runtime: Runtime.PROVIDED_AL2, 28 | architecture: Architecture.X86_64, 29 | handler: 'not.required', 30 | environment: { 31 | // Fill in your personal app's token below when testing (remove them when creating a PR) 32 | RUST_BACKTRACE: '1', 33 | SLACK_API_BOT_TOKEN: '', 34 | SLACK_API_USER_TOKEN: '', 35 | BUNS_TABLE_NAME: bunsTable.tableName, 36 | IS_DEVELOPMENT: 'true', 37 | TEST_CHANNEL_ID: 'C0351GJ62Q0', 38 | INTROS_CHANNEL_ID: 'CMGU8033K', 39 | }, 40 | logRetention: RetentionDays.ONE_DAY, // There will be a lot of event logs, this will make sure to cut down on costs 41 | }) 42 | 43 | // Add Dynamo read/write access to the buns table. 44 | rustSlackLambda.role?.attachInlinePolicy( 45 | new Policy(this, 'read-write-buns-table-policy', { 46 | statements: [ 47 | new PolicyStatement({ 48 | actions: [ 49 | 'dynamodb:DescribeTable', 50 | 'dynamodb:Query', 51 | 'dynamodb:Scan', 52 | 'dynamodb:PutItem', 53 | 'dynamodb:UpdateItem', 54 | ], 55 | resources: [bunsTable.tableArn], 56 | }), 57 | ], 58 | }) 59 | ) 60 | 61 | // Defines an API Gateway REST API resource backed by the "rust-slack-lambda" function. 62 | new LambdaRestApi(this, 'RustSlackEndpoint', { 63 | handler: rustSlackLambda, 64 | }) 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "devil-bot-rust-cdk", 3 | "version": "0.1.0", 4 | "bin": { 5 | "devil-bot-rust-cdk": "bin/devil-bot-rust-cdk.js" 6 | }, 7 | "scripts": { 8 | "prettier": "prettier --write './@(lib)/**/*@(.ts|.tsx)'", 9 | "build": "tsc", 10 | "watch": "tsc -w", 11 | "test": "jest", 12 | "cdk": "cdk", 13 | "deploy": "./build-function.sh && cdk deploy", 14 | "prepare": "husky install" 15 | }, 16 | "engines": { 17 | "npm": ">=8.0.0", 18 | "node": ">=16.0.0" 19 | }, 20 | "devDependencies": { 21 | "@aws-cdk/assert": "2.37.1", 22 | "@types/jest": "^28.1.7", 23 | "@types/node": "18.7.5", 24 | "aws-cdk": "^2.37.1", 25 | "jest": "^28.0.0", 26 | "prettier": "2.7.1", 27 | "ts-jest": "^28.0.0", 28 | "ts-node": "^10.0.0", 29 | "typescript": "~4.7.4" 30 | }, 31 | "dependencies": { 32 | "@aws-cdk/aws-apigateway": "1.168.0", 33 | "@aws-cdk/aws-dynamodb": "1.168.0", 34 | "@aws-cdk/aws-iam": "1.168.0", 35 | "@aws-cdk/aws-lambda": "1.168.0", 36 | "@aws-cdk/core": "1.168.0", 37 | "aws-cdk-lib": "2.37.1", 38 | "constructs": "^10.1.77", 39 | "husky": "7.0.4", 40 | "source-map-support": "0.5.21" 41 | }, 42 | "lint-staged": { 43 | "*.{js,ts,json,md}": "prettier --write" 44 | }, 45 | "prettier": { 46 | "semi": false, 47 | "singleQuote": true 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /resources/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "aho-corasick" 7 | version = "0.7.19" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" 10 | dependencies = [ 11 | "memchr", 12 | ] 13 | 14 | [[package]] 15 | name = "android_system_properties" 16 | version = "0.1.5" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" 19 | dependencies = [ 20 | "libc", 21 | ] 22 | 23 | [[package]] 24 | name = "async-recursion" 25 | version = "1.0.0" 26 | source = "registry+https://github.com/rust-lang/crates.io-index" 27 | checksum = "2cda8f4bcc10624c4e85bc66b3f452cca98cfa5ca002dc83a16aad2367641bea" 28 | dependencies = [ 29 | "proc-macro2", 30 | "quote", 31 | "syn", 32 | ] 33 | 34 | [[package]] 35 | name = "async-stream" 36 | version = "0.3.3" 37 | source = "registry+https://github.com/rust-lang/crates.io-index" 38 | checksum = "dad5c83079eae9969be7fadefe640a1c566901f05ff91ab221de4b6f68d9507e" 39 | dependencies = [ 40 | "async-stream-impl", 41 | "futures-core", 42 | ] 43 | 44 | [[package]] 45 | name = "async-stream-impl" 46 | version = "0.3.3" 47 | source = "registry+https://github.com/rust-lang/crates.io-index" 48 | checksum = "10f203db73a71dfa2fb6dd22763990fa26f3d2625a6da2da900d23b87d26be27" 49 | dependencies = [ 50 | "proc-macro2", 51 | "quote", 52 | "syn", 53 | ] 54 | 55 | [[package]] 56 | name = "async-trait" 57 | version = "0.1.58" 58 | source = "registry+https://github.com/rust-lang/crates.io-index" 59 | checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" 60 | dependencies = [ 61 | "proc-macro2", 62 | "quote", 63 | "syn", 64 | ] 65 | 66 | [[package]] 67 | name = "atty" 68 | version = "0.2.14" 69 | source = "registry+https://github.com/rust-lang/crates.io-index" 70 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 71 | dependencies = [ 72 | "hermit-abi", 73 | "libc", 74 | "winapi", 75 | ] 76 | 77 | [[package]] 78 | name = "autocfg" 79 | version = "1.1.0" 80 | source = "registry+https://github.com/rust-lang/crates.io-index" 81 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 82 | 83 | [[package]] 84 | name = "aws-config" 85 | version = "0.51.0" 86 | source = "registry+https://github.com/rust-lang/crates.io-index" 87 | checksum = "56a636c44c77fa18bdba56126a34d30cfe5538fe88f7d34988fa731fee143ddd" 88 | dependencies = [ 89 | "aws-http", 90 | "aws-sdk-sso", 91 | "aws-sdk-sts", 92 | "aws-smithy-async", 93 | "aws-smithy-client", 94 | "aws-smithy-http", 95 | "aws-smithy-http-tower", 96 | "aws-smithy-json", 97 | "aws-smithy-types", 98 | "aws-types", 99 | "bytes", 100 | "hex", 101 | "http", 102 | "hyper", 103 | "ring", 104 | "time 0.3.16", 105 | "tokio", 106 | "tower", 107 | "tracing", 108 | "zeroize", 109 | ] 110 | 111 | [[package]] 112 | name = "aws-endpoint" 113 | version = "0.51.0" 114 | source = "registry+https://github.com/rust-lang/crates.io-index" 115 | checksum = "6ca8f374874f6459aaa88dc861d7f5d834ca1ff97668eae190e97266b5f6c3fb" 116 | dependencies = [ 117 | "aws-smithy-http", 118 | "aws-smithy-types", 119 | "aws-types", 120 | "http", 121 | "regex", 122 | "tracing", 123 | ] 124 | 125 | [[package]] 126 | name = "aws-http" 127 | version = "0.51.0" 128 | source = "registry+https://github.com/rust-lang/crates.io-index" 129 | checksum = "78d41e19e779b73463f5f0c21b3aacc995f4ba783ab13a7ae9f5dfb159a551b4" 130 | dependencies = [ 131 | "aws-smithy-http", 132 | "aws-smithy-types", 133 | "aws-types", 134 | "bytes", 135 | "http", 136 | "http-body", 137 | "lazy_static", 138 | "percent-encoding", 139 | "pin-project-lite", 140 | "tracing", 141 | ] 142 | 143 | [[package]] 144 | name = "aws-sdk-dynamodb" 145 | version = "0.21.0" 146 | source = "registry+https://github.com/rust-lang/crates.io-index" 147 | checksum = "28e71b3f397f2f39cb15fbba1c9105a88fd12b665e51100f02837667f27294f9" 148 | dependencies = [ 149 | "aws-endpoint", 150 | "aws-http", 151 | "aws-sig-auth", 152 | "aws-smithy-async", 153 | "aws-smithy-client", 154 | "aws-smithy-http", 155 | "aws-smithy-http-tower", 156 | "aws-smithy-json", 157 | "aws-smithy-types", 158 | "aws-types", 159 | "bytes", 160 | "fastrand", 161 | "http", 162 | "tokio-stream", 163 | "tower", 164 | ] 165 | 166 | [[package]] 167 | name = "aws-sdk-sso" 168 | version = "0.21.0" 169 | source = "registry+https://github.com/rust-lang/crates.io-index" 170 | checksum = "86dcb1cb71aa8763b327542ead410424515cff0cde5b753eedd2917e09c63734" 171 | dependencies = [ 172 | "aws-endpoint", 173 | "aws-http", 174 | "aws-sig-auth", 175 | "aws-smithy-async", 176 | "aws-smithy-client", 177 | "aws-smithy-http", 178 | "aws-smithy-http-tower", 179 | "aws-smithy-json", 180 | "aws-smithy-types", 181 | "aws-types", 182 | "bytes", 183 | "http", 184 | "tokio-stream", 185 | "tower", 186 | ] 187 | 188 | [[package]] 189 | name = "aws-sdk-sts" 190 | version = "0.21.0" 191 | source = "registry+https://github.com/rust-lang/crates.io-index" 192 | checksum = "fdfcf584297c666f6b472d5368a78de3bc714b6e0a53d7fbf76c3e347c292ab1" 193 | dependencies = [ 194 | "aws-endpoint", 195 | "aws-http", 196 | "aws-sig-auth", 197 | "aws-smithy-async", 198 | "aws-smithy-client", 199 | "aws-smithy-http", 200 | "aws-smithy-http-tower", 201 | "aws-smithy-query", 202 | "aws-smithy-types", 203 | "aws-smithy-xml", 204 | "aws-types", 205 | "bytes", 206 | "http", 207 | "tower", 208 | ] 209 | 210 | [[package]] 211 | name = "aws-sig-auth" 212 | version = "0.51.0" 213 | source = "registry+https://github.com/rust-lang/crates.io-index" 214 | checksum = "12cbe7b2be9e185c1fbce27fc9c41c66b195b32d89aa099f98768d9544221308" 215 | dependencies = [ 216 | "aws-sigv4", 217 | "aws-smithy-http", 218 | "aws-types", 219 | "http", 220 | "tracing", 221 | ] 222 | 223 | [[package]] 224 | name = "aws-sigv4" 225 | version = "0.51.0" 226 | source = "registry+https://github.com/rust-lang/crates.io-index" 227 | checksum = "03ff4cff8c4a101962d593ba94e72cd83891aecd423f0c6e3146bff6fb92c9e3" 228 | dependencies = [ 229 | "aws-smithy-http", 230 | "form_urlencoded", 231 | "hex", 232 | "http", 233 | "once_cell", 234 | "percent-encoding", 235 | "regex", 236 | "ring", 237 | "time 0.3.16", 238 | "tracing", 239 | ] 240 | 241 | [[package]] 242 | name = "aws-smithy-async" 243 | version = "0.51.0" 244 | source = "registry+https://github.com/rust-lang/crates.io-index" 245 | checksum = "7b3442b4c5d3fc39891a2e5e625735fba6b24694887d49c6518460fde98247a9" 246 | dependencies = [ 247 | "futures-util", 248 | "pin-project-lite", 249 | "tokio", 250 | "tokio-stream", 251 | ] 252 | 253 | [[package]] 254 | name = "aws-smithy-client" 255 | version = "0.51.0" 256 | source = "registry+https://github.com/rust-lang/crates.io-index" 257 | checksum = "ff28d553714f8f54cd921227934fc13a536a1c03f106e56b362fd57e16d450ad" 258 | dependencies = [ 259 | "aws-smithy-async", 260 | "aws-smithy-http", 261 | "aws-smithy-http-tower", 262 | "aws-smithy-types", 263 | "bytes", 264 | "fastrand", 265 | "http", 266 | "http-body", 267 | "hyper", 268 | "hyper-rustls", 269 | "lazy_static", 270 | "pin-project-lite", 271 | "tokio", 272 | "tower", 273 | "tracing", 274 | ] 275 | 276 | [[package]] 277 | name = "aws-smithy-http" 278 | version = "0.51.0" 279 | source = "registry+https://github.com/rust-lang/crates.io-index" 280 | checksum = "bf58ed4fefa61dbf038e5421a521cbc2c448ef69deff0ab1d915d8a10eda5664" 281 | dependencies = [ 282 | "aws-smithy-types", 283 | "bytes", 284 | "bytes-utils", 285 | "futures-core", 286 | "http", 287 | "http-body", 288 | "hyper", 289 | "once_cell", 290 | "percent-encoding", 291 | "pin-project-lite", 292 | "pin-utils", 293 | "tokio", 294 | "tokio-util", 295 | "tracing", 296 | ] 297 | 298 | [[package]] 299 | name = "aws-smithy-http-tower" 300 | version = "0.51.0" 301 | source = "registry+https://github.com/rust-lang/crates.io-index" 302 | checksum = "20c96d7bd35e7cf96aca1134b2f81b1b59ffe493f7c6539c051791cbbf7a42d3" 303 | dependencies = [ 304 | "aws-smithy-http", 305 | "bytes", 306 | "http", 307 | "http-body", 308 | "pin-project-lite", 309 | "tower", 310 | "tracing", 311 | ] 312 | 313 | [[package]] 314 | name = "aws-smithy-json" 315 | version = "0.51.0" 316 | source = "registry+https://github.com/rust-lang/crates.io-index" 317 | checksum = "d8324ba98c8a94187723cc16c37aefa09504646ee65c3d2c3af495bab5ea701b" 318 | dependencies = [ 319 | "aws-smithy-types", 320 | ] 321 | 322 | [[package]] 323 | name = "aws-smithy-query" 324 | version = "0.51.0" 325 | source = "registry+https://github.com/rust-lang/crates.io-index" 326 | checksum = "83834ed2ff69ea6f6657baf205267dc2c0abe940703503a3e5d60ce23be3d306" 327 | dependencies = [ 328 | "aws-smithy-types", 329 | "urlencoding", 330 | ] 331 | 332 | [[package]] 333 | name = "aws-smithy-types" 334 | version = "0.51.0" 335 | source = "registry+https://github.com/rust-lang/crates.io-index" 336 | checksum = "8b02e06ea63498c43bc0217ea4d16605d4e58d85c12fc23f6572ff6d0a840c61" 337 | dependencies = [ 338 | "itoa", 339 | "num-integer", 340 | "ryu", 341 | "time 0.3.16", 342 | ] 343 | 344 | [[package]] 345 | name = "aws-smithy-xml" 346 | version = "0.51.0" 347 | source = "registry+https://github.com/rust-lang/crates.io-index" 348 | checksum = "246e9f83dd1fdf5d347fa30ae4ad30a9d1d42ce4cd74a93d94afa874646f94cd" 349 | dependencies = [ 350 | "xmlparser", 351 | ] 352 | 353 | [[package]] 354 | name = "aws-types" 355 | version = "0.51.0" 356 | source = "registry+https://github.com/rust-lang/crates.io-index" 357 | checksum = "05701d32da168b44f7ee63147781aed8723e792cc131cb9b18363b5393f17f70" 358 | dependencies = [ 359 | "aws-smithy-async", 360 | "aws-smithy-client", 361 | "aws-smithy-http", 362 | "aws-smithy-types", 363 | "http", 364 | "rustc_version", 365 | "tracing", 366 | "zeroize", 367 | ] 368 | 369 | [[package]] 370 | name = "aws_lambda_events" 371 | version = "0.7.2" 372 | source = "registry+https://github.com/rust-lang/crates.io-index" 373 | checksum = "20e4623e6898c4590b27eb26d64f498513b9e4c7b52537f64f75d3f423483c51" 374 | dependencies = [ 375 | "base64", 376 | "bytes", 377 | "chrono", 378 | "http", 379 | "http-body", 380 | "http-serde", 381 | "query_map", 382 | "serde", 383 | "serde_derive", 384 | "serde_json", 385 | ] 386 | 387 | [[package]] 388 | name = "axum" 389 | version = "0.5.17" 390 | source = "registry+https://github.com/rust-lang/crates.io-index" 391 | checksum = "acee9fd5073ab6b045a275b3e709c163dd36c90685219cb21804a147b58dba43" 392 | dependencies = [ 393 | "async-trait", 394 | "axum-core", 395 | "bitflags", 396 | "bytes", 397 | "futures-util", 398 | "http", 399 | "http-body", 400 | "hyper", 401 | "itoa", 402 | "matchit", 403 | "memchr", 404 | "mime", 405 | "percent-encoding", 406 | "pin-project-lite", 407 | "serde", 408 | "serde_json", 409 | "serde_urlencoded", 410 | "sync_wrapper", 411 | "tokio", 412 | "tower", 413 | "tower-http", 414 | "tower-layer", 415 | "tower-service", 416 | ] 417 | 418 | [[package]] 419 | name = "axum-core" 420 | version = "0.2.9" 421 | source = "registry+https://github.com/rust-lang/crates.io-index" 422 | checksum = "37e5939e02c56fecd5c017c37df4238c0a839fa76b7f97acdd7efb804fd181cc" 423 | dependencies = [ 424 | "async-trait", 425 | "bytes", 426 | "futures-util", 427 | "http", 428 | "http-body", 429 | "mime", 430 | "tower-layer", 431 | "tower-service", 432 | ] 433 | 434 | [[package]] 435 | name = "base64" 436 | version = "0.13.1" 437 | source = "registry+https://github.com/rust-lang/crates.io-index" 438 | checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" 439 | 440 | [[package]] 441 | name = "bitflags" 442 | version = "1.3.2" 443 | source = "registry+https://github.com/rust-lang/crates.io-index" 444 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 445 | 446 | [[package]] 447 | name = "block-buffer" 448 | version = "0.10.3" 449 | source = "registry+https://github.com/rust-lang/crates.io-index" 450 | checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" 451 | dependencies = [ 452 | "generic-array", 453 | ] 454 | 455 | [[package]] 456 | name = "bumpalo" 457 | version = "3.11.1" 458 | source = "registry+https://github.com/rust-lang/crates.io-index" 459 | checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" 460 | 461 | [[package]] 462 | name = "byteorder" 463 | version = "1.4.3" 464 | source = "registry+https://github.com/rust-lang/crates.io-index" 465 | checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" 466 | 467 | [[package]] 468 | name = "bytes" 469 | version = "1.2.1" 470 | source = "registry+https://github.com/rust-lang/crates.io-index" 471 | checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" 472 | dependencies = [ 473 | "serde", 474 | ] 475 | 476 | [[package]] 477 | name = "bytes-utils" 478 | version = "0.1.2" 479 | source = "registry+https://github.com/rust-lang/crates.io-index" 480 | checksum = "1934a3ef9cac8efde4966a92781e77713e1ba329f1d42e446c7d7eba340d8ef1" 481 | dependencies = [ 482 | "bytes", 483 | "either", 484 | ] 485 | 486 | [[package]] 487 | name = "cc" 488 | version = "1.0.74" 489 | source = "registry+https://github.com/rust-lang/crates.io-index" 490 | checksum = "581f5dba903aac52ea3feb5ec4810848460ee833876f1f9b0fdeab1f19091574" 491 | 492 | [[package]] 493 | name = "cfg-if" 494 | version = "1.0.0" 495 | source = "registry+https://github.com/rust-lang/crates.io-index" 496 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 497 | 498 | [[package]] 499 | name = "chrono" 500 | version = "0.4.22" 501 | source = "registry+https://github.com/rust-lang/crates.io-index" 502 | checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" 503 | dependencies = [ 504 | "iana-time-zone", 505 | "js-sys", 506 | "num-integer", 507 | "num-traits", 508 | "serde", 509 | "time 0.1.44", 510 | "wasm-bindgen", 511 | "winapi", 512 | ] 513 | 514 | [[package]] 515 | name = "codespan-reporting" 516 | version = "0.11.1" 517 | source = "registry+https://github.com/rust-lang/crates.io-index" 518 | checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" 519 | dependencies = [ 520 | "termcolor", 521 | "unicode-width", 522 | ] 523 | 524 | [[package]] 525 | name = "colored" 526 | version = "2.0.0" 527 | source = "registry+https://github.com/rust-lang/crates.io-index" 528 | checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd" 529 | dependencies = [ 530 | "atty", 531 | "lazy_static", 532 | "winapi", 533 | ] 534 | 535 | [[package]] 536 | name = "core-foundation" 537 | version = "0.9.3" 538 | source = "registry+https://github.com/rust-lang/crates.io-index" 539 | checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" 540 | dependencies = [ 541 | "core-foundation-sys", 542 | "libc", 543 | ] 544 | 545 | [[package]] 546 | name = "core-foundation-sys" 547 | version = "0.8.3" 548 | source = "registry+https://github.com/rust-lang/crates.io-index" 549 | checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" 550 | 551 | [[package]] 552 | name = "cpufeatures" 553 | version = "0.2.5" 554 | source = "registry+https://github.com/rust-lang/crates.io-index" 555 | checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" 556 | dependencies = [ 557 | "libc", 558 | ] 559 | 560 | [[package]] 561 | name = "crypto-common" 562 | version = "0.1.6" 563 | source = "registry+https://github.com/rust-lang/crates.io-index" 564 | checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" 565 | dependencies = [ 566 | "generic-array", 567 | "typenum", 568 | ] 569 | 570 | [[package]] 571 | name = "cxx" 572 | version = "1.0.80" 573 | source = "registry+https://github.com/rust-lang/crates.io-index" 574 | checksum = "6b7d4e43b25d3c994662706a1d4fcfc32aaa6afd287502c111b237093bb23f3a" 575 | dependencies = [ 576 | "cc", 577 | "cxxbridge-flags", 578 | "cxxbridge-macro", 579 | "link-cplusplus", 580 | ] 581 | 582 | [[package]] 583 | name = "cxx-build" 584 | version = "1.0.80" 585 | source = "registry+https://github.com/rust-lang/crates.io-index" 586 | checksum = "84f8829ddc213e2c1368e51a2564c552b65a8cb6a28f31e576270ac81d5e5827" 587 | dependencies = [ 588 | "cc", 589 | "codespan-reporting", 590 | "once_cell", 591 | "proc-macro2", 592 | "quote", 593 | "scratch", 594 | "syn", 595 | ] 596 | 597 | [[package]] 598 | name = "cxxbridge-flags" 599 | version = "1.0.80" 600 | source = "registry+https://github.com/rust-lang/crates.io-index" 601 | checksum = "e72537424b474af1460806647c41d4b6d35d09ef7fe031c5c2fa5766047cc56a" 602 | 603 | [[package]] 604 | name = "cxxbridge-macro" 605 | version = "1.0.80" 606 | source = "registry+https://github.com/rust-lang/crates.io-index" 607 | checksum = "309e4fb93eed90e1e14bea0da16b209f81813ba9fc7830c20ed151dd7bc0a4d7" 608 | dependencies = [ 609 | "proc-macro2", 610 | "quote", 611 | "syn", 612 | ] 613 | 614 | [[package]] 615 | name = "darling" 616 | version = "0.13.4" 617 | source = "registry+https://github.com/rust-lang/crates.io-index" 618 | checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" 619 | dependencies = [ 620 | "darling_core", 621 | "darling_macro", 622 | ] 623 | 624 | [[package]] 625 | name = "darling_core" 626 | version = "0.13.4" 627 | source = "registry+https://github.com/rust-lang/crates.io-index" 628 | checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" 629 | dependencies = [ 630 | "fnv", 631 | "ident_case", 632 | "proc-macro2", 633 | "quote", 634 | "strsim", 635 | "syn", 636 | ] 637 | 638 | [[package]] 639 | name = "darling_macro" 640 | version = "0.13.4" 641 | source = "registry+https://github.com/rust-lang/crates.io-index" 642 | checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" 643 | dependencies = [ 644 | "darling_core", 645 | "quote", 646 | "syn", 647 | ] 648 | 649 | [[package]] 650 | name = "devil_bot_rust" 651 | version = "0.1.0" 652 | dependencies = [ 653 | "aws-config", 654 | "aws-sdk-dynamodb", 655 | "hyper", 656 | "lambda_http", 657 | "lambda_runtime", 658 | "log", 659 | "openssl", 660 | "serde", 661 | "serde_derive", 662 | "serde_json", 663 | "simple_logger", 664 | "slack-morphism", 665 | "tokio", 666 | ] 667 | 668 | [[package]] 669 | name = "digest" 670 | version = "0.10.5" 671 | source = "registry+https://github.com/rust-lang/crates.io-index" 672 | checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" 673 | dependencies = [ 674 | "block-buffer", 675 | "crypto-common", 676 | ] 677 | 678 | [[package]] 679 | name = "either" 680 | version = "1.8.0" 681 | source = "registry+https://github.com/rust-lang/crates.io-index" 682 | checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" 683 | 684 | [[package]] 685 | name = "encoding_rs" 686 | version = "0.8.31" 687 | source = "registry+https://github.com/rust-lang/crates.io-index" 688 | checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" 689 | dependencies = [ 690 | "cfg-if", 691 | ] 692 | 693 | [[package]] 694 | name = "fastrand" 695 | version = "1.8.0" 696 | source = "registry+https://github.com/rust-lang/crates.io-index" 697 | checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" 698 | dependencies = [ 699 | "instant", 700 | ] 701 | 702 | [[package]] 703 | name = "fnv" 704 | version = "1.0.7" 705 | source = "registry+https://github.com/rust-lang/crates.io-index" 706 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 707 | 708 | [[package]] 709 | name = "foreign-types" 710 | version = "0.3.2" 711 | source = "registry+https://github.com/rust-lang/crates.io-index" 712 | checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" 713 | dependencies = [ 714 | "foreign-types-shared", 715 | ] 716 | 717 | [[package]] 718 | name = "foreign-types-shared" 719 | version = "0.1.1" 720 | source = "registry+https://github.com/rust-lang/crates.io-index" 721 | checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" 722 | 723 | [[package]] 724 | name = "form_urlencoded" 725 | version = "1.1.0" 726 | source = "registry+https://github.com/rust-lang/crates.io-index" 727 | checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" 728 | dependencies = [ 729 | "percent-encoding", 730 | ] 731 | 732 | [[package]] 733 | name = "futures" 734 | version = "0.3.25" 735 | source = "registry+https://github.com/rust-lang/crates.io-index" 736 | checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" 737 | dependencies = [ 738 | "futures-channel", 739 | "futures-core", 740 | "futures-executor", 741 | "futures-io", 742 | "futures-sink", 743 | "futures-task", 744 | "futures-util", 745 | ] 746 | 747 | [[package]] 748 | name = "futures-channel" 749 | version = "0.3.25" 750 | source = "registry+https://github.com/rust-lang/crates.io-index" 751 | checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" 752 | dependencies = [ 753 | "futures-core", 754 | "futures-sink", 755 | ] 756 | 757 | [[package]] 758 | name = "futures-core" 759 | version = "0.3.25" 760 | source = "registry+https://github.com/rust-lang/crates.io-index" 761 | checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" 762 | 763 | [[package]] 764 | name = "futures-executor" 765 | version = "0.3.25" 766 | source = "registry+https://github.com/rust-lang/crates.io-index" 767 | checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" 768 | dependencies = [ 769 | "futures-core", 770 | "futures-task", 771 | "futures-util", 772 | ] 773 | 774 | [[package]] 775 | name = "futures-io" 776 | version = "0.3.25" 777 | source = "registry+https://github.com/rust-lang/crates.io-index" 778 | checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" 779 | 780 | [[package]] 781 | name = "futures-locks" 782 | version = "0.7.0" 783 | source = "registry+https://github.com/rust-lang/crates.io-index" 784 | checksum = "3eb42d4fb72227be5778429f9ef5240a38a358925a49f05b5cf702ce7c7e558a" 785 | dependencies = [ 786 | "futures-channel", 787 | "futures-task", 788 | "tokio", 789 | ] 790 | 791 | [[package]] 792 | name = "futures-macro" 793 | version = "0.3.25" 794 | source = "registry+https://github.com/rust-lang/crates.io-index" 795 | checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" 796 | dependencies = [ 797 | "proc-macro2", 798 | "quote", 799 | "syn", 800 | ] 801 | 802 | [[package]] 803 | name = "futures-sink" 804 | version = "0.3.25" 805 | source = "registry+https://github.com/rust-lang/crates.io-index" 806 | checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" 807 | 808 | [[package]] 809 | name = "futures-task" 810 | version = "0.3.25" 811 | source = "registry+https://github.com/rust-lang/crates.io-index" 812 | checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" 813 | 814 | [[package]] 815 | name = "futures-util" 816 | version = "0.3.25" 817 | source = "registry+https://github.com/rust-lang/crates.io-index" 818 | checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" 819 | dependencies = [ 820 | "futures-channel", 821 | "futures-core", 822 | "futures-io", 823 | "futures-macro", 824 | "futures-sink", 825 | "futures-task", 826 | "memchr", 827 | "pin-project-lite", 828 | "pin-utils", 829 | "slab", 830 | ] 831 | 832 | [[package]] 833 | name = "generic-array" 834 | version = "0.14.6" 835 | source = "registry+https://github.com/rust-lang/crates.io-index" 836 | checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" 837 | dependencies = [ 838 | "typenum", 839 | "version_check", 840 | ] 841 | 842 | [[package]] 843 | name = "getrandom" 844 | version = "0.2.8" 845 | source = "registry+https://github.com/rust-lang/crates.io-index" 846 | checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" 847 | dependencies = [ 848 | "cfg-if", 849 | "libc", 850 | "wasi 0.11.0+wasi-snapshot-preview1", 851 | ] 852 | 853 | [[package]] 854 | name = "h2" 855 | version = "0.3.15" 856 | source = "registry+https://github.com/rust-lang/crates.io-index" 857 | checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" 858 | dependencies = [ 859 | "bytes", 860 | "fnv", 861 | "futures-core", 862 | "futures-sink", 863 | "futures-util", 864 | "http", 865 | "indexmap", 866 | "slab", 867 | "tokio", 868 | "tokio-util", 869 | "tracing", 870 | ] 871 | 872 | [[package]] 873 | name = "hashbrown" 874 | version = "0.12.3" 875 | source = "registry+https://github.com/rust-lang/crates.io-index" 876 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 877 | 878 | [[package]] 879 | name = "hermit-abi" 880 | version = "0.1.19" 881 | source = "registry+https://github.com/rust-lang/crates.io-index" 882 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" 883 | dependencies = [ 884 | "libc", 885 | ] 886 | 887 | [[package]] 888 | name = "hex" 889 | version = "0.4.3" 890 | source = "registry+https://github.com/rust-lang/crates.io-index" 891 | checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" 892 | 893 | [[package]] 894 | name = "http" 895 | version = "0.2.8" 896 | source = "registry+https://github.com/rust-lang/crates.io-index" 897 | checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" 898 | dependencies = [ 899 | "bytes", 900 | "fnv", 901 | "itoa", 902 | ] 903 | 904 | [[package]] 905 | name = "http-body" 906 | version = "0.4.5" 907 | source = "registry+https://github.com/rust-lang/crates.io-index" 908 | checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" 909 | dependencies = [ 910 | "bytes", 911 | "http", 912 | "pin-project-lite", 913 | ] 914 | 915 | [[package]] 916 | name = "http-range-header" 917 | version = "0.3.0" 918 | source = "registry+https://github.com/rust-lang/crates.io-index" 919 | checksum = "0bfe8eed0a9285ef776bb792479ea3834e8b94e13d615c2f66d03dd50a435a29" 920 | 921 | [[package]] 922 | name = "http-serde" 923 | version = "1.1.2" 924 | source = "registry+https://github.com/rust-lang/crates.io-index" 925 | checksum = "0e272971f774ba29341db2f686255ff8a979365a26fb9e4277f6b6d9ec0cdd5e" 926 | dependencies = [ 927 | "http", 928 | "serde", 929 | ] 930 | 931 | [[package]] 932 | name = "httparse" 933 | version = "1.8.0" 934 | source = "registry+https://github.com/rust-lang/crates.io-index" 935 | checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" 936 | 937 | [[package]] 938 | name = "httpdate" 939 | version = "1.0.2" 940 | source = "registry+https://github.com/rust-lang/crates.io-index" 941 | checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" 942 | 943 | [[package]] 944 | name = "hyper" 945 | version = "0.14.22" 946 | source = "registry+https://github.com/rust-lang/crates.io-index" 947 | checksum = "abfba89e19b959ca163c7752ba59d737c1ceea53a5d31a149c805446fc958064" 948 | dependencies = [ 949 | "bytes", 950 | "futures-channel", 951 | "futures-core", 952 | "futures-util", 953 | "h2", 954 | "http", 955 | "http-body", 956 | "httparse", 957 | "httpdate", 958 | "itoa", 959 | "pin-project-lite", 960 | "socket2", 961 | "tokio", 962 | "tower-service", 963 | "tracing", 964 | "want", 965 | ] 966 | 967 | [[package]] 968 | name = "hyper-rustls" 969 | version = "0.23.0" 970 | source = "registry+https://github.com/rust-lang/crates.io-index" 971 | checksum = "d87c48c02e0dc5e3b849a2041db3029fd066650f8f717c07bf8ed78ccb895cac" 972 | dependencies = [ 973 | "http", 974 | "hyper", 975 | "log", 976 | "rustls", 977 | "rustls-native-certs", 978 | "tokio", 979 | "tokio-rustls", 980 | ] 981 | 982 | [[package]] 983 | name = "iana-time-zone" 984 | version = "0.1.53" 985 | source = "registry+https://github.com/rust-lang/crates.io-index" 986 | checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" 987 | dependencies = [ 988 | "android_system_properties", 989 | "core-foundation-sys", 990 | "iana-time-zone-haiku", 991 | "js-sys", 992 | "wasm-bindgen", 993 | "winapi", 994 | ] 995 | 996 | [[package]] 997 | name = "iana-time-zone-haiku" 998 | version = "0.1.1" 999 | source = "registry+https://github.com/rust-lang/crates.io-index" 1000 | checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" 1001 | dependencies = [ 1002 | "cxx", 1003 | "cxx-build", 1004 | ] 1005 | 1006 | [[package]] 1007 | name = "ident_case" 1008 | version = "1.0.1" 1009 | source = "registry+https://github.com/rust-lang/crates.io-index" 1010 | checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" 1011 | 1012 | [[package]] 1013 | name = "idna" 1014 | version = "0.3.0" 1015 | source = "registry+https://github.com/rust-lang/crates.io-index" 1016 | checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" 1017 | dependencies = [ 1018 | "unicode-bidi", 1019 | "unicode-normalization", 1020 | ] 1021 | 1022 | [[package]] 1023 | name = "indexmap" 1024 | version = "1.9.1" 1025 | source = "registry+https://github.com/rust-lang/crates.io-index" 1026 | checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" 1027 | dependencies = [ 1028 | "autocfg", 1029 | "hashbrown", 1030 | ] 1031 | 1032 | [[package]] 1033 | name = "instant" 1034 | version = "0.1.12" 1035 | source = "registry+https://github.com/rust-lang/crates.io-index" 1036 | checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" 1037 | dependencies = [ 1038 | "cfg-if", 1039 | ] 1040 | 1041 | [[package]] 1042 | name = "itoa" 1043 | version = "1.0.4" 1044 | source = "registry+https://github.com/rust-lang/crates.io-index" 1045 | checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" 1046 | 1047 | [[package]] 1048 | name = "js-sys" 1049 | version = "0.3.60" 1050 | source = "registry+https://github.com/rust-lang/crates.io-index" 1051 | checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" 1052 | dependencies = [ 1053 | "wasm-bindgen", 1054 | ] 1055 | 1056 | [[package]] 1057 | name = "lambda_http" 1058 | version = "0.7.1" 1059 | source = "registry+https://github.com/rust-lang/crates.io-index" 1060 | checksum = "e99edb20005e6456db8f1bb5abec3cf7787640b456dda195c1a3216ec4397ce8" 1061 | dependencies = [ 1062 | "aws_lambda_events", 1063 | "base64", 1064 | "bytes", 1065 | "encoding_rs", 1066 | "http", 1067 | "http-body", 1068 | "hyper", 1069 | "lambda_runtime", 1070 | "mime", 1071 | "percent-encoding", 1072 | "serde", 1073 | "serde_json", 1074 | "serde_urlencoded", 1075 | "url", 1076 | ] 1077 | 1078 | [[package]] 1079 | name = "lambda_runtime" 1080 | version = "0.7.0" 1081 | source = "registry+https://github.com/rust-lang/crates.io-index" 1082 | checksum = "0b64c1a62e7f43f7c3aed77806c182a338acbed3d95995380d6a9c1eb8650767" 1083 | dependencies = [ 1084 | "async-stream", 1085 | "bytes", 1086 | "futures", 1087 | "http", 1088 | "hyper", 1089 | "lambda_runtime_api_client", 1090 | "serde", 1091 | "serde_json", 1092 | "tokio", 1093 | "tokio-stream", 1094 | "tower", 1095 | "tracing", 1096 | ] 1097 | 1098 | [[package]] 1099 | name = "lambda_runtime_api_client" 1100 | version = "0.7.0" 1101 | source = "registry+https://github.com/rust-lang/crates.io-index" 1102 | checksum = "7210012be904051520f0dc502140ba599bae3042b65b3737b87727f1aa88a7d6" 1103 | dependencies = [ 1104 | "http", 1105 | "hyper", 1106 | "tokio", 1107 | "tower-service", 1108 | ] 1109 | 1110 | [[package]] 1111 | name = "lazy_static" 1112 | version = "1.4.0" 1113 | source = "registry+https://github.com/rust-lang/crates.io-index" 1114 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 1115 | 1116 | [[package]] 1117 | name = "libc" 1118 | version = "0.2.137" 1119 | source = "registry+https://github.com/rust-lang/crates.io-index" 1120 | checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" 1121 | 1122 | [[package]] 1123 | name = "link-cplusplus" 1124 | version = "1.0.7" 1125 | source = "registry+https://github.com/rust-lang/crates.io-index" 1126 | checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" 1127 | dependencies = [ 1128 | "cc", 1129 | ] 1130 | 1131 | [[package]] 1132 | name = "lock_api" 1133 | version = "0.4.9" 1134 | source = "registry+https://github.com/rust-lang/crates.io-index" 1135 | checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" 1136 | dependencies = [ 1137 | "autocfg", 1138 | "scopeguard", 1139 | ] 1140 | 1141 | [[package]] 1142 | name = "log" 1143 | version = "0.4.17" 1144 | source = "registry+https://github.com/rust-lang/crates.io-index" 1145 | checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" 1146 | dependencies = [ 1147 | "cfg-if", 1148 | ] 1149 | 1150 | [[package]] 1151 | name = "matchit" 1152 | version = "0.5.0" 1153 | source = "registry+https://github.com/rust-lang/crates.io-index" 1154 | checksum = "73cbba799671b762df5a175adf59ce145165747bb891505c43d09aefbbf38beb" 1155 | 1156 | [[package]] 1157 | name = "memchr" 1158 | version = "2.5.0" 1159 | source = "registry+https://github.com/rust-lang/crates.io-index" 1160 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 1161 | 1162 | [[package]] 1163 | name = "mime" 1164 | version = "0.3.16" 1165 | source = "registry+https://github.com/rust-lang/crates.io-index" 1166 | checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" 1167 | 1168 | [[package]] 1169 | name = "mio" 1170 | version = "0.8.5" 1171 | source = "registry+https://github.com/rust-lang/crates.io-index" 1172 | checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" 1173 | dependencies = [ 1174 | "libc", 1175 | "log", 1176 | "wasi 0.11.0+wasi-snapshot-preview1", 1177 | "windows-sys 0.42.0", 1178 | ] 1179 | 1180 | [[package]] 1181 | name = "num-integer" 1182 | version = "0.1.45" 1183 | source = "registry+https://github.com/rust-lang/crates.io-index" 1184 | checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" 1185 | dependencies = [ 1186 | "autocfg", 1187 | "num-traits", 1188 | ] 1189 | 1190 | [[package]] 1191 | name = "num-traits" 1192 | version = "0.2.15" 1193 | source = "registry+https://github.com/rust-lang/crates.io-index" 1194 | checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" 1195 | dependencies = [ 1196 | "autocfg", 1197 | ] 1198 | 1199 | [[package]] 1200 | name = "num_cpus" 1201 | version = "1.13.1" 1202 | source = "registry+https://github.com/rust-lang/crates.io-index" 1203 | checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" 1204 | dependencies = [ 1205 | "hermit-abi", 1206 | "libc", 1207 | ] 1208 | 1209 | [[package]] 1210 | name = "num_threads" 1211 | version = "0.1.6" 1212 | source = "registry+https://github.com/rust-lang/crates.io-index" 1213 | checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" 1214 | dependencies = [ 1215 | "libc", 1216 | ] 1217 | 1218 | [[package]] 1219 | name = "once_cell" 1220 | version = "1.16.0" 1221 | source = "registry+https://github.com/rust-lang/crates.io-index" 1222 | checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" 1223 | 1224 | [[package]] 1225 | name = "openssl" 1226 | version = "0.10.42" 1227 | source = "registry+https://github.com/rust-lang/crates.io-index" 1228 | checksum = "12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13" 1229 | dependencies = [ 1230 | "bitflags", 1231 | "cfg-if", 1232 | "foreign-types", 1233 | "libc", 1234 | "once_cell", 1235 | "openssl-macros", 1236 | "openssl-sys", 1237 | ] 1238 | 1239 | [[package]] 1240 | name = "openssl-macros" 1241 | version = "0.1.0" 1242 | source = "registry+https://github.com/rust-lang/crates.io-index" 1243 | checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" 1244 | dependencies = [ 1245 | "proc-macro2", 1246 | "quote", 1247 | "syn", 1248 | ] 1249 | 1250 | [[package]] 1251 | name = "openssl-probe" 1252 | version = "0.1.5" 1253 | source = "registry+https://github.com/rust-lang/crates.io-index" 1254 | checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" 1255 | 1256 | [[package]] 1257 | name = "openssl-src" 1258 | version = "111.24.0+1.1.1s" 1259 | source = "registry+https://github.com/rust-lang/crates.io-index" 1260 | checksum = "3498f259dab01178c6228c6b00dcef0ed2a2d5e20d648c017861227773ea4abd" 1261 | dependencies = [ 1262 | "cc", 1263 | ] 1264 | 1265 | [[package]] 1266 | name = "openssl-sys" 1267 | version = "0.9.77" 1268 | source = "registry+https://github.com/rust-lang/crates.io-index" 1269 | checksum = "b03b84c3b2d099b81f0953422b4d4ad58761589d0229b5506356afca05a3670a" 1270 | dependencies = [ 1271 | "autocfg", 1272 | "cc", 1273 | "libc", 1274 | "openssl-src", 1275 | "pkg-config", 1276 | "vcpkg", 1277 | ] 1278 | 1279 | [[package]] 1280 | name = "parking_lot" 1281 | version = "0.12.1" 1282 | source = "registry+https://github.com/rust-lang/crates.io-index" 1283 | checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" 1284 | dependencies = [ 1285 | "lock_api", 1286 | "parking_lot_core", 1287 | ] 1288 | 1289 | [[package]] 1290 | name = "parking_lot_core" 1291 | version = "0.9.4" 1292 | source = "registry+https://github.com/rust-lang/crates.io-index" 1293 | checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" 1294 | dependencies = [ 1295 | "cfg-if", 1296 | "libc", 1297 | "redox_syscall", 1298 | "smallvec", 1299 | "windows-sys 0.42.0", 1300 | ] 1301 | 1302 | [[package]] 1303 | name = "percent-encoding" 1304 | version = "2.2.0" 1305 | source = "registry+https://github.com/rust-lang/crates.io-index" 1306 | checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" 1307 | 1308 | [[package]] 1309 | name = "pin-project" 1310 | version = "1.0.12" 1311 | source = "registry+https://github.com/rust-lang/crates.io-index" 1312 | checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" 1313 | dependencies = [ 1314 | "pin-project-internal", 1315 | ] 1316 | 1317 | [[package]] 1318 | name = "pin-project-internal" 1319 | version = "1.0.12" 1320 | source = "registry+https://github.com/rust-lang/crates.io-index" 1321 | checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" 1322 | dependencies = [ 1323 | "proc-macro2", 1324 | "quote", 1325 | "syn", 1326 | ] 1327 | 1328 | [[package]] 1329 | name = "pin-project-lite" 1330 | version = "0.2.9" 1331 | source = "registry+https://github.com/rust-lang/crates.io-index" 1332 | checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" 1333 | 1334 | [[package]] 1335 | name = "pin-utils" 1336 | version = "0.1.0" 1337 | source = "registry+https://github.com/rust-lang/crates.io-index" 1338 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 1339 | 1340 | [[package]] 1341 | name = "pkg-config" 1342 | version = "0.3.26" 1343 | source = "registry+https://github.com/rust-lang/crates.io-index" 1344 | checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" 1345 | 1346 | [[package]] 1347 | name = "ppv-lite86" 1348 | version = "0.2.16" 1349 | source = "registry+https://github.com/rust-lang/crates.io-index" 1350 | checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" 1351 | 1352 | [[package]] 1353 | name = "proc-macro2" 1354 | version = "1.0.47" 1355 | source = "registry+https://github.com/rust-lang/crates.io-index" 1356 | checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" 1357 | dependencies = [ 1358 | "unicode-ident", 1359 | ] 1360 | 1361 | [[package]] 1362 | name = "query_map" 1363 | version = "0.6.0" 1364 | source = "registry+https://github.com/rust-lang/crates.io-index" 1365 | checksum = "4465aacac3bebc9484cf7a56dc8b2d7feacb657da6002a9198b4f7af4247a204" 1366 | dependencies = [ 1367 | "form_urlencoded", 1368 | "serde", 1369 | "serde_derive", 1370 | ] 1371 | 1372 | [[package]] 1373 | name = "quote" 1374 | version = "1.0.21" 1375 | source = "registry+https://github.com/rust-lang/crates.io-index" 1376 | checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" 1377 | dependencies = [ 1378 | "proc-macro2", 1379 | ] 1380 | 1381 | [[package]] 1382 | name = "rand" 1383 | version = "0.8.5" 1384 | source = "registry+https://github.com/rust-lang/crates.io-index" 1385 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 1386 | dependencies = [ 1387 | "libc", 1388 | "rand_chacha", 1389 | "rand_core", 1390 | ] 1391 | 1392 | [[package]] 1393 | name = "rand_chacha" 1394 | version = "0.3.1" 1395 | source = "registry+https://github.com/rust-lang/crates.io-index" 1396 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 1397 | dependencies = [ 1398 | "ppv-lite86", 1399 | "rand_core", 1400 | ] 1401 | 1402 | [[package]] 1403 | name = "rand_core" 1404 | version = "0.6.4" 1405 | source = "registry+https://github.com/rust-lang/crates.io-index" 1406 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 1407 | dependencies = [ 1408 | "getrandom", 1409 | ] 1410 | 1411 | [[package]] 1412 | name = "redox_syscall" 1413 | version = "0.2.16" 1414 | source = "registry+https://github.com/rust-lang/crates.io-index" 1415 | checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" 1416 | dependencies = [ 1417 | "bitflags", 1418 | ] 1419 | 1420 | [[package]] 1421 | name = "regex" 1422 | version = "1.6.0" 1423 | source = "registry+https://github.com/rust-lang/crates.io-index" 1424 | checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" 1425 | dependencies = [ 1426 | "aho-corasick", 1427 | "memchr", 1428 | "regex-syntax", 1429 | ] 1430 | 1431 | [[package]] 1432 | name = "regex-syntax" 1433 | version = "0.6.27" 1434 | source = "registry+https://github.com/rust-lang/crates.io-index" 1435 | checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" 1436 | 1437 | [[package]] 1438 | name = "ring" 1439 | version = "0.16.20" 1440 | source = "registry+https://github.com/rust-lang/crates.io-index" 1441 | checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" 1442 | dependencies = [ 1443 | "cc", 1444 | "libc", 1445 | "once_cell", 1446 | "spin", 1447 | "untrusted", 1448 | "web-sys", 1449 | "winapi", 1450 | ] 1451 | 1452 | [[package]] 1453 | name = "rsb_derive" 1454 | version = "0.5.1" 1455 | source = "registry+https://github.com/rust-lang/crates.io-index" 1456 | checksum = "b2c53e42fccdc5f1172e099785fe78f89bc0c1e657d0c2ef591efbfac427e9a4" 1457 | dependencies = [ 1458 | "proc-macro2", 1459 | "quote", 1460 | "syn", 1461 | ] 1462 | 1463 | [[package]] 1464 | name = "rustc_version" 1465 | version = "0.4.0" 1466 | source = "registry+https://github.com/rust-lang/crates.io-index" 1467 | checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" 1468 | dependencies = [ 1469 | "semver", 1470 | ] 1471 | 1472 | [[package]] 1473 | name = "rustls" 1474 | version = "0.20.7" 1475 | source = "registry+https://github.com/rust-lang/crates.io-index" 1476 | checksum = "539a2bfe908f471bfa933876bd1eb6a19cf2176d375f82ef7f99530a40e48c2c" 1477 | dependencies = [ 1478 | "log", 1479 | "ring", 1480 | "sct", 1481 | "webpki", 1482 | ] 1483 | 1484 | [[package]] 1485 | name = "rustls-native-certs" 1486 | version = "0.6.2" 1487 | source = "registry+https://github.com/rust-lang/crates.io-index" 1488 | checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" 1489 | dependencies = [ 1490 | "openssl-probe", 1491 | "rustls-pemfile", 1492 | "schannel", 1493 | "security-framework", 1494 | ] 1495 | 1496 | [[package]] 1497 | name = "rustls-pemfile" 1498 | version = "1.0.1" 1499 | source = "registry+https://github.com/rust-lang/crates.io-index" 1500 | checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55" 1501 | dependencies = [ 1502 | "base64", 1503 | ] 1504 | 1505 | [[package]] 1506 | name = "rvs_derive" 1507 | version = "0.3.0" 1508 | source = "registry+https://github.com/rust-lang/crates.io-index" 1509 | checksum = "7efacd0f1ebb1c5c393af6e559ae4ba5712d665d499c7277a82bcb123f07cb66" 1510 | dependencies = [ 1511 | "proc-macro2", 1512 | "quote", 1513 | "syn", 1514 | ] 1515 | 1516 | [[package]] 1517 | name = "rvstruct" 1518 | version = "0.3.0" 1519 | source = "registry+https://github.com/rust-lang/crates.io-index" 1520 | checksum = "0694bba8940d00c633dc0c89c4ab5b3d7fe16f8e0e0119a090930dd149517ba8" 1521 | dependencies = [ 1522 | "rvs_derive", 1523 | ] 1524 | 1525 | [[package]] 1526 | name = "ryu" 1527 | version = "1.0.11" 1528 | source = "registry+https://github.com/rust-lang/crates.io-index" 1529 | checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" 1530 | 1531 | [[package]] 1532 | name = "schannel" 1533 | version = "0.1.20" 1534 | source = "registry+https://github.com/rust-lang/crates.io-index" 1535 | checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" 1536 | dependencies = [ 1537 | "lazy_static", 1538 | "windows-sys 0.36.1", 1539 | ] 1540 | 1541 | [[package]] 1542 | name = "scopeguard" 1543 | version = "1.1.0" 1544 | source = "registry+https://github.com/rust-lang/crates.io-index" 1545 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" 1546 | 1547 | [[package]] 1548 | name = "scratch" 1549 | version = "1.0.2" 1550 | source = "registry+https://github.com/rust-lang/crates.io-index" 1551 | checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" 1552 | 1553 | [[package]] 1554 | name = "sct" 1555 | version = "0.7.0" 1556 | source = "registry+https://github.com/rust-lang/crates.io-index" 1557 | checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" 1558 | dependencies = [ 1559 | "ring", 1560 | "untrusted", 1561 | ] 1562 | 1563 | [[package]] 1564 | name = "security-framework" 1565 | version = "2.7.0" 1566 | source = "registry+https://github.com/rust-lang/crates.io-index" 1567 | checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" 1568 | dependencies = [ 1569 | "bitflags", 1570 | "core-foundation", 1571 | "core-foundation-sys", 1572 | "libc", 1573 | "security-framework-sys", 1574 | ] 1575 | 1576 | [[package]] 1577 | name = "security-framework-sys" 1578 | version = "2.6.1" 1579 | source = "registry+https://github.com/rust-lang/crates.io-index" 1580 | checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" 1581 | dependencies = [ 1582 | "core-foundation-sys", 1583 | "libc", 1584 | ] 1585 | 1586 | [[package]] 1587 | name = "semver" 1588 | version = "1.0.14" 1589 | source = "registry+https://github.com/rust-lang/crates.io-index" 1590 | checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" 1591 | 1592 | [[package]] 1593 | name = "serde" 1594 | version = "1.0.147" 1595 | source = "registry+https://github.com/rust-lang/crates.io-index" 1596 | checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" 1597 | dependencies = [ 1598 | "serde_derive", 1599 | ] 1600 | 1601 | [[package]] 1602 | name = "serde_derive" 1603 | version = "1.0.147" 1604 | source = "registry+https://github.com/rust-lang/crates.io-index" 1605 | checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" 1606 | dependencies = [ 1607 | "proc-macro2", 1608 | "quote", 1609 | "syn", 1610 | ] 1611 | 1612 | [[package]] 1613 | name = "serde_json" 1614 | version = "1.0.87" 1615 | source = "registry+https://github.com/rust-lang/crates.io-index" 1616 | checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" 1617 | dependencies = [ 1618 | "itoa", 1619 | "ryu", 1620 | "serde", 1621 | ] 1622 | 1623 | [[package]] 1624 | name = "serde_urlencoded" 1625 | version = "0.7.1" 1626 | source = "registry+https://github.com/rust-lang/crates.io-index" 1627 | checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" 1628 | dependencies = [ 1629 | "form_urlencoded", 1630 | "itoa", 1631 | "ryu", 1632 | "serde", 1633 | ] 1634 | 1635 | [[package]] 1636 | name = "serde_with" 1637 | version = "1.14.0" 1638 | source = "registry+https://github.com/rust-lang/crates.io-index" 1639 | checksum = "678b5a069e50bf00ecd22d0cd8ddf7c236f68581b03db652061ed5eb13a312ff" 1640 | dependencies = [ 1641 | "serde", 1642 | "serde_json", 1643 | "serde_with_macros", 1644 | ] 1645 | 1646 | [[package]] 1647 | name = "serde_with_macros" 1648 | version = "1.5.2" 1649 | source = "registry+https://github.com/rust-lang/crates.io-index" 1650 | checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082" 1651 | dependencies = [ 1652 | "darling", 1653 | "proc-macro2", 1654 | "quote", 1655 | "syn", 1656 | ] 1657 | 1658 | [[package]] 1659 | name = "sha-1" 1660 | version = "0.10.0" 1661 | source = "registry+https://github.com/rust-lang/crates.io-index" 1662 | checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f" 1663 | dependencies = [ 1664 | "cfg-if", 1665 | "cpufeatures", 1666 | "digest", 1667 | ] 1668 | 1669 | [[package]] 1670 | name = "signal-hook" 1671 | version = "0.3.14" 1672 | source = "registry+https://github.com/rust-lang/crates.io-index" 1673 | checksum = "a253b5e89e2698464fc26b545c9edceb338e18a89effeeecfea192c3025be29d" 1674 | dependencies = [ 1675 | "cc", 1676 | "libc", 1677 | "signal-hook-registry", 1678 | ] 1679 | 1680 | [[package]] 1681 | name = "signal-hook-registry" 1682 | version = "1.4.0" 1683 | source = "registry+https://github.com/rust-lang/crates.io-index" 1684 | checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" 1685 | dependencies = [ 1686 | "libc", 1687 | ] 1688 | 1689 | [[package]] 1690 | name = "signal-hook-tokio" 1691 | version = "0.3.1" 1692 | source = "registry+https://github.com/rust-lang/crates.io-index" 1693 | checksum = "213241f76fb1e37e27de3b6aa1b068a2c333233b59cca6634f634b80a27ecf1e" 1694 | dependencies = [ 1695 | "futures-core", 1696 | "libc", 1697 | "signal-hook", 1698 | "tokio", 1699 | ] 1700 | 1701 | [[package]] 1702 | name = "simple_logger" 1703 | version = "4.0.0" 1704 | source = "registry+https://github.com/rust-lang/crates.io-index" 1705 | checksum = "e190a521c2044948158666916d9e872cbb9984f755e9bb3b5b75a836205affcd" 1706 | dependencies = [ 1707 | "atty", 1708 | "colored", 1709 | "log", 1710 | "time 0.3.16", 1711 | "windows-sys 0.42.0", 1712 | ] 1713 | 1714 | [[package]] 1715 | name = "slab" 1716 | version = "0.4.7" 1717 | source = "registry+https://github.com/rust-lang/crates.io-index" 1718 | checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" 1719 | dependencies = [ 1720 | "autocfg", 1721 | ] 1722 | 1723 | [[package]] 1724 | name = "slack-morphism" 1725 | version = "1.3.3" 1726 | source = "registry+https://github.com/rust-lang/crates.io-index" 1727 | checksum = "e60db8b4965a58053ea43184868b8b6f5d6a49c8b32978603aae5883cd36bb50" 1728 | dependencies = [ 1729 | "async-recursion", 1730 | "async-trait", 1731 | "axum", 1732 | "base64", 1733 | "bytes", 1734 | "chrono", 1735 | "futures", 1736 | "futures-locks", 1737 | "futures-util", 1738 | "hex", 1739 | "http", 1740 | "hyper", 1741 | "hyper-rustls", 1742 | "lazy_static", 1743 | "mime", 1744 | "rand", 1745 | "ring", 1746 | "rsb_derive", 1747 | "rvstruct", 1748 | "serde", 1749 | "serde_json", 1750 | "serde_with", 1751 | "signal-hook", 1752 | "signal-hook-tokio", 1753 | "tokio", 1754 | "tokio-stream", 1755 | "tokio-tungstenite", 1756 | "tower", 1757 | "tracing", 1758 | "url", 1759 | ] 1760 | 1761 | [[package]] 1762 | name = "smallvec" 1763 | version = "1.10.0" 1764 | source = "registry+https://github.com/rust-lang/crates.io-index" 1765 | checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" 1766 | 1767 | [[package]] 1768 | name = "socket2" 1769 | version = "0.4.7" 1770 | source = "registry+https://github.com/rust-lang/crates.io-index" 1771 | checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" 1772 | dependencies = [ 1773 | "libc", 1774 | "winapi", 1775 | ] 1776 | 1777 | [[package]] 1778 | name = "spin" 1779 | version = "0.5.2" 1780 | source = "registry+https://github.com/rust-lang/crates.io-index" 1781 | checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" 1782 | 1783 | [[package]] 1784 | name = "strsim" 1785 | version = "0.10.0" 1786 | source = "registry+https://github.com/rust-lang/crates.io-index" 1787 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 1788 | 1789 | [[package]] 1790 | name = "syn" 1791 | version = "1.0.103" 1792 | source = "registry+https://github.com/rust-lang/crates.io-index" 1793 | checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" 1794 | dependencies = [ 1795 | "proc-macro2", 1796 | "quote", 1797 | "unicode-ident", 1798 | ] 1799 | 1800 | [[package]] 1801 | name = "sync_wrapper" 1802 | version = "0.1.1" 1803 | source = "registry+https://github.com/rust-lang/crates.io-index" 1804 | checksum = "20518fe4a4c9acf048008599e464deb21beeae3d3578418951a189c235a7a9a8" 1805 | 1806 | [[package]] 1807 | name = "termcolor" 1808 | version = "1.1.3" 1809 | source = "registry+https://github.com/rust-lang/crates.io-index" 1810 | checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" 1811 | dependencies = [ 1812 | "winapi-util", 1813 | ] 1814 | 1815 | [[package]] 1816 | name = "thiserror" 1817 | version = "1.0.37" 1818 | source = "registry+https://github.com/rust-lang/crates.io-index" 1819 | checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" 1820 | dependencies = [ 1821 | "thiserror-impl", 1822 | ] 1823 | 1824 | [[package]] 1825 | name = "thiserror-impl" 1826 | version = "1.0.37" 1827 | source = "registry+https://github.com/rust-lang/crates.io-index" 1828 | checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" 1829 | dependencies = [ 1830 | "proc-macro2", 1831 | "quote", 1832 | "syn", 1833 | ] 1834 | 1835 | [[package]] 1836 | name = "time" 1837 | version = "0.1.44" 1838 | source = "registry+https://github.com/rust-lang/crates.io-index" 1839 | checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" 1840 | dependencies = [ 1841 | "libc", 1842 | "wasi 0.10.0+wasi-snapshot-preview1", 1843 | "winapi", 1844 | ] 1845 | 1846 | [[package]] 1847 | name = "time" 1848 | version = "0.3.16" 1849 | source = "registry+https://github.com/rust-lang/crates.io-index" 1850 | checksum = "0fab5c8b9980850e06d92ddbe3ab839c062c801f3927c0fb8abd6fc8e918fbca" 1851 | dependencies = [ 1852 | "itoa", 1853 | "libc", 1854 | "num_threads", 1855 | "serde", 1856 | "time-core", 1857 | "time-macros", 1858 | ] 1859 | 1860 | [[package]] 1861 | name = "time-core" 1862 | version = "0.1.0" 1863 | source = "registry+https://github.com/rust-lang/crates.io-index" 1864 | checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" 1865 | 1866 | [[package]] 1867 | name = "time-macros" 1868 | version = "0.2.5" 1869 | source = "registry+https://github.com/rust-lang/crates.io-index" 1870 | checksum = "65bb801831d812c562ae7d2bfb531f26e66e4e1f6b17307ba4149c5064710e5b" 1871 | dependencies = [ 1872 | "time-core", 1873 | ] 1874 | 1875 | [[package]] 1876 | name = "tinyvec" 1877 | version = "1.6.0" 1878 | source = "registry+https://github.com/rust-lang/crates.io-index" 1879 | checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" 1880 | dependencies = [ 1881 | "tinyvec_macros", 1882 | ] 1883 | 1884 | [[package]] 1885 | name = "tinyvec_macros" 1886 | version = "0.1.0" 1887 | source = "registry+https://github.com/rust-lang/crates.io-index" 1888 | checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" 1889 | 1890 | [[package]] 1891 | name = "tokio" 1892 | version = "1.21.2" 1893 | source = "registry+https://github.com/rust-lang/crates.io-index" 1894 | checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099" 1895 | dependencies = [ 1896 | "autocfg", 1897 | "bytes", 1898 | "libc", 1899 | "memchr", 1900 | "mio", 1901 | "num_cpus", 1902 | "parking_lot", 1903 | "pin-project-lite", 1904 | "signal-hook-registry", 1905 | "socket2", 1906 | "tokio-macros", 1907 | "winapi", 1908 | ] 1909 | 1910 | [[package]] 1911 | name = "tokio-macros" 1912 | version = "1.8.0" 1913 | source = "registry+https://github.com/rust-lang/crates.io-index" 1914 | checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" 1915 | dependencies = [ 1916 | "proc-macro2", 1917 | "quote", 1918 | "syn", 1919 | ] 1920 | 1921 | [[package]] 1922 | name = "tokio-rustls" 1923 | version = "0.23.4" 1924 | source = "registry+https://github.com/rust-lang/crates.io-index" 1925 | checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" 1926 | dependencies = [ 1927 | "rustls", 1928 | "tokio", 1929 | "webpki", 1930 | ] 1931 | 1932 | [[package]] 1933 | name = "tokio-stream" 1934 | version = "0.1.11" 1935 | source = "registry+https://github.com/rust-lang/crates.io-index" 1936 | checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce" 1937 | dependencies = [ 1938 | "futures-core", 1939 | "pin-project-lite", 1940 | "tokio", 1941 | ] 1942 | 1943 | [[package]] 1944 | name = "tokio-tungstenite" 1945 | version = "0.17.2" 1946 | source = "registry+https://github.com/rust-lang/crates.io-index" 1947 | checksum = "f714dd15bead90401d77e04243611caec13726c2408afd5b31901dfcdcb3b181" 1948 | dependencies = [ 1949 | "futures-util", 1950 | "log", 1951 | "rustls", 1952 | "rustls-native-certs", 1953 | "tokio", 1954 | "tokio-rustls", 1955 | "tungstenite", 1956 | "webpki", 1957 | ] 1958 | 1959 | [[package]] 1960 | name = "tokio-util" 1961 | version = "0.7.4" 1962 | source = "registry+https://github.com/rust-lang/crates.io-index" 1963 | checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" 1964 | dependencies = [ 1965 | "bytes", 1966 | "futures-core", 1967 | "futures-sink", 1968 | "pin-project-lite", 1969 | "tokio", 1970 | "tracing", 1971 | ] 1972 | 1973 | [[package]] 1974 | name = "tower" 1975 | version = "0.4.13" 1976 | source = "registry+https://github.com/rust-lang/crates.io-index" 1977 | checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" 1978 | dependencies = [ 1979 | "futures-core", 1980 | "futures-util", 1981 | "pin-project", 1982 | "pin-project-lite", 1983 | "tokio", 1984 | "tower-layer", 1985 | "tower-service", 1986 | "tracing", 1987 | ] 1988 | 1989 | [[package]] 1990 | name = "tower-http" 1991 | version = "0.3.4" 1992 | source = "registry+https://github.com/rust-lang/crates.io-index" 1993 | checksum = "3c530c8675c1dbf98facee631536fa116b5fb6382d7dd6dc1b118d970eafe3ba" 1994 | dependencies = [ 1995 | "bitflags", 1996 | "bytes", 1997 | "futures-core", 1998 | "futures-util", 1999 | "http", 2000 | "http-body", 2001 | "http-range-header", 2002 | "pin-project-lite", 2003 | "tower", 2004 | "tower-layer", 2005 | "tower-service", 2006 | ] 2007 | 2008 | [[package]] 2009 | name = "tower-layer" 2010 | version = "0.3.2" 2011 | source = "registry+https://github.com/rust-lang/crates.io-index" 2012 | checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" 2013 | 2014 | [[package]] 2015 | name = "tower-service" 2016 | version = "0.3.2" 2017 | source = "registry+https://github.com/rust-lang/crates.io-index" 2018 | checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" 2019 | 2020 | [[package]] 2021 | name = "tracing" 2022 | version = "0.1.37" 2023 | source = "registry+https://github.com/rust-lang/crates.io-index" 2024 | checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" 2025 | dependencies = [ 2026 | "cfg-if", 2027 | "log", 2028 | "pin-project-lite", 2029 | "tracing-attributes", 2030 | "tracing-core", 2031 | ] 2032 | 2033 | [[package]] 2034 | name = "tracing-attributes" 2035 | version = "0.1.23" 2036 | source = "registry+https://github.com/rust-lang/crates.io-index" 2037 | checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" 2038 | dependencies = [ 2039 | "proc-macro2", 2040 | "quote", 2041 | "syn", 2042 | ] 2043 | 2044 | [[package]] 2045 | name = "tracing-core" 2046 | version = "0.1.30" 2047 | source = "registry+https://github.com/rust-lang/crates.io-index" 2048 | checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" 2049 | dependencies = [ 2050 | "once_cell", 2051 | ] 2052 | 2053 | [[package]] 2054 | name = "try-lock" 2055 | version = "0.2.3" 2056 | source = "registry+https://github.com/rust-lang/crates.io-index" 2057 | checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" 2058 | 2059 | [[package]] 2060 | name = "tungstenite" 2061 | version = "0.17.3" 2062 | source = "registry+https://github.com/rust-lang/crates.io-index" 2063 | checksum = "e27992fd6a8c29ee7eef28fc78349aa244134e10ad447ce3b9f0ac0ed0fa4ce0" 2064 | dependencies = [ 2065 | "base64", 2066 | "byteorder", 2067 | "bytes", 2068 | "http", 2069 | "httparse", 2070 | "log", 2071 | "rand", 2072 | "rustls", 2073 | "sha-1", 2074 | "thiserror", 2075 | "url", 2076 | "utf-8", 2077 | "webpki", 2078 | ] 2079 | 2080 | [[package]] 2081 | name = "typenum" 2082 | version = "1.15.0" 2083 | source = "registry+https://github.com/rust-lang/crates.io-index" 2084 | checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" 2085 | 2086 | [[package]] 2087 | name = "unicode-bidi" 2088 | version = "0.3.8" 2089 | source = "registry+https://github.com/rust-lang/crates.io-index" 2090 | checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" 2091 | 2092 | [[package]] 2093 | name = "unicode-ident" 2094 | version = "1.0.5" 2095 | source = "registry+https://github.com/rust-lang/crates.io-index" 2096 | checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" 2097 | 2098 | [[package]] 2099 | name = "unicode-normalization" 2100 | version = "0.1.22" 2101 | source = "registry+https://github.com/rust-lang/crates.io-index" 2102 | checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" 2103 | dependencies = [ 2104 | "tinyvec", 2105 | ] 2106 | 2107 | [[package]] 2108 | name = "unicode-width" 2109 | version = "0.1.10" 2110 | source = "registry+https://github.com/rust-lang/crates.io-index" 2111 | checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" 2112 | 2113 | [[package]] 2114 | name = "untrusted" 2115 | version = "0.7.1" 2116 | source = "registry+https://github.com/rust-lang/crates.io-index" 2117 | checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" 2118 | 2119 | [[package]] 2120 | name = "url" 2121 | version = "2.3.1" 2122 | source = "registry+https://github.com/rust-lang/crates.io-index" 2123 | checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" 2124 | dependencies = [ 2125 | "form_urlencoded", 2126 | "idna", 2127 | "percent-encoding", 2128 | "serde", 2129 | ] 2130 | 2131 | [[package]] 2132 | name = "urlencoding" 2133 | version = "2.1.2" 2134 | source = "registry+https://github.com/rust-lang/crates.io-index" 2135 | checksum = "e8db7427f936968176eaa7cdf81b7f98b980b18495ec28f1b5791ac3bfe3eea9" 2136 | 2137 | [[package]] 2138 | name = "utf-8" 2139 | version = "0.7.6" 2140 | source = "registry+https://github.com/rust-lang/crates.io-index" 2141 | checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" 2142 | 2143 | [[package]] 2144 | name = "vcpkg" 2145 | version = "0.2.15" 2146 | source = "registry+https://github.com/rust-lang/crates.io-index" 2147 | checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" 2148 | 2149 | [[package]] 2150 | name = "version_check" 2151 | version = "0.9.4" 2152 | source = "registry+https://github.com/rust-lang/crates.io-index" 2153 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 2154 | 2155 | [[package]] 2156 | name = "want" 2157 | version = "0.3.0" 2158 | source = "registry+https://github.com/rust-lang/crates.io-index" 2159 | checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" 2160 | dependencies = [ 2161 | "log", 2162 | "try-lock", 2163 | ] 2164 | 2165 | [[package]] 2166 | name = "wasi" 2167 | version = "0.10.0+wasi-snapshot-preview1" 2168 | source = "registry+https://github.com/rust-lang/crates.io-index" 2169 | checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" 2170 | 2171 | [[package]] 2172 | name = "wasi" 2173 | version = "0.11.0+wasi-snapshot-preview1" 2174 | source = "registry+https://github.com/rust-lang/crates.io-index" 2175 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 2176 | 2177 | [[package]] 2178 | name = "wasm-bindgen" 2179 | version = "0.2.83" 2180 | source = "registry+https://github.com/rust-lang/crates.io-index" 2181 | checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" 2182 | dependencies = [ 2183 | "cfg-if", 2184 | "wasm-bindgen-macro", 2185 | ] 2186 | 2187 | [[package]] 2188 | name = "wasm-bindgen-backend" 2189 | version = "0.2.83" 2190 | source = "registry+https://github.com/rust-lang/crates.io-index" 2191 | checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" 2192 | dependencies = [ 2193 | "bumpalo", 2194 | "log", 2195 | "once_cell", 2196 | "proc-macro2", 2197 | "quote", 2198 | "syn", 2199 | "wasm-bindgen-shared", 2200 | ] 2201 | 2202 | [[package]] 2203 | name = "wasm-bindgen-macro" 2204 | version = "0.2.83" 2205 | source = "registry+https://github.com/rust-lang/crates.io-index" 2206 | checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" 2207 | dependencies = [ 2208 | "quote", 2209 | "wasm-bindgen-macro-support", 2210 | ] 2211 | 2212 | [[package]] 2213 | name = "wasm-bindgen-macro-support" 2214 | version = "0.2.83" 2215 | source = "registry+https://github.com/rust-lang/crates.io-index" 2216 | checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" 2217 | dependencies = [ 2218 | "proc-macro2", 2219 | "quote", 2220 | "syn", 2221 | "wasm-bindgen-backend", 2222 | "wasm-bindgen-shared", 2223 | ] 2224 | 2225 | [[package]] 2226 | name = "wasm-bindgen-shared" 2227 | version = "0.2.83" 2228 | source = "registry+https://github.com/rust-lang/crates.io-index" 2229 | checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" 2230 | 2231 | [[package]] 2232 | name = "web-sys" 2233 | version = "0.3.60" 2234 | source = "registry+https://github.com/rust-lang/crates.io-index" 2235 | checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" 2236 | dependencies = [ 2237 | "js-sys", 2238 | "wasm-bindgen", 2239 | ] 2240 | 2241 | [[package]] 2242 | name = "webpki" 2243 | version = "0.22.0" 2244 | source = "registry+https://github.com/rust-lang/crates.io-index" 2245 | checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" 2246 | dependencies = [ 2247 | "ring", 2248 | "untrusted", 2249 | ] 2250 | 2251 | [[package]] 2252 | name = "winapi" 2253 | version = "0.3.9" 2254 | source = "registry+https://github.com/rust-lang/crates.io-index" 2255 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 2256 | dependencies = [ 2257 | "winapi-i686-pc-windows-gnu", 2258 | "winapi-x86_64-pc-windows-gnu", 2259 | ] 2260 | 2261 | [[package]] 2262 | name = "winapi-i686-pc-windows-gnu" 2263 | version = "0.4.0" 2264 | source = "registry+https://github.com/rust-lang/crates.io-index" 2265 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 2266 | 2267 | [[package]] 2268 | name = "winapi-util" 2269 | version = "0.1.5" 2270 | source = "registry+https://github.com/rust-lang/crates.io-index" 2271 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" 2272 | dependencies = [ 2273 | "winapi", 2274 | ] 2275 | 2276 | [[package]] 2277 | name = "winapi-x86_64-pc-windows-gnu" 2278 | version = "0.4.0" 2279 | source = "registry+https://github.com/rust-lang/crates.io-index" 2280 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 2281 | 2282 | [[package]] 2283 | name = "windows-sys" 2284 | version = "0.36.1" 2285 | source = "registry+https://github.com/rust-lang/crates.io-index" 2286 | checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" 2287 | dependencies = [ 2288 | "windows_aarch64_msvc 0.36.1", 2289 | "windows_i686_gnu 0.36.1", 2290 | "windows_i686_msvc 0.36.1", 2291 | "windows_x86_64_gnu 0.36.1", 2292 | "windows_x86_64_msvc 0.36.1", 2293 | ] 2294 | 2295 | [[package]] 2296 | name = "windows-sys" 2297 | version = "0.42.0" 2298 | source = "registry+https://github.com/rust-lang/crates.io-index" 2299 | checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" 2300 | dependencies = [ 2301 | "windows_aarch64_gnullvm", 2302 | "windows_aarch64_msvc 0.42.0", 2303 | "windows_i686_gnu 0.42.0", 2304 | "windows_i686_msvc 0.42.0", 2305 | "windows_x86_64_gnu 0.42.0", 2306 | "windows_x86_64_gnullvm", 2307 | "windows_x86_64_msvc 0.42.0", 2308 | ] 2309 | 2310 | [[package]] 2311 | name = "windows_aarch64_gnullvm" 2312 | version = "0.42.0" 2313 | source = "registry+https://github.com/rust-lang/crates.io-index" 2314 | checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" 2315 | 2316 | [[package]] 2317 | name = "windows_aarch64_msvc" 2318 | version = "0.36.1" 2319 | source = "registry+https://github.com/rust-lang/crates.io-index" 2320 | checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" 2321 | 2322 | [[package]] 2323 | name = "windows_aarch64_msvc" 2324 | version = "0.42.0" 2325 | source = "registry+https://github.com/rust-lang/crates.io-index" 2326 | checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" 2327 | 2328 | [[package]] 2329 | name = "windows_i686_gnu" 2330 | version = "0.36.1" 2331 | source = "registry+https://github.com/rust-lang/crates.io-index" 2332 | checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" 2333 | 2334 | [[package]] 2335 | name = "windows_i686_gnu" 2336 | version = "0.42.0" 2337 | source = "registry+https://github.com/rust-lang/crates.io-index" 2338 | checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" 2339 | 2340 | [[package]] 2341 | name = "windows_i686_msvc" 2342 | version = "0.36.1" 2343 | source = "registry+https://github.com/rust-lang/crates.io-index" 2344 | checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" 2345 | 2346 | [[package]] 2347 | name = "windows_i686_msvc" 2348 | version = "0.42.0" 2349 | source = "registry+https://github.com/rust-lang/crates.io-index" 2350 | checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" 2351 | 2352 | [[package]] 2353 | name = "windows_x86_64_gnu" 2354 | version = "0.36.1" 2355 | source = "registry+https://github.com/rust-lang/crates.io-index" 2356 | checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" 2357 | 2358 | [[package]] 2359 | name = "windows_x86_64_gnu" 2360 | version = "0.42.0" 2361 | source = "registry+https://github.com/rust-lang/crates.io-index" 2362 | checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" 2363 | 2364 | [[package]] 2365 | name = "windows_x86_64_gnullvm" 2366 | version = "0.42.0" 2367 | source = "registry+https://github.com/rust-lang/crates.io-index" 2368 | checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" 2369 | 2370 | [[package]] 2371 | name = "windows_x86_64_msvc" 2372 | version = "0.36.1" 2373 | source = "registry+https://github.com/rust-lang/crates.io-index" 2374 | checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" 2375 | 2376 | [[package]] 2377 | name = "windows_x86_64_msvc" 2378 | version = "0.42.0" 2379 | source = "registry+https://github.com/rust-lang/crates.io-index" 2380 | checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" 2381 | 2382 | [[package]] 2383 | name = "xmlparser" 2384 | version = "0.13.5" 2385 | source = "registry+https://github.com/rust-lang/crates.io-index" 2386 | checksum = "4d25c75bf9ea12c4040a97f829154768bbbce366287e2dc044af160cd79a13fd" 2387 | 2388 | [[package]] 2389 | name = "zeroize" 2390 | version = "1.5.7" 2391 | source = "registry+https://github.com/rust-lang/crates.io-index" 2392 | checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" 2393 | -------------------------------------------------------------------------------- /resources/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | authors = ["CodeDevils"] 3 | name = "devil_bot_rust" 4 | version = "0.1.0" 5 | edition = "2021" 6 | 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [dependencies] 10 | aws-config = "0.51.0" 11 | aws-sdk-dynamodb = "0.21.0" 12 | hyper = "0.14.20" 13 | lambda_http = "0.7.1" 14 | lambda_runtime = "0.7.0" 15 | log = "0.4.14" 16 | openssl = { version = "0.10", features = ["vendored"] } 17 | serde = "^1" 18 | serde_derive = "^1" 19 | serde_json = "1.0.74" 20 | simple_logger = "4.0.0" 21 | slack-morphism = { version = "1.3.3", features = ["hyper", "axum"] } 22 | tokio = { version = "1.15.0", features = ["full"] } 23 | 24 | [[bin]] 25 | name = "bootstrap" 26 | path = "src/main.rs" 27 | -------------------------------------------------------------------------------- /resources/rust.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ASU-CodeDevils/devilbot/c4b49d109c9f00831d0b0fbfb2a57e41c4117898/resources/rust.zip -------------------------------------------------------------------------------- /resources/rustfmt.toml: -------------------------------------------------------------------------------- 1 | edition = "2021" 2 | -------------------------------------------------------------------------------- /resources/src/aws.rs: -------------------------------------------------------------------------------- 1 | pub mod dynamo; 2 | -------------------------------------------------------------------------------- /resources/src/aws/dynamo.rs: -------------------------------------------------------------------------------- 1 | use aws_sdk_dynamodb::{model::AttributeValue, Client, Error}; 2 | 3 | /** 4 | * Increments an item_name associated with a user_id in a specified AWS DynamoDB 5 | * table. If no entries exist, a new one will be created in the table. 6 | */ 7 | pub async fn increment_item( 8 | table_name: &str, 9 | key: &str, 10 | user_id: &str, 11 | item_name: &str, 12 | ) -> Result<(), Error> { 13 | let shared_config = aws_config::load_from_env().await; 14 | let client = Client::new(&shared_config); 15 | 16 | // Increment the value of item_name attribute if it exists. 17 | let increment_if_exists_request = client 18 | .update_item() 19 | .table_name(table_name) 20 | .key(key, AttributeValue::S(user_id.to_string())) 21 | .update_expression(format!("set {item_name} = {item_name} + :value")) 22 | .expression_attribute_values(":value", AttributeValue::N("1".to_string())) 23 | .condition_expression(format!("attribute_exists({item_name})")); 24 | 25 | let increment_if_exists_response = increment_if_exists_request 26 | .send() 27 | .await 28 | .map_err(|e| Error::from(e)); 29 | 30 | // Create a new item with value 1 for the item_name attribute if it does not yet exist. 31 | if let Err(Error::ConditionalCheckFailedException(_err)) = increment_if_exists_response { 32 | let create_if_dne_request = client 33 | .update_item() 34 | .table_name(table_name) 35 | .key(key, AttributeValue::S(user_id.to_string())) 36 | .update_expression(format!("set {item_name} = :value")) 37 | .expression_attribute_values(":value", AttributeValue::N("1".to_string())); 38 | 39 | create_if_dne_request.send().await?; 40 | } 41 | 42 | Ok(()) 43 | } 44 | -------------------------------------------------------------------------------- /resources/src/commands.rs: -------------------------------------------------------------------------------- 1 | // When you create new files under the commands directory 2 | // you will need to declare them as public modules below. 3 | // This will allow you to import them into main.rs. 4 | // Read more here: https://doc.rust-lang.org/rust-by-example/mod.html 5 | 6 | pub mod buns; 7 | pub mod introduction_reply; 8 | pub mod onboard_user; 9 | pub mod ping; 10 | -------------------------------------------------------------------------------- /resources/src/commands/buns.rs: -------------------------------------------------------------------------------- 1 | use crate::aws; 2 | use crate::get_env_var; 3 | use crate::slack; 4 | 5 | const BUNS_TABLE_NAME: &str = "BUNS_TABLE_NAME"; 6 | 7 | /** 8 | * Increments the buns counter for a specified user in the buns table. 9 | */ 10 | pub async fn increment_buns(enterprise_user_id: &str) { 11 | let buns_table_name: String = get_env_var(BUNS_TABLE_NAME); 12 | aws::dynamo::increment_item(&*buns_table_name, "user_id", enterprise_user_id, "buns") 13 | .await 14 | .unwrap_or_else(|err| log::info!("DynamoDB increment buns error: {}", err)); 15 | } 16 | 17 | /** 18 | * This function parses the text event from the slack event subscription 19 | * if the text contains any form of "buns", it will respond with a buns reaction. 20 | * This can be used as an example command when creating new commands for 21 | * the Slack bot. 22 | */ 23 | pub async fn run( 24 | channel: &str, 25 | enterprise_user_id: &str, 26 | timestamp: &str, 27 | ) -> Result<(), Box> { 28 | increment_buns(enterprise_user_id).await; 29 | 30 | slack::reactions::add(channel, timestamp, "buns") 31 | .await 32 | .unwrap_or_else(|err| log::info!("Reaction add error: {}", err)); 33 | Ok(()) 34 | } 35 | -------------------------------------------------------------------------------- /resources/src/commands/introduction_reply.rs: -------------------------------------------------------------------------------- 1 | use crate::slack; 2 | 3 | pub async fn send( 4 | base_message_timestamp: &str, 5 | intros_channel_id: String, 6 | ) -> Result<(), Box> { 7 | // add the reactions to the base message 8 | let emoji_names = vec![ 9 | "codedevils_rainbow_fast", 10 | "partywizard", 11 | "pogfish-pogging", 12 | "meow_code", 13 | "fork", 14 | "forks", 15 | ]; 16 | for emoji_name in emoji_names { 17 | slack::reactions::add(&intros_channel_id, base_message_timestamp, emoji_name) 18 | .await 19 | .unwrap_or_else(|err| log::info!("Add reaction error: {}", err)); 20 | } 21 | let text: String = format!( 22 | "Hey welcome to CodeDevils I am DevilBot! :partywizard: \ 23 | If you are looking to learn more about programming, I am an official CodeDevils project \ 24 | that can be worked on!" 25 | ); 26 | slack::chat::reply_message(&text, &intros_channel_id, base_message_timestamp) 27 | .await 28 | .unwrap_or_else(|err| log::info!("Chat post error: {}", err)); 29 | Ok(()) 30 | } 31 | -------------------------------------------------------------------------------- /resources/src/commands/onboard_user.rs: -------------------------------------------------------------------------------- 1 | use std::vec; 2 | 3 | use slack_morphism::blocks::{ 4 | SlackBlock, SlackBlockMarkDownText, SlackBlockPlainText, SlackBlockText, SlackDividerBlock, 5 | SlackHeaderBlock, SlackSectionBlock, 6 | }; 7 | use slack_morphism::SlackMessageContent; 8 | 9 | use crate::slack; 10 | 11 | // TODO: write docs 12 | pub async fn run( 13 | username: &str, 14 | first_name: &str, 15 | ) -> Result<(), Box> { 16 | let users_vec = vec![username]; 17 | 18 | // Open the channel between the bot and the user 19 | let bot_conversations_open_response = 20 | slack::conversations::open(users_vec.clone(), true).await?; 21 | let bot_channel_id = bot_conversations_open_response.channel.id.to_string(); 22 | log::info!("Bot Channel Id {:?}", bot_channel_id); 23 | 24 | // Build the message to send to the new user 25 | let content_vector: SlackMessageContent = 26 | SlackMessageContent::new().opt_blocks(build_bot_slack_block_message(first_name).into()); 27 | slack::chat::post_message_with_content(&content_vector, &bot_channel_id, true) 28 | .await 29 | .unwrap_or_else(|err| log::info!("Chat post error: {}", err)); 30 | 31 | // Open the channel between the user (Rhett) and the new user 32 | let user_conversations_open_response = slack::conversations::open(users_vec, false).await?; 33 | let user_channel_id = user_conversations_open_response.channel.id.to_string(); 34 | log::info!("User Channel Id {:?}", user_channel_id); 35 | 36 | // Message to send to the new user 37 | let message_to_new_user_from_user = format!( 38 | "Hey {} welcome to CodeDevils! I am Rhett, the \ 39 | President of the organization. Go ahead and introduce yourself over in <#CMGU8033K> and \ 40 | I look forward to seeing you in <#C2N5P84BD> soon! :partywizard:", 41 | first_name 42 | ); 43 | slack::chat::post_message(&message_to_new_user_from_user, &user_channel_id, false) 44 | .await 45 | .unwrap_or_else(|err| log::info!("Chat post error: {}", err)); 46 | 47 | Ok(()) 48 | } 49 | pub fn build_bot_slack_block_message(first_name: &str) -> Vec { 50 | let mut block_vector: Vec = vec![]; 51 | 52 | // Create the header 53 | let header_block_text: SlackBlockPlainText = 54 | format!(":alert: Hey! Welcome to CodeDevils {} :alert:", first_name).into(); 55 | let header_block_slack_block_text: SlackBlockText = header_block_text.into(); 56 | let header_block: SlackHeaderBlock = SlackHeaderBlock::new(header_block_slack_block_text); 57 | block_vector.push(header_block.into()); 58 | 59 | // Create the divider 60 | let slack_divider = SlackDividerBlock::new(); 61 | let slack_divider_block: SlackBlock = slack_divider.into(); 62 | block_vector.push(slack_divider_block.clone()); 63 | 64 | let paragraph1: SlackBlockPlainText = "I am DevilBot, the official SlackBot for CodeDevils. I am here to welcome you, and to give you some information about who we are.".into(); 65 | let paragraph1_block_text: SlackBlockText = paragraph1.into(); 66 | let paragraph1_block: SlackBlock = SlackSectionBlock::new() 67 | .with_text(paragraph1_block_text) 68 | .into(); 69 | block_vector.push(paragraph1_block); 70 | block_vector.push(slack_divider_block.clone()); 71 | 72 | let paragraph2: SlackBlockPlainText = "First, if you are reading this in your email, get the Slack App on mobile and/or desktop. You don't want to miss anything!".into(); 73 | let paragraph2_block_text: SlackBlockText = paragraph2.into(); 74 | let paragraph2_block: SlackBlock = SlackSectionBlock::new() 75 | .with_text(paragraph2_block_text) 76 | .into(); 77 | block_vector.push(paragraph2_block); 78 | block_vector.push(slack_divider_block.clone()); 79 | 80 | let markdown1: SlackBlockMarkDownText = "We have meetings every other Wednesday at 6:30 PM MST over Zoom during the Fall and Spring semesters. Links for these meetings get posted to the <#C30L07P18> channel along with other announcements.".into(); 81 | let markdown1_block_text: SlackBlockText = markdown1.into(); 82 | let markdown1_block: SlackBlock = SlackSectionBlock::new() 83 | .with_text(markdown1_block_text) 84 | .into(); 85 | block_vector.push(markdown1_block); 86 | 87 | let markdown2: SlackBlockMarkDownText = "Our President is Rhett Harrison <@WGJRL9NJD>. He should be messaging you right now as well. If you have any questions, he is a great person to start with. He may not know the answer, but he can connect you with the person who does.".into(); 88 | let markdown2_block_text: SlackBlockText = markdown2.into(); 89 | let markdown2_block: SlackBlock = SlackSectionBlock::new() 90 | .with_text(markdown2_block_text) 91 | .into(); 92 | block_vector.push(markdown2_block); 93 | block_vector.push(slack_divider_block); 94 | 95 | let markdown3: SlackBlockMarkDownText = 96 | "Lastly, we have a discord server for you to join. Join here! https://discord.gg/xG4VnS2hfZ".into(); 97 | let markdown3_block_text: SlackBlockText = markdown3.into(); 98 | let markdown3_block: SlackBlock = SlackSectionBlock::new() 99 | .with_text(markdown3_block_text) 100 | .into(); 101 | block_vector.push(markdown3_block); 102 | 103 | block_vector 104 | } 105 | -------------------------------------------------------------------------------- /resources/src/commands/ping.rs: -------------------------------------------------------------------------------- 1 | use crate::slack; 2 | 3 | // This function parses the text event from the slack event subscription 4 | // if the text contains any form of "ping", it will respond with "pong". 5 | // This can be used as an example command when creating new commands for 6 | // the Slack bot. 7 | pub async fn run(channel: &str) { 8 | let text = "pong"; 9 | let _status_with_bot_token = slack::chat::post_message(text, channel, true).await; 10 | let _status_with_user_token = slack::chat::post_message(text, channel, false).await; 11 | } 12 | -------------------------------------------------------------------------------- /resources/src/event_handlers.rs: -------------------------------------------------------------------------------- 1 | // When you create new files under the commands directory 2 | // you will need to declare them as public modules below. 3 | // This will allow you to import them into main.rs. 4 | // Read more here: https://doc.rust-lang.org/rust-by-example/mod.html 5 | 6 | pub mod message_event_handler; 7 | pub mod reaction_added_event_handler; 8 | pub mod team_join_event_handler; 9 | -------------------------------------------------------------------------------- /resources/src/event_handlers/message_event_handler.rs: -------------------------------------------------------------------------------- 1 | use serde_json::Value; 2 | use slack_morphism::SlackHistoryMessage; 3 | 4 | use crate::commands; 5 | use crate::get_env_var; 6 | use crate::slack::conversations::get_replies; 7 | 8 | pub async fn handle_message_event(body: &Value) { 9 | // Destructure everything needed 10 | let is_bot: bool = body["event"]["subtype"] == "bot_message"; 11 | if is_bot { 12 | log::info!("This is a bot"); 13 | return; 14 | } 15 | let channel: &str = body["event"]["channel"] 16 | .as_str() 17 | .unwrap_or("invalid_channel"); 18 | let text: String = body["event"]["text"] 19 | .as_str() 20 | .unwrap_or("invalid_text") 21 | .to_lowercase(); 22 | let timestamp: &str = body["event"]["event_ts"] 23 | .as_str() 24 | .unwrap_or("invalid_timestamp"); 25 | let enterprise_user_id: &str = body["enterprise_id"] 26 | .as_str() 27 | .unwrap_or("invalid_enterprise_user_id"); 28 | let _user: &str = body["event"]["user"].as_str().unwrap_or("invalid_user"); 29 | let is_development = get_env_var("IS_DEVELOPMENT").parse().unwrap(); 30 | let test_channel_id = get_env_var("TEST_CHANNEL_ID"); 31 | let intros_channel_id = get_env_var("INTROS_CHANNEL_ID"); 32 | // Stop the function if this is a development environment and outside the test channel 33 | if channel != test_channel_id && is_development { 34 | log::info!("This is a development environment {}", is_development); 35 | return; 36 | } 37 | 38 | // Match appropriate function 39 | match text.as_str() { 40 | // Add new commands below and create new async functions for them. 41 | "ping" => commands::ping::run(channel).await, 42 | _ => log::info!("Invalid command: {:?}", ..), 43 | } 44 | if text.contains("buns") { 45 | commands::buns::run(channel, enterprise_user_id, timestamp) 46 | .await 47 | .unwrap_or_else(|err| log::info!("Error running buns command: {}", err)); 48 | } 49 | // The timestamp of the base message of the thread 50 | let event_thread_timestamp: &str = body["event"]["thread_ts"].as_str().unwrap_or("invalid_ts"); 51 | let is_message_reply: bool = 52 | !event_thread_timestamp.is_empty() || event_thread_timestamp != "invalid_ts"; 53 | // Call get_conversation_replies to get the replies to the base message 54 | let replies = get_replies(channel, event_thread_timestamp) 55 | .await 56 | .unwrap_or_else(|err| -> Vec { 57 | log::info!("Error getting replies: {}", err); 58 | vec![] 59 | }); 60 | // Check if DevilBot has replied to this thread already 61 | let mut bot_replies_exist: bool = false; 62 | if !replies.is_empty() 63 | && replies 64 | .iter() 65 | .any(|slack_history_message| -> bool { slack_history_message.sender.bot_id.is_some() }) 66 | { 67 | bot_replies_exist = true; 68 | } 69 | // If the message is a reply and DevilBot has not replied to the thread, 70 | // call the introduction reply function 71 | if channel == intros_channel_id 72 | && is_message_reply 73 | && text.contains("welcome to codedevils") 74 | && !bot_replies_exist 75 | { 76 | commands::introduction_reply::send(event_thread_timestamp, intros_channel_id) 77 | .await 78 | .unwrap_or_else(|err| log::info!("Error running introduction reply command: {}", err)); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /resources/src/event_handlers/reaction_added_event_handler.rs: -------------------------------------------------------------------------------- 1 | use serde_json::Value; 2 | 3 | use crate::get_env_var; 4 | use crate::slack; 5 | 6 | pub async fn handle_reaction_added_event(body: &Value) { 7 | // deconstruct the information needed from the event 8 | let reaction = body["event"]["reaction"] 9 | .as_str() 10 | .unwrap_or("invalid_reaction"); 11 | let channel = body["event"]["item"]["channel"] 12 | .as_str() 13 | .unwrap_or("invalid_channel"); 14 | let timestamp = body["event"]["item"]["ts"] 15 | .as_str() 16 | .unwrap_or("invalid_timestamp"); 17 | 18 | log::info!( 19 | "Information parse from handle_reaction_added_event reaction: \ 20 | {}, channel {}, timestamp {}", 21 | reaction, 22 | channel, 23 | timestamp 24 | ); 25 | let is_development: bool = get_env_var("IS_DEVELOPMENT").parse().unwrap(); 26 | let test_channel_id = get_env_var("TEST_CHANNEL_ID"); 27 | // Stop the function if this is a development environment and outside the test channel 28 | if channel != test_channel_id && is_development { 29 | log::info!("This is a development environment {}", is_development); 30 | return; 31 | } 32 | // Add any other emojis to copy against here 33 | // Please keep alphabetized 34 | let emojis_to_copy = vec![ 35 | "100", 36 | "beer", 37 | "buns", 38 | "catjam", 39 | "codedevils_flash", 40 | "codedevils_rainbow_fast", 41 | "distressed_salamander", 42 | "fax", 43 | "ferris_happy", 44 | "fishjam", 45 | "heart", 46 | "kek", 47 | "kekhands", 48 | "kekleave", 49 | "keks", 50 | "kekthar", 51 | "kekw", 52 | "kekwoo", 53 | "kekzos", 54 | "party-ferris", 55 | "party-pogfish-pogging", 56 | "partywizard", 57 | "party_blob", 58 | "pepehands", 59 | "pepehands-6102", 60 | "pepelol", 61 | "peperun", 62 | "pesfuckyou", 63 | "pog", 64 | "pogfish-fast", 65 | "pogfish-pogging", 66 | "rust_logo", 67 | "sadkek", 68 | "temple-of-rust", 69 | ]; 70 | if emojis_to_copy.contains(&reaction) { 71 | slack::reactions::add(channel, timestamp, reaction) 72 | .await 73 | .unwrap_or_else(|err| log::info!("Error adding reaction: {}", err)) 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /resources/src/event_handlers/team_join_event_handler.rs: -------------------------------------------------------------------------------- 1 | use serde_json::Value; 2 | 3 | use crate::commands; 4 | use crate::get_env_var; 5 | 6 | pub async fn handle_team_join_event(body: &Value) { 7 | // Deconstruct the body 8 | let username: &str = body["event"]["user"]["id"] 9 | .as_str() 10 | .unwrap_or("invalid_user_name"); 11 | let mut first_name: &str = body["event"]["user"]["profile"]["first_name"] 12 | .as_str() 13 | .unwrap_or("invalid_first_name"); 14 | 15 | if first_name == "invalid_first_name" { 16 | log::info!("Invalid First Name"); 17 | first_name = ""; 18 | } 19 | let is_development: bool = get_env_var("IS_DEVELOPMENT").parse().unwrap(); 20 | // Stop the function if this is a development environment and outside the test channel 21 | if is_development { 22 | log::info!("This is a development environment {}", is_development); 23 | return; 24 | } 25 | // Call onboard user 26 | // Add anything else here that should happen when a user joins the workspace 27 | commands::onboard_user::run(username, first_name) 28 | .await 29 | .unwrap(); 30 | } 31 | -------------------------------------------------------------------------------- /resources/src/main.rs: -------------------------------------------------------------------------------- 1 | use std::{env, process}; 2 | 3 | use lambda_http::{service_fn, Error, IntoResponse, Request}; 4 | use log::LevelFilter; 5 | use serde_json::{json, Value}; 6 | use simple_logger::SimpleLogger; 7 | 8 | mod aws; 9 | mod commands; 10 | mod event_handlers; 11 | mod slack; 12 | 13 | #[tokio::main] 14 | async fn main() -> Result<(), Error> { 15 | SimpleLogger::new() 16 | .with_utc_timestamps() 17 | .with_level(LevelFilter::Info) 18 | .init() 19 | .unwrap(); 20 | 21 | let func = service_fn(handler); 22 | lambda_http::run(func).await?; 23 | Ok(()) 24 | } 25 | 26 | /** 27 | * This is the main event handler in the AWS Lambda. It parses the 28 | * requests that were sent to the static endpoint behind our AWS 29 | * API Gateway. 30 | */ 31 | async fn handler(request: Request) -> Result { 32 | let (_parts, body) = request.into_parts(); 33 | let body: Value = serde_json::from_slice(&body)?; 34 | log::info!("{}", body); 35 | let challenge: String = intercept_challenge_request(&body).await; 36 | intercept_command(&body).await; 37 | 38 | Ok(json!({ "challenge": challenge })) 39 | } 40 | 41 | /** 42 | * When you create a Slack event subscription, your endpoint needs 43 | * to respond to a challenge request with the challenge ID for 44 | * the subscription to be successfully created. 45 | * Read more here: https://api.slack.com/apis/connections/events-api 46 | */ 47 | async fn intercept_challenge_request(body: &Value) -> String { 48 | let token: &str = body["token"].as_str().unwrap_or("invalid_token"); 49 | let challenge: &str = body["challenge"].as_str().unwrap_or("invalid_challenge"); 50 | let message_type: &str = body["type"].as_str().unwrap_or("invalid_type"); 51 | 52 | if challenge == "invalid_challenge" { 53 | log::info!("Not a challenge request."); 54 | } else { 55 | let challenge_info: String = format!( 56 | "token: {}\nchallenge: {}\ntype: {}", 57 | token, challenge, message_type 58 | ); 59 | log::info!("{}", challenge_info); 60 | } 61 | 62 | challenge.to_string() 63 | } 64 | 65 | /** 66 | * This function parses the event body received in the request 67 | * and pulls out the Slack message text if there is any. 68 | */ 69 | async fn intercept_command(body: &Value) { 70 | let is_bot: bool = body["event"]["subtype"] == "bot_message"; 71 | if is_bot { 72 | // return early 73 | return; 74 | } 75 | let event_type: &str = body["event"]["type"] 76 | .as_str() 77 | .unwrap_or("invalid event type"); 78 | match event_type { 79 | "team_join" => event_handlers::team_join_event_handler::handle_team_join_event(body).await, 80 | "message" => event_handlers::message_event_handler::handle_message_event(body).await, 81 | "reaction_added" => { 82 | event_handlers::reaction_added_event_handler::handle_reaction_added_event(body).await 83 | } 84 | _ => log::info!("invalid event type {}", &event_type), 85 | } 86 | } 87 | 88 | /** 89 | * Helper function for getting Lambda environment variables. If 90 | * you want to add new env vars, you can add them to the 91 | * environment list in the devil-bot-rust-cdk-stack.ts file. 92 | */ 93 | pub fn get_env_var(env_var: &str) -> String { 94 | match env::var(env_var) { 95 | Ok(val) => val, 96 | Err(_) => { 97 | log::info!("Required the {} environment variable", env_var); 98 | process::exit(1); 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /resources/src/slack.rs: -------------------------------------------------------------------------------- 1 | pub mod chat; 2 | pub mod client; 3 | pub mod conversations; 4 | pub mod reactions; 5 | -------------------------------------------------------------------------------- /resources/src/slack/chat.rs: -------------------------------------------------------------------------------- 1 | use slack_morphism::hyper_tokio::SlackClientHyperConnector; 2 | use slack_morphism::prelude::{ 3 | SlackApiChatPostEphemeralRequest, SlackApiChatPostEphemeralResponse, 4 | SlackApiChatPostMessageRequest, SlackApiChatPostMessageResponse, 5 | }; 6 | use slack_morphism::{ 7 | SlackApiToken, SlackChannelId, SlackClient, SlackMessageContent, SlackUserId, 8 | }; 9 | 10 | use crate::slack::client::{build_bot_token, build_user_token}; 11 | 12 | /** 13 | * Posts a message to the specified Slack channel. 14 | * See https://api.slack.com/methods/chat.postMessage for request JSON examples. 15 | * Parameters: 16 | * - text: The text of the message to post. 17 | * - channel: The channel to post the message to. 18 | * - is_bot_token: Whether to use the bot token or the user token. 19 | */ 20 | pub async fn post_message( 21 | text: &str, 22 | channel: &str, 23 | is_bot_token: bool, 24 | ) -> Result<(), Box> { 25 | let client = SlackClient::new(SlackClientHyperConnector::new()); 26 | let slack_token = match is_bot_token { 27 | true => build_bot_token().await, 28 | false => build_user_token().await, 29 | }; 30 | let session = client.open_session(&slack_token); 31 | 32 | let post_chat_request = SlackApiChatPostMessageRequest::new( 33 | channel.into(), 34 | SlackMessageContent::new().with_text(text.into()), 35 | ); 36 | 37 | let _post_chat_response: SlackApiChatPostMessageResponse = 38 | session.chat_post_message(&post_chat_request).await?; 39 | Ok(()) 40 | } 41 | /** 42 | * Posts a reply to a specified message to the specified Slack channel. 43 | * See https://api.slack.com/methods/chat.postMessage for request JSON examples. 44 | * Parameters: 45 | * - text: The text of the message to post. 46 | * - channel: The channel to post the message to. 47 | * - thread_timestamp: the timestamp of the message to reply to in the specified channel. 48 | */ 49 | pub async fn reply_message( 50 | text: &str, 51 | channel: &str, 52 | thread_timestamp: &str, 53 | ) -> Result<(), Box> { 54 | let client = SlackClient::new(SlackClientHyperConnector::new()); 55 | let slack_token: SlackApiToken = build_bot_token().await; 56 | let session = client.open_session(&slack_token); 57 | 58 | let post_chat_request = SlackApiChatPostMessageRequest::new( 59 | channel.into(), 60 | SlackMessageContent::new().with_text(text.into()), 61 | ) 62 | .with_thread_ts(thread_timestamp.into()); 63 | 64 | let _post_chat_response: SlackApiChatPostMessageResponse = 65 | session.chat_post_message(&post_chat_request).await?; 66 | Ok(()) 67 | } 68 | /** 69 | * Posts a message to the specified Slack channel. 70 | * See https://api.slack.com/methods/chat.postMessage for request JSON examples. 71 | * This specifically uses SlackMessageContent which can use blocks. See https://app.slack.com/block-kit-builder/T2N76FZ3Q 72 | * Parameters: 73 | * - text: The text of the message to post. 74 | * - channel: The channel to post the message to. 75 | * - is_bot_token: Whether to use the bot token or the user token. 76 | */ 77 | pub async fn post_message_with_content( 78 | content: &SlackMessageContent, 79 | channel: &str, 80 | is_bot_token: bool, 81 | ) -> Result<(), Box> { 82 | let client = SlackClient::new(SlackClientHyperConnector::new()); 83 | let slack_token = match is_bot_token { 84 | true => build_bot_token().await, 85 | false => build_user_token().await, 86 | }; 87 | let session = client.open_session(&slack_token); 88 | 89 | let post_chat_request = SlackApiChatPostMessageRequest::new(channel.into(), content.clone()); 90 | 91 | let _post_chat_response: SlackApiChatPostMessageResponse = 92 | session.chat_post_message(&post_chat_request).await?; 93 | Ok(()) 94 | } 95 | 96 | pub async fn _post_ephemeral_message( 97 | channel: &str, 98 | user: &str, 99 | text: &str, 100 | ) -> Result<(), Box> { 101 | let client = SlackClient::new(SlackClientHyperConnector::new()); 102 | let slack_token: SlackApiToken = build_bot_token().await; 103 | let session = client.open_session(&slack_token); 104 | 105 | // Create params 106 | let message_content = SlackMessageContent::new().with_text(text.into()); 107 | let slack_channel_id = SlackChannelId(channel.to_string()); 108 | let slack_user_id = SlackUserId(user.to_string()); 109 | 110 | log::info!( 111 | "Chat post ephemeral message params: message_content {:?},\ 112 | slack_channel_id {:?} slack_user_id {:?}", 113 | message_content, 114 | slack_channel_id, 115 | slack_user_id 116 | ); 117 | 118 | let chat_post_ephemeral_message_request: SlackApiChatPostEphemeralRequest = 119 | SlackApiChatPostEphemeralRequest::new(slack_channel_id, slack_user_id, message_content); 120 | 121 | let _chat_post_ephemeral_message_response: SlackApiChatPostEphemeralResponse = session 122 | .chat_post_ephemeral(&chat_post_ephemeral_message_request) 123 | .await?; 124 | 125 | Ok(()) 126 | } 127 | -------------------------------------------------------------------------------- /resources/src/slack/client.rs: -------------------------------------------------------------------------------- 1 | use slack_morphism::{SlackApiToken, SlackApiTokenValue}; 2 | 3 | use crate::get_env_var; 4 | 5 | /** 6 | * Gets your Slack API token string from the environmental variables set in 7 | * devil-bot-rust-cdk-stack.ts and creates a SlackApiToken object for use in 8 | * a slack_morphism client. 9 | */ 10 | pub async fn build_bot_token() -> SlackApiToken { 11 | const SLACK_API_BOT_TOKEN: &str = "SLACK_API_BOT_TOKEN"; 12 | let slack_token_string: String = get_env_var(SLACK_API_BOT_TOKEN); 13 | let token_value: SlackApiTokenValue = slack_token_string.into(); 14 | 15 | SlackApiToken::new(token_value) 16 | } 17 | /** 18 | * Gets your Slack API token string for the user who installed the app 19 | * from the environmental variables set in 20 | * devil-bot-rust-cdk-stack.ts and creates a SlackApiToken object for use in 21 | * a slack_morphism client. 22 | */ 23 | pub async fn build_user_token() -> SlackApiToken { 24 | const SLACK_API_USER_TOKEN: &str = "SLACK_API_USER_TOKEN"; 25 | let slack_token_string: String = get_env_var(SLACK_API_USER_TOKEN); 26 | let token_value: SlackApiTokenValue = slack_token_string.into(); 27 | 28 | SlackApiToken::new(token_value) 29 | } 30 | -------------------------------------------------------------------------------- /resources/src/slack/conversations.rs: -------------------------------------------------------------------------------- 1 | use slack_morphism::api::{ 2 | SlackApiConversationsOpenRequest, SlackApiConversationsOpenResponse, 3 | SlackApiConversationsRepliesRequest, SlackApiConversationsRepliesResponse, 4 | }; 5 | use slack_morphism::hyper_tokio::SlackClientHyperConnector; 6 | use slack_morphism::{ 7 | SlackApiToken, SlackBasicChannelInfo, SlackChannelId, SlackClient, SlackHistoryMessage, SlackTs, 8 | }; 9 | 10 | use crate::slack::client::{build_bot_token, build_user_token}; 11 | 12 | /** 13 | * Opens a conversation. 14 | * See https://api.slack.com/methods/conversations.open for request JSON examples. 15 | */ 16 | pub async fn open( 17 | users: Vec<&str>, 18 | is_bot_token: bool, 19 | ) -> Result< 20 | SlackApiConversationsOpenResponse, 21 | Box, 22 | > { 23 | let client = SlackClient::new(SlackClientHyperConnector::new()); 24 | let slack_token = match is_bot_token { 25 | true => build_bot_token().await, 26 | false => build_user_token().await, 27 | }; 28 | let session = client.open_session(&slack_token); 29 | 30 | let conversation_open_request: SlackApiConversationsOpenRequest = 31 | SlackApiConversationsOpenRequest::new().with_users( 32 | users 33 | .into_iter() 34 | .map(|user_string| user_string.into()) 35 | .collect(), 36 | ); 37 | 38 | let open_conversation_response = session 39 | .conversations_open(&conversation_open_request) 40 | .await?; 41 | Ok(open_conversation_response) 42 | } 43 | 44 | pub async fn get_replies( 45 | channel: &str, 46 | timestamp: &str, 47 | ) -> Result, Box> { 48 | let client = SlackClient::new(SlackClientHyperConnector::new()); 49 | let slack_token: SlackApiToken = build_bot_token().await; 50 | let session = client.open_session(&slack_token); 51 | let slack_channel: SlackChannelId = channel.into(); 52 | let slack_timestamp: SlackTs = timestamp.into(); 53 | 54 | let conversations_replies_request = 55 | SlackApiConversationsRepliesRequest::new(slack_channel, slack_timestamp); 56 | 57 | let conversations_replies_response: SlackApiConversationsRepliesResponse = session 58 | .conversations_replies(&conversations_replies_request) 59 | .await?; 60 | Ok(conversations_replies_response.messages) 61 | } 62 | -------------------------------------------------------------------------------- /resources/src/slack/reactions.rs: -------------------------------------------------------------------------------- 1 | use slack_morphism::api::{SlackApiReactionsAddRequest, SlackApiReactionsAddResponse}; 2 | use slack_morphism::hyper_tokio::SlackClientHyperConnector; 3 | use slack_morphism::{SlackApiToken, SlackClient}; 4 | 5 | use crate::slack::client::build_bot_token; 6 | 7 | /** 8 | * Adds the specified reaction to a message identified by its timestamp. 9 | * See https://api.slack.com/methods/reactions.add for request JSON examples. 10 | */ 11 | pub async fn add( 12 | channel: &str, 13 | timestamp: &str, 14 | reaction: &str, 15 | ) -> Result<(), Box> { 16 | let client = SlackClient::new(SlackClientHyperConnector::new()); 17 | let slack_token: SlackApiToken = build_bot_token().await; 18 | let session = client.open_session(&slack_token); 19 | 20 | let add_reaction_request = 21 | SlackApiReactionsAddRequest::new(channel.into(), reaction.into(), timestamp.into()); 22 | 23 | let _add_reaction_response: SlackApiReactionsAddResponse = 24 | session.reactions_add(&add_reaction_request).await?; 25 | 26 | Ok(()) 27 | } 28 | -------------------------------------------------------------------------------- /test/devil-bot-rust-cdk.test.ts: -------------------------------------------------------------------------------- 1 | import { expect as expectCDK, haveResourceLike } from '@aws-cdk/assert' 2 | import * as cdk from '@aws-cdk/core' 3 | import * as RustLambda from '../lib/devil-bot-rust-cdk-stack' 4 | import { Code, CodeConfig } from '@aws-cdk/aws-lambda' 5 | 6 | let fromAssetMock: jest.SpyInstance 7 | 8 | beforeAll(() => { 9 | fromAssetMock = jest.spyOn(Code, 'fromAsset').mockReturnValue({ 10 | isInline: false, 11 | bind: (): CodeConfig => { 12 | return { 13 | s3Location: { 14 | bucketName: 'my-bucket', 15 | objectKey: 'my-key', 16 | }, 17 | } 18 | }, 19 | bindToResource: () => { 20 | return 21 | }, 22 | } as any) 23 | }) 24 | 25 | afterAll(() => { 26 | fromAssetMock?.mockRestore() 27 | }) 28 | 29 | test('Lambda function and corresponding IAM role is created', () => { 30 | const app = new cdk.App() 31 | const stack = new RustLambda.DevilBotRustCdkStack(app, 'RustLambda') 32 | 33 | expectCDK(stack).to( 34 | haveResourceLike('AWS::IAM::Role', { 35 | AssumeRolePolicyDocument: { 36 | Statement: [ 37 | { 38 | Action: 'sts:AssumeRole', 39 | Effect: 'Allow', 40 | Principal: { 41 | Service: 'lambda.amazonaws.com', 42 | }, 43 | }, 44 | ], 45 | Version: '2012-10-17', 46 | }, 47 | ManagedPolicyArns: [], 48 | }) 49 | ) 50 | 51 | expectCDK(stack).to( 52 | haveResourceLike('AWS::Lambda::Function', { 53 | Role: {}, 54 | Architectures: ['arm64'], 55 | Description: 56 | 'Deploying a Rust function on Lambda using the custom runtime to back our Slack bot endpoint.', 57 | Environment: { 58 | Variables: { 59 | RUST_BACKTRACE: '1', 60 | }, 61 | }, 62 | Handler: 'not.required', 63 | Runtime: 'provided.al2', 64 | }) 65 | ) 66 | }) 67 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2018", 4 | "module": "commonjs", 5 | "lib": [ 6 | "es2018" 7 | ], 8 | "declaration": true, 9 | "strict": true, 10 | "noImplicitAny": true, 11 | "strictNullChecks": true, 12 | "noImplicitThis": true, 13 | "alwaysStrict": true, 14 | "noUnusedLocals": false, 15 | "noUnusedParameters": false, 16 | "noImplicitReturns": true, 17 | "noFallthroughCasesInSwitch": false, 18 | "inlineSourceMap": true, 19 | "inlineSources": true, 20 | "experimentalDecorators": true, 21 | "strictPropertyInitialization": false, 22 | "typeRoots": [ 23 | "./node_modules/@types" 24 | ] 25 | }, 26 | "exclude": [ 27 | "node_modules", 28 | "cdk.out" 29 | ] 30 | } 31 | --------------------------------------------------------------------------------