diff --git a/examples/callback_query_handler.py b/examples/callback_query_handler.py index a9672f0e..71538eae 100644 --- a/examples/callback_query_handler.py +++ b/examples/callback_query_handler.py @@ -1,8 +1,9 @@ -from pyrogram import Client - """This example shows how to handle callback queries, i.e.: queries coming from inline button presses. -It uses the @on_callback_query decorator to register a CallbackQueryHandler.""" +It uses the @on_callback_query decorator to register a CallbackQueryHandler. +""" + +from pyrogram import Client app = Client("123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11") diff --git a/examples/echo_bot.py b/examples/echo_bot.py index a560ed51..7a2b0aa7 100644 --- a/examples/echo_bot.py +++ b/examples/echo_bot.py @@ -1,11 +1,11 @@ -from pyrogram import Client, Filters - """This simple echo bot replies to every private text message. It uses the @on_message decorator to register a MessageHandler and applies two filters on it: Filters.text and Filters.private to make sure it will reply to private text messages only. """ +from pyrogram import Client, Filters + app = Client("my_account") diff --git a/examples/get_chat_members.py b/examples/get_chat_members.py index db325f78..e0f8c3fa 100644 --- a/examples/get_chat_members.py +++ b/examples/get_chat_members.py @@ -1,12 +1,12 @@ +"""This example shows you how to get the first 10.000 members of a chat. +Refer to get_chat_members2.py for more than 10.000 members. +""" + import time from pyrogram import Client from pyrogram.api.errors import FloodWait -"""This example shows you how to get the first 10.000 members of a chat. -Refer to get_chat_members2.py for more than 10.000 members. -""" - app = Client("my_account") target = "pyrogramchat" # Target channel/supergroup diff --git a/examples/get_chat_members2.py b/examples/get_chat_members2.py index 5a92645b..a4fa9daa 100644 --- a/examples/get_chat_members2.py +++ b/examples/get_chat_members2.py @@ -1,9 +1,3 @@ -import time -from string import ascii_lowercase - -from pyrogram import Client -from pyrogram.api.errors import FloodWait - """This is an improved version of get_chat_members.py Since Telegram will return at most 10.000 members for a single query, this script @@ -13,6 +7,12 @@ This can be further improved by also searching for non-ascii characters (e.g.: J as some user names may not contain ascii letters at all. """ +import time +from string import ascii_lowercase + +from pyrogram import Client +from pyrogram.api.errors import FloodWait + app = Client("my_account") target = "pyrogramchat" # Target channel/supergroup diff --git a/examples/get_history.py b/examples/get_history.py index eb9b2dcd..628b5692 100644 --- a/examples/get_history.py +++ b/examples/get_history.py @@ -1,10 +1,10 @@ +"""This example shows how to retrieve the full message history of a chat""" + import time from pyrogram import Client from pyrogram.api.errors import FloodWait -"""This example shows how to retrieve the full message history of a chat""" - app = Client("my_account") target = "me" # "me" refers to your own chat (Saved Messages) messages = [] # List that will contain all the messages of the target chat diff --git a/examples/hello_world.py b/examples/hello_world.py index c4ff23d0..010725ef 100644 --- a/examples/hello_world.py +++ b/examples/hello_world.py @@ -1,7 +1,7 @@ -from pyrogram import Client - """This example demonstrates a basic API usage""" +from pyrogram import Client + # Create a new Client instance app = Client("my_account") diff --git a/examples/query_inline_bots.py b/examples/query_inline_bots.py index 0d75b9ff..c3b48874 100644 --- a/examples/query_inline_bots.py +++ b/examples/query_inline_bots.py @@ -1,7 +1,7 @@ -from pyrogram import Client - """This example shows how to query an inline bot""" +from pyrogram import Client + # Create a new Client app = Client("my_account") diff --git a/examples/raw_update_handler.py b/examples/raw_update_handler.py index 0f678cec..27d87eb3 100644 --- a/examples/raw_update_handler.py +++ b/examples/raw_update_handler.py @@ -1,7 +1,7 @@ -from pyrogram import Client - """This example shows how to handle raw updates""" +from pyrogram import Client + app = Client("my_account") diff --git a/examples/send_bot_keyboards.py b/examples/send_bot_keyboards.py index 21c1a60e..3a15a23a 100644 --- a/examples/send_bot_keyboards.py +++ b/examples/send_bot_keyboards.py @@ -1,5 +1,3 @@ -from pyrogram import Client, ReplyKeyboardMarkup, InlineKeyboardMarkup, InlineKeyboardButton - """This example will show you how to send normal and inline keyboards. You must log-in as a regular bot in order to send keyboards (use the token from @BotFather). @@ -9,6 +7,8 @@ send_message() is used as example, but a keyboard can be sent with any other sen like send_audio(), send_document(), send_location(), etc... """ +from pyrogram import Client, ReplyKeyboardMarkup, InlineKeyboardMarkup, InlineKeyboardButton + # Create a client using your bot token app = Client("123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11") app.start() diff --git a/examples/welcome_bot.py b/examples/welcome_bot.py index 71a00c1c..396fe870 100644 --- a/examples/welcome_bot.py +++ b/examples/welcome_bot.py @@ -1,11 +1,11 @@ -from pyrogram import Client, Emoji, Filters - """This is the Welcome Bot in @PyrogramChat. It uses the Emoji module to easily add emojis in your text messages and Filters -to make it only work for specific messages in a specific chat +to make it only work for specific messages in a specific chat """ +from pyrogram import Client, Emoji, Filters + app = Client("my_account")