第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Telethon:我想抓取所有鏈接并只加入群組,而不是頻道。但如何區(qū)分它們呢?

Telethon:我想抓取所有鏈接并只加入群組,而不是頻道。但如何區(qū)分它們呢?

森欄 2023-12-29 15:29:38
這是我的代碼,我需要一種方法來獲取 True/False 布爾值來確定收到的鏈接是否是組鏈接。client = TelegramClient('session', api_id, api_hash)#check whether there's a 'joinchat' in the msg text?@client.on(events.NewMessage(outgoing=False, pattern=r'(?i).*joinchat/')) async def my_event_handler(event):    #extract the hash of that link    hash = re.search('(?<=joinchat\/)(\w+[-]?\S\w+)', event.raw_text).group(0) 
查看完整描述

1 回答

?
慕斯王

TA貢獻(xiàn)1864條經(jīng)驗 獲得超2個贊

我想通了伙計們:


# checks whether there's a 'joinchat' in the msg text?

@client.on(events.NewMessage(outgoing=False, pattern=r'(?i).*joinchat/'))

async def my_event_handler(event):

    # extracts the hash of that link

    hash = re.search('(?<=joinchat\/)(\w+[-]?\S\w+)', event.raw_text).group(0)

    checked = await client(CheckChatInviteRequest(hash=hash))

    if checked.megagroup and checked.broadcast == False:

        updates = await client(ImportChatInviteRequest(hash))


client.start()

client.run_until_disconnected()


查看完整回答
反對 回復(fù) 2023-12-29
  • 1 回答
  • 0 關(guān)注
  • 216 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號