Compare commits
No commits in common. "98191d29ee866a53346ac1048f6ff31f9bf27aa3" and "094d210f64f1ddd8d4a57538c4ddc279a876a6aa" have entirely different histories.
98191d29ee
...
094d210f64
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -2188,7 +2188,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
|
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "reminder-rs"
|
name = "reminder_rs"
|
||||||
version = "1.6.10"
|
version = "1.6.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
|
12
Cargo.toml
12
Cargo.toml
@ -1,10 +1,8 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "reminder-rs"
|
name = "reminder_rs"
|
||||||
version = "1.6.10"
|
version = "1.6.10"
|
||||||
authors = ["Jude Southworth <judesouthworth@pm.me>"]
|
authors = ["Jude Southworth <judesouthworth@pm.me>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "AGPL-3.0 only"
|
|
||||||
description = "Reminder Bot for Discord, now in Rust"
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
poise = "0.4"
|
poise = "0.4"
|
||||||
@ -35,14 +33,12 @@ path = "postman"
|
|||||||
path = "web"
|
path = "web"
|
||||||
|
|
||||||
[package.metadata.deb]
|
[package.metadata.deb]
|
||||||
depends = "$auto, python3-dateparser"
|
depends = "$auto, nginx, python3, python3-venv"
|
||||||
suggests = "mysql-server-8.0, nginx"
|
suggests = "mysql-server-8.0"
|
||||||
maintainer-scripts = "debian"
|
maintainer-scripts = "debian"
|
||||||
assets = [
|
assets = [
|
||||||
["target/release/reminder-rs", "usr/bin/reminder-rs", "755"],
|
["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]
|
[package.metadata.deb.systemd-units]
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
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
|
### Compiling
|
||||||
Install build requirements:
|
Install build requirements:
|
||||||
`sudo apt install gcc gcc-multilib cmake libssl-dev build-essential python3-dateparser`
|
`sudo apt install gcc gcc-multilib cmake libssl-dev build-essential`
|
||||||
|
|
||||||
Install Rust from https://rustup.rs
|
Install Rust from https://rustup.rs
|
||||||
|
|
||||||
@ -28,7 +28,9 @@ Use MySQL 8. MariaDB is confirmed not working at the moment.
|
|||||||
Load the SQL files in order from "migrations" to generate the database schema.
|
Load the SQL files in order from "migrations" to generate the database schema.
|
||||||
|
|
||||||
### Setting up Python
|
### Setting up Python
|
||||||
Reminder Bot uses `python3-dateparser` to handle dates. This depends on Python 3.
|
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.
|
||||||
|
|
||||||
### Environment Variables
|
### 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.
|
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.
|
||||||
@ -44,3 +46,8 @@ __Other Variables__
|
|||||||
* `CNC_GUILD` - default `None`, accepts a single Discord guild ID for the server that the subscription roles belong to
|
* `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
|
* `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
|
* `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
|
||||||
|
@ -6,8 +6,7 @@ PATREON_ROLE_ID=
|
|||||||
|
|
||||||
LOCAL_TIMEZONE=
|
LOCAL_TIMEZONE=
|
||||||
MIN_INTERVAL=
|
MIN_INTERVAL=
|
||||||
PYTHON_LOCATION=/usr/bin/python3
|
PYTHON_LOCATION=
|
||||||
DONTRUN=web
|
|
||||||
SECRET_KEY=
|
SECRET_KEY=
|
||||||
|
|
||||||
REMIND_INTERVAL=
|
REMIND_INTERVAL=
|
||||||
|
2
debian/.gitignore
vendored
Normal file
2
debian/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
13
debian/postinst
vendored
13
debian/postinst
vendored
@ -1,13 +0,0 @@
|
|||||||
#!/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
11
debian/postrm
vendored
@ -1,11 +0,0 @@
|
|||||||
#!/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,
|
default_avatar VARCHAR(512) DEFAULT 'https://raw.githubusercontent.com/reminder-bot/logos/master/Remind_Me_Bot_Logo_PPic.jpg' NOT NULL,
|
||||||
|
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
FOREIGN KEY (default_channel_id) REFERENCES channels(id) ON DELETE SET NULL
|
FOREIGN KEY (default_channel_id) REFERENCES reminders.channels(id) ON DELETE SET NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE channels (
|
CREATE TABLE channels (
|
||||||
@ -35,7 +35,7 @@ CREATE TABLE channels (
|
|||||||
guild_id INT UNSIGNED,
|
guild_id INT UNSIGNED,
|
||||||
|
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
FOREIGN KEY (guild_id) REFERENCES guilds(id) ON DELETE CASCADE
|
FOREIGN KEY (guild_id) REFERENCES reminders.guilds(id) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE users (
|
CREATE TABLE users (
|
||||||
@ -55,7 +55,7 @@ CREATE TABLE users (
|
|||||||
patreon BOOLEAN NOT NULL DEFAULT 0,
|
patreon BOOLEAN NOT NULL DEFAULT 0,
|
||||||
|
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
FOREIGN KEY (dm_channel) REFERENCES channels(id) ON DELETE RESTRICT
|
FOREIGN KEY (dm_channel) REFERENCES reminders.channels(id) ON DELETE RESTRICT
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE roles (
|
CREATE TABLE roles (
|
||||||
@ -67,7 +67,7 @@ CREATE TABLE roles (
|
|||||||
guild_id INT UNSIGNED NOT NULL,
|
guild_id INT UNSIGNED NOT NULL,
|
||||||
|
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
FOREIGN KEY (guild_id) REFERENCES guilds(id) ON DELETE CASCADE
|
FOREIGN KEY (guild_id) REFERENCES reminders.guilds(id) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE embeds (
|
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>> {
|
async fn _main(tx: Sender<()>) -> Result<(), Box<dyn StdError + Send + Sync>> {
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
|
|
||||||
if Path::new("/etc/reminder-rs/config.env").exists() {
|
if Path::new("/etc/soundfx-rs/default.env").exists() {
|
||||||
dotenv::from_path("/etc/reminder-rs/config.env")?;
|
dotenv::from_path("/etc/soundfx-rs/default.env")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let discord_token = env::var("DISCORD_TOKEN").expect("Missing DISCORD_TOKEN from environment");
|
let discord_token = env::var("DISCORD_TOKEN").expect("Missing DISCORD_TOKEN from environment");
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
Description=Reminder Bot
|
Description=Reminder Bot
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
User=reminder
|
|
||||||
Type=simple
|
Type=simple
|
||||||
ExecStart=/usr/bin/reminder-rs
|
ExecStart=/usr/bin/reminder-rs
|
||||||
Restart=always
|
Restart=always
|
||||||
|
Loading…
Reference in New Issue
Block a user