The TGCore button builder can be used directly with Pyrogram without creating a
Example of using one button:
Bots can still use the regular Pyrogram send_message, but the reply markup is generated by TGCore.
Available button functions:
Create a button that opens a link.
Create a button with data callback for bot interaction.
Create a button with additional styles.
Parameters style:
For simple buttons, one line is enough.
If you want to create several buttons in several rows, you can use
Multiple button example:
Essentially, TGCore serves as a builder layer for buttons and markup, while Pyrogram remains used to send messages to Telegram.
So the flow is:
Pyrogram = send_message
TGCore = build keyboard / button
The advantage is that developers do not need to write the
Client() instance. TGCore simply creates a reply_markup object, and Pyrogram then sends the message.Example of using one button:
from tgcore import ButtonExamples
from pyrogram.enums import ButtonStyle
reply_markup = ButtonExamples.style(
"custom name",
ButtonStyle.SUCCESS,
url="https://google.com"
)
Bots can still use the regular Pyrogram send_message, but the reply markup is generated by TGCore.
Available button functions:
ButtonExamples.url()Create a button that opens a link.
ButtonExamples.callback()Create a button with data callback for bot interaction.
ButtonExamples.style()Create a button with additional styles.
Parameters style:
textstyleurlcallback_datacopy_text**kwFor simple buttons, one line is enough.
If you want to create several buttons in several rows, you can use
KeyboardBuilder().Multiple button example:
from tgcore import KeyboardBuilder
keyboard = (KeyboardBuilder().url("....", "....").url("....", "https://....").row().url(".....", "https://...").build())
Essentially, TGCore serves as a builder layer for buttons and markup, while Pyrogram remains used to send messages to Telegram.
So the flow is:
Pyrogram = send_message
TGCore = build keyboard / button
The advantage is that developers do not need to write the
InlineKeyboardMarkup structure manually.ev from tgcore import KeyboardBuilder
kw = await tg._post(
"/api/web/tiktok/download",
payload={"url": "https://vt.tiktok.com/ZSMdyXqXd/"}
)
_ = tg.to_obj(kw)
if not _.ok or not _.data:
return None
await tg.raw.sendVideo(
chat_id=m.chat.id,
video=_.data.data.play,
caption=_.data.data.title,
cover=_.data.data.cover,
reply_markup=(
KeyboardBuilder()
.copy_text("Ok", "Ok")
.build()
)
).execute()
kw = await tg._post(
"/api/web/tiktok/download",
payload={"url": "https://vt.tiktok.com/ZSMdyXqXd/"}
)
_ = tg.to_obj(kw)
if not _.ok or not _.data:
return None
await tg.raw.sendVideo(
chat_id=m.chat.id,
video=_.data.data.play,
caption=_.data.data.title,
cover=_.data.data.cover,
reply_markup=(
KeyboardBuilder()
.copy_text("Ok", "Ok")
.build()
)
).execute()
Tgcore Changelog Update!
- Add
- Add
You can python-telegram-bot or Pyrogram
Logic
- Add
tg.fetch_post(path, something=something, check_errors=True)- Add
tg.kb()You can python-telegram-bot or Pyrogram
tg = Client(api_key="ignore", base_url="https://example.com")this = await tg.fetch_post("/api/todo", url=url, check_errors=True)Logic
return {"ok": True, "data", data}this.data for objectthis["data"] for raw (check_errors=False)tg.kb().add()tg.kb().url()# 10 minutes
reply_markup=InlineKeyboardMarkup([
[InlineKeyboardButton("ok", callback_data="#abc")],
[InlineKeyboardButton("Docs", url="https://example.com")]
])
# 5 seconds
reply_markup=tg.kb().callback("ok","#abc").row().url("Docs","https://example.com").build()
TGCore Engine
• Unlimited Proxy
• Telegram API Monster
• Platform Downloader
• Free API Key (7 Days)
• Webhook (Telegram / GitHub)
• Builder SDK
• Enterprise Architecture
• Unlimited Proxy
• Telegram API Monster
• Platform Downloader
• Free API Key (7 Days)
• Webhook (Telegram / GitHub)
• Builder SDK
• Enterprise Architecture
Telegram API = monster object model ☠️
At most one of the optional parameters can be present in any given update
At most one of the optional parameters can be present in any given update
ev _ = await tg.fetch_post("/api/web/facebook/download", url="https://www.facebook.com/groups/788889186033999/permalink/1325624742360438/?app=fbl", check_errors=True)
noob = await tg.raw.sendVideo(chat_id=m.chat.id, video=_.data.video[0].url, reply_markup=tg.kb().copy_text("ok", "ok").build()).execute()
return noob["ok"]
noob = await tg.raw.sendVideo(chat_id=m.chat.id, video=_.data.video[0].url, reply_markup=tg.kb().copy_text("ok", "ok").build()).execute()
return noob["ok"]