Compare commits
42 Commits
a9e4a58f1f
...
3c7f21db64
| Author | SHA1 | Date | |
|---|---|---|---|
| 3c7f21db64 | |||
| dbba96deba | |||
| f46b0269ea | |||
| 80a7560292 | |||
| 04e8575f81 | |||
| dee6180e88 | |||
| b6fd31d510 | |||
| 2039d4a258 | |||
| ffc6e18795 | |||
| 1174f77f45 | |||
| 55674d2270 | |||
| 3c49bb2191 | |||
| 39da0cd107 | |||
| 5d3e3f8a6e | |||
| 9e5edc9045 | |||
| 596976624e | |||
| 107f365068 | |||
| 43e903efae | |||
| 6b7794a34b | |||
| d827aef4f3 | |||
| 831117d440 | |||
| 136e59f867 | |||
| 67dcbc77dd | |||
| f14d414aa2 | |||
| 974a2c0845 | |||
| 5f7c885f82 | |||
| 23c016fb17 | |||
| 7ccf4037f8 | |||
| 9a0c694448 | |||
| 4159b21d49 | |||
| 4106f2f99c | |||
| 5bb7a558f4 | |||
| 2c7147a287 | |||
| d3f0f269b1 | |||
| 3e6a77b980 | |||
| 1349a5a255 | |||
| f8ef74cd47 | |||
| 20a46e981a | |||
| c9dd40df6a | |||
| b2bf60b086 | |||
| ecc44df955 | |||
|
|
450cb8539d |
9
.gitignore
vendored
Normal file
9
.gitignore
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
Cargo.lock*
|
||||||
|
.direnv
|
||||||
|
.envrc
|
||||||
|
node_modules
|
||||||
|
/target
|
||||||
|
result*
|
||||||
|
/.tmp
|
||||||
|
.DS_Store
|
||||||
|
/.tmp
|
||||||
9
.sops.yaml
Normal file
9
.sops.yaml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
keys:
|
||||||
|
- &hydra age12qq2fn4nxx9g99vp5knndtn0xa0p6g9ztn48gv9ap8054am39c3qsezz90
|
||||||
|
- &universedesk age1apajqje4zvah0n2dzds3kstlsakqr2ntk64xl7xc4erzedsuy9jqqk7cd7
|
||||||
|
creation_rules:
|
||||||
|
- path_regex: secrets/[^/]+\.yaml$
|
||||||
|
key_groups:
|
||||||
|
- age:
|
||||||
|
- *hydra
|
||||||
|
- *universedesk
|
||||||
2096
Cargo.lock
generated
Normal file
2096
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
15
Cargo.toml
Normal file
15
Cargo.toml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
[package]
|
||||||
|
name = "new_alan"
|
||||||
|
version = "0.0.1"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
tracing = "0.1.37"
|
||||||
|
tracing-subscriber = "0.3.16"
|
||||||
|
tracing-futures = "0.2.5"
|
||||||
|
serenity = { version = "0.11.5", features = ["voice", "client", "rustls_backend", "standard_framework"] }
|
||||||
|
tokio = { version = "1.26.0", features = ["macros", "rt-multi-thread", "signal"] }
|
||||||
|
songbird = "0.3.1"
|
||||||
|
|
||||||
175
deploy/flake.lock
generated
Normal file
175
deploy/flake.lock
generated
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"advisory-db": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1678190193,
|
||||||
|
"narHash": "sha256-nuiUyTTjzMVfeRZInX81mBrWk26/2AgjZs/cdjX1oIk=",
|
||||||
|
"owner": "rustsec",
|
||||||
|
"repo": "advisory-db",
|
||||||
|
"rev": "292b3a8437125f015adbd32efd6bcdbbd95303f3",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "rustsec",
|
||||||
|
"repo": "advisory-db",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"crane": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": [
|
||||||
|
"newalan",
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"rust-overlay": "rust-overlay"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1678152261,
|
||||||
|
"narHash": "sha256-cPRDxwygVMleiSEGELrvAiq9vYAN4c3KK/K4UEO13vU=",
|
||||||
|
"owner": "ipetkov",
|
||||||
|
"repo": "crane",
|
||||||
|
"rev": "5291dd0aa7a52d607fc952763ef60714e4c881d4",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "ipetkov",
|
||||||
|
"repo": "crane",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-compat": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1673956053,
|
||||||
|
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1676283394,
|
||||||
|
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1676283394,
|
||||||
|
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"newalan": {
|
||||||
|
"inputs": {
|
||||||
|
"advisory-db": "advisory-db",
|
||||||
|
"crane": "crane",
|
||||||
|
"flake-utils": "flake-utils_2",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 0,
|
||||||
|
"narHash": "sha256-adKGCz1gVSev/Kf+Y38UCZJgcddTNeK5yGxn1ZwWhCE=",
|
||||||
|
"path": "/nix/store/8dvz739k19bsni4zdnyfz0sff6plqbr5-source",
|
||||||
|
"type": "path"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"path": "/nix/store/8dvz739k19bsni4zdnyfz0sff6plqbr5-source",
|
||||||
|
"type": "path"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1678207308,
|
||||||
|
"narHash": "sha256-WrmS/Inla0koTZIiq094tmjQA0akXjKtvZMcbgqfEP0=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "0ef02c4792fbde4b78957a46a8cb107b6c7aa3cc",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1678111249,
|
||||||
|
"narHash": "sha256-ZTIbK7vthZwti5XeLZE+twkb4l44q01q2XoLMmmJe94=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "a028e2873d7fcf44e66b784b4ba061824315537f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"newalan": "newalan",
|
||||||
|
"nixpkgs": "nixpkgs_2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rust-overlay": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": [
|
||||||
|
"newalan",
|
||||||
|
"crane",
|
||||||
|
"flake-utils"
|
||||||
|
],
|
||||||
|
"nixpkgs": [
|
||||||
|
"newalan",
|
||||||
|
"crane",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1677812689,
|
||||||
|
"narHash": "sha256-EakqhgRnjVeYJv5+BJx/NZ7/eFTMBxc4AhICUNquhUg=",
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"rev": "e53e8853aa7b0688bc270e9e6a681d22e01cf299",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
28
deploy/flake.nix
Normal file
28
deploy/flake.nix
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
inputs.newalan.url = "../";
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, newalan }: let
|
||||||
|
new_alan_overlay = (final: prev: {
|
||||||
|
new_alan = newalan.packages."x86_64-linux".default;
|
||||||
|
});
|
||||||
|
in {
|
||||||
|
nixosConfigurations."staging" = nixpkgs.lib.nixosSystem {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
modules = [
|
||||||
|
({ config, pkgs, ... }: {
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
new_alan_overlay
|
||||||
|
];
|
||||||
|
})
|
||||||
|
({lib, config, pkgs, ...}: {
|
||||||
|
system.stateVersion = "22.11";
|
||||||
|
boot.isContainer = true;
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
new_alan
|
||||||
|
];
|
||||||
|
})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
140
flake.lock
generated
Normal file
140
flake.lock
generated
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"advisory-db": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1678190193,
|
||||||
|
"narHash": "sha256-nuiUyTTjzMVfeRZInX81mBrWk26/2AgjZs/cdjX1oIk=",
|
||||||
|
"owner": "rustsec",
|
||||||
|
"repo": "advisory-db",
|
||||||
|
"rev": "292b3a8437125f015adbd32efd6bcdbbd95303f3",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "rustsec",
|
||||||
|
"repo": "advisory-db",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"crane": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"rust-overlay": "rust-overlay"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1678152261,
|
||||||
|
"narHash": "sha256-cPRDxwygVMleiSEGELrvAiq9vYAN4c3KK/K4UEO13vU=",
|
||||||
|
"owner": "ipetkov",
|
||||||
|
"repo": "crane",
|
||||||
|
"rev": "5291dd0aa7a52d607fc952763ef60714e4c881d4",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "ipetkov",
|
||||||
|
"repo": "crane",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-compat": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1673956053,
|
||||||
|
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1676283394,
|
||||||
|
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1676283394,
|
||||||
|
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1678207308,
|
||||||
|
"narHash": "sha256-WrmS/Inla0koTZIiq094tmjQA0akXjKtvZMcbgqfEP0=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "0ef02c4792fbde4b78957a46a8cb107b6c7aa3cc",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"advisory-db": "advisory-db",
|
||||||
|
"crane": "crane",
|
||||||
|
"flake-utils": "flake-utils_2",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rust-overlay": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": [
|
||||||
|
"crane",
|
||||||
|
"flake-utils"
|
||||||
|
],
|
||||||
|
"nixpkgs": [
|
||||||
|
"crane",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1677812689,
|
||||||
|
"narHash": "sha256-EakqhgRnjVeYJv5+BJx/NZ7/eFTMBxc4AhICUNquhUg=",
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"rev": "e53e8853aa7b0688bc270e9e6a681d22e01cf299",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
147
flake.nix
Normal file
147
flake.nix
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
{
|
||||||
|
description = "Build a cargo project";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
|
|
||||||
|
crane = {
|
||||||
|
url = "github:ipetkov/crane";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
|
||||||
|
advisory-db = {
|
||||||
|
url = "github:rustsec/advisory-db";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, crane, flake-utils, advisory-db, ... }:
|
||||||
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
|
let
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
};
|
||||||
|
|
||||||
|
inherit (pkgs) lib;
|
||||||
|
|
||||||
|
craneLib = crane.lib.${system};
|
||||||
|
src = craneLib.cleanCargoSource ./.;
|
||||||
|
|
||||||
|
# Common arguments can be set here to avoid repeating them later
|
||||||
|
commonArgs = {
|
||||||
|
inherit src;
|
||||||
|
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
cmake
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
# Add additional build inputs here
|
||||||
|
libopus
|
||||||
|
] ++ lib.optionals pkgs.stdenv.isDarwin ([
|
||||||
|
# Additional darwin specific inputs can be set here
|
||||||
|
pkgs.libiconv
|
||||||
|
] ++ (with pkgs.darwin.apple_sdk.frameworks; [
|
||||||
|
Security
|
||||||
|
]));
|
||||||
|
|
||||||
|
propagatedBuildInputs = with pkgs; [
|
||||||
|
ffmpeg_5-headless
|
||||||
|
];
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
hydraPlatforms = [ "x86_64-linux" ];
|
||||||
|
};
|
||||||
|
# Additional environment variables can be set directly
|
||||||
|
# MY_CUSTOM_VAR = "some value";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Build *just* the cargo dependencies, so we can reuse
|
||||||
|
# all of that work (e.g. via cachix) when running in CI
|
||||||
|
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
||||||
|
|
||||||
|
# Build the actual crate itself, reusing the dependency
|
||||||
|
# artifacts from above.
|
||||||
|
newalan = craneLib.buildPackage (commonArgs // {
|
||||||
|
inherit cargoArtifacts;
|
||||||
|
});
|
||||||
|
in
|
||||||
|
{
|
||||||
|
checks = pkgs.lib.optionalAttrs (system == "x86_64-linux") {
|
||||||
|
# Build the crate as part of `nix flake check` for convenience
|
||||||
|
inherit newalan;
|
||||||
|
|
||||||
|
# Run clippy (and deny all warnings) on the crate source,
|
||||||
|
# again, resuing the dependency artifacts from above.
|
||||||
|
#
|
||||||
|
# Note that this is done as a separate derivation so that
|
||||||
|
# we can block the CI if there are issues here, but not
|
||||||
|
# prevent downstream consumers from building our crate by itself.
|
||||||
|
newalan-clippy = craneLib.cargoClippy (commonArgs // {
|
||||||
|
inherit cargoArtifacts;
|
||||||
|
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
|
||||||
|
});
|
||||||
|
|
||||||
|
newalan-doc = craneLib.cargoDoc (commonArgs // {
|
||||||
|
inherit cargoArtifacts;
|
||||||
|
});
|
||||||
|
|
||||||
|
# Check formatting
|
||||||
|
newalan-fmt = craneLib.cargoFmt {
|
||||||
|
inherit src;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Audit dependencies
|
||||||
|
newalan-audit = craneLib.cargoAudit {
|
||||||
|
inherit src advisory-db;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Run tests with cargo-nextest
|
||||||
|
# Consider setting `doCheck = false` on `newalan` if you do not want
|
||||||
|
# the tests to run twice
|
||||||
|
newalan-nextest = craneLib.cargoNextest (commonArgs // {
|
||||||
|
inherit cargoArtifacts;
|
||||||
|
partitions = 1;
|
||||||
|
partitionType = "count";
|
||||||
|
});
|
||||||
|
} // lib.optionalAttrs (system == "x86_64-linux") {
|
||||||
|
# NB: cargo-tarpaulin only supports x86_64 systems
|
||||||
|
# Check code coverage (note: this will not upload coverage anywhere)
|
||||||
|
newalan-coverage = craneLib.cargoTarpaulin (commonArgs // {
|
||||||
|
inherit cargoArtifacts;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
runCommandHook = {
|
||||||
|
newalan = pkgs.writeScript "New Alan CD" ''
|
||||||
|
echo HIIIII $(date) >> ~/TEST_SCRIPT
|
||||||
|
echo Wheee
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
packages.default = newalan;
|
||||||
|
|
||||||
|
apps.default = flake-utils.lib.mkApp {
|
||||||
|
drv = newalan;
|
||||||
|
};
|
||||||
|
|
||||||
|
devShells.default = pkgs.mkShell {
|
||||||
|
inputsFrom = builtins.attrValues self.checks.${system};
|
||||||
|
|
||||||
|
# Additional dev-shell environment variables can be set directly
|
||||||
|
# MY_CUSTOM_DEVELOPMENT_VAR = "something else";
|
||||||
|
|
||||||
|
# Extra inputs can be added here
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
cargo
|
||||||
|
rustc
|
||||||
|
rust-analyzer
|
||||||
|
|
||||||
|
sops
|
||||||
|
age
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
114
index.js
114
index.js
@@ -1,114 +0,0 @@
|
|||||||
const Discord = require('discord.js');
|
|
||||||
const bot = new Discord.Client();
|
|
||||||
const ytdl = require('ytdl-core');
|
|
||||||
|
|
||||||
const status = require('minecraft-server-status');
|
|
||||||
|
|
||||||
var server = null;
|
|
||||||
var channels = null;
|
|
||||||
|
|
||||||
var vid = null;
|
|
||||||
var con = null;
|
|
||||||
|
|
||||||
var mcServer = 'bront.syzygial.cc'
|
|
||||||
|
|
||||||
bot.on('ready', () => {
|
|
||||||
console.log(`Logged in as ${bot.user.tag}!`);
|
|
||||||
server = bot.guilds.cache.get("574723462803882018");
|
|
||||||
channels = server.channels.cache.array();
|
|
||||||
let t = Math.random()*300000+2000;
|
|
||||||
setTimeout(joinMostppl,t);
|
|
||||||
setTimeout(statLine,15000);
|
|
||||||
console.log("Joining in "+t/1000+"s");
|
|
||||||
statLine();
|
|
||||||
});
|
|
||||||
|
|
||||||
function statLine() {
|
|
||||||
console.log(mcServer)
|
|
||||||
status(mcServer, 25565, response => {
|
|
||||||
console.log(response)
|
|
||||||
if (response!=undefined) {
|
|
||||||
if (response.online) {
|
|
||||||
let mcmax = response.players.max;
|
|
||||||
let mccount = response.players.now;
|
|
||||||
bot.user.setActivity(mccount+"/"+mcmax+" Players Online");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
setTimeout(statLine,15000);
|
|
||||||
}
|
|
||||||
|
|
||||||
function joinMostppl() {
|
|
||||||
if (vid==null) {
|
|
||||||
let max=0;
|
|
||||||
let vids = channels.filter(c => c.type === 'voice');
|
|
||||||
for (v in vids) {
|
|
||||||
if (vids[v].members.size>max) {
|
|
||||||
max = vids[v].members.size;
|
|
||||||
vid = vids[v];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (max>0) {
|
|
||||||
vid.join().then(c => {
|
|
||||||
con = c;
|
|
||||||
con.play("ding.mp3");
|
|
||||||
let t = Math.random()*400000+6000;
|
|
||||||
setTimeout(leaveChannel,t);
|
|
||||||
console.log("Leaving in "+t/1000+"s");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function leaveChannel() {
|
|
||||||
if (vid!=null) {
|
|
||||||
vid.leave();
|
|
||||||
vid=null;
|
|
||||||
}
|
|
||||||
let t = Math.random()*1000000+2000;
|
|
||||||
setTimeout(joinMostppl,t);
|
|
||||||
console.log("Joining in "+t/1000+"s");
|
|
||||||
}
|
|
||||||
|
|
||||||
bot.on('message', msg => {
|
|
||||||
var str = msg.content;
|
|
||||||
if (str === "ALAN") {
|
|
||||||
vid = msg.member.voice.channel;
|
|
||||||
if (vid!=null) {
|
|
||||||
vid.join().then(c => {
|
|
||||||
// console.log(c);
|
|
||||||
con = c;
|
|
||||||
con.play("ding.mp3");
|
|
||||||
}).catch(console.error);
|
|
||||||
}
|
|
||||||
}else if (str === "ALANO") {
|
|
||||||
if (vid!=null) {
|
|
||||||
vid.leave();
|
|
||||||
vid=null;
|
|
||||||
}
|
|
||||||
}else if (str.startsWith("poll")) {
|
|
||||||
var poll = str.slice(5).split('\n');
|
|
||||||
if (poll.length<3) {
|
|
||||||
msg.channel.send("You need at least two options for a poll");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var embed = new Discord.MessageEmbed().setTitle(`${msg.member.nickname} Poll:`)
|
|
||||||
.setColor('#348db2');
|
|
||||||
embed.setDescription(poll[0]);
|
|
||||||
emos = bot.emojis.cache.random(poll.length-1);
|
|
||||||
for (let i=1; i<poll.length; i++) {
|
|
||||||
embed.addField(emos[i-1],poll[i]);
|
|
||||||
}
|
|
||||||
msg.channel.send(embed).then(m => {
|
|
||||||
for (let i=1; i<poll.length; i++) {
|
|
||||||
m.react(emos[i-1]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
msg.delete();
|
|
||||||
}else if (str.startsWith("ALAN STATUS")) {
|
|
||||||
var words = str.slice(12).split(' ');
|
|
||||||
mcServer = words[0];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
bot.login('NzA4NDYxNzc0ODYwNzEzOTg0.XrX-dQ.fEo2gr8UHLV3JBr7CF47C-q8cOI');
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{}
|
|
||||||
30
secrets/deploy.yaml
Normal file
30
secrets/deploy.yaml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
DISCORD_TOKEN: ENC[AES256_GCM,data:IA1ZKRjahzR/hyi9DeZPYJSmCwkWhJ1BQhD/RgADm7mAj4La5Svad7swNFltimMJSuSOX8bz1onPOBiPeqBF4ZfuFS8LKw==,iv:3DYPxVlyDahUCztVjSvBfkXbkLM3J0lp8oZPbOjXI/g=,tag:esTAmPTewAU9zlO1JNn25A==,type:str]
|
||||||
|
sops:
|
||||||
|
kms: []
|
||||||
|
gcp_kms: []
|
||||||
|
azure_kv: []
|
||||||
|
hc_vault: []
|
||||||
|
age:
|
||||||
|
- recipient: age12qq2fn4nxx9g99vp5knndtn0xa0p6g9ztn48gv9ap8054am39c3qsezz90
|
||||||
|
enc: |
|
||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBMREpSMmI4K1J4LzlnNGdH
|
||||||
|
S0k0dWdZUHo2YkNxeWR2eG5HYXpmQndxRmo0CmFZY2RrRUpIT0NsdkNKQTl3L3N3
|
||||||
|
d2loNlZBajFyNmRPQzdIWUdMbUFzbEkKLS0tIGVGbEF1cDFneHl2ZUdpaTFjZGNq
|
||||||
|
dVNwdUNxcnhhd0dxcXhvRlRuR2IwR2cKCDFj6ubhGwcy6EFx0EaCcB/bE3k2PDeA
|
||||||
|
g8RhyS+k+XLpErkU2cd+Rz2Cwj2w4QORvJddwDhdnm/sqYCCLQlG3g==
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
||||||
|
- recipient: age1apajqje4zvah0n2dzds3kstlsakqr2ntk64xl7xc4erzedsuy9jqqk7cd7
|
||||||
|
enc: |
|
||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA5RklkWE9VMFNQbkNIU0Z6
|
||||||
|
WXBPTWthWG1oVzRsb3JWMUR1dE1zdEhMUkM4Clk0clA0d3A5SFdmem9lblhUVzRo
|
||||||
|
djJ3SlFDS0p4NEpxSHhoMnlnN2h3OVEKLS0tIGx1eVdaYXVtZER1KzB2ZkZickFs
|
||||||
|
TDd0dG1RYVFhWkkrWmlPVmt0aVJhclEK991J72XkQy2+1jQpY4rZSFkRFE8v/nqb
|
||||||
|
Vt3dG7GfnCjpf/F0BZscLsQdo1fcZcwgumlG3omyBTylFXTGnWT4VA==
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
||||||
|
lastmodified: "2023-03-09T04:26:07Z"
|
||||||
|
mac: ENC[AES256_GCM,data:Hj8QDZZj7NiLqjvA6cuTfvePdtkDt/noqO/g8sSsaUhkVceAbO8asKmRWezB9lhCzBk+EMzA/qZA1PeBqiw2FxU7DUQF2jC9RJTCrn242wUn2Ba9n70aj2QQQFSxjbBG0LwwAV2hqbxa/AhmLizvX2xd6lI/3E7Az7vsf9quFm8=,iv:oDZ7itiQ6lL9YHAlVk9izyjDVeUYtOJygaclSRl+SDg=,tag:hX2V7POGSjuFEqWw26b+IA==,type:str]
|
||||||
|
pgp: []
|
||||||
|
unencrypted_suffix: _unencrypted
|
||||||
|
version: 3.7.3
|
||||||
7
src/commands.rs
Normal file
7
src/commands.rs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
use serenity::framework::standard::macros::group;
|
||||||
|
pub mod ping;
|
||||||
|
use ping::*;
|
||||||
|
|
||||||
|
#[group]
|
||||||
|
#[commands(ping)]
|
||||||
|
pub struct General;
|
||||||
11
src/commands/ping.rs
Normal file
11
src/commands/ping.rs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
use serenity::framework::standard::macros::command;
|
||||||
|
use serenity::framework::standard::CommandResult;
|
||||||
|
use serenity::model::channel::Message;
|
||||||
|
use serenity::prelude::Context;
|
||||||
|
|
||||||
|
#[command]
|
||||||
|
pub async fn ping(ctx: &Context, msg: &Message) -> CommandResult {
|
||||||
|
msg.channel_id.say(&ctx.http, "pong!").await?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
23
src/events.rs
Normal file
23
src/events.rs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
use serenity::async_trait;
|
||||||
|
use serenity::model::gateway::Ready;
|
||||||
|
use serenity::prelude::Context;
|
||||||
|
use serenity::prelude::*;
|
||||||
|
|
||||||
|
pub struct Handler;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
|
impl EventHandler for Handler {
|
||||||
|
// Set a handler to be called on the `ready` event. This is called when a
|
||||||
|
// shard is booted, and a READY payload is sent by Discord. This payload
|
||||||
|
// contains data like the current user's guild Ids, current user data,
|
||||||
|
// private channels, and more.
|
||||||
|
//
|
||||||
|
// In this case, just print what the current user's username is.
|
||||||
|
async fn ready(&self, ctx: Context, ready: Ready) {
|
||||||
|
println!("{} is connected!", ready.user.name);
|
||||||
|
for g_id in ctx.cache.guilds() {
|
||||||
|
let g = ctx.cache.guild(g_id).expect("Unable to fetch guild");
|
||||||
|
println!("Initializing {}...", g.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
49
src/main.rs
Normal file
49
src/main.rs
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
/* TODO: Use tracing for better debugging following events */
|
||||||
|
|
||||||
|
use std::env;
|
||||||
|
|
||||||
|
use serenity::framework::standard::StandardFramework;
|
||||||
|
use serenity::prelude::*;
|
||||||
|
|
||||||
|
// This trait adds the `register_songbird` and `register_songbird_with` methods
|
||||||
|
// to the client builder below, making it easy to install this voice client.
|
||||||
|
// The voice client can be retrieved in any command using `songbird::get(ctx).await`.
|
||||||
|
use songbird::SerenityInit;
|
||||||
|
|
||||||
|
mod commands;
|
||||||
|
use commands::*;
|
||||||
|
|
||||||
|
mod events;
|
||||||
|
use events::*;
|
||||||
|
|
||||||
|
#[tokio::main]
|
||||||
|
async fn main() {
|
||||||
|
// Trace async functions
|
||||||
|
tracing_subscriber::fmt::init();
|
||||||
|
// Configure the client with your Discord bot token in the environment.
|
||||||
|
let token = env::var("DISCORD_TOKEN").expect("Expected a token in the environment");
|
||||||
|
// Set gateway intents, which decides what events the bot will be notified about
|
||||||
|
let intents = GatewayIntents::GUILD_MESSAGES
|
||||||
|
| GatewayIntents::GUILD_VOICE_STATES
|
||||||
|
| GatewayIntents::GUILD_MESSAGE_REACTIONS
|
||||||
|
| GatewayIntents::GUILD_MESSAGE_TYPING
|
||||||
|
| GatewayIntents::DIRECT_MESSAGES
|
||||||
|
| GatewayIntents::DIRECT_MESSAGE_REACTIONS
|
||||||
|
| GatewayIntents::DIRECT_MESSAGE_TYPING
|
||||||
|
| GatewayIntents::MESSAGE_CONTENT;
|
||||||
|
|
||||||
|
let framework = StandardFramework::new()
|
||||||
|
.configure(|c| c.prefix("ALAN! "))
|
||||||
|
.group(&GENERAL_GROUP);
|
||||||
|
|
||||||
|
let mut client = Client::builder(&token, intents)
|
||||||
|
.event_handler(Handler)
|
||||||
|
.framework(framework)
|
||||||
|
.register_songbird()
|
||||||
|
.await
|
||||||
|
.expect("Err creating client");
|
||||||
|
|
||||||
|
if let Err(why) = client.start().await {
|
||||||
|
println!("Client error: {:?}", why);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user