async def send(self, bot: telethon.TelegramClient, entity: Entity) -> UnrestrictedKeyboard: markup = bot.build_reply_markup(self.buttons()) await bot.send_message(entity=entity, message=self.message, buttons=markup, parse_mode="HTML", *self.message_args, **self.message_kwargs) return self
from telethon.tl import functions, types from telethon.tl.custom import Button, MessageButton from telethon.tl.types import KeyboardButton logging.basicConfig( format='[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s', level=logging.WARNING) APP_ID = 'snxnxn' APP_HASH = 'sjsjdjdj' BOT_TOKEN = "sjdkdkhdjdj" bot = TelegramClient('bot', APP_ID, APP_HASH).start(bot_token=BOT_TOKEN) markup = bot.build_reply_markup([ Button.inline('İleri▶️', 'ileri'), # Button.inline('Geri◀️','geri'), # Button.inline('Anasayfa⏺','ana'), Button.inline('Kapat❌', 'kapa'), ]) @bot.on(events.NewMessage(pattern="(/|!).*start ?(.*)")) async def start(event): await bot.send_message( event.chat_id, "BİM Aktüel Ürünleri Almak İçin Bu Botu Kullanabilirsiniz.", buttons=markup, link_preview=False) await asyncio.sleep(1) global j
# buttons view # markup_stop = client.build_reply_markup([ # [ # Button.text('Настройка чатов', resize=True), # Button.text('Настройка поиска', resize=True) # ], # [ # Button.text('Стоп') # ], # [ # Button.text('Выход') # ] # # ]) markup_phone = client.build_reply_markup([[Button.text('Назад')]]) markup1 = client.build_reply_markup([[Button.text('Меню', resize=True)]]) markup_menu = client.build_reply_markup([[ Button.text('Настройка чатов', resize=True), Button.text('Настройка поиска', resize=True) ], [Button.text(('Старт' if not started else 'stop'))], [Button.text('Выход')]]) markup_setup_chat = client.build_reply_markup([[ Button.text('Добавить чаты', resize=True), Button.text("Удалить чаты", resize=True), ], [Button.text('Ключевое слово', resize=True)], [Button.text('Меню', resize=True)]]) markup_pattern_chat = client.build_reply_markup(
await e.reply("وقت شما تمام شد لطفا مجددا درخواست فرمایید") except errors.common.AlreadyInConversationError: conv = client.conversation(uid) print(conv) await conv.cancel_all() conv.cancel() return except Exception as ex: print(type(ex)) err = str(ex)[:3000] await e.reply( f"**Unknown Error:**\n**Type**:{type(ex)}\n`{err}`\n\n**Report to :@The_Bloody**" ) KEYB = client.build_reply_markup(b("اهدای اکانت")) @client.on(NewMessage) async def start(e: NewMessage.Event): uid = e.sender.id text = e.message.text if text == "/start" or text == "بازگشت به منوی اصلی": try: u = User.select().where(User.uid == uid).get() except peewee.DoesNotExist: print("new user") u = User.create(uid=uid, status="", donated=0) u.save() await e.reply("Hello :)😆", buttons=KEYB) else: