Skip to content

Commit

Permalink
treewide: migrate to hydrogram
Browse files Browse the repository at this point in the history
  • Loading branch information
alissonlauffer committed Jun 1, 2024
1 parent b72fe14 commit 3ff68a9
Show file tree
Hide file tree
Showing 50 changed files with 131 additions and 151 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ EduuRobot

|License| |Codacy| |Crowdin| |Black| |Telegram Channel| |Telegram Chat|

A multipurpose Telegram Bot made with Pyrogram and asynchronous programming.
A multipurpose Telegram Bot made with Hydrogram and asynchronous programming.


Requirements
Expand Down
6 changes: 3 additions & 3 deletions eduu/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import platform
import sys

from pyrogram import idle
from hydrogram import idle

from .bot import Eduu
from .database import database
Expand All @@ -19,8 +19,8 @@
)

# To avoid some annoying log
logging.getLogger("pyrogram.syncer").setLevel(logging.WARNING)
logging.getLogger("pyrogram.client").setLevel(logging.WARNING)
logging.getLogger("hydrogram.syncer").setLevel(logging.WARNING)
logging.getLogger("hydrogram.client").setLevel(logging.WARNING)

logger = logging.getLogger(__name__)

Expand Down
16 changes: 8 additions & 8 deletions eduu/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import logging
import time

import pyrogram
from pyrogram import Client
from pyrogram.enums import ParseMode
from pyrogram.errors import BadRequest
from pyrogram.raw.all import layer
import hydrogram
from hydrogram import Client
from hydrogram.enums import ParseMode
from hydrogram.errors import BadRequest
from hydrogram.raw.all import layer

from config import API_HASH, API_ID, DISABLED_PLUGINS, LOG_CHAT, TOKEN, WORKERS

Expand Down Expand Up @@ -39,8 +39,8 @@ async def start(self):
self.start_time = time.time()

logger.info(
"Eduu running with Pyrogram v%s (Layer %s) started on @%s. Hi!",
pyrogram.__version__,
"Eduu running with Hydrogram v%s (Layer %s) started on @%s. Hi!",
hydrogram.__version__,
layer,
self.me.username,
)
Expand All @@ -53,7 +53,7 @@ async def start(self):
start_message = (
"<b>EduuRobot started!</b>\n\n"
f"<b>Version number:</b> <code>r{__version_number__} ({__commit__})</code>\n"
f"<b>Pyrogram:</b> <code>v{pyrogram.__version__}</code>"
f"<b>Hydrogram:</b> <code>v{hydrogram.__version__}</code>"
)

try:
Expand Down
2 changes: 1 addition & 1 deletion eduu/database/chats.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2018-2024 Amano LLC

from pyrogram.enums import ChatType
from hydrogram.enums import ChatType

from eduu.database import database
from eduu.utils.consts import GROUP_TYPES
Expand Down
2 changes: 1 addition & 1 deletion eduu/database/localization.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2018-2024 Amano LLC

from pyrogram.enums import ChatType
from hydrogram.enums import ChatType

from eduu.utils.consts import GROUP_TYPES

Expand Down
4 changes: 2 additions & 2 deletions eduu/plugins/admins/bans.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2018-2024 Amano LLC

from pyrogram import Client, filters
from pyrogram.types import ChatPrivileges, Message
from hydrogram import Client, filters
from hydrogram.types import ChatPrivileges, Message

from config import PREFIXES
from eduu.utils import commands, extract_time, get_reason_text, get_target_user
Expand Down
4 changes: 2 additions & 2 deletions eduu/plugins/admins/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import asyncio

from pyrogram import Client, filters
from pyrogram.types import ChatPrivileges, Message
from hydrogram import Client, filters
from hydrogram.types import ChatPrivileges, Message

from config import PREFIXES
from eduu.database.admins import check_if_del_service, toggle_del_service
Expand Down
4 changes: 2 additions & 2 deletions eduu/plugins/admins/mutes.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2018-2024 Amano LLC

from pyrogram import Client, filters
from pyrogram.types import ChatPermissions, ChatPrivileges, Message
from hydrogram import Client, filters
from hydrogram.types import ChatPermissions, ChatPrivileges, Message

from config import PREFIXES
from eduu.utils import commands, extract_time, get_reason_text, get_target_user
Expand Down
4 changes: 2 additions & 2 deletions eduu/plugins/admins/pins.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2018-2024 Amano LLC

from pyrogram import Client, filters
from pyrogram.types import ChatPrivileges, Message
from hydrogram import Client, filters
from hydrogram.types import ChatPrivileges, Message

from config import PREFIXES
from eduu.database.admins import check_if_antichannelpin, toggle_antichannelpin
Expand Down
4 changes: 2 additions & 2 deletions eduu/plugins/cats.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2018-2024 Amano LLC

from pyrogram import Client, filters
from pyrogram.types import Message
from hydrogram import Client, filters
from hydrogram.types import Message

from config import PREFIXES
from eduu.utils import commands, http
Expand Down
4 changes: 2 additions & 2 deletions eduu/plugins/chats.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2018-2024 Amano LLC

from pyrogram import Client
from pyrogram.types import Message
from hydrogram import Client
from hydrogram.types import Message

from eduu.database.chats import add_chat, chat_exists

Expand Down
4 changes: 2 additions & 2 deletions eduu/plugins/cmds_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

from itertools import zip_longest

from pyrogram import Client, filters
from pyrogram.types import (
from hydrogram import Client, filters
from hydrogram.types import (
CallbackQuery,
InlineKeyboardButton,
InlineKeyboardMarkup,
Expand Down
4 changes: 2 additions & 2 deletions eduu/plugins/coub.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import random

from pyrogram import Client, filters
from pyrogram.types import Message
from hydrogram import Client, filters
from hydrogram.types import Message

from config import PREFIXES
from eduu.utils import commands, http
Expand Down
6 changes: 3 additions & 3 deletions eduu/plugins/custom_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

import re

from pyrogram import Client, filters
from pyrogram.enums import ParseMode
from pyrogram.types import InlineKeyboardMarkup, Message
from hydrogram import Client, filters
from hydrogram.enums import ParseMode
from hydrogram.types import InlineKeyboardMarkup, Message

from config import PREFIXES
from eduu.database.custom_filters import (
Expand Down
4 changes: 2 additions & 2 deletions eduu/plugins/dice.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2018-2024 Amano LLC

from pyrogram import Client, filters
from pyrogram.types import Message
from hydrogram import Client, filters
from hydrogram.types import Message

from config import PREFIXES
from eduu.utils import commands
Expand Down
4 changes: 2 additions & 2 deletions eduu/plugins/dogs.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2018-2024 Amano LLC

from pyrogram import Client, filters
from pyrogram.types import Message
from hydrogram import Client, filters
from hydrogram.types import Message

from config import PREFIXES
from eduu.utils import commands, http
Expand Down
4 changes: 2 additions & 2 deletions eduu/plugins/gif.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import logging

from pyrogram import Client, filters
from pyrogram.types import Message
from hydrogram import Client, filters
from hydrogram.types import Message

from config import PREFIXES, TENOR_API_KEY
from eduu.utils import commands, http
Expand Down
4 changes: 2 additions & 2 deletions eduu/plugins/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

from urllib.parse import quote_plus

from pyrogram import Client, filters
from pyrogram.types import Message
from hydrogram import Client, filters
from hydrogram.types import Message

from config import PREFIXES
from eduu.utils import commands, http
Expand Down
6 changes: 3 additions & 3 deletions eduu/plugins/ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

import html

from pyrogram import Client, filters
from pyrogram.errors.exceptions import BadRequest
from pyrogram.types import Message
from hydrogram import Client, filters
from hydrogram.errors.exceptions import BadRequest
from hydrogram.types import Message

from config import PREFIXES
from eduu.utils import commands
Expand Down
8 changes: 4 additions & 4 deletions eduu/plugins/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import html
from contextlib import suppress

from pyrogram import Client, filters
from pyrogram.enums import ChatMemberStatus
from pyrogram.errors import BadRequest, UserNotParticipant
from pyrogram.types import Message
from hydrogram import Client, filters
from hydrogram.enums import ChatMemberStatus
from hydrogram.errors import BadRequest, UserNotParticipant
from hydrogram.types import Message

from config import PREFIXES
from eduu.utils import commands
Expand Down
4 changes: 2 additions & 2 deletions eduu/plugins/inline_search.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import html
from uuid import uuid4

from pyrogram import Client
from pyrogram.types import (
from hydrogram import Client
from hydrogram.types import (
InlineKeyboardButton,
InlineKeyboardMarkup,
InlineQuery,
Expand Down
8 changes: 4 additions & 4 deletions eduu/plugins/inlines.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import re
from collections.abc import Iterable

from pyrogram import Client, filters
from pyrogram.enums import ParseMode
from pyrogram.errors import PeerIdInvalid, UserIdInvalid, UsernameInvalid
from pyrogram.types import (
from hydrogram import Client, filters
from hydrogram.enums import ParseMode
from hydrogram.errors import PeerIdInvalid, UserIdInvalid, UsernameInvalid
from hydrogram.types import (
InlineKeyboardMarkup,
InlineQuery,
InlineQueryResultArticle,
Expand Down
4 changes: 2 additions & 2 deletions eduu/plugins/ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import ipaddress
import re

from pyrogram import Client, filters
from pyrogram.types import (
from hydrogram import Client, filters
from hydrogram.types import (
CallbackQuery,
InlineKeyboardButton,
InlineKeyboardMarkup,
Expand Down
4 changes: 2 additions & 2 deletions eduu/plugins/jsondump.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import io
import json

from pyrogram import Client, filters
from pyrogram.types import Message
from hydrogram import Client, filters
from hydrogram.types import Message

from config import PREFIXES
from eduu.utils import commands
Expand Down
6 changes: 3 additions & 3 deletions eduu/plugins/langs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from itertools import zip_longest
from typing import Union

from pyrogram import Client, filters
from pyrogram.enums import ChatType
from pyrogram.types import (
from hydrogram import Client, filters
from hydrogram.enums import ChatType
from hydrogram.types import (
CallbackQuery,
InlineKeyboardButton,
InlineKeyboardMarkup,
Expand Down
8 changes: 4 additions & 4 deletions eduu/plugins/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
from html import escape
from urllib.parse import quote, unquote

from pyrogram import Client, filters
from pyrogram.enums import ChatMembersFilter, ParseMode
from pyrogram.errors import BadRequest
from pyrogram.types import InlineKeyboardMarkup, Message
from hydrogram import Client, filters
from hydrogram.enums import ChatMembersFilter, ParseMode
from hydrogram.errors import BadRequest
from hydrogram.types import InlineKeyboardMarkup, Message

from config import LOG_CHAT, PREFIXES
from eduu.utils import button_parser, commands, http
Expand Down
6 changes: 3 additions & 3 deletions eduu/plugins/notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

import re

from pyrogram import Client, filters
from pyrogram.enums import ParseMode
from pyrogram.types import InlineKeyboardMarkup, Message
from hydrogram import Client, filters
from hydrogram.enums import ParseMode
from hydrogram.types import InlineKeyboardMarkup, Message

from config import PREFIXES
from eduu.database.notes import add_note, get_all_notes, rm_note, update_note
Expand Down
4 changes: 2 additions & 2 deletions eduu/plugins/pastes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

from typing import TYPE_CHECKING

from pyrogram import Client, filters
from pyrogram.types import Message
from hydrogram import Client, filters
from hydrogram.types import Message

from config import PREFIXES
from eduu.utils import commands, http
Expand Down
4 changes: 2 additions & 2 deletions eduu/plugins/ping.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

from datetime import datetime

from pyrogram import Client, filters
from pyrogram.types import Message
from hydrogram import Client, filters
from hydrogram.types import Message

from config import PREFIXES
from eduu.utils import commands
Expand Down
6 changes: 3 additions & 3 deletions eduu/plugins/prints.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from json import JSONDecodeError

from httpx import HTTPError
from pyrogram import Client, filters
from pyrogram.enums import MessageEntityType
from pyrogram.types import Message
from hydrogram import Client, filters
from hydrogram.enums import MessageEntityType
from hydrogram.types import Message

from config import PREFIXES
from eduu.utils import commands, http
Expand Down
4 changes: 2 additions & 2 deletions eduu/plugins/pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import html
import re

from pyrogram import Client, filters
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
from hydrogram import Client, filters
from hydrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message

from config import PREFIXES
from eduu.utils import commands, http
Expand Down
Loading

0 comments on commit 3ff68a9

Please sign in to comment.