Skip to content

SirTimme/scriletio

Repository files navigation

Scriletio

docker badge postgresql badge discord badge gradle badge

Scriletio is a discord bot that automatically
deletes your messages after a configured duration.


Table of contents

  1. Commands
  2. Self-hosting

Commands

Overview

Command Task
/register Registers yourself in the database
/autodelete add <channel> <duration> Adds an autodelete config for the specified channel
/autodelete get Displays an overview for all autodelete configs in this server
/autodelete update <channel> <duration> Updates an existing config with the specified duration
/autodelete delete Deletes an existing autodelete config
/delete Deletes all of your stored data from the database

/register

Parameter Type Required
- - -

Example:

register command


/autodelete add <channel> <duration>

Parameter Type Required
channel Textchannel true
duration String true

Important

For more information regarding the duration format click here.

Example:

autodelete add command


/autodelete get

Parameter Type Required
- - -

Example:

autodelete get command


/autodelete update <channel> <duration>

Parameter Type Required
channel Textchannel true
duration String true

Important

The choices for channel are dynamically resolved based on your saved autodelete configs.
You need to use one of the provided choices to update an autodelete config!

autodelete update choices information

For more information regarding the duration format click here.

Example:

autodelete update command


/autodelete delete

Parameter Type Required
- - -

Example:

autodelete delete command


/delete

Parameter Type Required
- - -

Caution

When clicking Accept all of your saved autodelete configs will be deleted.
This also means that the scheduled deletion of messages in these channels will be cancelled!

Example:

delete command


Duration format

Important

The duration format is structured as follows:
The duration is specified with a number, followed by a letter for the unit. These letters are permitted:

Letter Unit
D or d Day
H or h Hour
M or m Minute

The order of the units does not matter.
You can even specify multiple durations of the same unit (e.g. 3H3H). It is simply added together.

Examples:

  • 4D or 4d = 4 days
  • 2D3H or 2d3h = 2 days 3 hours
  • 1D5H3M or 1d5h3m = 1 day 5 hours 3 minutes

Self-hosting

Scriletio provides a docker image for self-hosting purposes. It can be found in the dockerhub registry.

Important

This directory structure is needed for Scriletio to run:

/
├── compose.yml
└── .env

First, copy the .env.example to .env:

> cp .env.example .env

The .env file needs these required entries:

# Discord credentials
TOKEN=                      # the bot token
OWNER_ID=                   # your discord user id
# Postgres connection credentials
POSTGRES_USER=              # the database username of your choice
POSTGRES_PASSWORD=          # the database password of your choice
POSTGRES_URL=               # the jdbc url of the postgres database
POSTGRES_DB=                # the database name of your choice

The following entries are optional:

# Docker image versions
POSTGRES_VERSION=           # if left empty, 16.2 is used
ADMINER_VERSION=            # if left empty, 4.8.1 is used
SCRILETIO_VERSION=          # if left empty, 0.0.8 is used
# Open Telemetry
LOG_EXPORTER_ENDPOINT=      # the endpoint of the OpenTelemetry Collector
# Logging
LOGBACK_CONFIG_FILE=        # the filepath to a logback.xml file

The compose.yml configures these services:

  • database - a postgres database for data storage
  • bot - scriletio itself
  • adminer - a GUI for accessing the database

Tip

Keep in mind that you may need to adjust the specified ports in the compose file below:

name: scriletio
services:
    database:
        image: postgres:${POSTGRES_VERSION-16.2}
        environment:
            POSTGRES_USER: ${POSTGRES_USER}
            POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
            POSTGRES_DB: ${POSTGRES_DB}
        volumes:
            - pg-data:/var/lib/postgresql/data
        ports:
            - "5432:5432"

    bot:
        image: sirtimme/scriletio:${SCRILETIO_VERSION-0.0.8}
        environment:
            OWNER_ID: ${OWNER_ID}
            TOKEN: ${TOKEN}
            POSTGRES_USER: ${POSTGRES_USER}
            POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
            POSTGRES_URL: ${POSTGRES_URL}
        volumes:
            - ${LOGBACK_CONFIG_FILE-./src/main/resources/cfg/logback.xml}:/home/gradle/src/cfg/logback.xml
        depends_on:
            - database

    adminer:
        image: adminer:${ADMINER_VERSION-4.8.1}
        depends_on:
            - database
        ports:
            - "8080:8080"

volumes:
    pg-data: