Exemple #1
0
import re
import math
import time
import asyncio
from datetime import datetime
from pathlib import Path

from pySmartDL import SmartDL
from hachoir.metadata import extractMetadata
from hachoir.parser import createParser
from pyrogram.errors.exceptions import FloodWait

from userge import userge, Config, Message
from userge.utils import progress, take_screen_shot, humanbytes

LOGGER = userge.getLogger(__name__)
CHANNEL = userge.getCLogger(__name__)

LOGO_PATH = 'resources/iu.png'
THUMB_PATH = Config.DOWN_PATH + "thumb_image.jpg"


@userge.on_cmd(
    "rename",
    about={
        'header': "Rename telegram files",
        'flags': {
            '-d': "upload as document"
        },
        'usage':
        "{tr}rename [flags] [new_name_with_extention] : reply to telegram media",
Exemple #2
0
#
# All rights reserved.

import asyncio
import shutil
import time

from pyrogram.types import User

from userge import Config, Message, get_collection, userge
from userge.core.ext import RawClient
from userge.utils import terminate

SAVED_SETTINGS = get_collection("CONFIGS")
MAX_IDLE_TIME = 300
LOG = userge.getLogger(__name__)
CHANNEL = userge.getCLogger(__name__)


async def _init() -> None:
    global MAX_IDLE_TIME  # pylint: disable=global-statement
    d_s = await SAVED_SETTINGS.find_one({"_id": "DYNO_SAVER"})
    if d_s:
        Config.RUN_DYNO_SAVER = bool(d_s["on"])
        MAX_IDLE_TIME = int(d_s["timeout"])


@userge.on_cmd(
    "restart",
    about={
        "header": "Restarts the bot and reload all plugins",
Exemple #3
0
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
#
# This file is part of < https://github.com/UsergeTeam/Userge > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE >
#
# All rights reserved.

import aiohttp

from userge import userge, Message

LOG = userge.getLogger(__name__)  # logger object
CHANNEL = userge.getCLogger(__name__)  # channel logger object


@userge.on_cmd("dic",
               about={
                   'header': "English Dictionary-telegram",
                   'usage': "{tr}dic [word]",
                   'examples': 'word : Search for any word'
               })
async def dictionary(message: Message):
    """this is a dictionary"""
    LOG.info("starting dic command...")
    input_ = message.input_str

    await message.edit("`processing...⚙️🛠`")

    def combine(s_word, name):
        w_word = f"🛑--**__{name.title()}__**--\n"