Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

Migrate to Pyrogram v1 #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions plugins/eval/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

from pyrogram import Client, Filters
from pyrogram import Client, filters

RUNNING = "**Eval Expression:**\n```{}```\n**Running...**"
ERROR = "**Eval Expression:**\n```{}```\n**Error:**\n```{}```"
SUCCESS = "**Eval Expression:**\n```{}```\n**Success**"
RESULT = "**Eval Expression:**\n```{}```\n**Result:**\n```{}```"


@Client.on_message(Filters.command("eval", prefix="!"))
@Client.on_message(filters.command("eval", "!"))
def eval_expression(client, message):
expression = " ".join(message.command[1:])

Expand Down
4 changes: 2 additions & 2 deletions plugins/haste/haste.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@

import requests

from pyrogram import Client, Filters
from pyrogram import Client, filters

BASE = "https://hastebin.com"


@Client.on_message(Filters.command("haste", prefix="!") & Filters.reply)
@Client.on_message(filters.command("haste", "!") & filters.reply)
def haste(client, message):
reply = message.reply_to_message

Expand Down
4 changes: 2 additions & 2 deletions plugins/replace/replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

from pyrogram import Client, Filters
from pyrogram import Client, filters

@Client.on_message(Filters.command("r", prefix="!") & Filters.reply & ~Filters.edited & Filters.group)
@Client.on_message(filters.command("r", "!") & filters.reply & ~filters.edited & filters.group)
def r(client, message):
if len(message.command) > 1:
colength = len("r") + len("!")
Expand Down
8 changes: 4 additions & 4 deletions plugins/welcome/welcome.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

from pyrogram import Client, Emoji, Filters
from pyrogram import Client, emoji, filters

MENTION = "[{}](tg://user?id={})"
MESSAGE = "{} Welcome to [Pyrogram](https://docs.pyrogram.ml/)'s group chat {}!"

chats_filter = Filters.chat(["PyrogramChat", "PyrogramLounge"])
chats_filter = filters.chat(["PyrogramChat", "PyrogramLounge"])


@Client.on_message(chats_filter & Filters.new_chat_members)
@Client.on_message(chats_filter & filters.new_chat_members)
def welcome(client, message):
new_members = [MENTION.format(i.first_name, i.id) for i in message.new_chat_members]
text = MESSAGE.format(Emoji.SPARKLES, ", ".join(new_members))
text = MESSAGE.format(emoji.SPARKLES, ", ".join(new_members))
message.reply(text, disable_web_page_preview=True)