/meme-saviour

A Telegram bot that saves meme (or any other image really) to a provided storage.

Primary LanguageGo

Meme saviour

pepe the frog

A Telegram bot that saves memes (or any other image really) to a provided storage.

type Storage interface {
Save(m Meme) error
GetName() string
MaxSize() Size
GetRandomMeme() (*Meme, error)
}

Configuration ⚙️

Configuration can be set using env variables. Storage variables are optional but at least one Storage must be for the app to work. Currently only Local storage is implemented therefore must be set.

  • TELEGRAM_TOKEN (required): Token of the Telegram bot you've created.
  • TELEGRAM_ALLOWED_USERNAMES (required): CSV of usernames that are allowed to use the bot (eg. user1,user2,usern)
  • LOCAL_STORAGE (optional): if set to 1 then is enabled (default: 0)
  • LOCAL_STORAGE_PATH (optional): Set to the path where you want to store the memes (eg. /data/memes/, default: /data)

Run

Run locally for development.

git clone git@github.com:contre95/meme-saviour.git
TELEGRAM_TOKEN=<telegram-bot-token> LOCAL_STORAGE=1 LOCAL_STORAGE_PATH=./data TELEGRAM_ALLOWED_USERNAMES=<your-username> go run ./main.go

Run it on a container.

podman container run --rm \
	--name memesaviour
	-v "$(pwd)/data:/data" \
	-e TELEGRAM_TOKEN=<telegram-bot-token> \
	-e LOCAL_STORAGE=1 \
	-e TELEGRAM_ALLOWED_USERNAMES=user1,user2,user3 \
	docker.io/contre95/memesaviour