Exemplo n.º 1
0
    "\U0001F780-\U0001F7FF"  # Geometric Shapes Extended
    "\U0001F800-\U0001F8FF"  # Supplemental Arrows-C
    "\U0001F900-\U0001F9FF"  # Supplemental Symbols and Pictographs
    "\U0001FA00-\U0001FA6F"  # Chess Symbols
    "\U0001FA70-\U0001FAFF"  # Symbols and Pictographs Extended-A
    "\U00002702-\U000027B0"  # Dingbats 
    "]+")


def deEmojify(inputString: str) -> str:
    """Remove emojis and other non-safe characters from string"""
    return re.sub(EMOJI_PATTERN, '', inputString)


#@register(outgoing=True, pattern="^.waifu(?: |$)(.*)", allow_sudo=True))
@bot.on(dev_cmd(pattern=r"waifu(?: |$)(.*)", allow_sudo=True))
async def waifu(animu):
    #"""Creates random anime sticker!"""

    text = animu.pattern_match.group(1)
    if not text:
        if animu.is_reply:
            text = (await animu.get_reply_message()).message
        else:
            await animu.edit(
                "`You haven't written any article, Waifu is going away.`")
            return
    animus = [1, 3, 7, 9, 13, 22, 34, 35, 36, 37, 43, 44, 45, 52, 53, 55]
    sticcers = await bot.inline_query(
        "stickerizerbot", f"#{random.choice(animus)}{(deEmojify(text))}")
    await sticcers[0].click(animu.chat_id,
Exemplo n.º 2
0
"""Command:
.fpost word"""

import string

from telethon import events
from telethon.tl import types
from userbot import bot
from userbot.system import dev_cmd

msg_cache = {}


@bot.on(dev_cmd(pattern=f"fpost", outgoing=True))
async def _(event):
    await event.delete()
    text = event.pattern_match.group(1)
    destination = await event.get_input_chat()

    for c in text.lower():
        if c not in string.ascii_lowercase:
            continue
        if c not in msg_cache:
            async for msg in bot.iter_messages(None, search=c):
                if msg.raw_text.lower() == c and msg.media is None:
                    msg_cache[c] = msg
                    break
        await bot.forward_messages(destination, msg_cache[c])
Exemplo n.º 3
0
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
"""Urban Dictionary
Syntax: .ud Query"""

import asyncurban

from telethon import events
from userbot import bot
from userbot.system import dev_cmd


@bot.on(dev_cmd("ud (.*)"))
async def _(event):
    if event.fwd_from:
        return
    await event.edit("**Processing...**")
    word = event.pattern_match.group(1)
    urban = asyncurban.UrbanDictionary()
    try:
        mean = await urban.get_word(word)
        await event.edit(
            "**Testo: {}**\n\n**Definizione: {}**\n\n**Esempio: {}**".format(
                mean.word, mean.definition, mean.example))
    except asyncurban.WordNotFoundError:
        await event.edit("**Nessun risultato trovato per " + word + "**")
Exemplo n.º 4
0
# e viene rilasciato in base alla "Licenza GNU Affero General Public v3.0".
# Si prega di consultare <https://github.com/100101110/userbot-100101110/blob/master/LICENSE>
#
# Tutti i diritti riservati.
#
# Crediti: @100101110
#
"""Commands:
.like
.dislike"""

import asyncio
import random
import logging

from collections import deque
from telethon import events
from telethon.errors.rpcerrorlist import MessageIdInvalidError
from userbot import bot
from userbot.system import dev_cmd


@bot.on(dev_cmd("like", outgoing=True))
async def like(event):
    await event.edit("**👍🏻 a sniffmydroga💔 ᶜᵖᵗ piace questo elemento.**")


@bot.on(dev_cmd("dislike", outgoing=True))
async def dislike(event):
    await event.edit("**👎🏻 a sniffmydroga💔 ᶜᵖᵗ non piace questo elemento.**")
Exemplo n.º 5
0
"""Remove.BG Plugin
Syntax: .rmbg https://link.to/image.extension
Syntax: .rmbg as reply to a media"""

import asyncio
import io
import os
import requests

from datetime import datetime
from telethon import events
from userbot import bot
from userbot.system import progress, dev_cmd


@bot.on(dev_cmd("rmbg ?(.*)"))
async def _(event):
    HELP_STR = "**Rispondi `.rmbg` ad un img o insrisci un link e il comando**"
    if event.fwd_from:
        return
    if Var.REM_BG_API_KEY is None:
        await event.edit(
            "**Serve API token da remove.bg per usare questo plugin.**")
        return False
    input_str = event.pattern_match.group(1)
    start = datetime.now()
    message_id = event.message.id
    if event.reply_to_msg_id:
        message_id = event.reply_to_msg_id
        reply_message = await event.get_reply_message()
        # check if media message
Exemplo n.º 6
0
#
# Crediti: @100101110
#
"""
Commands:
.sos
.sup
"""

import asyncio
from telethon import events
from userbot import bot
from userbot.system import dev_cmd


@bot.on(dev_cmd("sup ?(.*)", outgoing=True))
async def sup(e):
    await e.edit("\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿"
                 "\n⣿⣿⣿⣿⣿⣿⡿⠋⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿"
                 "\n⣿⣿⣿⣿⣿⣿⠀⠀⣠⣾⣿⡿⠋⠀⠀⠉⠻⣿⣿⣿"
                 "\n⣿⣿⣿⣿⣿⣿⠀⠀⣿⣿⣿⠃⠀⠀⣀⡀⠀⢹⣿⣿"
                 "\n⣿⣿⣿⣿⣿⣿⡄⠀⠙⠻⠋⠀⠀⣸⣿⣿⠀⠀⣿⣿"
                 "\n⣿⣿⣿⣿⣿⣿⣷⣄⠀⠀⠀⠀⣰⣿⣿⠟⠀⢠⣿⣿"
                 "\n⣿⣿⣿⣿⣿⣿⡿⠛⠛⠒⠶⠾⢿⣿⣿⣷⣄⣾⣿⣿"
                 "\n⣿⣿⣿⣿⣿⣿⠁⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿"
                 "\n⣿⣿⣿⣿⣿⣿⠀⢰⣿⣿⣷⣶⣦⣼⣿⣿⣿⣿⣿⣿"
                 "\n⣿⣿⣿⣿⣿⣿⡀⠀⠙⠻⠿⠿⣿⣿⣿⣿⣿⣿⣿⣿"
                 "\n⣿⣿⢿⣿⣿⣿⣷⣄⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿"
                 "\n⣿⣿⠀⠀⠀⠉⠉⠛⠛⠛⠶⢶⣤⣼⣿⣿⣿⣿⣿⣿"
                 "\n⣿⣿⣦⣤⣤⣄⡀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿"
                 "\n⣿⣿⣿⣿⣿⣿⠁⠀⣾⣿⣷⡄⠀⢼⣿⣿⣿⣿⣿⣿"
Exemplo n.º 7
0
# Copyright © 2020 di 100101110 Github, <https://github.com/100101110>.
#
# Questo file fa parte del progetto <https://github.com/100101110/userbot-100101110>,
# e viene rilasciato in base alla "Licenza GNU Affero General Public v3.0".
# Si prega di consultare <https://github.com/100101110/userbot-100101110/blob/master/LICENSE>
#
# Tutti i diritti riservati.
"""Commands:
.bye"""

import time

from telethon.tl.functions.channels import LeaveChannelRequest
from userbot import bot
from userbot.system import dev_cmd


@bot.on(dev_cmd("bye", outgoing=True))
async def bye(e):
    if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
        await e.edit('**da ora in poi sono il fratm ingiustament uscit!**')
        time.sleep(3)
        if '-' in str(e.chat_id):
            await bot(LeaveChannelRequest(e.chat_id))
        else:
            await e.edit('**Non puoi abbandonare la chat**')
Exemplo n.º 8
0
"""BarCode Generator
Command .barcode"""

import asyncio
import barcode
import os
import time

from barcode.writer import ImageWriter
from datetime import datetime
from userbot import ALIVE_NAME, bot
from userbot.system import dev_cmd


@bot.on(dev_cmd(pattern="barcode (.*)"))
async def _(event):
    if event.fwd_from:
        return
    await event.edit(f"**Creo Stickers...**")
    start = datetime.now()
    input_str = event.pattern_match.group(1)
    message = "SYNTAX: .barcode <testo>"
    reply_msg_id = event.message.id
    if input_str:
        message = input_str
    elif event.reply_to_msg_id:
        previous_message = await event.get_reply_message()
        reply_msg_id = previous_message.id
        if previous_message.media:
            downloaded_file_name = await bot.download_media(
                previous_message,
Exemplo n.º 9
0
import os
import sys
import asyncio

from telethon import events
from userbot import CMD_HELP, ALIVE_NAME, bot
from userbot.system import dev_cmd
from platform import uname

# ================= CONSTANT =================
DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "100101110"
# ============================================


@bot.on(dev_cmd(pattern=f"hypno", outgoing=True))
async def _(event):
    if event.fwd_from:
        return
    animation_interval = 0.3
    animation_ttl = range(0, 15)
    #input_str = event.pattern_match.group(1)
    #if input_str == "hypno":
    await event.edit("hypno")
    animation_chars = [
        "⬜⬜⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜⬜⬜",
        "⬜⬜⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜⬜⬜\n⬜⬜⬜⬛⬜⬜⬜\n⬜⬜⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜⬜⬜",
        "⬜⬜⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜⬜⬜\n⬜⬜⬛⬛⬛⬜⬜\n⬜⬜⬛⬜⬛⬜⬜\n⬜⬜⬛⬛⬛⬜⬜\n⬜⬜⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜⬜⬜",
        "⬜⬜⬜⬜⬜⬜⬜\n⬜⬛⬛⬛⬛⬛⬜\n⬜⬛⬜⬜⬜⬛⬜\n⬜⬛⬜⬜⬜⬛⬜\n⬜⬛⬜⬜⬜⬛⬜\n⬜⬛⬛⬛⬛⬛⬜\n⬜⬜⬜⬜⬜⬜⬜",
        "⬛⬛⬛⬛⬛⬛⬛\n⬛⬜⬜⬜⬜⬜⬛\n⬛⬜⬜⬜⬜⬜⬛\n⬛⬜⬜⬜⬜⬜⬛\n⬛⬜⬜⬜⬜⬜⬛\n⬛⬜⬜⬜⬜⬜⬛\n⬛⬛⬛⬛⬛⬛⬛",
        "⬛⬜⬛⬜⬛⬜⬛⬜\n⬜⬛⬜⬛⬜⬛⬜⬛\n⬛⬜⬛⬜⬛⬜⬛⬜\n⬜⬛⬜⬛⬜⬛⬜⬛\n⬛⬜⬛⬜⬛⬜⬛⬜\n⬜⬛⬜⬛⬜⬛⬜⬛\n⬛⬜⬛⬜⬛⬜⬛⬜\n⬜⬛⬜⬛⬜⬛⬜⬛",
Exemplo n.º 10
0
from telethon import events, errors, functions, types
import inspect
import traceback
import asyncio
import sys
import io
from userbot import bot
from userbot.system import dev_cmd


@bot.on(dev_cmd(pattern="exec"))
async def _(event):
    if event.fwd_from:
        return
    await event.edit("**Processing...**")
    cmd = event.text.split(" ", maxsplit=1)[1]
    reply_to_id = event.message.id
    if event.reply_to_msg_id:
        reply_to_id = event.reply_to_msg_id

    old_stderr = sys.stderr
    old_stdout = sys.stdout
    redirected_output = sys.stdout = io.StringIO()
    redirected_error = sys.stderr = io.StringIO()
    stdout, stderr, exc = None, None, None

    try:
        await aexec(cmd, event)
    except Exception:
        exc = traceback.format_exc()
Exemplo n.º 11
0
"""CoinFlip by @Cattivah
Syntax: .coinflip [optional_choice]"""
import random, re
import asyncio
import time

from asyncio import wait, sleep
from telethon import events
from userbot.system import register, dev_cmd


@bot.on(dev_cmd(pattern="coin ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    r = random.randint(1, 100)
    input_str = event.pattern_match.group(1)
    if input_str:
        input_str = input_str.lower()
    if r % 2 == 1:
        if input_str == "testa":
            await event.edit("È uscito: **Testa**. \n Hai indovinato.")
        elif input_str == "croce":
            await event.edit("È uscito: **Testa**. \n Mi dispiace, hai perso.")
        else:
            await event.edit("È uscito: **Testa**.")
    elif r % 2 == 0:
        if input_str == "croce":
            await event.edit("È uscito: **Croce**. \n Hai indovinato.")
        elif input_str == "testa":
            await event.edit("È uscito: **Croce**. \n Mi dispiace, hai perso.")
Exemplo n.º 12
0
    "3D-Deadpool-Logo-Wallpaper", "Cool-Deadpool-Wallpaper",
    "Thor-Wallpaper-HD"
]


async def animepp():
    os.system("rm -rf donot.jpg")
    rnd = random.randint(0, len(COLLECTION_STRING) - 1)
    pack = COLLECTION_STRING[rnd]
    pc = requests.get("http://getwallpapers.com/collection/" + pack).text
    f = re.compile('/\w+/full.+.jpg')
    f = f.findall(pc)
    fy = "http://getwallpapers.com" + random.choice(f)
    print(fy)
    if not os.path.exists("f.ttf"):
        urllib.request.urlretrieve(
            "https://github.com/rebel6969/mym/raw/master/Rebel-robot-Regular.ttf",
            "f.ttf")
    urllib.request.urlretrieve(fy, "donottouch.jpg")


@bot.on(dev_cmd(pattern="marveldp ?(.*)"))
async def main(event):
    await event.edit("**Avvio Marvel Profile Pic...**")
    while True:
        await animepp()
        file = await event.client.upload_file("donottouch.jpg")
        await event.client(functions.photos.UploadProfilePhotoRequest(file))
        os.system("rm -rf donottouch.jpg")
        await asyncio.sleep(600)  #Edit this to your required needs
Exemplo n.º 13
0
"""" Spotify / Deezer downloader plugin by @leo4tomic | Syntax: .sdd link"""
import datetime
import asyncio
from telethon import events
from telethon.errors.rpcerrorlist import YouBlockedUserError, UserAlreadyParticipantError
from telethon.tl.functions.account import UpdateNotifySettingsRequest
from telethon.tl.functions.messages import ImportChatInviteRequest
from userbot.system import dev_cmd


@bot.on(dev_cmd("sdd ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    d_link = event.pattern_match.group(1)
    if ".com" not in d_link:
        await event.edit("` I need a link to download something pro.`**(._.)**"
                         )
    else:
        await event.edit("🎶**Sto iniziando a scaricare!**🎶")
    bot = "@DeezLoadBot"

    async with borg.conversation("@DeezLoadBot") as conv:
        try:
            await conv.send_message("/start")
            response = await conv.get_response()
            try:
                await bot(ImportChatInviteRequest('AAAAAFZPuYvdW1A8mrT8Pg'))
            except UserAlreadyParticipantError:
                await asyncio.sleep(0.00000069420)
            await conv.send_message(d_link)
Exemplo n.º 14
0
async def on_new_message(event):
    # TODO: exempt admins from locks
    name = event.raw_text
    snips = blacklist_sql.get_chat_blacklist(event.chat_id)
    for snip in snips:
        pattern = r"( |^|[^\w])" + re.escape(snip) + r"( |$|[^\w])"
        if re.search(pattern, name, flags=re.IGNORECASE):
            try:
                await event.delete()
            except Exception as e:
                await event.reply("**Non ho i permessi sufficenti in questa chat**")
                blacklist_sql.rm_from_blacklist(event.chat_id, snip.lower())
            break


@bot.on(dev_cmd("addblacklist ((.|\n)*)"))
async def on_add_black_list(event):
    text = event.pattern_match.group(1)
    to_blacklist = list(set(trigger.strip() for trigger in text.split("\n") if trigger.strip()))
    for trigger in to_blacklist:
        blacklist_sql.add_to_blacklist(event.chat_id, trigger.lower())
    await event.edit("**Aggiunto {} alla blacklist di questa chat**".format(len(to_blacklist)))


@bot.on(dev_cmd("listblacklist"))
async def on_view_blacklist(event):
    all_blacklisted = blacklist_sql.get_chat_blacklist(event.chat_id)
    OUT_STR = "**BlackList in questa Chat:**\n"
    if len(all_blacklisted) > 0:
        for trigger in all_blacklisted:
            OUT_STR += f"👉 {trigger} \n"
Exemplo n.º 15
0
"""Get ID of any Telegram media, or any user
Syntax: .get_id"""
from telethon import events
from telethon.utils import pack_bot_file_id
from userbot import bot
from userbot.system import dev_cmd


@bot.on(dev_cmd("get_id"))
async def _(event):
    if event.fwd_from:
        return
    if event.reply_to_msg_id:
        chat = await event.get_input_chat()
        r_msg = await event.get_reply_message()
        if r_msg.media:
            bot_api_file_id = pack_bot_file_id(r_msg.media)
            await event.edit(
                "**Chat ID**: `{}`\n**User ID**: `{}`\n**Bot API File ID**: `{}`"
                .format(str(event.chat_id), str(r_msg.from_id),
                        bot_api_file_id))
        else:
            await event.edit("**Chat ID**: `{}`\n**User ID**: `{}`".format(
                str(event.chat_id), str(r_msg.from_id)))
    else:
        await event.edit("**Chat ID**: `{}`".format(str(event.chat_id)))
Exemplo n.º 16
0
from telethon.errors import (ChannelInvalidError, ChannelPrivateError,
                             ChannelPublicGroupNaError, InviteHashEmptyError,
                             InviteHashExpiredError, InviteHashInvalidError)
from telethon.utils import get_input_location
from telethon import events, functions
from telethon.events import NewMessage
from telethon.tl.custom import Dialog
from userbot import CMD_HELP, bot, ALIVE_NAME
from userbot.system import dev_cmd, register, errors_handler

# ================= CONSTANT =================
DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "100101110"
# ============================================


@bot.on(dev_cmd(pattern="dc"))  # pylint:disable=E0602
async def _(event):
    if event.fwd_from:
        return
    result = await borg(functions.help.GetNearestDcRequest())  # pylint:disable=E0602
    await event.edit(f"**Paese:** {result.country}\n"
                     f"**DC vicino:** {result.nearest_dc}\n"
                     f"**DC:** {result.this_dc}")


@register(pattern=".chatinfo(?: |$)(.*)", outgoing=True)
@errors_handler
async def info(event):
    await event.edit(f"`{DEFAULTUSER}:`**Ricerca nel database...**")
    chat = await get_chatinfo(event)
    caption = await fetch_info(chat, event)
Exemplo n.º 17
0
#
# Tutti i diritti riservati.
#
# Crediti: @Cattivah
#
"""Commands:
.ciro"""

import asyncio
from telethon import events
from platform import uname
from userbot import CMD_HELP, ALIVE_NAME, bot
from userbot.system import dev_cmd


@bot.on(dev_cmd(pattern=f"ciro", outgoing=True))
async def _(event):
    if event.fwd_from:
        return
    await event.edit("**TG5:** Le scuole chiudono a Napoli...")
    await event.sleep(1)
    await event.edit("**CIRO:** È tempo di giocare a Scuole Chiude a Napoli..."
                     )
    await event.sleep(1)
    await event.edit(
        "__Ciao Gamer! Facciamo un gioco: ipotizziamo che stai scaricando Scuole Chiuse a Napoli in questo momento: inizi a giocarci e ci rimani in fissa. Facciamo finta che hai capito al volo come funziona: due team composti da 5 giocatori senza casco che si affrontano per distruggersi a vicenda in una mappa piena di obbiettivi e orologi. Tra le centinaia di campioni disponibili, scegli Ciro, ti piace Ciro; con Ciro è facile rubare agli avversari. non hai bisogno di essere il migliore fin da subito, poiché il gioco stesso ti posiziona davanti a stranieri del tuo stesso livello intellettuale; giocandovi e divertendovi diventerai sempre più bravo. È così che vinci il tuo primo orologio. Insieme ad altri quattro sconosciuti è bello, certo, ma ti accorgi che affrontare gli avversari con un gruppo di amici è molto più divertente. Tu puoi essere il uaglio, qualcun altro l'affammoc e così via. Scarica anche tu Scuole Chiuse a Napoli.__"
    )
Exemplo n.º 18
0
import git
from git import Repo
from git.exc import GitCommandError, InvalidGitRepositoryError, NoSuchPathError
from userbot import bot, ALIVE_NAME, UPSTREAM_REPO_URL
from userbot.system import dev_cmd
from var import Var

# -- Constants -- #
UPSTREAM_REPO_URL = "https://github.com/Leoatomic/ubotpack.git"
HEROKU_GIT_REF_SPEC = "HEAD:refs/heads/master"
DELETE_TIMEOUT = 4
DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "@AtomicUserbot"
# -- Constants End -- #


@bot.on(dev_cmd("update ?(.*)", outgoing=True))
async def updater(upd):
    "For .update command, check if the bot is up to date, update if specified"
    await upd.edit('**Ricerca update in corso....**')

    try:
        repo = git.Repo()
    except git.exc.InvalidGitRepositoryError as e:
        repo = git.Repo.init()
        origin = repo.create_remote('updater', UPSTREAM_REPO_URL)
        origin.fetch()
        repo.create_head('master', origin.refs.master)
        repo.heads.master.set_tracking_branch(origin.refs.master)
        repo.heads.master.checkout(True)

    active_branch_name = repo.active_branch.name
Exemplo n.º 19
0
#
# Tutti i diritti riservati.
# 
# Crediti: @100101110
#

import asyncio
from telethon import events, version
from telethon.tl.types import ChannelParticipantsAdmins
from platform import uname
from userbot import ALIVE_NAME, bot, versions
from userbot.system import dev_cmd

# ================= CONSTANT =================
DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "100101110"
# ============================================

@bot.on(dev_cmd(pattern=f"alive", outgoing=True))
async def amireallyalive(alive):
    """ For .alive command, check if the bot is running. """
    await alive.edit("**▬▬▬▬▬ ❴✪❵ SYSTEM ❴✪❵ ▬▬▬▬▬**\n\n"
                     f"**> Telethon:** {version.__version__}\n"
                     f"**> Python:** {versions.__python_version__}\n"
                     f"**> Firmware:** {versions.__version__}\n"
                     f"**> Licenza:** {versions.__license__}\n"
                     f"**> Copyright:** {versions.__copyright__}\n"
                     "**> [UPDATE](https://t.me/IOIIOIIIOIIOI)\n**"
                     f"**> 👤 USER**: {DEFAULTUSER}\n\n"
                     CIAO
                     "▬▬▬▬▬▬▬▬ ❴✪❵ ▬▬▬▬▬▬▬▬")
Exemplo n.º 20
0
"""Check your internet speed powered by speedtest.net
Syntax: .speedtest
Available Options: image, file, text"""

from telethon import events
from datetime import datetime
import io
import speedtest
from userbot import bot
from userbot.system import dev_cmd


@bot.on(dev_cmd("speedtest ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    as_text = True
    as_document = False
    if input_str == "image":
        as_document = False
    elif input_str == "file":
        as_document = True
    elif input_str == "text":
        as_text = True
    await event.edit("`Calculating my internet speed. Please wait!`")
    start = datetime.now()
    s = speedtest.Speedtest()
    s.get_best_server()
    s.download()
    s.upload()
Exemplo n.º 21
0
"""Syntax:
.hp"""

import asyncio
import os
import sys
import random

from telethon import events
from userbot import bot
from userbot.system import dev_cmd


@bot.on(dev_cmd(pattern=f"hps", outgoing=True))
async def _(event):
    if event.fwd_from:
        return
    x = (random.randrange(1, 40))
    if (x == 1):
        await event.edit("**Aberto**")
    if (x == 2):
        await event.edit("**Accio**")
    if (x == 3):
        await event.edit("**Aguamenti**")
    if (x == 4):
        await event.edit("**Alohomora**")
    if (x == 5):
        await event.edit("**Avada Kedavra**")
    if (x == 6):
        await event.edit("**Colloportus**")
    if (x == 7):
Exemplo n.º 22
0
"""Syntax:
.cmeme"""

import asyncio
import os
import sys
import random

from telethon import events
from userbot import bot
from userbot.system import dev_cmd


@bot.on(dev_cmd(pattern=f"cmeme", outgoing=True))
async def _(event):
    if event.fwd_from:
        return
    x = (random.randrange(1, 27))
    if (x == 1):
        await event.edit("**Sei un meme, valore : 1%**")
    if (x == 2):
        await event.edit("**Sei un meme, valore : 5%**")
    if (x == 3):
        await event.edit("**Sei un meme, valore : 10%**")
    if (x == 4):
        await event.edit("**Sei un meme, valore : 15%**")
    if (x == 5):
        await event.edit("**Sei un meme, valore : 20%**")
    if (x == 6):
        await event.edit("**Sei un meme, valore : 25%**")
    if (x == 7):
Exemplo n.º 23
0
"""CoronaVirus LookUp
Syntax: .covid <country>"""
from covid import Covid
covid = Covid(source="worldometers")
from datetime import datetime
from userbot import bot
from userbot.system import dev_cmd


@bot.on(dev_cmd(pattern="covid (.*)"))
async def _(event):
    await event.edit("**Processing...**")
    country = event.pattern_match.group(1)
    covid = Covid()
    country_data = covid.get_status_by_country_name(country)
    deaths = covid.get_total_deaths()
    if country_data:
        output_text =  f"**Confermati**: {country_data['confirmed']}\n"
        output_text += f"**Attuali**: {country_data['active']}\n"
        output_text += f"**Morti**: {country_data['deaths']}\n"
        output_text += f"**Ricoverati**: {country_data['recovered']}\n\n"        
        output_text += f"TOTALI\n\n"                
        output_text += f"**Morti**: {covid.get_total_deaths()}\n"
        output_text += f"**Ricoverati**: {covid.get_total_recovered()}\n"
        output_text += f"**Confermati**: {covid.get_total_confirmed_cases()}\n"
        output_text += f"**Attuali**: {covid.get_total_active_cases()}\n\n"
        output_text += ("**Aggiornato**: "f"{datetime.utcfromtimestamp(country_data['last_update'] // 1000).strftime('%H:%M')}[GMT]\n")
    else:
        output_text = "**Invalid Country name**"
    await event.edit(f"**Corona Virus Info in** {country}:\n\n{output_text}")
Exemplo n.º 24
0
            seconds, 24)
        if seconds == 0 and remainder == 0:
            break
        time_list.append(int(result))
        seconds = int(remainder)
    hmm = len(time_list)
    for x in range(hmm):
        time_list[x] = str(time_list[x]) + time_suffix_list[x]
    if len(time_list) == 4:
        up_time += time_list.pop() + ", "
    time_list.reverse()
    up_time += ":".join(time_list)
    return up_time


@bot.on(dev_cmd(pattern="alive", outgoing=True))
async def amireallyalive(alive):
    """ For .alive command, check if the bot is running. """
    uptime = await get_readable_time((time.time() - StartTime))
    start = datetime.now()
    await alive.edit(
        f"⚙️ **Userbot Online** \n\n ** • 🗃 Database:** `Funzionante` \n ** • [🪐](https://github.com/Leoatomic/Userbot) AtomicUserbot Version:** `2.0` \n ** • 🐍 Python Version:** `3.9.2`\n ** • 📚 Telethon Version:** `1.21.1` \n ** • 📶 Latenza:** `Calcolo...` \n ** • ⏳ Ultimo Riavvio:** `{uptime}`"
    )
    end = datetime.now()
    ms = (end - start).microseconds / 10000
    await alive.edit(
        f"⚙️ **Userbot Online** \n\n ** • 🗃 Database:** `Funzionante` \n ** • [🪐](https://github.com/Leoatomic/Userbot) AtomicUserbot Version:** `2.0` \n ** • 🐍 Python Version:** `3.9.2`\n ** • 📚 Telethon Version:** `1.21.1` \n ** • 📶 Latenza:** `{ms}` \n ** • ⏳ Ultimo Riavvio:** `{uptime}`"
    )


@bot.on(dev_cmd(pattern=f"on", outgoing=True))
Exemplo n.º 25
0
# This is a troll indeed ffs *facepalm*
import asyncio
from telethon import events
from telethon.tl.functions.users import GetFullUserRequest
from telethon.tl.types import ChannelParticipantsAdmins
from userbot import bot
from userbot.system import dev_cmd


@bot.on(dev_cmd("gbun"))
async def gbun(event):
    if event.fwd_from:
        return
    gbunVar = event.text
    gbunVar = gbunVar[6:]
    mentions = "**Warning!! User 𝙂𝘽𝘼𝙉𝙉𝙀𝘿 By Admin...**\n"
    no_reason = "**__MOTIVO: Guardi troppi porno.__**"
    await event.edit("**Summoning out le Gungnir ❗️⚜️☠️**")
    asyncio.sleep(3.5)
    chat = await event.get_input_chat()
    async for x in bot.iter_participants(chat,
                                         filter=ChannelParticipantsAdmins):
        mentions += f""
    reply_message = None
    if event.reply_to_msg_id:
        reply_message = await event.get_reply_message()
        replied_user = await event.client(
            GetFullUserRequest(reply_message.from_id))
        firstname = replied_user.user.first_name
        usname = replied_user.user.username
        idd = reply_message.from_id
Exemplo n.º 26
0
from telethon import events
from userbot import bot
from userbot.system import dev_cmd


@bot.on(dev_cmd("blu (.*)"))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    if event.reply_to_msg_id:
        previous_message = await event.get_reply_message()
        if previous_message.forward:
            replied_user = previous_message.forward.from_id
        else:
            replied_user = previous_message.from_id
    else:
        await event.edit("rispondi ad un messaggio")
    user_id = replied_user
    caption = """<a href='tg://user?id={}'>{}</a>""".format(user_id, input_str)
    await event.edit(caption, parse_mode="HTML")
Exemplo n.º 27
0
""" Google Text to Speak
Commands:
.tts LanguageCode as reply to a message
.tts LangaugeCode | text to speak"""

import asyncio
import os
import subprocess
from datetime import datetime
from gtts import gTTS
from userbot import bot
from userbot.system import dev_cmd
from userbot.uniborgConfig import Config


@bot.on(dev_cmd(pattern="tts (.*)"))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    start = datetime.now()
    if event.reply_to_msg_id:
        previous_message = await event.get_reply_message()
        text = previous_message.message
        lan = input_str
    elif "|" in input_str:
        lan, text = input_str.split("|")
    else:
        await event.edit("`.tts LanguageCode` **in risposta a messaggi.**")
        return
    await event.delete()  # Ilas
Exemplo n.º 28
0
from telethon import events
import asyncio
from datetime import datetime
from telethon.tl.types import User, Chat, Channel
from userbot.system import dev_cmd


@bot.on(dev_cmd(pattern="count"))
async def _(event):
    if event.fwd_from:
        return
    start = datetime.now()
    u = 0  # number of users
    g = 0  # number of basic groups
    c = 0  # number of super groups
    bc = 0  # number of channels
    b = 0  # number of bots
    await event.edit("Retrieving Telegram Count(s)")
    async for d in borg.iter_dialogs(limit=None):
        if d.is_user:
            if d.entity.bot:
                b += 1
            else:
                u += 1
        elif d.is_channel:
            if d.entity.broadcast:
                bc += 1
            else:
                c += 1
        elif d.is_group:
            g += 1
Exemplo n.º 29
0
    DocumentAttributeSticker,
    InputMediaUploadedDocument,
    InputPeerNotifySettings,
    InputStickerSetID,
    InputStickerSetShortName,
    MessageMediaPhoto
)
from userbot.system import dev_cmd
from userbot import ALIVE_NAME, bot
from userbot.uniborgConfig import Config

# ================= CONSTANT =================
DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "100101110"
# ============================================

@bot.on(dev_cmd(pattern="sticker ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    if not event.is_reply:
        await event.edit(f"`{DEFAULTUSER}:`**Rispondi ad un img per creare uno Stickers**")
        return
    reply_message = await event.get_reply_message()
    sticker_emoji = "🔥"
    input_str = event.pattern_match.group(1)
    if input_str:
        sticker_emoji = input_str

    user = await bot.get_me()
    if not user.first_name:
        user.first_name = user.id
Exemplo n.º 30
0
"""Commands:
.fadmin"""

import asyncio

from telethon import events
from userbot import bot
from userbot.system import dev_cmd


@bot.on(dev_cmd(pattern=f"fadmin", outgoing=True))
async def _(event):
    if event.fwd_from:
        return
    animation_interval = 1
    animation_ttl = range(0, 20)
    #input_str = event.pattern_match.group(1)
    #if input_str == "fadmin":
    await event.edit("fadmin")
    animation_chars = [
        "**Promozione User ad Admin...**",
        "**Attivazione di tutti i Permessi...**",
        "**(1) Inviare Messaggi: ☑️**", "**(1) Inviare Messaggi: ✅**",
        "**(2) Inviare Media: ☑️**", "**(2) Inviare Media: ✅**",
        "**(3) Inviare stickers & GIF: ☑️**",
        "**(3) Inviare stickers & GIF: ✅**", "**(4) Inviare sondaggi: ☑️**",
        "**(4) Inviare sondaggi: ✅**",
        "**(5) Inviare link con anteprima: ☑️**",
        "**(5) Inviare link con anteprima: ✅**",
        "**(6) Aggiungere utenti: ☑️**", "**(6) Aggiungere utenti: ✅**",
        "**(7) Fissare messaggi: ☑️**", "**(7) Fissare messaggi: ✅**",