Added discord posting naming for backups

main
Jan Beníček 2024-06-20 17:09:28 +02:00
parent 7d1c945cf1
commit b00a8a495f
3 changed files with 4 additions and 2 deletions

View File

@ -4,4 +4,5 @@ SERVER_ID=yugytt457b
SAVE_DIR=/dir SAVE_DIR=/dir
DISCORD_WEBHOOK=https://webhookaddress DISCORD_WEBHOOK=https://webhookaddress
MAIN_DOMAIN=http://baseOfDomainForbackupsPropagationViaWebhook MAIN_DOMAIN=http://baseOfDomainForbackupsPropagationViaWebhook
DISCORD_BACKUPNAME=ServerName
DISCORD_ENABLED=1 DISCORD_ENABLED=1

View File

@ -10,6 +10,7 @@ class Config(BaseSettings):
discord_webhook: str discord_webhook: str
main_domain: str main_domain: str
discord_enabled: int discord_enabled: int
disscord_backupname: str
cfg = Config() cfg = Config()

View File

@ -1,6 +1,6 @@
import discordwebhook, datetime import discordwebhook, datetime
def send_url_to_discord(webhook_url: str, backup_url: str, datetime: datetime.datetime): def send_url_to_discord(webhook_url: str, backup_url: str, datetime: datetime.datetime, backup_name: str):
webhook = discordwebhook.Webhook(url=webhook_url) webhook = discordwebhook.Webhook(url=webhook_url)
embed = discordwebhook.Embed(title=f"Backup of {datetime.year}-{datetime.month}-{datetime.day}", description=backup_url) embed = discordwebhook.Embed(title=f"Backup of {backup_name} from {datetime.year}-{datetime.month}-{datetime.day}", description=backup_url)
webhook.send_sync(content="", embed=embed) webhook.send_sync(content="", embed=embed)