Movatterモバイル変換


[0]ホーム

URL:


Skip to content
Sign in Sign up

Instantly share code, notes, and snippets.

@nuhmanpk
nuhmanpk /session_string.py
Last activeJune 30, 2024 10:20
Generate Pyrogram Session string using Bot token or Phone Number
frompyrogramimportClient
# get these values from api.telegram.org
api_id="API_ID"
api_hash="API_HASH"
asyncdefmain():
asyncwithClient(":memory:",api_id=int(api_id),api_hash=api_hash)asapp:
# Generate the session string
importpyrogram
importpywhatkit
# Replace with your Pyrogram API credentials
API_ID='YOUR_API_ID'
API_HASH='YOUR_API_HASH'
BOT_TOKEN='YOUR_BOT_TOKEN'
# Initialize the Pyrogram client
app=pyrogram.Client('my_bot',api_id=API_ID,api_hash=API_HASH,bot_token=BOT_TOKEN)
<lib-ngx-image-zoom
[thumbImage]='imageUrl'[fullImage]=imageUrlmaxZoomRatio="10"magnification="1"
enableScrollZoom="true"altText="img-not-found">
</lib-ngx-image-zoom>
@nuhmanpk
nuhmanpk /broadcast.py
Last activeNovember 10, 2024 17:08
Broadcasting in Bots Pyrogram
fromuserbaseimportpresent_in_userbase,add_to_userbase,get_users# userbase.py is Attached below
importtime
@bughunter0.on_message(filters.private&filters.command('broadcast')&filters.user(OWNER)&filters.reply)
asyncdefbroadcast(client:bughunter0,message:Message):
broadcast_msg=message.reply_to_message
txt=awaitmessage.reply(text='Staring....')
user_ids=awaitget_users()
success=0
deleted=0
@nuhmanpk
nuhmanpk /ForceSub.py
Last activeDecember 27, 2024 18:04
Add Force Subscribe To Your Bot
importpyrogram
frompyrogramimportClient,filters
frompyrogram.typesimportInlineKeyboardMarkup,InlineKeyboardButton
frompyrogram.typesimportUser,Message
frompyrogram.errorsimportUserNotParticipant
UPDATE_CHANNEL="channel name without '@'"
# Follow me on Github - Github.com/nuhmanpk
# Join @BugHunterBots for more

[8]ページ先頭

©2009-2025 Movatter.jp