1
0
mirror of https://github.com/kmein/niveum synced 2026-03-19 19:41:08 +01:00

fix: atuin, nachtischsatan

This commit is contained in:
2023-06-07 10:27:02 +02:00
parent 8967f860e8
commit 56e4d710e5
2 changed files with 9 additions and 9 deletions

View File

@@ -8,23 +8,22 @@
pkgs.writers.writePython3 "nachtischsatan-bot" { pkgs.writers.writePython3 "nachtischsatan-bot" {
libraries = [pkgs.python3Packages.python-telegram-bot]; libraries = [pkgs.python3Packages.python-telegram-bot];
} '' } ''
from telegram.ext import Updater, MessageHandler from telegram.ext import Application, ContextTypes, MessageHandler, filters
from telegram.ext.filters import Filters from telegram import Update
import random import random
import time import time
def flubber(update, context): async def flubber(update: Update, context: ContextTypes.DEFAULT_TYPE):
time.sleep(random.randrange(4000) / 1000) time.sleep(random.randrange(4000) / 1000)
update.message.reply_text("*flubberflubber*") await update.message.reply_text("*flubberflubber*")
with open('${tokenFile}', 'r') as tokenFile: with open('${tokenFile}', 'r') as tokenFile:
updater = Updater(tokenFile.read().strip()) token = tokenFile.read().strip()
application = Application.builder().token(token).build()
updater.dispatcher.add_handler(MessageHandler(Filters.all, flubber)) application.add_handler(MessageHandler(filters.ALL, flubber))
updater.start_polling() application.run_polling()
updater.idle()
''; '';
in { in {
systemd.services.telegram-nachtischsatan = { systemd.services.telegram-nachtischsatan = {

View File

@@ -30,5 +30,6 @@ in {
openFirewall = true; openFirewall = true;
openRegistration = true; openRegistration = true;
port = 8888; port = 8888;
enable = true;
}; };
} }