Sat Jun 22 10:45:16 PM CEST 2024

This commit is contained in:
Thomas Avé 2024-06-22 22:45:16 +02:00
parent 23ae2bbfb2
commit ca94b6299b
2 changed files with 7 additions and 20 deletions

View File

@ -1,18 +0,0 @@
#!/usr/bin/python3
import telegram
import fileinput
import asyncio
async def run():
text = "Vault Etienne:\n\n"
for line in fileinput.input():
text += line
bot = telegram.Bot(token="381718873:AAElFmI2BDjumCehhWicuksE0vutrPSkoGA")
chat_id = 125754925
await bot.send_message(chat_id, text)
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(asyncio.wait([loop.create_task(run())]))
loop.close()

View File

@ -8,6 +8,7 @@ let
import asyncio import asyncio
import sys import sys
import socket import socket
import json
import subprocess import subprocess
import tempfile import tempfile
@ -25,12 +26,16 @@ let
] ]
).decode("utf-8") ).decode("utf-8")
with open("/home/server/.secrets/Telegram/token.json") as f:
credentials = json.load(f)
token = credentials["token"]
chat_id = credentials["chat_id"]
with open("/home/server/mail.log", "a") as f: with open("/home/server/mail.log", "a") as f:
f.write(text) f.write(text)
f.write("\n===========================================\n") f.write("\n===========================================\n")
bot = telegram.Bot(token="381718873:AAElFmI2BDjumCehhWicuksE0vutrPSkoGA") bot = telegram.Bot(token=token)
chat_id = 125754925
hostname = socket.gethostname() hostname = socket.gethostname()
await bot.send_message( await bot.send_message(
chat_id, chat_id,