Rᴇɴᴅʏ Pʀᴏɪᴇᴄᴛs
224 subscribers
1.04K photos
29 videos
17 files
743 links
tgcore is open source. Built for production Telegram apps.

https://github.com/TeamKillerX/tgcore/
Download Telegram
Evolution of Telegram API usage.
From parameter hell to fluent builders.
Why Do Architects Choose Fluent Builder?

This is Rendy Projects, a channel built around architecture.

In the past, whiteboards were filled with static functions.
As parameters grew, the code became harder to read, harder to scale, and easy to break.

With a Fluent Builder approach, things change.

Instead of writing long parameter lists, you compose the request step-by-step:
tg.raw.send()
.chat_id()
.photo()
.skip()

If the old method was like riding a public bus fixed routes, limited control then the Fluent Builder is like driving your own car.

You decide where to stop.
You decide the order.
You decide the flow.

Stop at .skip() or go straight to .send().

That freedom is why architects prefer builder patterns.
Share ke grup coding kalian sekarang 🤣
TGCore SDK architecture bersih, bukan parameter hell.

Open source: https://github.com/TeamKillerX/tgcore/
Fluent Builder vs Parameter Hell

❌ Old Method Parameter Hell
from something.types import OthersHell

await instagram_download(
type="instagram",
url="https://www.instagram.com/reel/...",
options=OthersHell.HELL,
timeout=30,
quality="best"
)

Problem:
More and more parameters
Hard to read
Difficult to extend
Breaking change when the API changes

✅ Fluent Builder TGCore Style:
user = await tg.platform.tools\
.types()\
.platform("instagram")\
.url("https://www.instagram.com/reel/...")\
.send(via_result=True)

More clearly:
Every step is explicit
The API can be extended without breaking the signature.
More readable

Retrieving the output file
Your code could also be tidied up a bit:
resp = await tg._ensure_client().get(user.ig_url()[0])

video = tg.writer(
"mp4",
image_bytes=resp.content
)

return video

The core architecture that you show
Parameter API:
function(parameter1, parameter2, parameter3...)

Fluent Builder:
object.step().step().step().execute()
Design pattern:
• Fluent Interface
• Builder Pattern
• Composable API
Stop fighting parameter hell. Start designing APIs.
Rᴇɴᴅʏ Pʀᴏɪᴇᴄᴛs pinned «Fluent Builder vs Parameter Hell ❌ Old Method Parameter Hell from something.types import OthersHell await instagram_download( type="instagram", url="https://www.instagram.com/reel/...", options=OthersHell.HELL, timeout=30, quality="best"…»
This media is not supported in your browser
VIEW IN TELEGRAM
Wkwk itu wajar bgt 🤣 klo sudah lama ngoding, hampir semua developer pernah kena parameter hell
Full code:
from tgcore import Client

tg = Client(api_key="")

user = await tg.platform.tools\
.types()\
.platform("instagram")\
.url(
"https://www.instagram.com/reel/...."
).send(via_result=True)

video = tg.writer(
"mp4",
image_bytes=(await tg._ensure_client().get(
user.ig_url()[0])).content
)

return await tg.raw.sendVideoUpload()\
.chat_id(id)\
.video(video)\
.reply_markup(
tg.kb().url(
"View Coder",
"https://t.me/meme_your_username"
).build()
)\
.caption(
"Siapa yang pernah kena parameter hell? 🗿"
).skip()
Developer: syntax
Architect: API design.
Choose your path.
How to learn chaining in tgcore?

You can learn easily

Examples Usage
• only POST
from tgcore import Client

tg = Client(api_key="something", base_url="https://meme_your_domain.com")

result = await (
tg.use.default
.types("/api/todo")
.step()
.step2()
.execute()
)

print(result)
When Google understands your architecture.
Architecture: clean
Code: perfect
Async: working

API:
Invalid or expired token
How to Automatically Save base_url?

You can set base_url when using the userbot:

1. During initialization:
tg = Client(base_url="https://tgcore.ryzenths.dpdns.org")


2. Or by assigning it directly:
tg.base_url = "https://tgcore.ryzenths.dpdns.org"

This value will be saved and will persist.

Code Example:
MEME_IG_URL = "https://www.instagram.com/reel/......"

result = await tg.use.default\
.types("/api/web/platform/download")\
.platform("instagram")\
.url(MEME_IG_URL)\
.send(allow_object=True)

return result