Notice
Recent Posts
Recent Comments
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

아직도 텔레그램 안쓰니?

텔레그램 봇으로 스티커 보내기 본문

텔레그램 팁

텔레그램 봇으로 스티커 보내기

텔레그램사랑 2024. 1. 7. 00:43

스티커 셋의 이름을 확인한다.

Telegram Bot Raw(https://t.me/RawDataBot)에게 스티커 하나를 보낸다.

그러면 보낸 스티커의 정보를 JSON으로 보여준다.

"sticker"에서 "set_name"을 확인한다. 이게 스티커셋의 이름이다.

 

send_sticker로 보낸다

async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
    sticker_set = await context.bot.get_sticker_set("MrGreene")

    for sticker in sticker_set.stickers:
        await context.bot.send_sticker(chat_id=update.effective_chat.id, sticker=sticker.file_id)