From 56e4d710e5f4c40fb53b1b41c4b16b2072debbd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Wed, 7 Jun 2023 10:27:02 +0200 Subject: [PATCH] fix: atuin, nachtischsatan --- configs/telegram-bots/nachtischsatan.nix | 17 ++++++++--------- systems/zaatar/atuin.nix | 1 + 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/configs/telegram-bots/nachtischsatan.nix b/configs/telegram-bots/nachtischsatan.nix index c274ef9..86dc987 100644 --- a/configs/telegram-bots/nachtischsatan.nix +++ b/configs/telegram-bots/nachtischsatan.nix @@ -8,23 +8,22 @@ pkgs.writers.writePython3 "nachtischsatan-bot" { libraries = [pkgs.python3Packages.python-telegram-bot]; } '' - from telegram.ext import Updater, MessageHandler - from telegram.ext.filters import Filters + from telegram.ext import Application, ContextTypes, MessageHandler, filters + from telegram import Update import random import time - def flubber(update, context): + async def flubber(update: Update, context: ContextTypes.DEFAULT_TYPE): time.sleep(random.randrange(4000) / 1000) - update.message.reply_text("*flubberflubber*") + await 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() + 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 = { diff --git a/systems/zaatar/atuin.nix b/systems/zaatar/atuin.nix index 5c037a6..8e8d1ee 100644 --- a/systems/zaatar/atuin.nix +++ b/systems/zaatar/atuin.nix @@ -30,5 +30,6 @@ in { openFirewall = true; openRegistration = true; port = 8888; + enable = true; }; }