Skip to content

Commit

Permalink
Merge pull request #8 from ThomasByr/v1
Browse files Browse the repository at this point in the history
v1 revision
  • Loading branch information
ThomasByr authored Mar 17, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents e95850e + eb95b88 commit d74c746
Showing 74 changed files with 5,880 additions and 5,918 deletions.
36 changes: 21 additions & 15 deletions .env.example
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
BOT_TOKEN=

## Bot's application ID
APPLICATION_ID=
APPLICATION_ID=887037513682812960

## Show only our logs, serenity is noisy
RUST_LOG=discord_compiler_bot
@@ -13,29 +13,31 @@ RUST_LOG=discord_compiler_bot
BOT_PREFIX=;

## Bot info links
INVITE_LINK=https
DISCORDBOTS_LINK=https
GITHUB_LINK=https
STATS_LINK=https
INVITE_LINK=https://discordapp.com/oauth2/authorize?client_id=887037513682812960&permissions=379968&scope=applications.commands%20bot
DISCORDBOTS_LINK=https://discordbots.org/bot/887037513682812960
GITHUB_LINK=https://github.com/ThomasByr/discord-compiler-bot
STATS_LINK=https://github.com/ThomasByr/discord-compiler-bot

# Optional variables

## If the bot is unable to fetch it's own application info, having this filled in will allow
## the bot to continue
BOT_ID=
BOT_ID=887037513682812960

## Emojis
SUCCESS_EMOJI_NAME=
SUCCESS_EMOJI_ID=
LOADING_EMOJI_NAME=
LOADING_EMOJI_ID=
LOGO_EMOJI_NAME=
LOGO_EMOJI_ID=
SUCCESS_EMOJI_NAME=check_mark
SUCCESS_EMOJI_ID=1014226765863989391
FAIL_EMOJI_NAME=across
FAIL_EMOJI_ID=1014227632461709383
LOADING_EMOJI_NAME=loading
LOADING_EMOJI_ID=983470338417516615
LOGO_EMOJI_NAME=copilot
LOGO_EMOJI_ID=1026534320489377853

## Usage logging
COMPILE_LOG=
JOIN_LOG=
PANIC_LOG=
COMPILE_LOG=1014242294918021200
JOIN_LOG=1015605164033445899
PANIC_LOG=1014242354934329474

## Top.gg bot voting announcement
VOTE_CHANNEL=
@@ -46,3 +48,7 @@ DBL_WEBHOOK_PASSWORD=
## Statistics tracking API
STATS_API_LINK=
STATS_API_KEY=

## quick_link for godbolt urls
# QUICK_LINK_URL=
# QUICK_LINK_POST=
29 changes: 20 additions & 9 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ Any behavior that fails to meet these core values will result in your issue or p

## Pull Requests

Pull requests to fix issues or add new features are greatly appreciated, but having to outright reject contributions due to them being "not a good fit" is something we don't like to do. We ask that you coordinate changes with us to prevent any wasted time, as your time is valuable. The best place to get in contact with us is in our [support guild](discord.gg/ExraTaJ).
Pull requests to fix issues or add new features are greatly appreciated, but having to outright reject contributions due to them being "not a good fit" is something we don't like to do. We ask that you coordinate changes with us to prevent any wasted time, as your time is valuable.

## Rejection

@@ -55,24 +55,35 @@ If you're looking for something - here's a breakdown of our codebase

```
src/ # Our source folder
├── build.rs # Build script to embed git hash for ;botinfo commmand
|
├── main.rs # Code entry point, command registration, and client spawning
├── cache.rs # Sets up the cache to be used for the bot's resources
├── events.rs # All discord event handlers excluding command callbacks
├── apis/ # The home of any involved API integration
│ └── dbl.rs ## Discord bot's list webhook logic
├── commands/ # Module containing all of our command logic
├── commands/ # Module containing all of our command's logic
│ └── ...
├── stats/ # Module containing all statistics tracking logic
│ ├── stats.rs ## StatsManager abstraction for common code paths
├── managers/ # Module containing all statistics tracking logic
│ ├── compilation.rs ## StatsManager abstraction for common code paths
│ └── stats.rs ## Manager used to handle all interactons with stats/tracking
├── stats/ # Module containing all statistics tracking structures
│ └── structures.rs ## Stats request models & request dispatch
└── utls/ # Module with random utilities to be used throughout the project
├── apis/ # The home of any involved API integration
│ └──dbl.rs ## top.gg's webhook logic
├── boilerplate/ # Module containing some boilerplate code geneeration
│ └──...
└── utls/ # Module with random utilities to be used throughout the project
├── discordhelpers/ # Module with some discord shortcuts to help keep the project clean
│ ├── mod.rs ## Menu handlers & other commonly used functions
│ └── embeds.rs ## Tools that builds our outputs & prepares them for display
├── blocklist.rs ## Our blocklisting strategy to preven abuse
├── constants.rs ## Constants
├── discordhelpers.rs ## Embed builders, menu builders, general tools to be used
└── parser.rs ## Compile/Asm command parsing logic
```
25 changes: 12 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -16,30 +16,30 @@ jobs:
matrix:
name:
- ubuntu-latest-stable
# - ubuntu-latest-nightly
# - ubuntu-latest-nightly
- windows-latest-stable
# - windows-latest-nightly
# - windows-latest-nightly
include:
- name: ubuntu-latest-stable
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-gnu
rustflags: -D warnings
# - name: ubuntu-latest-nightly
# os: ubuntu-latest
# rust: nightly
# target: x86_64-unknown-linux-gnu
# rustflags: -D warnings
# - name: ubuntu-latest-nightly
# os: ubuntu-latest
# rust: nightly
# target: x86_64-unknown-linux-gnu
# rustflags: -D warnings
- name: windows-latest-stable
os: windows-latest
rust: stable
target: x86_64-pc-windows-msvc
rustflags: -D warnings
# - name: windows-latest-nightly
# os: windows-latest
# rust: nightly
# target: x86_64-pc-windows-msvc
# rustflags: -D warnings
# - name: windows-latest-nightly
# os: windows-latest
# rust: nightly
# target: x86_64-pc-windows-msvc
# rustflags: -D warnings

steps:
- uses: actions/checkout@v2
@@ -70,7 +70,6 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: test

# - uses: actions-rs/cargo@v1
# with:
# command: clippy
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ name: Publish
on:
push:
tags:
- '*'
- "*"

jobs:
publish:
13 changes: 7 additions & 6 deletions .github/workflows/rust-clippy.yml
Original file line number Diff line number Diff line change
@@ -4,19 +4,19 @@
# documentation.
# rust-clippy is a tool that runs a bunch of lints to catch common
# mistakes in your Rust code and help improve your Rust code.
# More details at https://github.com/rust-lang/rust-clippy
# More details at https://github.com/rust-lang/rust-clippy
# and https://rust-lang.github.io/rust-clippy/

name: rust-clippy analyze

on:
push:
branches: [ master ]
branches: [master, v*]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [master]
schedule:
- cron: '45 8 * * 4'
- cron: "45 8 * * 4"

jobs:
rust-clippy-analyze:
@@ -41,10 +41,11 @@ jobs:
run: cargo install clippy-sarif sarif-fmt

- name: Run rust-clippy
run:
cargo clippy
run: cargo clippy
--all-targets
--all-features
--message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt
-D clippy::all
continue-on-error: true

- name: Upload analysis results to GitHub
19 changes: 16 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
# Generated by Cargo
# will have compiled files and executables
debug/
target/
.idea/

.env
.env.base
.env.beta
*.exe
*.log
blocklist.json

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
# Added by cargo
/target
/.idea

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
14 changes: 14 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Fuchsia Format Style
# last reviewed: Feb 27, 2023
# Fuchsia uses mostly 2021 edition
edition = "2021"
# The "Default" setting has a heuristic which splits lines too aggresively.
# We are willing to revisit this setting in future versions of rustfmt.
# Bugs:
# * https://github.com/rust-lang/rustfmt/issues/3119
# * https://github.com/rust-lang/rustfmt/issues/3120
use_small_heuristics = "Max"
# Prevent carriage returns
newline_style = "Unix"
# We use 2 spaces for indentation
tab_spaces = 2
2 changes: 1 addition & 1 deletion .rusty-hook.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[hooks]
pre-commit = "cargo fmt -- --check && cargo clippy --all-targets --all-features -- -D clippy::all && cargo test"
pre-commit = "cargo fmt --all --check && cargo clippy --all-targets --all-features -- -D clippy::all && cargo test --all"

[logging]
verbose = true
52 changes: 26 additions & 26 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
[package]
name = "discord-compiler-bot"
description = "Discord bot to compile your spaghetti code."
version = "0.1.5"
authors = ["ThomasByr"]
edition = "2021"
build = "src/build.rs"
name = "discord-compiler-bot"
description = "🤖 discord bot to compile your spaghetti code"
version = "1.4.2"
authors = ["ThomasByr"]
edition = "2021"
build = "src/build.rs"

[dev-dependencies]
rusty-hook = "0.11"

[dependencies]
tokio = { version = "1", features = ["full"] }
reqwest = { version = "0.11" }
dotenv = "0.15.0"
regex = "1"
log = "0.4"
pretty_env_logger = "0.3"
tokio = { version = "1", features = ["full"] }
reqwest = { version = "0.11" }
dotenv = "0.15.0"
regex = "1"
log = "0.4"
pretty_env_logger = "0.4"
strip-ansi-escapes = "0.1.0"
serde = { version = "1.0.*", features = ["derive"] }
serde_json = "1.0"
lru-cache = "0.1"
async-trait = "0.1"
content_inspector = "0.2"
shell-words = "0.1"
const_format = "0.2"
lazy_static = "1.4.0"
similar = "2.1.0"
serde = { version = "1.0.*", features = ["derive"] }
serde_json = "1.0"
lru-cache = "0.1"
async-trait = "0.1"
content_inspector = "0.2"
shell-words = "0.1"
const_format = "0.2"
lazy_static = "1.4.0"
similar = "2.1.0"
#tests
indoc = "1.0.3"
indoc = "2.0"
test-context = "0.1"
#dbl
dbl-rs = "0.3"
dbl-rs = "0.3"
futures-util = "0.3.6"
warp = "0.3"
chrono = "0.4.19"
warp = "0.3"
chrono = "0.4.19"

[target.'cfg(target_arch = "arm")'.dependencies]
openssl = { version = "0.10", features = ["vendored"] }

[dependencies.serenity]
version = "=0.11.1"
version = "=0.11.5"
default-features = false
features = [
"collector",
Loading
Oops, something went wrong.

0 comments on commit d74c746

Please sign in to comment.