3 Commits

Author SHA1 Message Date
9cfcb0d09c Bump ver 2023-03-29 18:18:27 +01:00
cc55b3e1d1 Add user when installing 2023-03-29 18:16:04 +01:00
a9a08e656f Copy config files around to prevent overwriting 2023-03-29 17:51:36 +01:00
7 changed files with 31 additions and 15 deletions

View File

@ -2,7 +2,7 @@
name = "soundfx-rs"
description = "Discord bot for custom sound effects and soundboards"
license = "AGPL-3.0-only"
version = "1.5.7"
version = "1.5.8"
authors = ["jellywx <judesouthworth@pm.me>"]
edition = "2018"

2
debian/.gitignore vendored
View File

@ -1,2 +0,0 @@
*
!.gitignore

13
debian/postinst vendored Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
set -e
id -u soundfx &>/dev/null || useradd -r -M soundfx
if [ ! -f /etc/soundfx-rs/config.env ]; then
cp /etc/soundfx-rs/default.env /etc/soundfx-rs/config.env
fi
chown soundfx /etc/soundfx-rs/config.env
#DEBHELPER#

11
debian/postrm vendored Normal file
View File

@ -0,0 +1,11 @@
#!/bin/bash
set -e
id -u soundfx &>/dev/null || userdel soundfx
if [ -f /etc/soundfx-rs/config.env ]; then
rm /etc/soundfx/config.env
fi
#DEBHELPER#

View File

@ -68,8 +68,8 @@ pub async fn register_application_commands(
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
if Path::new("/etc/soundfx-rs/default.env").exists() {
dotenv::from_path("/etc/soundfx-rs/default.env").unwrap();
if Path::new("/etc/soundfx-rs/config.env").exists() {
dotenv::from_path("/etc/soundfx-rs/config.env").unwrap();
}
env_logger::init();

View File

@ -409,14 +409,7 @@ WHERE
&self,
db_pool: impl Executor<'_, Database = Database>,
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
sqlx::query!(
"
DELETE
FROM sounds
WHERE id = ?
",
self.id
)
sqlx::query!("DELETE FROM sounds WHERE id = ?", self.id)
.execute(db_pool)
.await?;

View File

@ -2,6 +2,7 @@
Description=Discord bot for custom sound effects and soundboards
[Service]
User=soundfx
Type=simple
ExecStart=/usr/bin/soundfx-rs
WorkingDirectory=/etc/soundfx-rs