Compare commits
3 Commits
094d210f64
...
98191d29ee
Author | SHA1 | Date | |
---|---|---|---|
|
98191d29ee | ||
|
1c4c4a8b31 | ||
|
d496c81003 |
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -2188,7 +2188,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
|
||||
|
||||
[[package]]
|
||||
name = "reminder_rs"
|
||||
name = "reminder-rs"
|
||||
version = "1.6.10"
|
||||
dependencies = [
|
||||
"base64",
|
||||
|
12
Cargo.toml
12
Cargo.toml
@ -1,8 +1,10 @@
|
||||
[package]
|
||||
name = "reminder_rs"
|
||||
name = "reminder-rs"
|
||||
version = "1.6.10"
|
||||
authors = ["Jude Southworth <judesouthworth@pm.me>"]
|
||||
edition = "2021"
|
||||
license = "AGPL-3.0 only"
|
||||
description = "Reminder Bot for Discord, now in Rust"
|
||||
|
||||
[dependencies]
|
||||
poise = "0.4"
|
||||
@ -33,12 +35,14 @@ path = "postman"
|
||||
path = "web"
|
||||
|
||||
[package.metadata.deb]
|
||||
depends = "$auto, nginx, python3, python3-venv"
|
||||
suggests = "mysql-server-8.0"
|
||||
depends = "$auto, python3-dateparser"
|
||||
suggests = "mysql-server-8.0, nginx"
|
||||
maintainer-scripts = "debian"
|
||||
assets = [
|
||||
["target/release/reminder-rs", "usr/bin/reminder-rs", "755"],
|
||||
["conf/default.env", "etc/reminder-rs/default.env", "600"]
|
||||
["conf/default.env", "etc/reminder-rs/default.env", "600"],
|
||||
# ["web/static/", "var/www/reminder-rs/static", "755"],
|
||||
# ["nginx/reminder-rs", "etc/nginx/sites-available/reminder-rs", "755"]
|
||||
]
|
||||
|
||||
[package.metadata.deb.systemd-units]
|
||||
|
9
Containerfile
Normal file
9
Containerfile
Normal file
@ -0,0 +1,9 @@
|
||||
FROM ubuntu:20.04
|
||||
|
||||
ENV RUSTUP_HOME=/usr/local/rustup \
|
||||
CARGO_HOME=/usr/local/cargo \
|
||||
PATH=/usr/local/cargo/bin:$PATH
|
||||
|
||||
RUN apt update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt install -y gcc gcc-multilib cmake pkg-config libssl-dev curl mysql-client-8.0
|
||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --profile minimal
|
||||
RUN cargo install cargo-deb
|
11
README.md
11
README.md
@ -9,7 +9,7 @@ You'll need rustc and cargo for compilation. To run, you'll need Python 3 still
|
||||
|
||||
### Compiling
|
||||
Install build requirements:
|
||||
`sudo apt install gcc gcc-multilib cmake libssl-dev build-essential`
|
||||
`sudo apt install gcc gcc-multilib cmake libssl-dev build-essential python3-dateparser`
|
||||
|
||||
Install Rust from https://rustup.rs
|
||||
|
||||
@ -28,9 +28,7 @@ Use MySQL 8. MariaDB is confirmed not working at the moment.
|
||||
Load the SQL files in order from "migrations" to generate the database schema.
|
||||
|
||||
### Setting up Python
|
||||
Reminder Bot by default looks for a venv within it's working directory to run Python out of. To set up a venv, install `python3-venv` and run `python3 -m venv venv`. Then, run `source venv/bin/activate` to activate the venv, and do `pip install dateparser` to install the required library.
|
||||
|
||||
Remember where you create the venv! You may need to change the `PYTHON_LOCATION` variable in the next step to point to your Python binary if the venv is not in your working directory.
|
||||
Reminder Bot uses `python3-dateparser` to handle dates. This depends on Python 3.
|
||||
|
||||
### Environment Variables
|
||||
Reminder Bot reads a number of environment variables. Some are essential, and others have hardcoded fallbacks. Environment variables can be loaded from a .env file in the working directory.
|
||||
@ -46,8 +44,3 @@ __Other Variables__
|
||||
* `CNC_GUILD` - default `None`, accepts a single Discord guild ID for the server that the subscription roles belong to
|
||||
* `PYTHON_LOCATION` - default `venv/bin/python3`. Can be changed if your Python executable is located somewhere else
|
||||
* `THEME_COLOR` - default `8fb677`. Specifies the hex value of the color to use on info message embeds
|
||||
* `DM_ENABLED` - default `1`, if `1`, Reminder Bot will respond to direct messages
|
||||
|
||||
### Todo List
|
||||
|
||||
* Convert aliases to macros
|
||||
|
3
build.rs
Normal file
3
build.rs
Normal file
@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=migrations");
|
||||
}
|
@ -6,7 +6,8 @@ PATREON_ROLE_ID=
|
||||
|
||||
LOCAL_TIMEZONE=
|
||||
MIN_INTERVAL=
|
||||
PYTHON_LOCATION=
|
||||
PYTHON_LOCATION=/usr/bin/python3
|
||||
DONTRUN=web
|
||||
SECRET_KEY=
|
||||
|
||||
REMIND_INTERVAL=
|
||||
|
2
debian/.gitignore
vendored
2
debian/.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
*
|
||||
!.gitignore
|
13
debian/postinst
vendored
Normal file
13
debian/postinst
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
id -u reminder &>/dev/null || useradd -r -M reminder
|
||||
|
||||
if [ ! -f /etc/reminder-rs/config.env ]; then
|
||||
cp /etc/reminder-rs/default.env /etc/reminder-rs/config.env
|
||||
fi
|
||||
|
||||
chown reminder /etc/reminder-rs/config.env
|
||||
|
||||
#DEBHELPER#
|
11
debian/postrm
vendored
Normal file
11
debian/postrm
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
id -u reminder &>/dev/null || userdel reminder
|
||||
|
||||
if [ -f /etc/reminder-rs/config.env ]; then
|
||||
rm /etc/reminder-rs/config.env
|
||||
fi
|
||||
|
||||
#DEBHELPER#
|
@ -14,7 +14,7 @@ CREATE TABLE guilds (
|
||||
default_avatar VARCHAR(512) DEFAULT 'https://raw.githubusercontent.com/reminder-bot/logos/master/Remind_Me_Bot_Logo_PPic.jpg' NOT NULL,
|
||||
|
||||
PRIMARY KEY (id),
|
||||
FOREIGN KEY (default_channel_id) REFERENCES reminders.channels(id) ON DELETE SET NULL
|
||||
FOREIGN KEY (default_channel_id) REFERENCES channels(id) ON DELETE SET NULL
|
||||
);
|
||||
|
||||
CREATE TABLE channels (
|
||||
@ -35,7 +35,7 @@ CREATE TABLE channels (
|
||||
guild_id INT UNSIGNED,
|
||||
|
||||
PRIMARY KEY (id),
|
||||
FOREIGN KEY (guild_id) REFERENCES reminders.guilds(id) ON DELETE CASCADE
|
||||
FOREIGN KEY (guild_id) REFERENCES guilds(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE users (
|
||||
@ -55,7 +55,7 @@ CREATE TABLE users (
|
||||
patreon BOOLEAN NOT NULL DEFAULT 0,
|
||||
|
||||
PRIMARY KEY (id),
|
||||
FOREIGN KEY (dm_channel) REFERENCES reminders.channels(id) ON DELETE RESTRICT
|
||||
FOREIGN KEY (dm_channel) REFERENCES channels(id) ON DELETE RESTRICT
|
||||
);
|
||||
|
||||
CREATE TABLE roles (
|
||||
@ -67,7 +67,7 @@ CREATE TABLE roles (
|
||||
guild_id INT UNSIGNED NOT NULL,
|
||||
|
||||
PRIMARY KEY (id),
|
||||
FOREIGN KEY (guild_id) REFERENCES reminders.guilds(id) ON DELETE CASCADE
|
||||
FOREIGN KEY (guild_id) REFERENCES guilds(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE embeds (
|
||||
|
@ -88,8 +88,8 @@ async fn main() -> Result<(), Box<dyn StdError + Send + Sync>> {
|
||||
async fn _main(tx: Sender<()>) -> Result<(), Box<dyn StdError + Send + Sync>> {
|
||||
env_logger::init();
|
||||
|
||||
if Path::new("/etc/soundfx-rs/default.env").exists() {
|
||||
dotenv::from_path("/etc/soundfx-rs/default.env")?;
|
||||
if Path::new("/etc/reminder-rs/config.env").exists() {
|
||||
dotenv::from_path("/etc/reminder-rs/config.env")?;
|
||||
}
|
||||
|
||||
let discord_token = env::var("DISCORD_TOKEN").expect("Missing DISCORD_TOKEN from environment");
|
||||
|
@ -2,6 +2,7 @@
|
||||
Description=Reminder Bot
|
||||
|
||||
[Service]
|
||||
User=reminder
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/reminder-rs
|
||||
Restart=always
|
||||
|
Loading…
Reference in New Issue
Block a user