Reviewed-on: #1 Co-authored-by: Xyon <xyon@orbiter-radio.uk> Co-committed-by: Xyon <xyon@orbiter-radio.uk>
This commit is contained in:
parent
bc76e4bd5c
commit
1ecf57c1f3
|
|
@ -8,6 +8,8 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: rust
|
runs-on: rust
|
||||||
|
container:
|
||||||
|
options: --dns 172.16.255.254
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
@ -15,5 +17,14 @@ jobs:
|
||||||
run: mkdir -pv ~/.ssh && ssh-keyscan -t rsa badgey >> ~/.ssh/known_hosts
|
run: mkdir -pv ~/.ssh && ssh-keyscan -t rsa badgey >> ~/.ssh/known_hosts
|
||||||
- name: Build (Release)
|
- name: Build (Release)
|
||||||
run: cargo build --release --color=always
|
run: cargo build --release --color=always
|
||||||
|
- uses: actions/replace-tokens@v1
|
||||||
|
with:
|
||||||
|
files: config/production.badgey.json
|
||||||
|
env:
|
||||||
|
POSTGRES_HOST: ${{ vars.POSTGRES_HOST }}
|
||||||
|
POSTGRES_USER: ${{ vars.POSTGRES_USER }}
|
||||||
|
POSTGRES_DATABASE_NAME: ${{ vars.POSTGRES_DATABASE_NAME }}
|
||||||
|
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
|
||||||
|
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
run: bash cicd/deploy.sh
|
run: bash cicd/deploy.sh
|
||||||
|
|
|
||||||
|
|
@ -8,5 +8,15 @@
|
||||||
<jdbc-url>jdbc:sqlite:$PROJECT_DIR$/manifold.db</jdbc-url>
|
<jdbc-url>jdbc:sqlite:$PROJECT_DIR$/manifold.db</jdbc-url>
|
||||||
<working-dir>$ProjectFileDir$</working-dir>
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
</data-source>
|
</data-source>
|
||||||
|
<data-source source="LOCAL" name="badgey_development@localhost" uuid="b7d69cd0-2e6e-404e-bf50-b088ea77d787">
|
||||||
|
<driver-ref>postgresql</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:postgresql://localhost:5432/badgey_development</jdbc-url>
|
||||||
|
<jdbc-additional-properties>
|
||||||
|
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||||
|
</jdbc-additional-properties>
|
||||||
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
|
</data-source>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="SqlDialectMappings">
|
<component name="SqlDialectMappings">
|
||||||
<file url="file://$PROJECT_DIR$/migrations/2023-09-20-230922_extend userinfo to include XP/up.sql" dialect="GenericSQL" />
|
<file url="file://$PROJECT_DIR$/migrations/2023-09-20-230922_extend userinfo to include XP/up.sql" dialect="PostgreSQL" />
|
||||||
<file url="PROJECT" dialect="SQLite" />
|
<file url="PROJECT" dialect="SQLite" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -159,7 +159,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "badgey"
|
name = "badgey"
|
||||||
version = "2.0.0"
|
version = "3.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"built",
|
"built",
|
||||||
"clap",
|
"clap",
|
||||||
|
|
@ -303,18 +303,18 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "4.4.4"
|
version = "4.4.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b1d7b8d5ec32af0fadc644bf1fd509a688c2103b185644bb1e29d164e0703136"
|
checksum = "824956d0dca8334758a5b7f7e50518d66ea319330cbceedcf76905c2f6ab30e3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap_builder",
|
"clap_builder",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_builder"
|
name = "clap_builder"
|
||||||
version = "4.4.4"
|
version = "4.4.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5179bb514e4d7c2051749d8fcefa2ed6d06a9f4e6d69faf3805f5d80b8cf8d56"
|
checksum = "122ec64120a49b4563ccaedcbea7818d069ed8e9aa6d829b82d8a4128936b2ab"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstream",
|
"anstream",
|
||||||
"anstyle",
|
"anstyle",
|
||||||
|
|
@ -478,22 +478,24 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "diesel"
|
name = "diesel"
|
||||||
version = "2.1.1"
|
version = "2.1.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d98235fdc2f355d330a8244184ab6b4b33c28679c0b4158f63138e51d6cf7e88"
|
checksum = "53c8a2cb22327206568569e5a45bb5a2c946455efdd76e24d15b7e82171af95e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"bitflags 2.4.0",
|
||||||
|
"byteorder",
|
||||||
"chrono",
|
"chrono",
|
||||||
"diesel_derives",
|
"diesel_derives",
|
||||||
"libsqlite3-sys",
|
"itoa",
|
||||||
|
"pq-sys",
|
||||||
"r2d2",
|
"r2d2",
|
||||||
"time",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "diesel_derives"
|
name = "diesel_derives"
|
||||||
version = "2.1.1"
|
version = "2.1.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e054665eaf6d97d1e7125512bb2d35d07c73ac86cc6920174cb42d1ab697a554"
|
checksum = "ef8337737574f55a468005a83499da720f20c65586241ffea339db9ecdfd2b44"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"diesel_table_macro_syntax",
|
"diesel_table_macro_syntax",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
|
|
@ -609,9 +611,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fastrand"
|
name = "fastrand"
|
||||||
version = "2.0.0"
|
version = "2.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764"
|
checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "flate2"
|
name = "flate2"
|
||||||
|
|
@ -1042,16 +1044,6 @@ dependencies = [
|
||||||
"pkg-config",
|
"pkg-config",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libsqlite3-sys"
|
|
||||||
version = "0.26.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "afc22eff61b133b115c6e8c74e818c628d6d5e7a502afea6f64dee076dd94326"
|
|
||||||
dependencies = [
|
|
||||||
"pkg-config",
|
|
||||||
"vcpkg",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libz-sys"
|
name = "libz-sys"
|
||||||
version = "1.1.12"
|
version = "1.1.12"
|
||||||
|
|
@ -1094,8 +1086,8 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "manifold"
|
name = "manifold"
|
||||||
version = "4.0.0"
|
version = "5.0.0"
|
||||||
source = "git+https://code.orbiter-radio.uk/discord/manifold.git#3d712fdcb32f4a6269d12b25b10371e1c307e272"
|
source = "git+https://code.orbiter-radio.uk/discord/manifold.git#742609b4afdc4ba328cfb9df68c9e705a96b2704"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"built",
|
"built",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
|
@ -1568,6 +1560,15 @@ version = "0.2.17"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pq-sys"
|
||||||
|
version = "0.4.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "31c0052426df997c0cbd30789eb44ca097e3541717a7b8fa36b1c464ee7edebd"
|
||||||
|
dependencies = [
|
||||||
|
"vcpkg",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.67"
|
version = "1.0.67"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "badgey"
|
name = "badgey"
|
||||||
version = "2.0.0"
|
version = "3.0.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
@ -11,7 +11,7 @@ built = { version = "0.6.0", features = ["git2", "semver", "chrono"] }
|
||||||
[dependencies]
|
[dependencies]
|
||||||
built = { version = "0.6.0", features = ["git2", "semver", "chrono"] }
|
built = { version = "0.6.0", features = ["git2", "semver", "chrono"] }
|
||||||
clap = { version = "4.3.23", features = ["cargo"] }
|
clap = { version = "4.3.23", features = ["cargo"] }
|
||||||
diesel = { version = "2.1.0", features = ["sqlite", "r2d2", "chrono"] }
|
diesel = { version = "2.1.0", features = ["postgres", "r2d2", "chrono"] }
|
||||||
diesel_migrations = "2.1.0"
|
diesel_migrations = "2.1.0"
|
||||||
env_logger = "0.10.0"
|
env_logger = "0.10.0"
|
||||||
log = "0.4.20"
|
log = "0.4.20"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,13 @@
|
||||||
{
|
{
|
||||||
"prefix": "-",
|
"prefix": "-",
|
||||||
"nickname": "Badgey (Development Edition)",
|
"nickname": "Badgey (Development Edition)",
|
||||||
|
"database": {
|
||||||
|
"host": "127.0.0.1",
|
||||||
|
"user": "badgey_development",
|
||||||
|
"pass": "",
|
||||||
|
"database_name": "badgey_development",
|
||||||
|
"port": 5432
|
||||||
|
},
|
||||||
"channels": {
|
"channels": {
|
||||||
"log": 648260641626390528
|
"log": 648260641626390528
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,13 @@
|
||||||
"channels": {
|
"channels": {
|
||||||
"log": 1143479696886087801
|
"log": 1143479696886087801
|
||||||
},
|
},
|
||||||
|
"database": {
|
||||||
|
"host": "#{POSTGRES_HOST}#",
|
||||||
|
"user": "#{POSTGRES_USER}#",
|
||||||
|
"pass": "#{POSTGRES_PASSWORD}#",
|
||||||
|
"database_name": "#{POSTGRES_DATABASE_NAME}#",
|
||||||
|
"port": 5432
|
||||||
|
},
|
||||||
"responses_file_path": "txt/responses.txt",
|
"responses_file_path": "txt/responses.txt",
|
||||||
"services": {
|
"services": {
|
||||||
"weather": {
|
"weather": {
|
||||||
|
|
|
||||||
|
|
@ -25,25 +25,25 @@ CREATE TABLE IF NOT EXISTS "ranks"
|
||||||
);
|
);
|
||||||
|
|
||||||
INSERT INTO "tracks" (track_id, track_name) VALUES
|
INSERT INTO "tracks" (track_id, track_name) VALUES
|
||||||
(0, "officer"),
|
(0, 'officer'),
|
||||||
(1, "enlisted");
|
(1, 'enlisted');
|
||||||
|
|
||||||
INSERT INTO "ranks" (role_id, required_level, rank_track, rank_name) VALUES
|
INSERT INTO "ranks" (role_id, required_level, rank_track, rank_name) VALUES
|
||||||
(1154403063960961063, 0, 0, "cadet first year"), -- cadet 1
|
(1154403063960961063, 0, 0, 'cadet first year'), -- cadet 1
|
||||||
(1154403107313307729, 10, 0, "cadet fourth year"), -- cadet 4
|
(1154403107313307729, 5, 0, 'cadet fourth year'), -- cadet 4
|
||||||
(1152963553620393995, 20, 0, "ensign"), -- ensign
|
(1152963553620393995, 10, 0, 'ensign'), -- ensign
|
||||||
(1152963552299188224, 30, 0, "lieutenant junior grade"), -- ltjg
|
(1152963552299188224, 20, 0, 'lieutenant junior grade'), -- ltjg
|
||||||
(1152963550906695762, 40, 0, "lieutenant"), -- lt
|
(1152963550906695762, 30, 0, 'lieutenant'), -- lt
|
||||||
(1152963549979758712, 50, 0, "lieutenant commander"), -- ltcmdr
|
(1152963549979758712, 40, 0, 'lieutenant commander'), -- ltcmdr
|
||||||
(1152963548843094126, 60, 0, "commander"), -- cmdr
|
(1152963548843094126, 50, 0, 'commander'), -- cmdr
|
||||||
(1152963541255594054, 80, 0, "captain"), -- capt
|
(1152963541255594054, 75, 0, 'captain'), -- capt
|
||||||
(1152759044893843656, 100, 0, "fleet captain"), -- fleetcapt
|
(1152759044893843656, 100, 0, 'fleet captain'), -- fleetcapt
|
||||||
(1152965025938550926, 0, 1, "crewman third class"), -- crewman 3rd
|
(1152965025938550926, 0, 1, 'crewman third class'), -- crewman 3rd
|
||||||
(1152965024550228099, 10, 1, "crewman second class"), -- crewman 2nd
|
(1152965024550228099, 5, 1, 'crewman second class'), -- crewman 2nd
|
||||||
(1152965023098994789, 20, 1, "crewman first class"), -- crewman 1st
|
(1152965023098994789, 10, 1, 'crewman first class'), -- crewman 1st
|
||||||
(1152964462844846162, 30, 1, "petty officer third class"), -- petty 3rd
|
(1152964462844846162, 20, 1, 'petty officer third class'), -- petty 3rd
|
||||||
(1152964461817253958, 40, 1, "petty officer second class"), -- petty 2nd
|
(1152964461817253958, 30, 1, 'petty officer second class'), -- petty 2nd
|
||||||
(1152964460835778631, 50, 1, "petty officer first class"), -- petty 1st
|
(1152964460835778631, 40, 1, 'petty officer first class'), -- petty 1st
|
||||||
(1152963559010087022, 60, 1, "chief petty officer"), -- chief petty
|
(1152963559010087022, 50, 1, 'chief petty officer'), -- chief petty
|
||||||
(1152963557537886229, 80, 1, "senior chief petty officer"), -- sr ch petty
|
(1152963557537886229, 75, 1, 'senior chief petty officer'), -- sr ch petty
|
||||||
(1152963556527063110, 100, 1, "master chief petty officer"); -- master ch petty
|
(1152963556527063110, 100, 1, 'master chief petty officer'); -- master ch petty
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,11 @@ impl BadgeyHandler {
|
||||||
return Ok(())
|
return Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if fctx.user_data().await.user_info.lock().await.get_mut(&msg.author.id.as_u64()).is_none() {
|
||||||
|
debug!("Tried to add XP to a user we don't know about, aborting.");
|
||||||
|
return Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
let db = &fctx.user_data().await.database;
|
let db = &fctx.user_data().await.database;
|
||||||
let mut rng = SmallRng::from_entropy();
|
let mut rng = SmallRng::from_entropy();
|
||||||
let xp_reward = rng.gen_range(1..30).clone();
|
let xp_reward = rng.gen_range(1..30).clone();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue