diff --git a/plugins/fun/autofastly/__main__.py b/plugins/fun/autofastly/__main__.py
index ea57da77e..12d62aeaf 100644
--- a/plugins/fun/autofastly/__main__.py
+++ b/plugins/fun/autofastly/__main__.py
@@ -13,6 +13,7 @@
import os
from pyrogram import enums
+from pyrogram.types import LinkPreviewOptions
from userge import userge, Message, filters, config, get_collection
from ...utils import ocr
@@ -45,7 +46,9 @@ async def autofastly(msg: Message):
"Oops!!get the OCR API from
"
"HERE "
"& add it to Heroku config vars
(OCR_SPACE_API_KEY
)",
- disable_web_page_preview=True,
+ link_preview_options=LinkPreviewOptions(
+ is_disabled=True
+ ),
parse_mode=enums.ParseMode.HTML, del_in=0)
return
diff --git a/plugins/misc/deezloader/__main__.py b/plugins/misc/deezloader/__main__.py
index ef1d19d39..4e2eb0870 100644
--- a/plugins/misc/deezloader/__main__.py
+++ b/plugins/misc/deezloader/__main__.py
@@ -13,6 +13,8 @@
import shutil
from pathlib import Path
+from pyrogram.types import LinkPreviewOptions
+
import deezloader # pylint: disable=W0406
from deezloader.exceptions import NoDataApi
@@ -51,7 +53,7 @@ async def deezload(message: Message):
os.makedirs(TEMP_PATH)
await message.edit("Checking your Token.")
if ARL_TOKEN is None:
- await message.edit(ARL_HELP, disable_web_page_preview=True)
+ await message.edit(ARL_HELP, link_preview_options=LinkPreviewOptions(is_disabled=True))
return
try:
loader = deezloader.Login(ARL_TOKEN)
diff --git a/plugins/misc/download/downloader.py b/plugins/misc/download/downloader.py
index 05e74fa6f..01215d2ed 100644
--- a/plugins/misc/download/downloader.py
+++ b/plugins/misc/download/downloader.py
@@ -20,6 +20,7 @@
from pySmartDL import SmartDL
from pyrogram.types import Message as PyroMessage
from pyrogram import enums
+from pyrogram.types import LinkPreviewOptions
from userge import Message, config
from userge.utils import progress, humanbytes, extract_entities
@@ -112,7 +113,12 @@ async def url_download(message: Message, url: str) -> Tuple[str, int]:
humanbytes(total_length),
speed,
estimated_total_time)
- await message.edit(progress_str, disable_web_page_preview=True)
+ await message.edit(
+ progress_str,
+ link_preview_options=LinkPreviewOptions(
+ is_disabled=True
+ )
+ )
await asyncio.sleep(config.Dynamic.EDIT_SLEEP_TIMEOUT)
if message.process_is_canceled:
raise ProcessCanceled
diff --git a/plugins/misc/gdrive/__main__.py b/plugins/misc/gdrive/__main__.py
index 7f3ee9231..e64bfa080 100644
--- a/plugins/misc/gdrive/__main__.py
+++ b/plugins/misc/gdrive/__main__.py
@@ -29,6 +29,8 @@
from oauth2client.client import (
OAuth2Credentials, OAuth2WebServerFlow, HttpAccessTokenRefreshError, FlowExchangeError)
+from pyrogram.types import LinkPreviewOptions
+
from userge import userge, Message, config, get_collection, pool
from userge.plugins.misc.download import url_download, tg_download
from userge.utils import humanbytes, time_formatter, is_url
@@ -621,7 +623,7 @@ async def setup(self) -> None:
reply_string += "send back "
reply_string += ".gconf [auth_code or url]
"
await self._message.edit(
- text=reply_string, disable_web_page_preview=True)
+ text=reply_string, link_preview_options=LinkPreviewOptions(is_disabled=True))
async def confirm_setup(self) -> None:
""" Finalize GDrive setup """
@@ -677,8 +679,11 @@ async def share(self) -> None:
_LOG.exception(h_e)
await self._message.err(h_e._get_reason()) # pylint: disable=protected-access
return
- await self._message.edit(f"**Shareable Links**\n\n{out}",
- disable_web_page_preview=True, log=__name__)
+ await self._message.edit(
+ f"**Shareable Links**\n\n{out}",
+ link_preview_options=LinkPreviewOptions(is_disabled=True),
+ log=__name__
+ )
@creds_dec
async def search(self) -> None:
@@ -692,7 +697,7 @@ async def search(self) -> None:
await self._message.err(h_e._get_reason()) # pylint: disable=protected-access
return
await self._message.edit_or_send_as_file(
- out, disable_web_page_preview=True,
+ out, link_preview_options=LinkPreviewOptions(is_disabled=True),
caption=f"search results for `{self._message.filtered_input_str}`")
@creds_dec
@@ -710,8 +715,11 @@ async def make_folder(self) -> None:
_LOG.exception(h_e)
await self._message.err(h_e._get_reason()) # pylint: disable=protected-access
return
- await self._message.edit(f"**Folder Created Successfully**\n\n{out}",
- disable_web_page_preview=True, log=__name__)
+ await self._message.edit(
+ f"**Folder Created Successfully**\n\n{out}",
+ link_preview_options=LinkPreviewOptions(is_disabled=True),
+ log=__name__
+ )
@creds_dec
async def list_folder(self) -> None:
@@ -732,7 +740,10 @@ async def list_folder(self) -> None:
await self._message.err(h_e._get_reason()) # pylint: disable=protected-access
return
await self._message.edit_or_send_as_file(
- out, disable_web_page_preview=True, caption=f"list results for `{file_id}`")
+ out,
+ link_preview_options=LinkPreviewOptions(is_disabled=True),
+ caption=f"list results for `{file_id}`"
+ )
@creds_dec
async def upload(self) -> None:
@@ -787,7 +798,11 @@ async def upload(self) -> None:
out = self._output
else:
out = "`failed to upload.. check logs?`"
- await self._message.edit(out, disable_web_page_preview=True, log=__name__)
+ await self._message.edit(
+ out,
+ link_preview_options=LinkPreviewOptions(is_disabled=True),
+ log=__name__
+ )
@creds_dec
async def download(self) -> None:
@@ -811,7 +826,13 @@ async def download(self) -> None:
out = self._output
else:
out = "`failed to download.. check logs?`"
- await self._message.edit(out, disable_web_page_preview=True, log=__name__)
+ await self._message.edit(
+ out,
+ link_preview_options=LinkPreviewOptions(
+ is_disabled=True
+ ),
+ log=__name__
+ )
@creds_dec
async def copy(self) -> None:
@@ -838,7 +859,11 @@ async def copy(self) -> None:
out = self._output
else:
out = "`failed to copy.. check logs?`"
- await self._message.edit(out, disable_web_page_preview=True, log=__name__)
+ await self._message.edit(
+ out,
+ link_preview_options=LinkPreviewOptions(is_disabled=True),
+ log=__name__
+ )
@creds_dec
async def move(self) -> None:
@@ -897,7 +922,7 @@ async def get(self) -> None:
return
out = f"**I Found these Details for** `{file_id}`\n\n{meta_data}"
await self._message.edit_or_send_as_file(
- out, disable_web_page_preview=True,
+ out, link_preview_options=LinkPreviewOptions(is_disabled=True),
caption=f"metadata for `{file_id}`")
@creds_dec
@@ -913,7 +938,7 @@ async def get_perms(self) -> None:
return
out = f"**I Found these Permissions for** `{file_id}`\n\n{out}"
await self._message.edit_or_send_as_file(
- out, disable_web_page_preview=True,
+ out, link_preview_options=LinkPreviewOptions(is_disabled=True),
caption=f"view perm results for `{file_id}`")
@creds_dec
@@ -928,7 +953,7 @@ async def set_perms(self) -> None:
await self._message.err(h_e._get_reason()) # pylint: disable=protected-access
else:
out = f"**Set Permissions successfully for** `{file_id}`\n\n{link}"
- await self._message.edit(out, disable_web_page_preview=True)
+ await self._message.edit(out, link_preview_options=LinkPreviewOptions(is_disabled=True))
@creds_dec
async def del_perms(self) -> None:
@@ -943,7 +968,7 @@ async def del_perms(self) -> None:
return
out = f"**Removed These Permissions successfully from** `{file_id}`\n\n{out}"
await self._message.edit_or_send_as_file(
- out, disable_web_page_preview=True,
+ out, link_preview_options=LinkPreviewOptions(is_disabled=True),
caption=f"removed perm results for `{file_id}`")
@@ -960,7 +985,9 @@ async def gsetup_(message: Message):
else:
await message.edit(
"`G_DRIVE_CLIENT_ID` and `G_DRIVE_CLIENT_SECRET` not found!\n"
- f"[Read this]({link}) to know more.", disable_web_page_preview=True)
+ f"[Read this]({link}) to know more.",
+ link_preview_options=LinkPreviewOptions(is_disabled=True)
+ )
@userge.on_cmd("gconf", about={
diff --git a/plugins/misc/parser/__main__.py b/plugins/misc/parser/__main__.py
index f771baa58..2a4724ac7 100644
--- a/plugins/misc/parser/__main__.py
+++ b/plugins/misc/parser/__main__.py
@@ -19,6 +19,8 @@
import requests
from bs4 import BeautifulSoup
+from pyrogram.types import LinkPreviewOptions
+
from userge import Message, userge, pool
from .. import parser
@@ -148,7 +150,7 @@ async def gdtot(message: Message):
f'Date: {info[1].text.strip()}\n'
f'\nGDrive-URL:\n{gdrive_url}'
)
- await message.edit(out, disable_web_page_preview=True)
+ await message.edit(out, link_preview_options=LinkPreviewOptions(is_disabled=True))
except Exception:
await message.err("Unable To parse Link")
@@ -177,4 +179,4 @@ async def appdrive(message: Message):
'Drive_Link: '
f'{res.get("gdrive_link", "Something Went Wrong")}'
)
- await message.edit(output, disable_web_page_preview=True)
+ await message.edit(output, link_preview_options=LinkPreviewOptions(is_disabled=True))
diff --git a/plugins/misc/telegraph/__main__.py b/plugins/misc/telegraph/__main__.py
index ab5ef7d9a..b2f21a566 100644
--- a/plugins/misc/telegraph/__main__.py
+++ b/plugins/misc/telegraph/__main__.py
@@ -13,7 +13,7 @@
from aiofiles import os
from html_telegraph_poster import TelegraphPoster
from telegraph import upload_file
-
+from pyrogram.types import LinkPreviewOptions
from userge import userge, Message, config, pool
from userge.utils import progress
@@ -71,7 +71,7 @@ async def telegraph_(message: Message):
header = "Pasted content by @theuserge"
t_url = await pool.run_in_thread(post_to_telegraph)(header, text.replace("\n", "
"))
jv_text = f"**[Here Your Telegra.ph Link!]({t_url})**"
- await message.edit(text=jv_text, disable_web_page_preview=True)
+ await message.edit(text=jv_text, link_preview_options=LinkPreviewOptions(is_disabled=True))
return
dl_loc = await message.client.download_media(
message=message.reply_to_message,
diff --git a/plugins/misc/zippyshare/__main__.py b/plugins/misc/zippyshare/__main__.py
index 09b5c9660..d1c53103f 100644
--- a/plugins/misc/zippyshare/__main__.py
+++ b/plugins/misc/zippyshare/__main__.py
@@ -13,9 +13,8 @@
# plugin by @aryanvikash
import re
-
import requests
-
+from pyrogram.types import LinkPreviewOptions
from userge import userge, Message, pool
@@ -32,7 +31,7 @@ async def zippyshare(message: Message):
await message.edit(f"**Original** : {url}\n**FileName** : `{fname}`\n"
f"**DirectLink** : {direct_url}\n\n"
"**[HINT]** : use `.download [directLink]`",
- disable_web_page_preview=True)
+ link_preview_options=LinkPreviewOptions(is_disabled=True))
except Exception as z_e: # pylint: disable=broad-except
await message.edit(f"`{z_e}`")
diff --git a/plugins/tools/alive/__main__.py b/plugins/tools/alive/__main__.py
index 228122e73..1771d308a 100644
--- a/plugins/tools/alive/__main__.py
+++ b/plugins/tools/alive/__main__.py
@@ -19,6 +19,7 @@
FileIdInvalid, FileReferenceEmpty, BadRequest, ChannelInvalid, MediaEmpty
)
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
+from pyrogram.types import LinkPreviewOptions
from userge import userge, Message, pool, config, versions as ver, logging
from userge.utils import get_file_id_of_media, get_custom_import_re
@@ -51,7 +52,13 @@ async def _alive(message: Message):
alive_text, markup = await _get_text_and_markup(message)
if _MSG_ID == "text_format":
- return await message.edit(alive_text, disable_web_page_preview=True, reply_markup=markup)
+ return await message.edit(
+ alive_text,
+ link_preview_options=LinkPreviewOptions(
+ is_disabled=True
+ ),
+ reply_markup=markup
+ )
await message.delete()
try:
await _send_alive(message, alive_text, markup)
@@ -118,10 +125,12 @@ async def _send_alive(message: Message,
await _send_telegraph(message, text, reply_markup)
else:
try:
- await message.client.send_cached_media(chat_id=message.chat.id,
- file_id=_LOGO_ID,
- caption=text,
- reply_markup=should_mark)
+ await message.client.send_cached_media(
+ chat_id=message.chat.id,
+ file_id=_LOGO_ID,
+ caption=text,
+ reply_markup=should_mark
+ )
if _IS_STICKER:
raise ChatSendMediaForbidden
except SlowmodeWait as s_m:
@@ -134,10 +143,14 @@ async def _send_alive(message: Message,
await _refresh_id(message)
return await _send_alive(message, text, reply_markup, recurs_count + 1)
except (ChatSendMediaForbidden, Forbidden):
- await message.client.send_message(chat_id=message.chat.id,
- text=text,
- disable_web_page_preview=True,
- reply_markup=should_mark)
+ await message.client.send_message(
+ chat_id=message.chat.id,
+ text=text,
+ link_preview_options=LinkPreviewOptions(
+ is_disabled=True
+ ),
+ reply_markup=should_mark
+ )
async def _refresh_id(message: Message) -> None:
@@ -147,10 +160,9 @@ async def _refresh_id(message: Message) -> None:
except (ChannelInvalid, PeerIdInvalid, ValueError):
_set_data(True)
return await _refresh_id(message)
- else:
- if media.sticker:
- _IS_STICKER = True
- _LOGO_ID = get_file_id_of_media(media)
+ if media.sticker:
+ _IS_STICKER = True
+ _LOGO_ID = get_file_id_of_media(media)
def _set_data(errored: bool = False) -> None:
diff --git a/plugins/utils/admins/__main__.py b/plugins/utils/admins/__main__.py
index 474590d3b..d298aafed 100644
--- a/plugins/utils/admins/__main__.py
+++ b/plugins/utils/admins/__main__.py
@@ -10,6 +10,7 @@
from userge import userge, Message
from pyrogram import enums
+from pyrogram.types import LinkPreviewOptions
@userge.on_cmd("admins", about={
@@ -57,4 +58,9 @@ async def mentionadmins(message: Message):
mentions += " " + str(e) + "\n"
await message.delete()
await message.client.send_message(
- chat_id=message.chat.id, text=mentions, disable_web_page_preview=True)
+ chat_id=message.chat.id,
+ text=mentions,
+ link_preview_options=LinkPreviewOptions(
+ is_disabled=True
+ )
+ )
diff --git a/plugins/utils/app/__main__.py b/plugins/utils/app/__main__.py
index cff479c44..93b241b00 100644
--- a/plugins/utils/app/__main__.py
+++ b/plugins/utils/app/__main__.py
@@ -14,7 +14,7 @@
import aiohttp
import bs4
-
+from pyrogram.types import LinkPreviewOptions
from userge import userge, Message
@@ -57,7 +57,7 @@ async def app(message: Message):
app_details += f"`Developer :` [{app_dev}]({app_dev_link})\n"
app_details += f"`Rating :` {app_rating} ⭐️\n"
app_details += f"`Features :` [View in Play Store]({app_link})"
- await message.edit(app_details, disable_web_page_preview=False)
+ await message.edit(app_details, link_preview_options=LinkPreviewOptions(is_disabled=True))
except IndexError:
await message.edit("No result found in search. Please enter **Valid app name**")
except Exception as err:
diff --git a/plugins/utils/bitly/__main__.py b/plugins/utils/bitly/__main__.py
index 09fa64337..2fb1fed04 100644
--- a/plugins/utils/bitly/__main__.py
+++ b/plugins/utils/bitly/__main__.py
@@ -12,6 +12,9 @@
import gdshortener
from pyrogram.errors import YouBlockedUser
+from pyrogram.types import (
+ LinkPreviewOptions
+)
from userge import userge, Message
from userge.utils.exceptions import StopConversation
@@ -37,7 +40,12 @@ async def bitly(msg: Message):
shorten_url = (
await conv.get_response(mark_read=True)
).text.split('\n', maxsplit=1)[-1]
- await msg.edit(f"`{shorten_url}`", disable_web_page_preview=True)
+ await msg.edit(
+ f"`{shorten_url}`",
+ link_preview_options=LinkPreviewOptions(
+ is_disabled=True
+ )
+ )
except StopConversation:
await msg.err("bot is down")
@@ -58,7 +66,7 @@ async def is_gd(msg: Message):
else:
await msg.edit(
f"**Shortened URL:**\n`{s_url}`\n\n**Stats:** `{stats}`",
- disable_web_page_preview=True
+ link_preview_options=LinkPreviewOptions(is_disabled=True)
)
@@ -78,5 +86,5 @@ async def stats_is_gd(msg: Message):
else:
await msg.edit(
f"**URL:** `{original_url}`",
- disable_web_page_preview=True
+ link_preview_options=LinkPreviewOptions(is_disabled=True)
)
diff --git a/plugins/utils/botpm/__main__.py b/plugins/utils/botpm/__main__.py
index 40e7f854c..efeac7eb1 100644
--- a/plugins/utils/botpm/__main__.py
+++ b/plugins/utils/botpm/__main__.py
@@ -19,7 +19,8 @@
import wget
from pyrogram.errors import UserIsBlocked, FloodWait
from pyrogram.types import (
- Message as PyroMessage, InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery
+ Message as PyroMessage, InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery,
+ LinkPreviewOptions
)
from userge import userge, Message, config, filters, get_collection, pool
@@ -258,8 +259,8 @@ async def bot_pm_handler(_, msg: PyroMessage):
After Adding a var, you can see your media when you start your Bot.
"""
- SET_CUSTOM_TEXT = """You can set Custom Start text which you will see when you start Bot by /settext command.
-"""
+ SET_CUSTOM_TEXT = """You can set Custom Start text which
+you will see when you start Bot by /settext command."""
HELP_TEXT = """**Here are the available commands for Bot PM:**
@@ -295,7 +296,7 @@ async def cq_handler(_, cq: CallbackQuery):
mp.inline_keyboard.insert(0, btn)
await cq.edit_message_text(
SETTINGS_TEXT,
- disable_web_page_preview=True,
+ link_preview_options=LinkPreviewOptions(is_disabled=True),
reply_markup=mp
)
elif cq.data == "en_dis_bot_pm":
@@ -314,7 +315,7 @@ async def cq_handler(_, cq: CallbackQuery):
mp = InlineKeyboardMarkup([[InlineKeyboardButton("Back", callback_data="stngs")]])
await cq.edit_message_text(
HELP_TEXT,
- disable_web_page_preview=True,
+ link_preview_options=LinkPreviewOptions(is_disabled=True),
reply_markup=mp
)
elif cq.data == "stats":
@@ -335,7 +336,7 @@ async def cq_handler(_, cq: CallbackQuery):
"""
await cq.edit_message_text(
out_str,
- disable_web_page_preview=True,
+ link_preview_options=LinkPreviewOptions(is_disabled=True),
reply_markup=mp
)
elif cq.data == "broadcast":
@@ -364,21 +365,21 @@ async def cq_handler(_, cq: CallbackQuery):
)
await cq.edit_message_text(
MISC_TEXT,
- disable_web_page_preview=True,
+ link_preview_options=LinkPreviewOptions(is_disabled=True),
reply_markup=mp
)
elif cq.data == "setmedia":
mp = InlineKeyboardMarkup([[InlineKeyboardButton("Back", callback_data="misc")]])
await cq.edit_message_text(
SET_MEDIA_TEXT,
- disable_web_page_preview=True,
+ link_preview_options=LinkPreviewOptions(is_disabled=True),
reply_markup=mp
)
elif cq.data == "settext":
mp = InlineKeyboardMarkup([[InlineKeyboardButton("Back", callback_data="misc")]])
await cq.edit_message_text(
SET_CUSTOM_TEXT,
- disable_web_page_preview=True,
+ link_preview_options=LinkPreviewOptions(is_disabled=True),
reply_markup=mp
)
elif cq.data == "startcq":
@@ -386,7 +387,7 @@ async def cq_handler(_, cq: CallbackQuery):
mp = InlineKeyboardMarkup([[InlineKeyboardButton("Settings", callback_data="stngs")]])
await cq.edit_message_text(
START_TEXT.format_map(SafeDict(**user_dict)),
- disable_web_page_preview=True,
+ link_preview_options=LinkPreviewOptions(is_disabled=True),
reply_markup=mp
)
@@ -394,7 +395,11 @@ async def send_start_text(
msg: PyroMessage, text: str, path: str, markup: Optional[InlineKeyboardMarkup] = None
):
if not path:
- return await msg.reply(text, disable_web_page_preview=True, reply_markup=markup)
+ return await msg.reply(
+ text,
+ link_preview_options=LinkPreviewOptions(is_disabled=True),
+ reply_markup=markup
+ )
if path.lower().endswith((".jpg", ".jpeg", ".png", ".bmp")):
await bot.send_photo(
chat_id=msg.chat.id,
@@ -482,7 +487,13 @@ async def handle_reply(msg: PyroMessage):
reply_id = _U_ID_F_M_ID.get(replied.id)
try:
if msg.text:
- await bot.send_message(reply_id, msg.text, disable_web_page_preview=True)
+ await bot.send_message(
+ chat_id=reply_id,
+ text=msg.text,
+ link_preview_options=LinkPreviewOptions(
+ is_disabled=True
+ )
+ )
else:
await msg.copy(reply_id)
except UserIsBlocked:
@@ -507,7 +518,8 @@ async def handle_reply(msg: PyroMessage):
NEXT_MESSAGE = "This message has been added to the post."
PREVIEW_MESSAGE = "The post preview sent above."
- CONTINUE_MESSAGE = """{} You can continue to send messages. Type /done to send this broadcast post.
+ CONTINUE_MESSAGE = """{} You can continue to send messages.
+Type /done to send this broadcast post.
/preview — preview the broadcast post
/cancel - cancel the current operation
diff --git a/plugins/utils/chat/__main__.py b/plugins/utils/chat/__main__.py
index c038d4ca5..8dafbd831 100644
--- a/plugins/utils/chat/__main__.py
+++ b/plugins/utils/chat/__main__.py
@@ -23,6 +23,9 @@
UsernameNotOccupied,
PeerIdInvalid)
from pyrogram import enums
+from pyrogram.types import (
+ LinkPreviewOptions
+)
from userge import userge, config, Message
@@ -61,9 +64,8 @@ async def join_chat(message: Message):
except PeerIdInvalid:
await message.edit("```\nChat id, you entered, does not exist... ```", del_in=3)
return
- else:
- await message.delete()
- await asyncio.sleep(2)
+ await message.delete()
+ await asyncio.sleep(2)
@userge.on_cmd("leave",
@@ -96,7 +98,7 @@ async def invite_link(message: Message):
await message.edit(
"**Invite link Generated Successfully for\n"
f"{chat_name}**\n[Click here to join]({link})",
- disable_web_page_preview=True)
+ link_preview_options=LinkPreviewOptions(is_disabled=True))
else:
await message.err("Requirements doesn't met...")
except Exception as e_f:
@@ -248,8 +250,7 @@ async def set_chat(message: Message):
await message.edit(
"```\nUsername, you entered, is already Occupied... ```", del_in=3)
return
- else:
- await message.edit("```\nChat Username is Successfully Updated...```", del_in=3)
+ await message.edit("```\nChat Username is Successfully Updated...```", del_in=3)
elif '-des' in message.flags:
try:
await userge.set_chat_description(message.chat.id, args.strip())
diff --git a/plugins/utils/cnf/__main__.py b/plugins/utils/cnf/__main__.py
index 52215a8a3..93726c5d6 100644
--- a/plugins/utils/cnf/__main__.py
+++ b/plugins/utils/cnf/__main__.py
@@ -14,6 +14,10 @@
import aiohttp
from bs4 import BeautifulSoup
+from pyrogram.types import (
+ LinkPreviewOptions
+)
+
from userge import userge, Message
@@ -47,7 +51,7 @@ async def cnf(message: Message):
# heading
payload = f"**[{cmd}]({base_url + cmd})**\n"
# description
- payload += f"{soup.find('p', attrs = {'class':'my-0'}).text.strip()}\n\n"
+ payload += f"{soup.find('p', attrs={'class': 'my-0'}).text.strip()}\n\n"
lst = soup.findAll("div", attrs={"class": "command-install"})
@@ -64,7 +68,7 @@ async def cnf(message: Message):
payload += f"{os}\n`{command}`\n\n"
- await message.edit(payload, disable_web_page_preview=False)
+ await message.edit(payload, link_preview_options=LinkPreviewOptions(is_disabled=False))
except IndexError:
await message.edit("Command Not Found")
except Exception as err:
diff --git a/plugins/utils/country/__main__.py b/plugins/utils/country/__main__.py
index c6671d7cf..91e5f5bb7 100644
--- a/plugins/utils/country/__main__.py
+++ b/plugins/utils/country/__main__.py
@@ -12,6 +12,10 @@
from countryinfo import CountryInfo
+from pyrogram.types import (
+ LinkPreviewOptions
+)
+
from userge import userge, Message
PREVIEW = False # False for instant view
@@ -41,6 +45,12 @@ async def countryinfo(update: Message):
Timezone : `{country.timezones()}`
Wiki : {country.wiki()}"""
try:
- await update.edit_text(text=info, disable_web_page_preview=PREVIEW)
+ await update.edit_text(
+ text=info,
+ link_preview_options=LinkPreviewOptions(is_disabled=PREVIEW)
+ )
except Exception as error:
- await update.edit_text(text=error, disable_web_page_preview=True)
+ await update.edit_text(
+ text=error,
+ link_preview_options=LinkPreviewOptions(is_disabled=True)
+ )
diff --git a/plugins/utils/currency/__main__.py b/plugins/utils/currency/__main__.py
index d737eab85..65fc6f9d6 100644
--- a/plugins/utils/currency/__main__.py
+++ b/plugins/utils/currency/__main__.py
@@ -14,6 +14,9 @@
from emoji import get_emoji_regexp
from pyrogram import enums
+from pyrogram.types import (
+ LinkPreviewOptions
+)
from userge import userge, Message
from .. import currency
@@ -35,7 +38,7 @@ async def cur_conv(message: Message):
"Oops!!get the API from
"
"HERE "
"& add it to Heroku config vars
(CURRENCY_API
)",
- disable_web_page_preview=True,
+ link_preview_options=LinkPreviewOptions(is_disabled=True),
parse_mode=enums.ParseMode.HTML, del_in=0)
return
diff --git a/plugins/utils/google/__main__.py b/plugins/utils/google/__main__.py
index 8745e5cf8..05b67fe9d 100644
--- a/plugins/utils/google/__main__.py
+++ b/plugins/utils/google/__main__.py
@@ -10,6 +10,10 @@
from search_engine_parser import GoogleSearch
+from pyrogram.types import (
+ LinkPreviewOptions
+)
+
from userge import userge, Message
GoogleSearch.parse_soup = lambda __, _: _.find_all("div", class_="Gx5Zad fP1Qef xpd EtOod pkphOe")
@@ -51,4 +55,4 @@ async def gsearch(message: Message):
break
output = f"**Google Search:**\n`{query}`\n\n**Results:**\n{output}"
await message.edit_or_send_as_file(text=output, caption=query,
- disable_web_page_preview=True)
+ link_preview_options=LinkPreviewOptions(is_disabled=True))
diff --git a/plugins/utils/google_img/__main__.py b/plugins/utils/google_img/__main__.py
index 4d645ff2f..f2cef94f4 100644
--- a/plugins/utils/google_img/__main__.py
+++ b/plugins/utils/google_img/__main__.py
@@ -15,7 +15,10 @@
from PIL import Image
from google_images_search import GoogleImagesSearch as GIS
from pyrogram import enums
-from pyrogram.types import InputMediaPhoto
+from pyrogram.types import (
+ InputMediaPhoto,
+ LinkPreviewOptions
+)
from userge import userge, Message
from .. import google_img as gimg
@@ -47,7 +50,7 @@
'examples': "{tr}gimg Dogs"})
async def google_img(message: Message):
if (gimg.GCS_API_KEY and gimg.GCS_IMAGE_E_ID) is None:
- await message.edit(REQ_ERR, disable_web_page_preview=True)
+ await message.edit(REQ_ERR, link_preview_options=LinkPreviewOptions(is_disabled=True))
return
if os.path.exists(PATH):
shutil.rmtree(PATH, ignore_errors=True)
diff --git a/plugins/utils/google_reverse_search/__main__.py b/plugins/utils/google_reverse_search/__main__.py
index 0e4bc2f9f..d4c9f1427 100644
--- a/plugins/utils/google_reverse_search/__main__.py
+++ b/plugins/utils/google_reverse_search/__main__.py
@@ -16,6 +16,9 @@
from bs4 import BeautifulSoup
from pyrogram import enums
+from pyrogram.types import (
+ LinkPreviewOptions
+)
from userge import userge, Message, config
from userge.utils import take_screen_shot
@@ -85,4 +88,10 @@ async def google_rs(message: Message):
More Info: Open this Link
Time Taken: {ms} seconds"""
- await message.edit(out_str, parse_mode=enums.ParseMode.HTML, disable_web_page_preview=True)
+ await message.edit(
+ out_str,
+ parse_mode=enums.ParseMode.HTML,
+ link_preview_options=LinkPreviewOptions(
+ is_disabled=True
+ )
+ )
diff --git a/plugins/utils/header/__main__.py b/plugins/utils/header/__main__.py
index fa675b645..447e2b149 100644
--- a/plugins/utils/header/__main__.py
+++ b/plugins/utils/header/__main__.py
@@ -10,6 +10,10 @@
import requests
+from pyrogram.types import (
+ LinkPreviewOptions
+)
+
from userge import userge, Message
@@ -43,4 +47,4 @@ async def req_head(message: Message):
for k, v in cd.headers.items():
output += f" 🏷 __{k.lower()}__ : `{v}`\n\n"
await message.edit_or_send_as_file(text=output, caption=link,
- disable_web_page_preview=True)
+ link_preview_options=LinkPreviewOptions(is_disabled=True))
diff --git a/plugins/utils/imdb/__main__.py b/plugins/utils/imdb/__main__.py
index 4d343b323..c3a4aa484 100644
--- a/plugins/utils/imdb/__main__.py
+++ b/plugins/utils/imdb/__main__.py
@@ -20,7 +20,8 @@
InlineQueryResultArticle,
InputTextMessageContent,
InlineKeyboardButton,
- InlineKeyboardMarkup
+ InlineKeyboardMarkup,
+ LinkPreviewOptions
)
from pyrogram import enums
@@ -42,7 +43,7 @@ async def _imdb(message: Message):
if not (imdb.API_ONE_URL or imdb.API_TWO_URL):
return await message.err(
"First set [these two vars](https://t.me/UsergePlugins/127) before using imdb",
- disable_web_page_preview=True
+ link_preview_options=LinkPreviewOptions(is_disabled=True)
)
try:
movie_name = message.input_str
@@ -76,7 +77,7 @@ async def _imdb(message: Message):
else:
await message.edit(
description,
- disable_web_page_preview=True,
+ link_preview_options=LinkPreviewOptions(is_disabled=True),
parse_mode=enums.ParseMode.HTML
)
@@ -212,7 +213,7 @@ async def imdb_callback(_, c_q: CallbackQuery):
)
await c_q.edit_message_text(
text=description,
- disable_web_page_preview=False,
+ link_preview_options=LinkPreviewOptions(is_disabled=False),
reply_markup=InlineKeyboardMarkup(
[
[
@@ -261,7 +262,7 @@ async def inline_fn(_, inline_query: InlineQuery):
input_message_content=InputTextMessageContent(
message_text=message_text,
parse_mode=enums.ParseMode.HTML,
- disable_web_page_preview=False
+ link_preview_options=LinkPreviewOptions(is_disabled=False)
),
url=imdb_url,
description=f" {description} | {stars}",
diff --git a/plugins/utils/info/__main__.py b/plugins/utils/info/__main__.py
index f4a53bed2..b88f6ba38 100644
--- a/plugins/utils/info/__main__.py
+++ b/plugins/utils/info/__main__.py
@@ -18,7 +18,7 @@
import spamwatch
from UsergeAntiSpamApi import Client
-from pyrogram.types import User
+from pyrogram.types import User, LinkPreviewOptions
from pyrogram import enums
from userge import userge, Message, get_collection
@@ -108,7 +108,12 @@ async def _info(msg: Message):
user_info += f"\n **● Reason** : `{reduce_spam(user_gbanned['reason'] or None)}`"
else:
user_info += "\n**User Gbanned** : `False`"
- await msg.edit_or_send_as_file(text=user_info, disable_web_page_preview=True)
+ await msg.edit_or_send_as_file(
+ text=user_info,
+ link_preview_options=LinkPreviewOptions(
+ is_disabled=True
+ )
+ )
def reduce_spam(text: Optional[str]) -> Optional[str]:
diff --git a/plugins/utils/iplookup/__main__.py b/plugins/utils/iplookup/__main__.py
index 973686e24..369b556a7 100644
--- a/plugins/utils/iplookup/__main__.py
+++ b/plugins/utils/iplookup/__main__.py
@@ -14,6 +14,7 @@
import aiohttp
from pyrogram import enums
+from pyrogram.types import LinkPreviewOptions
from userge import userge, Message
@@ -59,6 +60,6 @@ async def _ip_look_up(message: Message):
f"**City:** `{city}`\n"
f"**Location:** `{localisation}`\n"
f"**Google Map:** {gmap_lock}"),
- disable_web_page_preview=True,
+ link_preview_options=LinkPreviewOptions(is_disabled=True),
parse_mode=enums.ParseMode.MARKDOWN
)
diff --git a/plugins/utils/labstack/__main__.py b/plugins/utils/labstack/__main__.py
index 22cdd7934..f43f2d41b 100644
--- a/plugins/utils/labstack/__main__.py
+++ b/plugins/utils/labstack/__main__.py
@@ -22,6 +22,10 @@
import requests
from pySmartDL import SmartDL
+from pyrogram.types import (
+ LinkPreviewOptions
+)
+
from userge import userge, config, Message
from userge.utils import progress, humanbytes
@@ -89,7 +93,12 @@ async def labstack(message: Message):
count += 1
if count >= 5:
count = 0
- await message.try_to_edit(progress_str, disable_web_page_preview=True)
+ await message.try_to_edit(
+ progress_str,
+ link_preview_options=LinkPreviewOptions(
+ is_disabled=True
+ )
+ )
await asyncio.sleep(1)
except Exception as d_e:
await message.err(d_e)
diff --git a/plugins/utils/lastfm/__main__.py b/plugins/utils/lastfm/__main__.py
index 712f0ec9a..f70d461a8 100644
--- a/plugins/utils/lastfm/__main__.py
+++ b/plugins/utils/lastfm/__main__.py
@@ -20,6 +20,7 @@
import pylast
import wget
from pyrogram.errors import ChatWriteForbidden, ChannelPrivate, ChatIdInvalid
+from pyrogram.types import LinkPreviewOptions
from userge import userge, Message, config, pool, get_collection
from userge.utils import time_formatter
@@ -46,7 +47,7 @@ async def checker(msg: Message):
"`This plugins needs environmental variables,"
" For more info see` "
"[this post](https://t.me/UsergePlugins/123).",
- disable_web_page_preview=True
+ link_preview_options=LinkPreviewOptions(is_disabled=True)
)
return checker
@@ -83,7 +84,7 @@ async def _lastfm(msg: Message):
k = get_track_info(track)
if not k:
return await msg.err("Track Not found...")
- await msg.edit(out + k, disable_web_page_preview=True)
+ await msg.edit(out + k, link_preview_options=LinkPreviewOptions(is_disabled=True))
@check_creds
@@ -181,7 +182,7 @@ async def get_track(msg: Message):
out = get_track_info(track)
if not out:
return await msg.err("Track not found...")
- await msg.edit(out, disable_web_page_preview=True)
+ await msg.edit(out, link_preview_options=LinkPreviewOptions(is_disabled=True))
@check_creds
@@ -223,15 +224,15 @@ async def lastfm_worker():
if userge.has_bot:
try:
await userge.bot.send_message(
- chat_id, out, disable_web_page_preview=True
+ chat_id, out, link_preview_options=LinkPreviewOptions(is_disabled=True)
)
except (ChatWriteForbidden, ChannelPrivate, ChatIdInvalid):
await userge.send_message(
- chat_id, out, disable_web_page_preview=True
+ chat_id, out, link_preview_options=LinkPreviewOptions(is_disabled=True)
)
else:
await userge.send_message(
- chat_id, out, disable_web_page_preview=True
+ chat_id, out, link_preview_options=LinkPreviewOptions(is_disabled=True)
)
NOW_PLAYING[0] = False # Should not update to DB ig ?
@@ -265,8 +266,7 @@ def get_track_info(track: pylast.Track) -> Optional[str]:
'''
except pylast.WSError:
return None
- else:
- return out
+ return out
@pool.run_in_thread
@@ -429,4 +429,4 @@ async def lastfm_compat_(message: Message):
disart = ", ".join({comart[r] for r in range(min(len(comart), 5))})
compat = min((len(comart) * 100 / 40), 100)
rep = f"{display} both listen to __{disart}__...\nMusic Compatibility is **{compat}%**"
- await message.edit(rep, disable_web_page_preview=True)
+ await message.edit(rep, link_preview_options=LinkPreviewOptions(is_disabled=True))
diff --git a/plugins/utils/mentions/__main__.py b/plugins/utils/mentions/__main__.py
index 9033c4bef..897f53eea 100644
--- a/plugins/utils/mentions/__main__.py
+++ b/plugins/utils/mentions/__main__.py
@@ -10,7 +10,7 @@
import os
from pyrogram.errors import PeerIdInvalid, BadRequest, UserIsBlocked
-from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
+from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, LinkPreviewOptions
from pyrogram import enums
from userge import userge, Message, config, filters, get_collection
@@ -113,7 +113,7 @@ async def handle_mentions(msg: Message, is_retry=False):
await client.send_message(
chat_id=userge.id if userge.has_bot else config.LOG_CHANNEL_ID,
text=text,
- disable_web_page_preview=True,
+ link_preview_options=LinkPreviewOptions(is_disabled=True),
reply_markup=InlineKeyboardMarkup(buttons)
)
except (PeerIdInvalid, UserIsBlocked) as e:
diff --git a/plugins/utils/music/__main__.py b/plugins/utils/music/__main__.py
index 64149c822..a16caaa89 100644
--- a/plugins/utils/music/__main__.py
+++ b/plugins/utils/music/__main__.py
@@ -17,6 +17,8 @@
from Python_ARQ import ARQ
from aiohttp import ClientSession
+from pyrogram.types import LinkPreviewOptions
+
from userge import config, Message, userge
from .. import music
from ...misc.download import url_download
@@ -43,7 +45,7 @@ async def savn(message: Message):
return await message.err(
"Before using this command, "
"you have to set this [Environmental var.](https://t.me/UsergePlugins/128)",
- disable_web_page_preview=True
+ link_preview_options=LinkPreviewOptions(is_disabled=True)
)
query = message.input_str
await message.edit(f"Searching for {query} in JioSaavn...")
@@ -89,7 +91,7 @@ async def deeza(message: Message):
return await message.err(
"Before using this command, "
"you have to set this [Environmental var.](https://t.me/UsergePlugins/128)",
- disable_web_page_preview=True
+ link_preview_options=LinkPreviewOptions(is_disabled=True)
)
query = str(message.filtered_input_str)
await message.edit(f"Searching for {query} in Deezer...")
diff --git a/plugins/utils/ocr/__main__.py b/plugins/utils/ocr/__main__.py
index d34600f59..4030bf8dc 100644
--- a/plugins/utils/ocr/__main__.py
+++ b/plugins/utils/ocr/__main__.py
@@ -11,6 +11,7 @@
import os
from pyrogram import enums
+from pyrogram.types import LinkPreviewOptions
from userge import userge, Message, config
from .. import ocr
@@ -33,7 +34,7 @@ async def ocr_gen(message: Message):
"Oops!!get the OCR API from
"
"HERE "
"& add it to Heroku config vars
(OCR_SPACE_API_KEY
)",
- disable_web_page_preview=True,
+ link_preview_options=LinkPreviewOptions(is_disabled=True),
parse_mode=enums.ParseMode.HTML, del_in=0)
return
@@ -52,9 +53,8 @@ async def ocr_gen(message: Message):
f"\n\n**ERROR**: `{e_f}`", del_in=0)
os.remove(file_name)
return
- else:
- await message.edit(
- "**Here's what I could read from it:**"
- f"\n\n`{ParsedText}`")
- os.remove(file_name)
- return await CHANNEL.log("`ocr` command succefully executed")
+ await message.edit(
+ "**Here's what I could read from it:**"
+ f"\n\n`{ParsedText}`")
+ os.remove(file_name)
+ return await CHANNEL.log("`ocr` command succefully executed")
diff --git a/plugins/utils/paste/__main__.py b/plugins/utils/paste/__main__.py
index bbd2801dc..a5d531168 100644
--- a/plugins/utils/paste/__main__.py
+++ b/plugins/utils/paste/__main__.py
@@ -16,6 +16,8 @@
import aiohttp
from aiohttp import client_exceptions
+from pyrogram.types import LinkPreviewOptions
+
from userge import userge, Message, config
@@ -268,7 +270,7 @@ async def paste_(message: Message) -> None:
await message.edit(f"`Failed to reach {service.get_name().title()}`", del_in=5)
else:
await message.edit(f"**{service.get_name().title()}** [URL]({url})",
- disable_web_page_preview=True)
+ link_preview_options=LinkPreviewOptions(is_disabled=True))
@userge.on_cmd("getpaste", about={
diff --git a/plugins/utils/removebg/__main__.py b/plugins/utils/removebg/__main__.py
index fb807a3f4..ad55ab2de 100644
--- a/plugins/utils/removebg/__main__.py
+++ b/plugins/utils/removebg/__main__.py
@@ -17,6 +17,7 @@
from removebg import RemoveBg
from pyrogram import enums
+from pyrogram.types import LinkPreviewOptions
from userge import userge, config, Message
from userge.utils import progress
@@ -33,7 +34,9 @@ async def remove_background(message: Message):
await message.edit(
"Get the API from HERE "
" & add it to Heroku Config Vars REMOVE_BG_API_KEY
",
- disable_web_page_preview=True, parse_mode=enums.ParseMode.HTML)
+ link_preview_options=LinkPreviewOptions(is_disabled=True),
+ parse_mode=enums.ParseMode.HTML
+ )
return
await message.edit("Analysing...")
replied = message.reply_to_message
diff --git a/plugins/utils/requote/__main__.py b/plugins/utils/requote/__main__.py
index b18112535..606e0d6c2 100644
--- a/plugins/utils/requote/__main__.py
+++ b/plugins/utils/requote/__main__.py
@@ -12,6 +12,8 @@
from requests.utils import requote_uri
+from pyrogram.types import LinkPreviewOptions
+
from userge import userge, Message
@@ -26,5 +28,5 @@ async def requote(update: Message):
text = requote_uri(update.input_str)
await update.edit(
text=text,
- disable_web_page_preview=True
+ link_preview_options=LinkPreviewOptions(is_disabled=True)
)
diff --git a/plugins/utils/time/__main__.py b/plugins/utils/time/__main__.py
index 29ad9bd96..60b6d8896 100644
--- a/plugins/utils/time/__main__.py
+++ b/plugins/utils/time/__main__.py
@@ -12,6 +12,7 @@
from pytz import timezone
from pyrogram import enums
+from pyrogram.types import LinkPreviewOptions
from userge import userge, Message
from . import COUNTRY_CITY
@@ -79,8 +80,11 @@ async def flag_checks(message: Message):
"Ex: America/Los_Angeles
")
if 'list' in message.flags or 'l' in message.flags:
LOG.debug("Time | FLAG = List: Giving TZ list...")
- await message.edit(default_message, disable_web_page_preview=True,
- parse_mode=enums.ParseMode.HTML, del_in=30)
+ await message.edit(
+ default_message,
+ link_preview_options=LinkPreviewOptions(is_disabled=True),
+ parse_mode=enums.ParseMode.HTML, del_in=30
+ )
return None
if 'code' in message.flags or 'c' in message.flags:
@@ -94,8 +98,12 @@ async def flag_checks(message: Message):
return country_input
if not COUNTRY_CITY:
LOG.debug("Time: No Config Set")
- await message.edit(default_message, disable_web_page_preview=True,
- parse_mode=enums.ParseMode.HTML, del_in=30)
+ await message.edit(
+ default_message,
+ link_preview_options=LinkPreviewOptions(is_disabled=True),
+ parse_mode=enums.ParseMode.HTML,
+ del_in=30
+ )
return None
return False
diff --git a/plugins/utils/ud/__main__.py b/plugins/utils/ud/__main__.py
index ffe6455bc..1a1f4d610 100644
--- a/plugins/utils/ud/__main__.py
+++ b/plugins/utils/ud/__main__.py
@@ -17,7 +17,8 @@
from pyrogram.types import (
InlineQuery,
InlineQueryResultArticle,
- InputTextMessageContent
+ InputTextMessageContent,
+ LinkPreviewOptions
)
from pyrogram import enums
@@ -83,7 +84,7 @@ async def wpraip(query: str) -> List[InlineQueryResultArticle]:
input_message_content=InputTextMessageContent(
message_text=message_text,
parse_mode=enums.ParseMode.HTML,
- disable_web_page_preview=False
+ link_preview_options=LinkPreviewOptions(is_disabled=False)
),
url=term.get("permalink"),
description=term.get("definition", " ")
diff --git a/plugins/utils/video_chat/callbacks.py b/plugins/utils/video_chat/callbacks.py
index 8acaf81be..4e057df6d 100644
--- a/plugins/utils/video_chat/callbacks.py
+++ b/plugins/utils/video_chat/callbacks.py
@@ -3,7 +3,8 @@
from pyrogram.types import (InlineKeyboardMarkup,
InlineKeyboardButton,
CallbackQuery,
- Message as RawMessage)
+ Message as RawMessage,
+ LinkPreviewOptions)
from pyrogram.errors import MessageNotModified, QueryIdInvalid
from userge import userge, filters, config
@@ -39,7 +40,7 @@ async def vc_callback(cq: CallbackQuery):
CQ_MSG.pop(i)
break
- await cq.edit_message_text(text, disable_web_page_preview=True)
+ await cq.edit_message_text(text, link_preview_options=LinkPreviewOptions(is_disabled=True))
await skip_song()
elif "queue" in cq.data:
@@ -67,7 +68,7 @@ async def vc_callback(cq: CallbackQuery):
await cq.edit_message_text(
out,
- disable_web_page_preview=True,
+ link_preview_options=LinkPreviewOptions(is_disabled=True),
reply_markup=button
)
@@ -75,7 +76,7 @@ async def vc_callback(cq: CallbackQuery):
if Vars.BACK_BUTTON_TEXT:
await cq.edit_message_text(
Vars.BACK_BUTTON_TEXT,
- disable_web_page_preview=True,
+ link_preview_options=LinkPreviewOptions(is_disabled=True),
reply_markup=default_markup()
)
else:
diff --git a/plugins/utils/video_chat/helpers.py b/plugins/utils/video_chat/helpers.py
index e633e6c6f..4029f2358 100644
--- a/plugins/utils/video_chat/helpers.py
+++ b/plugins/utils/video_chat/helpers.py
@@ -13,6 +13,9 @@
UserAlreadyParticipant,
UserBannedInChannel
)
+from pyrogram.types import (
+ LinkPreviewOptions
+)
from pytgcalls import StreamType
from pytgcalls.types import (
@@ -197,7 +200,7 @@ async def skip_song(clear_queue: bool = False):
await Vars.CLIENT.send_message(
Vars.CHAT_ID,
out,
- disable_web_page_preview=True
+ link_preview_options=LinkPreviewOptions(is_disabled=True)
)
await skip_song()
@@ -249,8 +252,7 @@ async def invite_vc_client(msg: Message) -> bool:
except ChatAdminRequired:
await reply_text(msg, '`Provide a invite link along command.!!`')
return False
- else:
- invite_link = link.invite_link
+ invite_link = link.invite_link
try:
await VC_CLIENT.join_chat(invite_link)
except UserAlreadyParticipant:
diff --git a/plugins/utils/weather/__main__.py b/plugins/utils/weather/__main__.py
index 6cb13fd7f..2290c93b4 100644
--- a/plugins/utils/weather/__main__.py
+++ b/plugins/utils/weather/__main__.py
@@ -15,6 +15,9 @@
from pytz import country_timezones as c_tz, timezone as tz, country_names as c_n
from pyrogram import enums
+from pyrogram.types import (
+ LinkPreviewOptions
+)
from userge import userge, Message
from .. import weather
@@ -52,7 +55,7 @@ async def weather_get(message: Message):
"Oops!!get the API from
"
"HERE "
"& add it to Heroku config vars
(OPEN_WEATHER_MAP
)",
- disable_web_page_preview=True,
+ link_preview_options=LinkPreviewOptions(is_disabled=True),
parse_mode=enums.ParseMode.HTML, del_in=0)
return
@@ -112,7 +115,7 @@ async def weather_get(message: Message):
fullc_n = c_n[f"{country}"]
dirs = ["N", "NE", "E", "SE", "S", "SW", "W", "NW"]
- div = (360 / len(dirs))
+ div = 360 / len(dirs)
funmath = int((winddir + (div / 2)) / div)
findir = dirs[funmath % len(dirs)]
kmph = str(wind * 3.6).split(".")
diff --git a/plugins/utils/wikipedia/__main__.py b/plugins/utils/wikipedia/__main__.py
index e0dd2f343..d2e1eee89 100644
--- a/plugins/utils/wikipedia/__main__.py
+++ b/plugins/utils/wikipedia/__main__.py
@@ -10,6 +10,10 @@
import wikipedia
+from pyrogram.types import (
+ LinkPreviewOptions
+)
+
from userge import userge, Message
@@ -43,4 +47,4 @@ async def wiki_pedia(message: Message):
break
output = f"**Wikipedia Search:**\n`{query}`\n\n**Results:**\n{output}"
await message.edit_or_send_as_file(text=output, caption=query,
- disable_web_page_preview=True)
+ link_preview_options=LinkPreviewOptions(is_disabled=True))