stage changes
This commit is contained in:
parent
e5f32b754e
commit
e437445861
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1002,7 +1002,7 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "oscuro"
|
||||
name = "oscuro-discord-bot"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
|
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "oscuro"
|
||||
name = "oscuro-discord-bot"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
|
22
LICENSE
Normal file
22
LICENSE
Normal file
@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2023-2024 George Kusayko [L-Nafaryus] <l.nafaryus@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
16
README.md
16
README.md
@ -1,16 +1,6 @@
|
||||
# Serenity Hello World Bot with Shuttle
|
||||
# Oscuro - Discord Bot
|
||||
|
||||
In this example we will deploy a Serenity bot with Shuttle that responds to the `!hello` command with `world!`. To run this bot we need a valid Discord Token. To get started log in to the [Discord developer portal](https://discord.com/developers/applications).
|
||||
# License
|
||||
|
||||
1. Click the New Application button, name your application and click Create.
|
||||
2. Navigate to the Bot tab in the lefthand menu, and add a new bot.
|
||||
3. On the bot page click the Reset Token button to reveal your token. Put this token in your `Secrets.toml`. It's very important that you don't reveal your token to anyone, as it can be abused. Create a `.gitignore` file to omit your `Secrets.toml` from version control.
|
||||
4. For the sake of this example, you also need to scroll down on the bot page to the Message Content Intent section and enable that option.
|
||||
|
||||
To add the bot to a server we need to create an invite link.
|
||||
|
||||
1. On your bot's application page, open the OAuth2 page via the lefthand panel.
|
||||
2. Go to the URL Generator via the lefthand panel, and select the `bot` scope as well as the `Send Messages` permission in the Bot Permissions section.
|
||||
3. Copy the URL, open it in your browser and select a Discord server you wish to invite the bot to.
|
||||
|
||||
For more information please refer to the [Discord docs](https://discord.com/developers/docs/getting-started) as well as the [Serenity repo](https://github.com/serenity-rs/serenity) for more examples.
|
||||
**oscuro** is licensed under the [MIT License](LICENSE).
|
||||
|
70
flake.lock
generated
Normal file
70
flake.lock
generated
Normal file
@ -0,0 +1,70 @@
|
||||
{
|
||||
"nodes": {
|
||||
"crane": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1703439018,
|
||||
"narHash": "sha256-VT+06ft/x3eMZ1MJxWzQP3zXFGcrxGo5VR2rB7t88hs=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "afdcd41180e3dfe4dac46b5ee396e3b12ccc967a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"fenix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"rust-analyzer-src": []
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1703485398,
|
||||
"narHash": "sha256-eJkxehEmQjSLD/UwPCXlHxH6g41R66fY7Hw9AOSsQA8=",
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"rev": "57a533b99ebe646449b71718e43ca29b550bd254",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1703134684,
|
||||
"narHash": "sha256-SQmng1EnBFLzS7WSRyPM9HgmZP2kLJcPAz+Ug/nug6o=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d6863cbcbbb80e71cecfc03356db1cda38919523",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"crane": "crane",
|
||||
"fenix": "fenix",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
55
flake.nix
Normal file
55
flake.nix
Normal file
@ -0,0 +1,55 @@
|
||||
{
|
||||
description = "Basic rust template";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
crane = { url = "github:ipetkov/crane"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
fenix = { url = "github:nix-community/fenix"; inputs.nixpkgs.follows = "nixpkgs"; inputs.rust-analyzer-src.follows = ""; };
|
||||
};
|
||||
|
||||
outputs = inputs @ { self, nixpkgs, crane, fenix, ... }:
|
||||
let
|
||||
forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" ];
|
||||
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
|
||||
in
|
||||
{
|
||||
packages = forAllSystems (system: {
|
||||
oscuro =
|
||||
let
|
||||
pkgs = nixpkgsFor.${system};
|
||||
cranelib = crane.lib.${system};
|
||||
in
|
||||
cranelib.buildPackage {
|
||||
src = cranelib.cleanCargoSource (cranelib.path ./.);
|
||||
strictDeps = true;
|
||||
|
||||
buildInputs = [ ];
|
||||
};
|
||||
|
||||
default = self.packages.${system}.oscuro;
|
||||
});
|
||||
|
||||
checks = forAllSystems (system: {
|
||||
inherit (self.packages.${system}.oscuro);
|
||||
|
||||
oscuro-fmt = let cranelib = crane.lib.${system}; in
|
||||
cranelib.cargoFmt {
|
||||
src = cranelib.cleanCargoSource (cranelib.path ./.);
|
||||
};
|
||||
});
|
||||
|
||||
apps = forAllSystems (system: {
|
||||
default = {
|
||||
type = "app";
|
||||
program = "${self.packages.${system}.oscuro}/bin/oscuro";
|
||||
};
|
||||
});
|
||||
|
||||
devShells = forAllSystems (system: {
|
||||
default = let pkgs = nixpkgsFor.${system}; in pkgs.mkShell {
|
||||
nativeBuildInputs = [ fenix.packages.${system}.complete.toolchain pkgs.cargo-shuttle ];
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
}
|
16
info.md
Normal file
16
info.md
Normal file
@ -0,0 +1,16 @@
|
||||
# Serenity Hello World Bot with Shuttle
|
||||
|
||||
In this example we will deploy a Serenity bot with Shuttle that responds to the `!hello` command with `world!`. To run this bot we need a valid Discord Token. To get started log in to the [Discord developer portal](https://discord.com/developers/applications).
|
||||
|
||||
1. Click the New Application button, name your application and click Create.
|
||||
2. Navigate to the Bot tab in the lefthand menu, and add a new bot.
|
||||
3. On the bot page click the Reset Token button to reveal your token. Put this token in your `Secrets.toml`. It's very important that you don't reveal your token to anyone, as it can be abused. Create a `.gitignore` file to omit your `Secrets.toml` from version control.
|
||||
4. For the sake of this example, you also need to scroll down on the bot page to the Message Content Intent section and enable that option.
|
||||
|
||||
To add the bot to a server we need to create an invite link.
|
||||
|
||||
1. On your bot's application page, open the OAuth2 page via the lefthand panel.
|
||||
2. Go to the URL Generator via the lefthand panel, and select the `bot` scope as well as the `Send Messages` permission in the Bot Permissions section.
|
||||
3. Copy the URL, open it in your browser and select a Discord server you wish to invite the bot to.
|
||||
|
||||
For more information please refer to the [Discord docs](https://discord.com/developers/docs/getting-started) as well as the [Serenity repo](https://github.com/serenity-rs/serenity) for more examples.
|
Loading…
Reference in New Issue
Block a user