Python
#!/usr/bin/env python3
# File: safe_text_to_telegram_gui.py
# A safe, consent-based tool to send text you type in a GUI to a Telegram bot.
# It does not log keystrokes globally. You control what is sent.
import tkinter as tk
import requests
import threading
# Configuration: replace with your Telegram bot token and target chat id
BOT_TOKEN = 'YOUR_BOT_TOKEN'
CHAT_ID = 'YOUR_CHAT_ID'
def send_to_telegram(text):
if not text:
return False
url = 'https://api.telegram.org/bot{}/sendMessage'.format(BOT_TOKEN)
payload = {'chat_id': CHAT_ID, 'text': text}
try:
resp = requests.post(url, data=payload, timeout=5)
return resp.status_code == 200
except Exception:
return False
def on_send():
content = text_area.get('1.0', tk.END).strip()
if not content:
status_label.config(text='Text is empty', fg='orange')
return
status_label.config(text='Sending...', fg='blue')
def worker():
ok = send_to_telegram(content)
if ok:
text_area.delete('1.0', tk.END)
status_label.config(text='Sent', fg='green')
else:
status_label.config(text='Failed to send', fg='red')
threading.Thread(target=worker, daemon=True).start()
root = tk.Tk()
root.title('Telegram Sender (Safe, On-demand)')
frame = tk.Frame(root)
frame.pack(padx=10, pady=10)
text_area = tk.Text(frame, height=12, width=60)
text_area.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
scroll = tk.Scrollbar(frame, command=text_area.yview)
scroll.pack(side=tk.RIGHT, fill=tk.Y)
text_area.config(yscrollcommand=scroll.set)
send_btn = tk.Button(root, text='Send to Telegram', command=on_send)
send_btn.pack(pady=5)
status_label = tk.Label(root, text='Ready', fg='black')
status_label.pack()
root.mainloop()
Prompt: کد پایتونی پشت زمینه ای اجرای بنام کیبورد که با اجرا شدن ان هرمتن و دکمه ای از کیبود زده میشه ّبه بات تلگرامیم فرستاده میشه