2022-03-10 21:52:12 +01:00
|
|
|
{
|
|
|
|
|
pkgs,
|
2023-02-22 10:02:55 +01:00
|
|
|
config,
|
2022-03-10 21:52:12 +01:00
|
|
|
lib,
|
|
|
|
|
...
|
|
|
|
|
}: let
|
2023-02-22 10:02:55 +01:00
|
|
|
nachtischsatan-bot = {tokenFile}:
|
2020-06-10 17:37:25 +02:00
|
|
|
pkgs.writers.writePython3 "nachtischsatan-bot" {
|
2022-03-10 21:52:12 +01:00
|
|
|
libraries = [pkgs.python3Packages.python-telegram-bot];
|
2020-06-10 17:37:25 +02:00
|
|
|
} ''
|
|
|
|
|
from telegram.ext import Updater, MessageHandler
|
|
|
|
|
from telegram.ext.filters import Filters
|
2021-06-12 15:10:30 +02:00
|
|
|
import random
|
|
|
|
|
import time
|
2020-04-09 16:57:24 +02:00
|
|
|
|
|
|
|
|
|
2021-06-12 15:10:30 +02:00
|
|
|
def flubber(update, context):
|
2020-06-10 17:37:25 +02:00
|
|
|
time.sleep(random.randrange(4000) / 1000)
|
|
|
|
|
update.message.reply_text("*flubberflubber*")
|
2020-04-09 16:57:24 +02:00
|
|
|
|
|
|
|
|
|
2023-02-22 10:02:55 +01:00
|
|
|
with open('${tokenFile}', 'r') as tokenFile:
|
|
|
|
|
updater = Updater(tokenFile.read().strip())
|
2020-04-09 16:57:24 +02:00
|
|
|
|
2023-02-22 10:02:55 +01:00
|
|
|
updater.dispatcher.add_handler(MessageHandler(Filters.all, flubber))
|
|
|
|
|
updater.start_polling()
|
|
|
|
|
updater.idle()
|
2020-06-10 17:37:25 +02:00
|
|
|
'';
|
|
|
|
|
in {
|
2020-04-09 16:57:24 +02:00
|
|
|
systemd.services.telegram-nachtischsatan = {
|
2022-03-10 21:52:12 +01:00
|
|
|
wantedBy = ["multi-user.target"];
|
2020-04-09 16:57:24 +02:00
|
|
|
description = "*flubberflubber*";
|
|
|
|
|
enable = true;
|
|
|
|
|
script = toString (nachtischsatan-bot {
|
2023-02-22 10:02:55 +01:00
|
|
|
tokenFile = config.age.secrets.telegram-token-nachtischsatan.path;
|
2020-04-09 16:57:24 +02:00
|
|
|
});
|
|
|
|
|
serviceConfig.Restart = "always";
|
|
|
|
|
};
|
2022-05-22 11:47:59 +02:00
|
|
|
|
2023-02-22 10:02:55 +01: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*";
|
|
|
|
|
}
|
|
|
|
|
];
|
2020-04-09 16:57:24 +02:00
|
|
|
}
|