1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00
Files
niveum/configs/telegram-bots/nachtischsatan.nix
Kierán Meinhardt d03c6bb0de feat: convert to flake
feat(zaatar): convert to flake

feat(tahina, tabula): convert to flake

feat(makanek): convert to flake

feat(manakish, zaatar): convert to flake

feat(ci): build flake systems

fix: ci build

feat: secrets via submodule

foo

foo

foo
2023-02-23 15:12:53 +01:00

50 lines
1.3 KiB
Nix

{
pkgs,
config,
lib,
...
}: let
nachtischsatan-bot = {tokenFile}:
pkgs.writers.writePython3 "nachtischsatan-bot" {
libraries = [pkgs.python3Packages.python-telegram-bot];
} ''
from telegram.ext import Updater, MessageHandler
from telegram.ext.filters import Filters
import random
import time
def flubber(update, context):
time.sleep(random.randrange(4000) / 1000)
update.message.reply_text("*flubberflubber*")
with open('${tokenFile}', 'r') as tokenFile:
updater = Updater(tokenFile.read().strip())
updater.dispatcher.add_handler(MessageHandler(Filters.all, flubber))
updater.start_polling()
updater.idle()
'';
in {
systemd.services.telegram-nachtischsatan = {
wantedBy = ["multi-user.target"];
description = "*flubberflubber*";
enable = true;
script = toString (nachtischsatan-bot {
tokenFile = config.age.secrets.telegram-token-nachtischsatan.path;
});
serviceConfig.Restart = "always";
};
age.secrets.telegram-token-nachtischsatan.file = ../../secrets/telegram-token-nachtischsatan.age;
niveum.passport.services = [
{
title = "Nachtischsatan-Bot";
link = "https://t.me/NachtischsatanBot";
description = "*flubberflubber*";
}
];
}