HadisMastodonBotu/telegramMastodonBot.py

43 lines
1.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

TOKEN_Telegram = "7727645914:AAGxMNFEV3ry5W-HS8t4eWgtRmX1vZJqpqk"
from telebot import TeleBot
from mastodon import Mastodon
bot = TeleBot(TOKEN_Telegram)
# Yusuf Hoca: 816494516
# Hadis Botu: 7727645914
# Hadis Kanal: -1001205204850
data = {
816494516: -1001205204850,
# 7581042235: -1001205204850 # Yönetici komutu
}
@bot.message_handler(content_types=['text'])
def give(m):
dataKeys = data.keys()
if(m.from_user.id in dataKeys and m.chat.id in dataKeys and m.chat.type == "private"):
try:
bot.send_message(data[m.from_user.id], m.text)
bot.send_message(m.chat.id, "*Telegram kanalınızda gönderi paylaşıldı.*", parse_mode='Markdown')
except:
bot.send_message(m.chat.id, "*Telegram kanalınızda gönderi paylaşılamadı.*\n Lütfen bot yöneticisi ile iletişime geçiniz. bc1428@vuhuv.com", parse_mode='Markdown')
try:
mastodon = Mastodon(
client_id='LOD2-WQ8fbGT42i6WeCWPvRppbj0Y1hIrOWXEXEHxRc',
client_secret='9xADkvI1GYtjOHXpXOPL4V6UdiuCIz94OqJClzzYhSA',
access_token='TZxWQBoDqSeOme05gKipQaN0yzK0EsHAH-eu13m3ZDs',
api_base_url='https://arslansah.com.tr'
)
mastodonStatus = mastodon.status_post(m.text)
statusMessage = f"*Arslanşah Mastodon Sunucusunda Gönderi Paylaşıldı.*\n{mastodonStatus.uri}"
except:
statusMessage = "*Mastodon'da gönderi paylaşılamadı.*\n Lütfen bot yöneticisi ile iletişime geçiniz. bc1428@vuhuv.com"
bot.send_message(m.chat.id, statusMessage, parse_mode='Markdown')
else:
bot.send_message(m.chat.id, "*Yalnızca yetkili kişiler botu kullanabilir.*", parse_mode='Markdown')
bot.polling()