1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00
Files
niveum/configs/bots/nachtischsatan.nix

54 lines
1.4 KiB
Nix
Raw Permalink Normal View History

2022-03-10 21:52:12 +01:00
{
pkgs,
config,
lib,
2022-03-10 21:52:12 +01:00
...
2025-12-27 22:22:54 +01:00
}:
let
nachtischsatan-bot =
{ tokenFile }:
pkgs.writers.writePython3 "nachtischsatan-bot"
{
libraries = [ pkgs.python3Packages.python-telegram-bot ];
}
''
from telegram.ext import Application, ContextTypes, MessageHandler, filters
from telegram import Update
import random
import time
2025-12-27 22:22:54 +01:00
async def flubber(update: Update, context: ContextTypes.DEFAULT_TYPE):
time.sleep(random.randrange(4000) / 1000)
await update.message.reply_text("*flubberflubber*")
2025-12-27 22:22:54 +01:00
with open('${tokenFile}', 'r') as tokenFile:
token = tokenFile.read().strip()
application = Application.builder().token(token).build()
application.add_handler(MessageHandler(filters.ALL, flubber))
application.run_polling()
'';
in
{
systemd.services.telegram-nachtischsatan = {
2025-12-27 22:22:54 +01:00
wantedBy = [ "multi-user.target" ];
description = "*flubberflubber*";
enable = true;
script = toString (nachtischsatan-bot {
tokenFile = config.age.secrets.telegram-token-nachtischsatan.path;
});
serviceConfig.Restart = "always";
};
2022-05-22 11:47:59 +02:00
age.secrets.telegram-token-nachtischsatan.file = ../../secrets/telegram-token-nachtischsatan.age;
2022-05-22 11:47:59 +02:00
niveum.passport.services = [
{
title = "Nachtischsatan-Bot";
link = "https://t.me/NachtischsatanBot";
description = "*flubberflubber*";
}
];
}