Ejemplo n.º 1
0
#
# All rights reserved.

import asyncio
from time import time

from git import Repo
from git.exc import GitCommandError

from petercord import Config, Message, petercord, pool

LOG = petercord.getLogger(__name__)
CHANNEL = petercord.getCLogger(__name__)


@petercord.on_cmd(
    "update",
    about={
        "header":
        "Check Updates or Update Petercord",
        "flags": {
            "-pull": "pull updates",
            "-push": "push updates to heroku",
            "-master": "select master branch",
            "-beta": "select beta branch",
        },
        "petercord":
        "{tr}update : check updates from master branch\n"
        "{tr}update -[branch_name] : check updates from any branch\n"
        "add -pull if you want to pull updates\n"
        "add -push if you want to push updates to heroku",
Ejemplo n.º 2
0
# Thanks to @Intellivoid For Creating CoffeeHouse API

import os
import random
import asyncio
from time import time

from coffeehouse.api import API
from coffeehouse.lydia import LydiaAI, Session
from coffeehouse.exception import CoffeeHouseError
from pyrogram.errors.exceptions.bad_request_400 import PeerIdInvalid

from petercord import petercord, get_collection, Message, filters, pool
from petercord.utils import get_file_id_of_media

LOGGER = petercord.getCLogger(__name__)
LYDIA_CHATS = get_collection("LYDIA_CHATS")
CH_LYDIA_API = os.environ.get("CH_LYDIA_API", None)
CUSTOM_REPLY_CHANNEL = int(os.environ.get("CUSTOM_REPLY_CHANNEL", 0))
if CH_LYDIA_API is not None:
    LYDIA = LydiaAI(API(CH_LYDIA_API))

ACTIVE_CHATS = {}
CUSTOM_REPLIES_IDS = []
QUEUE = asyncio.Queue()

LYDIA_API_INFO = """This module uses Lydia AI
Powered by CoffeeHouse API created by @Intellivoid.

Lydia is a Active Machine Learning Chat Bot.
Which can adapt to current user and chat with user
Ejemplo n.º 3
0
import os
import asyncio

from petercord import petercord, Message, Config

S_LOG = petercord.getCLogger(__name__)


@petercord.on_cmd(
    "spam",
    about={
        'header':
        "Spam some Messages",
        'description':
        "Message Spam module just for fun."
        "Btw Don't over use this plugin or get"
        "ready for account ban or flood waits. "
        "For spamming text use '|' to separate count and text.",
        'petercord':
        "{tr}spam [spam count] | [spam message/reply to a media] | [Optional: delay]",
        'examples':
        "**For Text:** `{tr}spam 2 | Durov will ban me for using this plugin`"
    })
async def spam(message: Message):
    replied = message.reply_to_message
    delay = str(0.1)
    is_str = "|" in message.input_str
    if (replied and replied.media and not is_str):
        if not os.path.isdir(Config.DOWN_PATH):
            os.makedirs(Config.DOWN_PATH)
        if replied.sticker:
Ejemplo n.º 4
0
import os
import re
import shutil
from pathlib import Path
import deezloader  # pylint: disable=W0406
from deezloader.exceptions import NoDataApi

from petercord import petercord, Message, pool
from petercord.plugins.misc.upload import doc_upload, audio_upload

Clogger = petercord.getCLogger(__name__)
ARL_TOKEN = os.environ.get("ARL_TOKEN")
TEMP_PATH = 'deezdown_temp/'
REX = re.compile(r"https?:\/\/(open\.spotify|www\.deezer)\.com\/"
                 r"(track|album|playlist)\/[A-Z0-9a-z]{3,}")
ARL_HELP = """**Oops, Time to Help Yourself**
[Here Help Yourself](https://www.google.com/search?q=how+to+get+deezer+arl+token)

After getting Arl token Config `ARL_TOKEN` var in heroku"""


@petercord.on_cmd(
    "deezload",
    about={
        'header':
        "DeezLoader for Petercord",
        'description':
        "Download Songs/Albums/Playlists via "
        "Spotify or Deezer Links. "
        "\n<b>NOTE:</b> Music Quality is optional",
        'flags': {
Ejemplo n.º 5
0
# All rights reserved.

import aiohttp

from petercord import Message, petercord

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


@petercord.on_cmd(
    "dic",
    about={
        "header": "English Dictionary-telegram",
        "petercord": "{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"
        for i in s_word:
            if "definition" in i:
                if "example" in i:
                    w_word += ("\n👩‍🏫 **Definition** 👨‍🏫\n<pre>" +