├── README.md
├── runtime.txt
├── .github
├── workflows
│ ├── ISSUE_TEMPLATE
│ │ ├── bug_report.md
│ │ ├── python-app.yml
│ │ └── pylint.yml
│ ├── python-app.yml
│ └── pylint.yml
└── FUNDING.yml
├── userbot
├── modules
│ ├── .bin
│ │ └── readme
│ ├── sql_helper
│ │ ├── .DS_Store
│ │ ├── __init__.py
│ │ ├── keep_read_sql.py
│ │ ├── gmute_sql.py
│ │ ├── pm_permit_sql.py
│ │ ├── mute_sql.py
│ │ ├── fban_sql.py
│ │ ├── spam_mute_sql.py
│ │ ├── gban_sql.py
│ │ ├── globals.py
│ │ ├── google_drive_sql.py
│ │ ├── snips_sql.py
│ │ ├── lydia_sql.py
│ │ ├── notes_sql.py
│ │ ├── filter_sql.py
│ │ ├── welcome_sql.py
│ │ ├── antiflood_sql.py
│ │ └── blacklist_sql.py
│ ├── __init__.py
│ ├── lordae.py
│ ├── tag_all.py
│ ├── gcast.py
│ ├── salam.py
│ ├── oi.py
│ ├── lordhelper.py
│ ├── db.py
│ ├── resi.py
│ ├── hentai.py
│ ├── gps.py
│ ├── id.py
│ ├── lordtm.py
│ ├── user_id.py
│ ├── bitly.py
│ ├── lord.py
│ ├── lordfun.py
│ ├── __help.py
│ ├── frog.py
│ ├── figlet.py
│ ├── lordtt.py
│ ├── mentions.py
│ ├── adzan.py
│ ├── emojigames.py
│ ├── github.py
│ ├── lorddeteksi.py
│ ├── webupload.py
│ ├── gban.py
│ ├── spotifynow.py
│ ├── lyrics.py
│ ├── wallpaper.py
│ ├── antiflood.py
│ ├── ss_video.py
│ ├── sangmata.py
│ ├── coolprofilepics.py
│ ├── fakegban.py
│ ├── create.py
│ ├── hash.py
│ ├── createstickers.py
│ ├── lordig.py
│ ├── covid.py
│ ├── lordtiny.py
│ ├── lordhz.py
│ ├── spam.py
│ ├── rastick.py
│ ├── lordimp.py
│ ├── lordwc.py
│ ├── blacklist.py
│ ├── help.py
│ ├── sed.py
│ ├── gitcommit.py
│ ├── telegraph.py
│ ├── stat.py
│ ├── filemanager.py
│ ├── lordsong.py
│ ├── quotly.py
│ └── stickers_v2.py
├── utils
│ ├── styles
│ │ ├── FontLord.ttf
│ │ ├── lordfont.ttf
│ │ ├── MutantAcademyStyle.ttf
│ │ ├── ProductSans-Light.ttf
│ │ └── ProductSans-BoldItalic.ttf
│ ├── exceptions.py
│ ├── __init__.py
│ ├── funtions.py
│ ├── chrome.py
│ └── progress.py
├── __main__.py
└── core.py
├── heroku.yml
├── LordUserbot
└── lorduserbot.png
├── Procfile.txt
├── .deepsource.toml
├── .travis.yml
├── .gitignore
├── windows_startup_script.py
├── init
├── start.sh
├── userbot
├── Merge.sh
├── CI_Test_Script.sh
└── telegram
├── generate_session_file.py
├── string_session.py
├── requirements.txt
├── Getstring.sh
├── varshelper.txt
├── termux_install.sh
├── sample_config.env
└── CODE_OF_CONDUCT
/README.md:
--------------------------------------------------------------------------------
1 | OFF ❌
2 |
--------------------------------------------------------------------------------
/runtime.txt:
--------------------------------------------------------------------------------
1 | python-3.9.2
2 |
--------------------------------------------------------------------------------
/.github/workflows/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/userbot/modules/.bin/readme:
--------------------------------------------------------------------------------
1 | /bin/sh -c curl https://cli-assets.heroku.com/install.sh
2 |
--------------------------------------------------------------------------------
/heroku.yml:
--------------------------------------------------------------------------------
1 | build:
2 | docker:
3 | worker: Dockerfile
4 | run:
5 | worker: python3 -m userbot
6 |
--------------------------------------------------------------------------------
/LordUserbot/lorduserbot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zora24/Lord-Userbot/HEAD/LordUserbot/lorduserbot.png
--------------------------------------------------------------------------------
/Procfile.txt:
--------------------------------------------------------------------------------
1 | build:
2 | docker:
3 | worker: Dockerfile
4 | run:
5 | worker: python3 -m userbot
6 |
--------------------------------------------------------------------------------
/userbot/utils/styles/FontLord.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zora24/Lord-Userbot/HEAD/userbot/utils/styles/FontLord.ttf
--------------------------------------------------------------------------------
/userbot/utils/styles/lordfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zora24/Lord-Userbot/HEAD/userbot/utils/styles/lordfont.ttf
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zora24/Lord-Userbot/HEAD/userbot/modules/sql_helper/.DS_Store
--------------------------------------------------------------------------------
/userbot/utils/styles/MutantAcademyStyle.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zora24/Lord-Userbot/HEAD/userbot/utils/styles/MutantAcademyStyle.ttf
--------------------------------------------------------------------------------
/userbot/utils/styles/ProductSans-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zora24/Lord-Userbot/HEAD/userbot/utils/styles/ProductSans-Light.ttf
--------------------------------------------------------------------------------
/userbot/utils/styles/ProductSans-BoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zora24/Lord-Userbot/HEAD/userbot/utils/styles/ProductSans-BoldItalic.ttf
--------------------------------------------------------------------------------
/.deepsource.toml:
--------------------------------------------------------------------------------
1 | version = 1
2 |
3 | [[analyzers]]
4 | name = "python"
5 | enabled = true
6 |
7 | [analyzers.meta]
8 | runtime_version = "3.x.x"
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: python
2 | python:
3 | - "3.9.2"
4 | # command to install dependencies
5 | install:
6 | - pip install -r requirements.txt
7 | script: echo overide build
8 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | config.env
2 | __pycache__/*
3 | userbot.db
4 | userbot.session
5 | userbot.session-journal
6 | userbot/__pycache__/*
7 | userbot/modules/__pycache__/*
8 | userbot/modules/sql_helper/__pycache__/*
9 | .progress
10 | .vscode/*
11 | bin/*
12 | TG_BOT_TOKEN.session
--------------------------------------------------------------------------------
/windows_startup_script.py:
--------------------------------------------------------------------------------
1 | from telethon import TelegramClient
2 | API_KEY = "Type that here"
3 | API_HASH = "Type that here"
4 | # get it from my.telegram.org
5 | bot = TelegramClient('userbot', API_KEY, API_HASH)
6 | bot.start()
7 |
8 | # This script wont run your bot, it just generates a session.
9 |
--------------------------------------------------------------------------------
/init/start.sh:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env bash
2 | # Copyright (C) 2019 The Raphielscape Company LLC.
3 | #
4 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
5 | # you may not use this file except in compliance with the License.
6 | #
7 |
8 | redis-server --daemonize yes
9 | python3 -m userbot
10 |
--------------------------------------------------------------------------------
/init/userbot:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Telegram UserBot Systemd Service
3 | After=network.target
4 |
5 | [Install]
6 | WantedBy=multi-user.target
7 |
8 | [Service]
9 | Type=simple
10 | User=root
11 | ExecStart=bash ./start.sh
12 | ProtectSystem=full
13 | Restart=on-failure
14 | # Other Restart options: or always, on-abort, etc
15 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [sahyam2019] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | custom: # Replace with a single custom sponsorship URL
9 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/__init__.py:
--------------------------------------------------------------------------------
1 | from sqlalchemy import create_engine
2 | from sqlalchemy.ext.declarative import declarative_base
3 | from sqlalchemy.orm import sessionmaker, scoped_session
4 | from userbot import DB_URI
5 |
6 | BASE = declarative_base()
7 |
8 |
9 | def start() -> scoped_session:
10 | engine = create_engine(DB_URI)
11 | BASE.metadata.bind = engine
12 | BASE.metadata.create_all(engine)
13 | return scoped_session(sessionmaker(bind=engine, autoflush=False))
14 |
15 |
16 | SESSION = start()
17 |
--------------------------------------------------------------------------------
/generate_session_file.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.
2 | #
3 | # Licensed under the Raphielscape Public License, Version 1.b (the "License");
4 | # you may not use this file except in compliance with the License.
5 | #
6 | # This script wont run your bot, it just generates a session.
7 |
8 | from telethon import TelegramClient
9 | from dotenv import load_dotenv
10 | import os
11 |
12 | load_dotenv("config.env")
13 |
14 | API_KEY = os.environ.get("API_KEY", None)
15 | API_HASH = os.environ.get("API_HASH", None)
16 |
17 | bot = TelegramClient('userbot', API_KEY, API_HASH)
18 | bot.start()
19 |
--------------------------------------------------------------------------------
/userbot/modules/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.
2 | #
3 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
4 | # you may not use this file except in compliance with the License.
5 | #
6 | """ Init file which loads all of the modules """
7 | from userbot import LOGS
8 |
9 |
10 | def __list_all_modules():
11 | from os.path import dirname, basename, isfile
12 | import glob
13 |
14 | mod_paths = glob.glob(dirname(__file__) + "/*.py")
15 | all_modules = [
16 | basename(f)[:-3] for f in mod_paths
17 | if isfile(f) and f.endswith(".py") and not f.endswith("__init__.py")
18 | ]
19 | return all_modules
20 |
21 |
22 | ALL_MODULES = sorted(__list_all_modules())
23 | LOGS.info("Modules to load: %s", str(ALL_MODULES))
24 | __all__ = ALL_MODULES + ["ALL_MODULES"]
25 |
--------------------------------------------------------------------------------
/userbot/utils/exceptions.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2020 Adek Maulana
2 | #
3 | # SPDX-License-Identifier: GPL-3.0-or-later
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program. If not, see .
16 |
17 | class CancelProcess(Exception):
18 | """Cancel Process"""
19 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/keep_read_sql.py:
--------------------------------------------------------------------------------
1 | try:
2 | from userbot.modules.sql_helper import SESSION, BASE
3 | except ImportError:
4 | raise AttributeError
5 |
6 | from sqlalchemy import Column, String
7 |
8 |
9 | class KRead(BASE):
10 | __tablename__ = "kread"
11 | groupid = Column(String(14), primary_key=True)
12 |
13 | def __init__(self, sender):
14 | self.groupid = str(sender)
15 |
16 |
17 | KRead.__table__.create(checkfirst=True)
18 |
19 |
20 | def is_kread():
21 | try:
22 | return SESSION.query(KRead).all()
23 | except BaseException:
24 | return None
25 | finally:
26 | SESSION.close()
27 |
28 |
29 | def kread(chat):
30 | adder = KRead(str(chat))
31 | SESSION.add(adder)
32 | SESSION.commit()
33 |
34 |
35 | def unkread(chat):
36 | rem = SESSION.query(KRead).get((str(chat)))
37 | if rem:
38 | SESSION.delete(rem)
39 | SESSION.commit()
40 |
--------------------------------------------------------------------------------
/userbot/modules/lordae.py:
--------------------------------------------------------------------------------
1 | # Based Plugins
2 | # Ported for Lord-Userbot By liualvinas/Alvin
3 |
4 | from telethon import events
5 | from userbot.events import register
6 | from userbot import CMD_HELP
7 |
8 | PRINTABLE_ASCII = range(0x21, 0x7F)
9 |
10 |
11 | def aesthetify(string):
12 | for c in string:
13 | c = ord(c)
14 | if c in PRINTABLE_ASCII:
15 | c += 0xFF00 - 0x20
16 | elif c == ord(" "):
17 | c = 0x3000
18 | yield chr(c)
19 |
20 |
21 | @register(outgoing=True, pattern=r"^\.ae(?: |$)(.*)")
22 | async def _(event):
23 | if event.fwd_from:
24 | return
25 | text = event.pattern_match.group(1)
26 | text = "".join(aesthetify(text))
27 | await event.edit(text=text, parse_mode=None, link_preview=False)
28 | raise events.StopPropagation
29 |
30 |
31 | CMD_HELP.update({
32 | "aeshtetic":
33 | "`.ae `\
34 | \nUsage: mengubah font teks"
35 | })
36 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/gmute_sql.py:
--------------------------------------------------------------------------------
1 | try:
2 | from userbot.modules.sql_helper import SESSION, BASE
3 | except ImportError:
4 | raise AttributeError
5 |
6 | from sqlalchemy import Column, String
7 |
8 |
9 | class GMute(BASE):
10 | __tablename__ = "gmute"
11 | sender = Column(String(14), primary_key=True)
12 |
13 | def __init__(self, sender):
14 | self.sender = str(sender)
15 |
16 |
17 | GMute.__table__.create(checkfirst=True)
18 |
19 |
20 | def is_gmuted(sender_id):
21 | try:
22 | return SESSION.query(GMute).all()
23 | except BaseException:
24 | return None
25 | finally:
26 | SESSION.close()
27 |
28 |
29 | def gmute(sender):
30 | adder = GMute(str(sender))
31 | SESSION.add(adder)
32 | SESSION.commit()
33 |
34 |
35 | def ungmute(sender):
36 | rem = SESSION.query(GMute).get((str(sender)))
37 | if rem:
38 | SESSION.delete(rem)
39 | SESSION.commit()
40 |
--------------------------------------------------------------------------------
/userbot/modules/tag_all.py:
--------------------------------------------------------------------------------
1 | # This Source Code Form is subject to the terms of the Mozilla Public
2 | # License, v. 2.0. If a copy of the MPL was not distributed with this
3 | # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 | """A Plugin to tagall in the chat for @UniBorg and cmd is `.all`"""
5 |
6 |
7 | from userbot import CMD_HELP, bot
8 | from userbot.events import register
9 |
10 |
11 | @register(outgoing=True, pattern="^.all$")
12 | async def all(event):
13 | if event.fwd_from:
14 | return
15 | await event.delete()
16 | mentions = "@all"
17 | chat = await event.get_input_chat()
18 | async for x in bot.iter_participants(chat, 200000):
19 | mentions += f"[\u2063](tg://user?id={x.id})"
20 | await bot.send_message(chat, mentions, reply_to=event.message.reply_to_msg_id)
21 |
22 |
23 | CMD_HELP.update({
24 | "tag_all":
25 | "`.all`\
26 | \nUsage: Untuk Mengetag semua anggota yang ada di group."
27 | })
28 |
--------------------------------------------------------------------------------
/init/Merge.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Copyright (C) 2020 The Raphielscape Company LLC.
3 | #
4 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
5 | # you may not use this file except in compliance with the License.
6 | #
7 | # CI Runner Script for Paperplane CI
8 |
9 | # We need this directive
10 | # shellcheck disable=1090
11 |
12 | export SEMAPHORE_PROJECT_DIR=`pwd`
13 | . "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/telegram
14 | TELEGRAM_TOKEN=${BOT_API_KEY}
15 | export BOT_API_KEY TELEGRAM_TOKEN
16 | tg_sendinfo "I am gonna merge staging into Lord-Userbot"
17 | cd
18 | git clone https://github.com/sahyam2019/oub-remix.git
19 | cd oub-remix
20 | git remote set-url origin https://${GH_USERNAME}:${GH_PERSONAL_TOKEN}@github.com/sahyam2019/oub-remix.git
21 | git fetch
22 | git checkout staging
23 | git pull origin staging
24 | git push --force origin staging:sql-extended
25 | tg_sendinfo "I have merged all commits from staging into Lord-Userbot"
26 |
--------------------------------------------------------------------------------
/init/CI_Test_Script.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Copyright (C) 2020 The Raphielscape Company LLC.
3 | #
4 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
5 | # you may not use this file except in compliance with the License.
6 | #
7 | # CI Runner Script for Paperplane CI
8 |
9 | # We need this directive
10 | # shellcheck disable=1090
11 |
12 | export SEMAPHORE_PROJECT_DIR=`pwd`
13 | . "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/telegram
14 | TELEGRAM_TOKEN=${BOT_API_KEY}
15 | export BOT_API_KEY TELEGRAM_TOKEN
16 | tg_sendinfo "I am gonna merge staging into Lord-Userbot"
17 | cd
18 | git clone https://github.com/mkaraniya/OpenUserBot.git
19 | cd OpenUserBot
20 | git remote set-url origin https://${GH_USERNAME}:${GH_PERSONAL_TOKEN}@github.com/mkaraniya/OpenUserBot.git
21 | git fetch
22 | git checkout staging
23 | git pull origin staging
24 | git push --force origin staging:Lord-Userbot
25 | tg_sendinfo "I have merged all commits from staging into Lord-Userbot"
26 |
--------------------------------------------------------------------------------
/userbot/utils/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2020 Adek Maulana
2 | #
3 | # SPDX-License-Identifier: GPL-3.0-or-later
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program. If not, see .
16 |
17 | from .chrome import chrome, options
18 | from .google_images_download import googleimagesdownload
19 | from .progress import progress
20 | from .tools import humanbytes, time_formatter, human_to_bytes, md5, take_screen_shot, runcmd
21 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/pm_permit_sql.py:
--------------------------------------------------------------------------------
1 | try:
2 | from userbot.modules.sql_helper import SESSION, BASE
3 | except ImportError:
4 | raise AttributeError
5 | from sqlalchemy import Column, String
6 |
7 |
8 | class PMPermit(BASE):
9 | __tablename__ = "pmpermit"
10 | chat_id = Column(String(14), primary_key=True)
11 |
12 | def __init__(self, chat_id):
13 | self.chat_id = str(chat_id) # ensure string
14 |
15 |
16 | PMPermit.__table__.create(checkfirst=True)
17 |
18 |
19 | def is_approved(chat_id):
20 | try:
21 | return SESSION.query(PMPermit).filter(
22 | PMPermit.chat_id == str(chat_id)).one()
23 | except BaseException:
24 | return None
25 | finally:
26 | SESSION.close()
27 |
28 |
29 | def approve(chat_id):
30 | adder = PMPermit(str(chat_id))
31 | SESSION.add(adder)
32 | SESSION.commit()
33 |
34 |
35 | def dissprove(chat_id):
36 | rem = SESSION.query(PMPermit).get(str(chat_id))
37 | if rem:
38 | SESSION.delete(rem)
39 | SESSION.commit()
40 |
--------------------------------------------------------------------------------
/.github/workflows/python-app.yml:
--------------------------------------------------------------------------------
1 | name: FailCheck
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | build:
7 |
8 | runs-on: ubuntu-latest
9 | strategy:
10 | max-parallel: 5
11 | matrix:
12 | python-version: [3.9.2]
13 |
14 | steps:
15 | - uses: actions/checkout@v1
16 | - name: Set up Python ${{ matrix.python-version }}
17 | uses: actions/setup-python@v1
18 | with:
19 | python-version: ${{ matrix.python-version }}
20 | - name: Install dependencies
21 | run: |
22 | sudo apt-get install libpq-dev
23 | python -m pip install --upgrade pip
24 | pip install -r requirements.txt
25 | pip install flake8 flake8-print flake8-quotes
26 | - name: Check for showstoppers
27 | run: |
28 | flake8 . --count --select=E999 --show-source --statistics
29 | shellcheck:
30 |
31 | runs-on: ubuntu-latest
32 |
33 | steps:
34 | - uses: actions/checkout@v1
35 | - name: Check for install script errors
36 | uses: ludeeus/action-shellcheck@0.1.0
37 |
--------------------------------------------------------------------------------
/.github/workflows/ISSUE_TEMPLATE/python-app.yml:
--------------------------------------------------------------------------------
1 | name: FailCheck
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | build:
7 |
8 | runs-on: ubuntu-latest
9 | strategy:
10 | max-parallel: 5
11 | matrix:
12 | python-version: [3.9.2]
13 |
14 | steps:
15 | - uses: actions/checkout@v1
16 | - name: Set up Python ${{ matrix.python-version }}
17 | uses: actions/setup-python@v1
18 | with:
19 | python-version: ${{ matrix.python-version }}
20 | - name: Install dependencies
21 | run: |
22 | sudo apt-get install libpq-dev
23 | python -m pip install --upgrade pip
24 | pip install -r requirements.txt
25 | pip install flake8 flake8-print flake8-quotes
26 | - name: Check for showstoppers
27 | run: |
28 | flake8 . --count --select=E999 --show-source --statistics
29 | shellcheck:
30 |
31 | runs-on: ubuntu-latest
32 |
33 | steps:
34 | - uses: actions/checkout@v1
35 | - name: Check for install script errors
36 | uses: ludeeus/action-shellcheck@0.1.0
37 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/mute_sql.py:
--------------------------------------------------------------------------------
1 | try:
2 | from userbot.modules.sql_helper import SESSION, BASE
3 | except ImportError:
4 | raise Exception("Hello!")
5 |
6 | from sqlalchemy import Column, String
7 |
8 |
9 | class Mute(BASE):
10 | __tablename__ = "mute"
11 | sender = Column(String(14), primary_key=True)
12 | chat_id = Column(String(14), primary_key=True)
13 |
14 | def __init__(self, sender, chat_id):
15 | self.sender = str(sender)
16 | self.chat_id = str(chat_id)
17 |
18 |
19 | Mute.__table__.create(checkfirst=True)
20 |
21 |
22 | def is_muted(sender, chat_id):
23 | user = SESSION.query(Mute).get((str(sender), str(chat_id)))
24 | if user:
25 | return True
26 | else:
27 | return False
28 |
29 |
30 | def mute(sender, chat_id):
31 | adder = Mute(str(sender), str(chat_id))
32 | SESSION.add(adder)
33 | SESSION.commit()
34 |
35 |
36 | def unmute(sender, chat_id):
37 | rem = SESSION.query(Mute).get((str(sender), str(chat_id)))
38 | if rem:
39 | SESSION.delete(rem)
40 | SESSION.commit()
41 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/fban_sql.py:
--------------------------------------------------------------------------------
1 | try:
2 | from userbot.modules.sql_helper import SESSION, BASE
3 | except ImportError:
4 | raise AttributeError
5 |
6 | from sqlalchemy import Column, String, UnicodeText
7 |
8 |
9 | class Fban(BASE):
10 | __tablename__ = "fban"
11 | chat_id = Column(String(14), primary_key=True)
12 | fed_name = Column(UnicodeText)
13 |
14 | def __init__(self, chat_id, fed_name):
15 | self.chat_id = str(chat_id)
16 | self.fed_name = fed_name
17 |
18 |
19 | Fban.__table__.create(checkfirst=True)
20 |
21 |
22 | def get_flist():
23 | try:
24 | return SESSION.query(Fban).all()
25 | finally:
26 | SESSION.close()
27 |
28 |
29 | def add_flist(chat_id, fed_name):
30 | adder = Fban(str(chat_id), fed_name)
31 | SESSION.add(adder)
32 | SESSION.commit()
33 |
34 |
35 | def del_flist(chat_id):
36 | rem = SESSION.query(Fban).get(str(chat_id))
37 | if rem:
38 | SESSION.delete(rem)
39 | SESSION.commit()
40 |
41 |
42 | def del_flist_all():
43 | SESSION.execute("""TRUNCATE TABLE fban""")
44 | SESSION.commit()
45 |
--------------------------------------------------------------------------------
/userbot/__main__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.
2 | #
3 | # Licensed under the Raphielscape Public License, Version 1.c (the "License");
4 | # you may not use this file except in compliance with the License.
5 | #
6 | """ Userbot start point """
7 |
8 | from importlib import import_module
9 | from sys import argv
10 |
11 | from telethon.errors.rpcerrorlist import PhoneNumberInvalidError
12 | from userbot import BOT_VER, LOGS, bot
13 | from userbot.modules import ALL_MODULES
14 |
15 | INVALID_PH = '\nERROR: The Phone No. entered is INVALID' \
16 | '\n Tip: Use Country Code along with number.' \
17 | '\n or check your phone number and try again !'
18 |
19 | try:
20 | bot.start()
21 | except PhoneNumberInvalidError:
22 | print(INVALID_PH)
23 | exit(1)
24 |
25 | for module_name in ALL_MODULES:
26 | imported_module = import_module("userbot.modules." + module_name)
27 |
28 |
29 | LOGS.info(
30 | f"Lord-Userbot ⚙️ V{BOT_VER} [TELAH DIAKTIFKAN!]")
31 |
32 |
33 | if len(argv) not in (1, 3, 4):
34 | bot.disconnect()
35 | else:
36 | bot.run_until_disconnected()
37 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/spam_mute_sql.py:
--------------------------------------------------------------------------------
1 | try:
2 | from userbot.modules.sql_helper import SESSION, BASE
3 | except ImportError:
4 | raise AttributeError
5 |
6 | from sqlalchemy import Column, String
7 |
8 |
9 | class Mute(BASE):
10 | __tablename__ = "muted"
11 | chat_id = Column(String(14), primary_key=True)
12 | sender = Column(String(14), primary_key=True)
13 |
14 | def __init__(self, chat_id, sender):
15 | self.chat_id = str(chat_id) # ensure string
16 | self.sender = str(sender)
17 |
18 |
19 | Mute.__table__.create(checkfirst=True)
20 |
21 |
22 | def is_muted(chat_id):
23 | try:
24 | return SESSION.query(Mute).filter(Mute.chat_id == str(chat_id)).all()
25 | except BaseException:
26 | return None
27 | finally:
28 | SESSION.close()
29 |
30 |
31 | def mute(chat_id, sender):
32 | adder = Mute(str(chat_id), str(sender))
33 | SESSION.add(adder)
34 | SESSION.commit()
35 |
36 |
37 | def unmute(chat_id, sender):
38 | rem = SESSION.query(Mute).get(((str(chat_id)), (str(sender))))
39 | if rem:
40 | SESSION.delete(rem)
41 | SESSION.commit()
42 |
--------------------------------------------------------------------------------
/userbot/modules/gcast.py:
--------------------------------------------------------------------------------
1 | # frm Ultroid
2 | # port by Koala @manusiarakitann
3 | # @LordUserbot_Group
4 | # Alvin Ganteng
5 |
6 | from userbot.events import register
7 | from userbot import CMD_HELP, bot
8 | # Alvin Ganteng
9 |
10 |
11 | @register(outgoing=True, pattern="^.gcast (.*)")
12 | async def gcast(event):
13 | xx = event.pattern_match.group(1)
14 | if not xx:
15 | return await event.edit("`Lord, Mohon Berikan Sebuah Pesan`")
16 | tt = event.text
17 | msg = tt[6:]
18 | kk = await event.edit("`Sedang Mengirim Pesan Secara Global... 📢`")
19 | er = 0
20 | done = 0
21 | async for x in bot.iter_dialogs():
22 | if x.is_group:
23 | chat = x.id
24 | try:
25 | done += 1
26 | await bot.send_message(chat, msg)
27 | except BaseException:
28 | er += 1
29 | await kk.edit(f"**Berhasil Mengirim Pesan Ke** `{done}` **Grup, Gagal Mengirim Pesan Ke** `{er}` **Grup**")
30 |
31 | # Alvin Ganteng
32 | CMD_HELP.update(
33 | {
34 | "gcast": "`.gcast `\
35 | \nPenjelasan: Global Broadcast mengirim pesan ke Seluruh Grup yang Lord Masuki."
36 | })
37 |
--------------------------------------------------------------------------------
/userbot/modules/salam.py:
--------------------------------------------------------------------------------
1 | from platform import uname
2 | from userbot import ALIVE_NAME, CMD_HELP
3 | from userbot.events import register
4 |
5 | # ================= CONSTANT =================
6 | DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else uname().node
7 | # ============================================
8 |
9 |
10 | @register(outgoing=True, pattern='^.P(?: |$)(.*)')
11 | async def typewriter(typew):
12 | typew.pattern_match.group(1)
13 | await typew.edit("Assalamu'alaikum")
14 |
15 |
16 | @register(outgoing=True, pattern='^.p(?: |$)(.*)')
17 | async def typewriter(typew):
18 | typew.pattern_match.group(1)
19 | await typew.edit("Assalamu'alaikum")
20 |
21 |
22 | @register(outgoing=True, pattern='^.L(?: |$)(.*)')
23 | async def typewriter(typew):
24 | typew.pattern_match.group(1)
25 | await typew.edit("Wa'alaikumussalam")
26 |
27 |
28 | @register(outgoing=True, pattern='^.l(?: |$)(.*)')
29 | async def typewriter(typew):
30 | typew.pattern_match.group(1)
31 | await typew.edit("Wa'alaikumussalam")
32 |
33 |
34 | CMD_HELP.update({
35 | "salam":
36 | "`.P`\
37 | \nUsage: Untuk Memberi salam.\
38 | \n\n`.L`\
39 | \nUsage: Untuk Menjawab Salam."
40 | })
41 |
--------------------------------------------------------------------------------
/.github/workflows/pylint.yml:
--------------------------------------------------------------------------------
1 | name: PyLint
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | PEP8:
7 | runs-on: ubuntu-latest
8 | steps:
9 | - uses: actions/checkout@v2
10 |
11 | - name: Setup Python
12 | uses: actions/setup-python@v1
13 | with:
14 | python-version: 3.9.2
15 |
16 | - name: Install Python lint libraries
17 | run: |
18 | pip install autopep8 autoflake
19 | - name: Check for showstoppers
20 | run: |
21 | autopep8 --verbose --in-place --recursive --aggressive --aggressive . *.py
22 | - name: Remove unused imports and variables
23 | run: |
24 | autoflake --in-place --recursive --remove-all-unused-imports --remove-unused-variables --ignore-init-module-imports .
25 |
26 | # commit changes
27 | - uses: stefanzweifel/git-auto-commit-action@v4
28 | with:
29 | commit_message: 'pylint: auto fixes'
30 | commit_options: '--no-verify --signoff'
31 | repository: .
32 | commit_user_name: Zora24
33 | commit_user_email: liualvinas1212@gmail.com
34 | commit_author: Zora24
35 |
--------------------------------------------------------------------------------
/.github/workflows/ISSUE_TEMPLATE/pylint.yml:
--------------------------------------------------------------------------------
1 | name: PyLint
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | PEP8:
7 | runs-on: ubuntu-latest
8 | steps:
9 | - uses: actions/checkout@v2
10 |
11 | - name: Setup Python
12 | uses: actions/setup-python@v1
13 | with:
14 | python-version: 3.9.2
15 |
16 | - name: Install Python lint libraries
17 | run: |
18 | pip install autopep8 autoflake
19 | - name: Check for showstoppers
20 | run: |
21 | autopep8 --verbose --in-place --recursive --aggressive --aggressive . *.py
22 | - name: Remove unused imports and variables
23 | run: |
24 | autoflake --in-place --recursive --remove-all-unused-imports --remove-unused-variables --ignore-init-module-imports .
25 |
26 | # commit changes
27 | - uses: stefanzweifel/git-auto-commit-action@v4
28 | with:
29 | commit_message: 'pylint: auto fixes'
30 | commit_options: '--no-verify --signoff'
31 | repository: .
32 | commit_user_name: Zora24
33 | commit_user_email: liualvinas1212@gmail.com
34 | commit_author: Zora24
35 |
--------------------------------------------------------------------------------
/string_session.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # (c) https://t.me/TelethonChat/37677 and SpEcHiDe
3 | #
4 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
5 | # you may not use this file except in compliance with the License.
6 | #
7 |
8 | from telethon.sync import TelegramClient
9 | from telethon.sessions import StringSession
10 |
11 | print("""Please go-to my.telegram.org
12 | Login using your Telegram account
13 | Click on API Development Tools
14 | Create a new application, by entering the required details
15 | Check your Telegram saved messages section to copy the STRING_SESSION""")
16 | API_KEY = int(input("Enter API_KEY here: "))
17 | API_HASH = input("Enter API_HASH here: ")
18 |
19 | with TelegramClient(StringSession(), API_KEY, API_HASH) as client:
20 | print("Check Telegram Save Message Mu Untuk Copy STRING_SESSION ")
21 | session_string = client.session.save()
22 | saved_messages_template = """Grup Support @LordUserbot_Group
23 |
24 | STRING_SESSION: {}
25 |
26 | ⚠️ Please be careful before passing this value to third parties""".format(session_string)
27 | client.send_message("me", saved_messages_template, parse_mode="html")
28 |
--------------------------------------------------------------------------------
/userbot/modules/oi.py:
--------------------------------------------------------------------------------
1 | from time import sleep
2 | from userbot.events import register
3 |
4 |
5 | @register(outgoing=True, pattern='^.alvin(?: |$)(.*)')
6 | async def typewriter(typew):
7 | typew.pattern_match.group(1)
8 | sleep(3)
9 | await typew.edit("`Hai Perkenalkan Namaku Alvin`")
10 | sleep(3)
11 | await typew.edit("`17 Tahun`")
12 | sleep(1)
13 | await typew.edit("`Tinggal Dibatam, Salam Kenal:)`")
14 | # Create by myself @localheart
15 |
16 |
17 | @register(outgoing=True, pattern='^.sayang(?: |$)(.*)')
18 | async def typewriter(typew):
19 | typew.pattern_match.group(1)
20 | sleep(3)
21 | await typew.edit("`Cuma Mau Bilang`")
22 | sleep(3)
23 | await typew.edit("`Aku Sayang Kamu`")
24 | sleep(1)
25 | await typew.edit("`I LOVE YOU 💞`")
26 | # Create by myself @localheart
27 |
28 |
29 | @register(outgoing=True, pattern='^.semangat(?: |$)(.*)')
30 | async def typewriter(typew):
31 | typew.pattern_match.group(1)
32 | sleep(3)
33 | await typew.edit("`Apapun Yang Terjadi`")
34 | sleep(3)
35 | await typew.edit("`Tetaplah Bernapas`")
36 | sleep(1)
37 | await typew.edit("`Dan Selalu Bersyukur`")
38 | # Create by myself @localheart
39 |
--------------------------------------------------------------------------------
/userbot/modules/lordhelper.py:
--------------------------------------------------------------------------------
1 | """ Userbot module for other small commands. """
2 | from userbot import CMD_HELP, ALIVE_NAME
3 | from userbot.events import register
4 |
5 |
6 | # ================= CONSTANT =================
7 | DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else uname().node
8 | # ============================================
9 |
10 |
11 | @register(outgoing=True, pattern="^.lhelp$")
12 | async def usit(e):
13 | await e.edit(
14 | f"**Hai Lord {DEFAULTUSER} Kalau Anda Tidak Tau Perintah Untuk Memerintah Ku Ketik** `.help` Atau Bisa Minta Bantuan Ke:\n"
15 | "\n[Telegram](t.me/liualvinas)"
16 | "\n[Repo](https://github.com/zora24/Lord-Userbot)"
17 | "\n[Instagram](Instagram.com/liualvinas_)")
18 |
19 |
20 | @register(outgoing=True, pattern="^.vars$")
21 | async def var(m):
22 | await m.edit(
23 | f"**Disini Daftar Vars Dari {DEFAULTUSER}:**\n"
24 | "\n[DAFTAR VARS](https://raw.githubusercontent.com/Zora24/Lord-Userbot/Lord-Userbot/varshelper.txt)")
25 |
26 |
27 | CMD_HELP.update({
28 | "lordhelper":
29 | "`.lordhelp`\
30 | \nPenjelasan: Bantuan Untuk Lord-Userbot.\
31 | \n`.lordvar`\
32 | \nPenjelasan: Untuk Melihat Beberapa Daftar Vars."
33 | })
34 |
--------------------------------------------------------------------------------
/init/telegram:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env dash
2 | # shellcheck source=/dev/null
3 | #
4 | # Copyright (C) 2020 Raphielscape LLC.
5 | #
6 | # Licensed under the Raphielscape Public License, Version 1.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | #
9 | # Telegram command container
10 |
11 | TELEGRAM=$SEMAPHORE_PROJECT_DIR/init/telegramapi
12 | export TELEGRAM
13 | # Caster configurations
14 | MAINGROUP_ID="-1001445525038"
15 |
16 | # sendcast to group
17 | tg_sendinfo() {
18 | "${TELEGRAM}" -c ${MAINGROUP_ID} -H \
19 | "$(
20 | for POST in "${@}"; do
21 | echo "${POST}"
22 | done
23 | )" \
24 | -t $BOT_API_KEY
25 | }
26 |
27 | kickstart_pub() {
28 | if [ ! -z "$PULL_REQUEST_NUMBER" ]; then
29 | tg_sendinfo "I am starting build" \
30 | "PR: ${PULL_REQUEST_NUMBER}" \
31 | "Commit Point ${COMMIT_POINT}" \
32 | " " \
33 | "Github Link: https://github.com/Zora24/Lord-Userbot/commit/${COMMIT_HASH}"
34 | else
35 | tg_sendinfo "I am starting build" \
36 | "Branch ${PARSE_BRANCH}" \
37 | "Commit Point ${COMMIT_POINT}" \
38 | " " \
39 | "Github Link: https://github.com/Zora24/Lord-Userbot/commit/${COMMIT_HASH}"
40 | fi
41 | }
42 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/gban_sql.py:
--------------------------------------------------------------------------------
1 | from sqlalchemy import Column, String
2 |
3 | from userbot.modules.sql_helper import BASE, SESSION
4 |
5 |
6 | class GBan(BASE):
7 | __tablename__ = "gban"
8 | chat_id = Column(String(14), primary_key=True)
9 | reason = Column(String(127))
10 |
11 | def __init__(self, chat_id, reason=""):
12 | self.chat_id = chat_id
13 | self.reason = reason
14 |
15 |
16 | GBan.__table__.create(checkfirst=True)
17 |
18 |
19 | def is_gbanned(chat_id):
20 | try:
21 | return SESSION.query(GBan).filter(GBan.chat_id == str(chat_id)).one()
22 | except BaseException:
23 | return None
24 | finally:
25 | SESSION.close()
26 |
27 |
28 | def get_gbanuser(chat_id):
29 | try:
30 | return SESSION.query(GBan).get(str(chat_id))
31 | finally:
32 | SESSION.close()
33 |
34 |
35 | def freakgban(chat_id, reason):
36 | adder = GBan(str(chat_id), str(reason))
37 | SESSION.add(adder)
38 | SESSION.commit()
39 |
40 |
41 | def freakungban(chat_id):
42 | rem = SESSION.query(GBan).get(str(chat_id))
43 | if rem:
44 | SESSION.delete(rem)
45 | SESSION.commit()
46 |
47 |
48 | def get_all_gbanned():
49 | rem = SESSION.query(GBan).all()
50 | SESSION.close()
51 | return rem
52 |
--------------------------------------------------------------------------------
/userbot/modules/db.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.
2 | #
3 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
4 | # you may not use this file except in compliance with the License.
5 | #
6 | """ Userbot module for getting information about the server. """
7 |
8 | from platform import uname
9 |
10 |
11 | from userbot import ALIVE_NAME, BOT_VER, is_mongo_alive, is_redis_alive
12 | from userbot.events import register
13 |
14 | # ================= CONSTANT =================
15 | DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else uname().node
16 | # ============================================
17 |
18 |
19 | @register(outgoing=True, pattern="^.db$")
20 | async def amireallydbs(dbs):
21 | if not is_mongo_alive() and not is_redis_alive():
22 | db = "Both Mongo and Redis Database seems to be failing!"
23 | elif not is_mongo_alive():
24 | db = "Mongo DB seems to be failing!"
25 | elif not is_redis_alive():
26 | db = "Redis Cache seems to be failing!"
27 | else:
28 | db = "Databases functioning normally!"
29 | await dbs.edit(""
30 | f"**User:** `{DEFAULTUSER}` \n"
31 | f"**Status Database:** `{db}`\n"
32 | f"**Lord-Userbot:** `{BOT_VER}`"
33 | "")
34 |
--------------------------------------------------------------------------------
/userbot/modules/resi.py:
--------------------------------------------------------------------------------
1 |
2 | from telethon import events
3 | from telethon.errors.rpcerrorlist import YouBlockedUserError
4 | from userbot import bot, CMD_HELP
5 | from userbot.events import register
6 |
7 |
8 | @register(outgoing=True, pattern=r"^\.resi(?: |$)(.*)")
9 | async def _(event):
10 | if event.fwd_from:
11 | return
12 | event.pattern_match.group(1)
13 | chat = "@GeDebugBetaBot" # pylint:disable=E0602
14 | resi = f"resi" # pylint:disable=E0602
15 | await event.edit("Processing....")
16 | async with bot.conversation("@GeDebugBetaBot") as conv:
17 | try:
18 | response = conv.wait_event(
19 | events.NewMessage(
20 | incoming=True,
21 | from_users=443213072))
22 | await conv.send_message(f'{kurir} {resi}')
23 | response = await response
24 | except YouBlockedUserError:
25 | await event.reply("Unblock @ GeDebugBetaBot dulu Goblok!!")
26 | return
27 | else:
28 | await event.edit(f"{response.message.message}")
29 | await event.client.delete_messages(response.message.message)
30 |
31 |
32 | CMD_HELP.update({
33 | "resi":
34 | "`.resi`\
35 | \nUsage: Cek resi \
36 | \n\n`.lacak`\
37 | \nUsage:lacak paket"
38 | })
39 |
--------------------------------------------------------------------------------
/userbot/modules/hentai.py:
--------------------------------------------------------------------------------
1 | from telethon import events
2 | from telethon.errors.rpcerrorlist import YouBlockedUserError
3 | from userbot import bot, CMD_HELP
4 | from userbot.events import register
5 |
6 |
7 | @register(outgoing=True, pattern=r"^\.hentai(?: |$)(.*)")
8 | async def _(event):
9 | if event.fwd_from:
10 | return
11 | link = event.pattern_match.group(1)
12 | chat = "@nHentaiBot"
13 | await event.edit("```Processing```")
14 | async with bot.conversation(chat) as conv:
15 | try:
16 | response = conv.wait_event(
17 | events.NewMessage(
18 | incoming=True,
19 | from_users=424466890))
20 | await bot.send_message(chat, link)
21 | response = await response
22 | except YouBlockedUserError:
23 | await event.reply("```Please unblock @nHentaiBot and try again```")
24 | return
25 | if response.text.startswith("**Sorry I couldn't get manga from**"):
26 | await event.edit("```I think this is not the right link```")
27 | else:
28 | await event.delete()
29 | await bot.send_message(event.chat_id, response.message)
30 |
31 | CMD_HELP.update({
32 | "hentai":
33 | "`.hentai` \
34 | \nUsage: view nhentai in telegra.ph XD\n"})
35 |
--------------------------------------------------------------------------------
/userbot/modules/gps.py:
--------------------------------------------------------------------------------
1 | #credits: mrconfused
2 | from geopy.geocoders import Nominatim
3 | from telethon.tl import types
4 | from userbot.events import register
5 | from userbot import CMD_HELP
6 |
7 |
8 | @register(outgoing=True, pattern="^.gps(?: |$)(.*)")
9 | async def gps(event):
10 | if event.fwd_from:
11 | return
12 | reply_to_id = event.message
13 | if event.reply_to_msg_id:
14 | reply_to_id = await event.get_reply_message()
15 | input_str = event.pattern_match.group(1)
16 |
17 | if not input_str:
18 | return await event.edit("`Lord Mohon Berikan Tempat Yang Dicari`")
19 |
20 | await event.edit("`Menemukan Lokasi Ini Di Server Map....`")
21 |
22 | geolocator = Nominatim(user_agent="Lord")
23 | geoloc = geolocator.geocode(input_str)
24 |
25 | if geoloc:
26 | lon = geoloc.longitude
27 | lat = geoloc.latitude
28 | await reply_to_id.reply(
29 | input_str,
30 | file=types.InputMediaGeoPoint(
31 | types.InputGeoPoint(
32 | lat, lon
33 | )
34 | )
35 | )
36 | await event.delete()
37 | else:
38 | await event.edit("`Lord Saya Tidak Dapat Menemukannya`")
39 |
40 | CMD_HELP.update({
41 | "gps":
42 | ">.`gps`"
43 | "\nUsage: Untuk Mendapatkan Lokasi Map"
44 | })
45 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/globals.py:
--------------------------------------------------------------------------------
1 | try:
2 | from userbot.modules.sql_helper import SESSION, BASE
3 | except ImportError:
4 | raise AttributeError
5 |
6 | from sqlalchemy import Column, String, UnicodeText
7 |
8 |
9 | class Globals(BASE):
10 | __tablename__ = "globals"
11 | variable = Column(String, primary_key=True, nullable=False)
12 | value = Column(UnicodeText, primary_key=True, nullable=False)
13 |
14 | def __init__(self, variable, value):
15 | self.variable = str(variable)
16 | self.value = value
17 |
18 |
19 | Globals.__table__.create(checkfirst=True)
20 |
21 |
22 | def gvarstatus(variable):
23 | try:
24 | return SESSION.query(Globals).filter(
25 | Globals.variable == str(variable)).first().value
26 | except BaseException:
27 | return None
28 | finally:
29 | SESSION.close()
30 |
31 |
32 | def addgvar(variable, value):
33 | if SESSION.query(Globals).filter(
34 | Globals.variable == str(variable)).one_or_none():
35 | delgvar(variable)
36 | adder = Globals(str(variable), value)
37 | SESSION.add(adder)
38 | SESSION.commit()
39 |
40 |
41 | def delgvar(variable):
42 | rem = SESSION.query(Globals).filter(Globals.variable == str(variable))\
43 | .delete(synchronize_session="fetch")
44 | if rem:
45 | SESSION.commit()
46 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/google_drive_sql.py:
--------------------------------------------------------------------------------
1 | from userbot.modules.sql_helper import SESSION, BASE
2 | from sqlalchemy import Column, String, Text
3 |
4 |
5 | class GoogleDriveCreds(BASE):
6 | __tablename__ = 'gdrive'
7 | user = Column(String, primary_key=True)
8 | credentials = Column(Text, nullable=False)
9 |
10 | def __init__(self, user):
11 | self.user = user
12 |
13 |
14 | GoogleDriveCreds.__table__.create(checkfirst=True)
15 |
16 |
17 | def save_credentials(user, credentials):
18 | saved_credentials = SESSION.query(GoogleDriveCreds).get(user)
19 | if not saved_credentials:
20 | saved_credentials = GoogleDriveCreds(user)
21 |
22 | saved_credentials.credentials = credentials
23 |
24 | SESSION.add(saved_credentials)
25 | SESSION.commit()
26 | return True
27 |
28 |
29 | def get_credentials(user):
30 | try:
31 | saved_credentials = SESSION.query(GoogleDriveCreds).get(user)
32 | creds = None
33 |
34 | if saved_credentials is not None:
35 | creds = saved_credentials.credentials
36 | return creds
37 | finally:
38 | SESSION.close()
39 |
40 |
41 | def clear_credentials(user):
42 | saved_credentials = SESSION.query(GoogleDriveCreds).get(user)
43 | if saved_credentials:
44 | SESSION.delete(saved_credentials)
45 | SESSION.commit()
46 | return True
47 |
--------------------------------------------------------------------------------
/userbot/modules/id.py:
--------------------------------------------------------------------------------
1 | from PIL import Image, ImageDraw, ImageFont
2 |
3 | from userbot import CMD_HELP
4 | from userbot.events import register
5 |
6 |
7 | @register(outgoing=True, pattern=r"^\.id$")
8 | async def image_maker(event):
9 | replied_user = await event.get_reply_message()
10 | await event.client.download_profile_photo(
11 | replied_user.from_id, file="user.png", download_big=True
12 | )
13 | user_photo = Image.open("user.png")
14 | id_template = Image.open("userbot/resources/FrameID.png")
15 | user_photo = user_photo.resize((989, 1073))
16 | id_template.paste(user_photo, (1229, 573))
17 | position = (2473, 481)
18 | draw = ImageDraw.Draw(id_template)
19 | color = "rgb(23, 43, 226)" # red color
20 | font = ImageFont.truetype("userbot/resources/fontx.ttf", size=200)
21 | draw.text(
22 | position,
23 | replied_user.sender.first_name.replace("\u2060", ""),
24 | fill=color,
25 | font=font,
26 | )
27 | id_template.save("user_id.png")
28 | await event.edit("`Membuat ID Card..`")
29 | await event.client.send_message(
30 | event.chat_id,
31 | "Generated User ID",
32 | reply_to=event.message.reply_to_msg_id,
33 | file="user_id.png",
34 | force_document=False,
35 | silent=True,
36 | )
37 | await event.delete()
38 |
39 |
40 | CMD_HELP.update(
41 | {
42 | "id": ">`.id`\
43 | \nUsage: Reply to a user to generate ID Card."
44 | }
45 | )
46 |
--------------------------------------------------------------------------------
/userbot/utils/funtions.py:
--------------------------------------------------------------------------------
1 | import os
2 | import shlex
3 | import asyncio
4 | from os.path import basename
5 | from typing import Optional, Tuple
6 |
7 | # For using gif , animated stickers and videos in some parts , this
8 | # function takes take a screenshot and stores ported from userge
9 |
10 |
11 | async def take_screen_shot(video_file: str, duration: int, path: str = '') -> Optional[str]:
12 | print(
13 | '[[[Extracting a frame from %s ||| Video duration => %s]]]',
14 | video_file,
15 | duration)
16 | ttl = duration // 2
17 | thumb_image_path = path or os.path.join(
18 | "./temp/", f"{basename(video_file)}.jpg")
19 | command = f"ffmpeg -ss {ttl} -i '{video_file}' -vframes 1 '{thumb_image_path}'"
20 | err = (await runcmd(command))[1]
21 | if err:
22 | print(err)
23 | return thumb_image_path if os.path.exists(thumb_image_path) else None
24 |
25 | # executing of terminal commands
26 |
27 |
28 | async def runcmd(cmd: str) -> Tuple[str, str, int, int]:
29 | args = shlex.split(cmd)
30 | process = await asyncio.create_subprocess_exec(*args,
31 | stdout=asyncio.subprocess.PIPE,
32 | stderr=asyncio.subprocess.PIPE)
33 | stdout, stderr = await process.communicate()
34 | return (stdout.decode('utf-8', 'replace').strip(),
35 | stderr.decode('utf-8', 'replace').strip(),
36 | process.returncode,
37 | process.pid)
38 |
--------------------------------------------------------------------------------
/userbot/modules/lordtm.py:
--------------------------------------------------------------------------------
1 | # BASED FROM ULTROID PORTED FOR LORD USERBOT BY ALVIN / @LIUALVINAS
2 | # THANKS ULTROID
3 | # DONT REMOVE THIS
4 | # ALVIN GANTENG
5 | # @LORDUSERBOT_GROUP
6 |
7 | from telethon import events
8 | from userbot import CMD_HELP, bot
9 | from userbot.events import register
10 | from telethon.errors.rpcerrorlist import YouBlockedUserError
11 | import asyncio
12 |
13 |
14 | @register(outgoing=True, pattern=r"^\.tm(?: |$)(.*)")
15 | async def _(event):
16 | chat = "@TempMailBot"
17 | lord = await event.edit("Sedang Memprosess...")
18 | async with bot.conversation(chat) as conv:
19 | try:
20 | response = conv.wait_event(events.NewMessage(
21 | incoming=True,
22 | from_users=220112646
23 | )
24 | )
25 | await conv.send_message("/start")
26 | await asyncio.sleep(1)
27 | await conv.send_message("Generate New")
28 | response = await response
29 | lorduserbot = ((response).reply_markup.rows[2].buttons[0].url)
30 | await event.client.send_read_acknowledge(conv.chat_id)
31 | except YouBlockedUserError:
32 | await lord.edit("`Mohon buka blokir` @TempMailBot `lalu coba lagi`")
33 | return
34 | await event.edit(f"**LORD TEMPMAIL** ~ `{response.message.message}`\n\n[KLIK DISINI UNTUK VERIFIKASI]({lorduserbot})")
35 |
36 |
37 | # Alvin Ganteng
38 | # Ported For Lord Userbot From Ultroid
39 |
40 | CMD_HELP.update({"tempmail": "**Modules:** __Temp Mail__\n\n**Perintah:** `.tm`"
41 | "\n**Penjelasan:** Mendapatkan Email Gratis Dari Temp Mail"})
42 |
--------------------------------------------------------------------------------
/userbot/modules/user_id.py:
--------------------------------------------------------------------------------
1 | from telethon import events
2 | from telethon.errors.rpcerrorlist import YouBlockedUserError
3 | from userbot.events import register
4 | from userbot import bot, CMD_HELP
5 |
6 |
7 | @register(outgoing=True, pattern=r"^\.getid(?: |$)(.*)")
8 | async def _(event):
9 | if event.fwd_from:
10 | return
11 | if not event.reply_to_msg_id:
12 | await event.edit("`Mohon Balas Ke Pesan Lord`")
13 | return
14 | reply_message = await event.get_reply_message()
15 | if not reply_message.text:
16 | await event.edit("```Mohon Balas Ke Pesan Lord```")
17 | return
18 | chat = "@getidsbot"
19 | reply_message.sender
20 | if reply_message.sender.bot:
21 | await event.edit("`Mohon Balas Ke Pesan Lord`")
22 | return
23 | await event.edit("`Mencari ID.......`")
24 | async with bot.conversation(chat) as conv:
25 | try:
26 | response = conv.wait_event(
27 | events.NewMessage(
28 | incoming=True,
29 | from_users=186675376))
30 | await bot.forward_messages(chat, reply_message)
31 | response = await response
32 | except YouBlockedUserError:
33 | await event.reply("`Bot Sedang Error`")
34 | return
35 | if response.text.startswith("Forward"):
36 | await event.edit("`Lord Orang Ini Tidak Mempunyai ID`")
37 | else:
38 | await event.edit(f"{response.message.message}")
39 |
40 |
41 | CMD_HELP.update({
42 | "getid":
43 | "`.gid`"
44 | "\nUsage: Balas Ke Pesan Pengguna Untuk Mendapatkan ID Nya."
45 | })
46 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/snips_sql.py:
--------------------------------------------------------------------------------
1 | try:
2 | from userbot.modules.sql_helper import SESSION, BASE
3 | except ImportError:
4 | raise AttributeError
5 |
6 | from sqlalchemy import Column, Numeric, UnicodeText
7 |
8 |
9 | class Snips(BASE):
10 | __tablename__ = "snips"
11 | snip = Column(UnicodeText, primary_key=True)
12 | reply = Column(UnicodeText)
13 | f_mesg_id = Column(Numeric)
14 |
15 | def __init__(self, snip, reply, f_mesg_id):
16 | self.snip = snip
17 | self.reply = reply
18 | self.f_mesg_id = f_mesg_id
19 |
20 |
21 | Snips.__table__.create(checkfirst=True)
22 |
23 |
24 | def get_snip(keyword):
25 | try:
26 | return SESSION.query(Snips).get(keyword)
27 | finally:
28 | SESSION.close()
29 |
30 |
31 | def get_snips():
32 | try:
33 | return SESSION.query(Snips).all()
34 | finally:
35 | SESSION.close()
36 |
37 |
38 | def add_snip(keyword, reply, f_mesg_id):
39 | to_check = get_snip(keyword)
40 | if not to_check:
41 | adder = Snips(keyword, reply, f_mesg_id)
42 | SESSION.add(adder)
43 | SESSION.commit()
44 | return True
45 | else:
46 | rem = SESSION.query(Snips).filter(Snips.snip == keyword)
47 | SESSION.delete(rem)
48 | SESSION.commit()
49 | adder = Snips(keyword, reply, f_mesg_id)
50 | SESSION.add(adder)
51 | SESSION.commit()
52 | return False
53 |
54 |
55 | def remove_snip(keyword):
56 | to_check = get_snip(keyword)
57 | if not to_check:
58 | return False
59 | else:
60 | rem = SESSION.query(Snips).filter(Snips.snip == keyword)
61 | rem.delete()
62 | SESSION.commit()
63 | return True
64 |
--------------------------------------------------------------------------------
/userbot/modules/bitly.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2020 azrim.
2 | # All rights reserved.
3 | #
4 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
5 | # you may not use this file except in compliance with the License.
6 | #
7 |
8 | from bitlyshortener import Shortener
9 | from re import match
10 | from userbot import BITLY_TOKEN, BOTLOG, BOTLOG_CHATID
11 | from userbot.events import register
12 |
13 |
14 | @register(outgoing=True, pattern=r"^\.bitly(?: |$)(.*)")
15 | async def shortener(short):
16 | """
17 | Shorten link using bit.ly API
18 | """
19 | if BITLY_TOKEN is not None:
20 | token = [f'{BITLY_TOKEN}']
21 | reply = await short.get_reply_message()
22 | message = short.pattern_match.group(1)
23 | if message:
24 | pass
25 | elif reply:
26 | message = reply.text
27 | else:
28 | await short.edit("`Error! No URL given!`")
29 | return
30 | link_match = match(r'\bhttps?://.*\.\S+', message)
31 | if not link_match:
32 | await short.edit("`Error! Please provide valid url!`\nexample: https://google.com")
33 | return
34 | urls = [f'{message}']
35 | bitly = Shortener(tokens=token, max_cache_size=8192)
36 | raw_output = bitly.shorten_urls(urls)
37 | string_output = f"{raw_output}"
38 | output = string_output.replace("['", "").replace("']", "")
39 | await short.edit(f"`Your link shortened successfully!`\nHere is your link {output}")
40 | if BOTLOG:
41 | await short.client.send_message(BOTLOG_CHATID, f"`#SHORTLINK \nThis Your Link!`\n {output}")
42 | else:
43 | await short.edit("Set bit.ly API token first\nGet from [here](https://bitly.com/a/sign_up)")
44 |
--------------------------------------------------------------------------------
/userbot/modules/lord.py:
--------------------------------------------------------------------------------
1 | from time import sleep
2 | from userbot import CMD_HELP
3 | from userbot.events import register
4 |
5 |
6 | @register(outgoing=True, pattern='^.sadboy(?: |$)(.*)')
7 | async def typewriter(typew):
8 | typew.pattern_match.group(1)
9 | sleep(2)
10 | await typew.edit("`Pertama-tama kamu cantik`")
11 | sleep(2)
12 | await typew.edit("`Kedua kamu manis`")
13 | sleep(1)
14 | await typew.edit("`Dan yang terakhir adalah kamu bukan jodohku`")
15 | # Create by myself @localheart
16 |
17 |
18 | @register(outgoing=True, pattern='^.punten(?: |$)(.*)')
19 | async def typewriter(typew):
20 | typew.pattern_match.group(1)
21 | await typew.edit("`\n┻┳|―-∩`"
22 | "`\n┳┻| ヽ`"
23 | "`\n┻┳| ● |`"
24 | "`\n┳┻|▼) _ノ`"
25 | "`\n┻┳| ̄ )`"
26 | "`\n┳ミ( ̄ /`"
27 | "`\n┻┳T ̄|`"
28 | "\n**Punten**")
29 |
30 |
31 | @register(outgoing=True, pattern='^.pantau(?: |$)(.*)')
32 | async def typewriter(typew):
33 | typew.pattern_match.group(1)
34 | await typew.edit("`\n┻┳|―-∩`"
35 | "`\n┳┻| ヽ`"
36 | "`\n┻┳| ● |`"
37 | "`\n┳┻|▼) _ノ`"
38 | "`\n┻┳| ̄ )`"
39 | "`\n┳ミ( ̄ /`"
40 | "`\n┻┳T ̄|`"
41 | "\n**Masih Ku Pantau**")
42 |
43 |
44 | # Create by myself @localheart
45 |
46 | CMD_HELP.update({
47 | "lord":
48 | "`.lord`\
49 | \nUsage: alive bot.\
50 | \n\n`.sadboy`\
51 | \nUsage: hiks\
52 | \n\n`.punten` ; `.pantau`\
53 | \nUsage: coba aja.\
54 | \n\n`kosong`\
55 | \nUsage: tunggu update selanjutnya.\
56 | \n\n`kosong`\
57 | \nUsage: tunggu update selanjutnya."
58 | })
59 |
--------------------------------------------------------------------------------
/userbot/modules/lordfun.py:
--------------------------------------------------------------------------------
1 | # Based Plugins
2 | # Ported For Lord-Userbot By liualvinas/Alvin
3 | # If You Kang It Don't Delete / Warning!! Jangan Hapus Ini!!!
4 | from userbot import CMD_HELP, bot
5 | from userbot.events import register
6 |
7 |
8 | @register(outgoing=True, pattern=r"^\.xogame(?: |$)(.*)")
9 | async def _(event):
10 | if event.fwd_from:
11 | return
12 | botusername = "@xobot"
13 | noob = "play"
14 | if event.reply_to_msg_id:
15 | await event.get_reply_message()
16 | tap = await bot.inline_query(botusername, noob)
17 | await tap[0].click(event.chat_id)
18 | await event.delete()
19 |
20 | # Alvin Gans
21 |
22 |
23 | @register(outgoing=True, pattern=r"^\.wp(?: |$)(.*)")
24 | async def _(event):
25 | if event.fwd_from:
26 | return
27 | wwwspr = event.pattern_match.group(1)
28 | botusername = "@whisperBot"
29 | if event.reply_to_msg_id:
30 | await event.get_reply_message()
31 | tap = await bot.inline_query(botusername, wwwspr)
32 | await tap[0].click(event.chat_id)
33 | await event.delete()
34 |
35 | # Alvin Gans
36 |
37 |
38 | @register(outgoing=True, pattern=r"^\.mod(?: |$)(.*)")
39 | async def _(event):
40 | if event.fwd_from:
41 | return
42 | modr = event.pattern_match.group(1)
43 | botusername = "@PremiumAppBot"
44 | if event.reply_to_msg_id:
45 | await event.get_reply_message()
46 | tap = await bot.inline_query(botusername, modr)
47 | await tap[0].click(event.chat_id)
48 | await event.delete()
49 |
50 | # Ported For Lord-Userbot By liualvinas/Alvin
51 |
52 | CMD_HELP.update({
53 | "lordfun": "\
54 | `.xogame`\
55 | \nUsage: Mainkan game XO bersama temanmu.\
56 | \n\n`.mod `\
57 | \nUsage: Dapatkan applikasi mod\
58 | \n\n`.wp `\
59 | \nUsage: Berikan pesan rahasia"})
60 |
--------------------------------------------------------------------------------
/userbot/modules/__help.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2020 TeamDerUntergang.
2 | #
3 | # SedenUserBot is free software: you can redistribute it and/or modify
4 | # it under the terms of the GNU General Public License as published by
5 | # the Free Software Foundation, either version 3 of the License, or
6 | # (at your option) any later version.
7 | #
8 | # SedenUserBot is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program. If not, see .
15 |
16 | # @Qulec tarafından yazılmıştır.
17 | # Thanks @Spechide.
18 |
19 | import logging
20 |
21 |
22 | from userbot import BOT_USERNAME
23 | from userbot.events import register
24 |
25 | logging.basicConfig(
26 | format="[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s",
27 | level=logging.WARNING)
28 |
29 |
30 | @register(outgoing=True, pattern=r"^\.helpme")
31 | async def yardim(event):
32 | try:
33 | tgbotusername = BOT_USERNAME
34 | if tgbotusername is not None:
35 | results = await event.client.inline_query(tgbotusername, "@UserButt")
36 | await results[0].click(
37 | event.chat_id, reply_to=event.reply_to_msg_id, hide_via=True
38 | )
39 | await event.delete()
40 | else:
41 | await event.edit(
42 | "`The bot doesn't work! Please set the Bot Token and Username correctly. The module has been stopped.`"
43 | )
44 | except Exception:
45 | return await event.edit(
46 | "`You cannot send inline results in this chat (caused by SendInlineBotResultRequest)`"
47 | )
48 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | wheel
2 | aiohttp
3 | aiofiles
4 | aria2p
5 | async_generator
6 | cowpy
7 | psutil
8 | wget
9 | TgCrypto>=1.2.0
10 | cffi>=1.0.0
11 | dnspython
12 | emoji
13 | PyPDF2
14 | cryptg
15 | patool
16 | gitpython
17 | asyncurban
18 | google-api-python-client==1.8.0
19 | google-auth-oauthlib
20 | googletrans==3.1.0a0
21 | google_images_download>=2.7.1
22 | gTTS>=2.1.1
23 | gTTS-token>=1.1.3
24 | hachoir>=3.0a5
25 | REPO_LINK
26 | heroku3>=3.4.0
27 | httplib2>=0.18.0
28 | humanize
29 | lxml
30 | oauth2client
31 | Pillow>=6.0.0
32 | fontTools
33 | psycopg2
34 | psycopg2-binary
35 | pybase64>=0.4.0
36 | pylast
37 | pySmartDL
38 | python-barcode
39 | python-dotenv
40 | pytz
41 | qrcode
42 | requests>=2.18.4
43 | search-engine-parser>=0.6.1
44 | speedtest-cli>=2.0.2
45 | sqlalchemy<=1.3.23
46 | telethon>=1.14.0
47 | telethon-session-sqlalchemy>=0.2.6
48 | urbandict>=0.5
49 | wikipedia>=1.4.0
50 | coffeehouse>=2.1.0
51 | git+https://github.com/johnwmillr/LyricsGenius.git
52 | git+https://github.com/voins/google-images-download.git@2cd68173c961324a2c41c61e8b6f40a49663ce60
53 | lyricsgenius
54 | redis>=3.3.10
55 | PyDrive2
56 | pyDownload
57 | beautifulsoup4>=4.8.1
58 | youtube-dl
59 | PyGithub
60 | bs4
61 | covid>=2.2.9
62 | base
63 | pip>=19.2.3
64 | setuptools>=28.8.0
65 | selenium>=3.141.0
66 | telegraph
67 | python-dateutil
68 | pyfiglet
69 | jotquote
70 | html_telegraph_poster
71 | csvfaker
72 | git+https://github.com/LonamiWebs/Telethon
73 | git+https://github.com/ahupp/python-magic
74 | pytube>=9.5.1
75 | pymongo[srv]
76 | youtube_search
77 | justwatch
78 | deezloader
79 | zipfile38
80 | bitlyshortener
81 | validators
82 | geopy
83 | glitch_this
84 | twitter_scraper
85 | pyaztro
86 | jikanpy
87 | vcsi
88 | lottie
89 | wand
90 | colour
91 | scipy
92 | wordcloud
93 | opencv-python
94 | youtube-dl>=2021.1.8
95 | youtube-search-python>=1.3.2
96 | youtube-search>=1.1.1
97 | pendulum
98 | lyrics_extractor
99 |
--------------------------------------------------------------------------------
/userbot/modules/frog.py:
--------------------------------------------------------------------------------
1 | # Yang Hapus Besok Mati Aminnn
2 | # Port By @Vckyouuu
3 |
4 |
5 | import random
6 |
7 | from telethon.errors import ChatSendInlineForbiddenError, ChatSendStickersForbiddenError
8 |
9 | from userbot.events import register
10 | from userbot import CMD_HELP, bot
11 |
12 | @register(outgoing=True, pattern=r"^\.frog (.*)")
13 | async def honkasays(event):
14 | wai = await event.edit("`Sedang Memprosess!!!`")
15 | text = event.pattern_match.group(1)
16 | if not text:
17 | return await event.edit("`Beri Aku Bebeberapa Teks, Contoh .prog test`")
18 | try:
19 | if not text.endswith("."):
20 | text = text + "."
21 | if len(text)<=9:
22 | results = await bot.inline_query("honka_says_bot", text)
23 | await results[2].click(
24 | event.chat_id,
25 | silent=True,
26 | hide_via=True,
27 | )
28 | elif len(text)>=14:
29 | results = await bot.inline_query("honka_says_bot", text)
30 | await results[0].click(
31 | event.chat_id,
32 | silent=True,
33 | hide_via=True,
34 | )
35 | else:
36 | results = await bot.inline_query("honka_says_bot", text)
37 | await results[1].click(
38 | event.chat_id,
39 | silent=True,
40 | hide_via=True,
41 | )
42 | await event.delete()
43 | except ChatSendInlineForbiddenError:
44 | await event.edit("`Boss! Saya tidak bisa menggunakan hal-hal sebaris di sini...`")
45 | except ChatSendStickersForbiddenError:
46 | await event.edit("Maaf Lord, saya tidak bisa mengirim stiker ke sini !!")
47 |
48 |
49 | CMD_HELP.update({"frog": "**Modules:** __Frog__\n\n**Perintah:** `.frog `\
50 | \n**Penjelasan:** Mengirim sebuah animasi sticker kodok."})
51 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/lydia_sql.py:
--------------------------------------------------------------------------------
1 | from sqlalchemy import Column, Numeric, UnicodeText
2 | from userbot.modules.sql_helper import SESSION, BASE
3 |
4 |
5 | class LydiaAI(BASE):
6 | __tablename__ = "lydia_ai"
7 | user_id = Column(Numeric, primary_key=True)
8 | chat_id = Column(Numeric, primary_key=True)
9 | session_id = Column(UnicodeText)
10 | session_expires = Column(Numeric)
11 |
12 | def __init__(
13 | self,
14 | user_id,
15 | chat_id,
16 | session_id,
17 | session_expires
18 | ):
19 | self.user_id = user_id
20 | self.chat_id = chat_id
21 | self.session_id = session_id
22 | self.session_expires = session_expires
23 |
24 |
25 | LydiaAI.__table__.create(checkfirst=True)
26 |
27 |
28 | def get_s(user_id, chat_id):
29 | try:
30 | return SESSION.query(LydiaAI).get((user_id, chat_id))
31 | except BaseException:
32 | return None
33 | finally:
34 | SESSION.close()
35 |
36 |
37 | def get_all_s():
38 | try:
39 | return SESSION.query(LydiaAI).all()
40 | except BaseException:
41 | return None
42 | finally:
43 | SESSION.close()
44 |
45 |
46 | def add_s(
47 | user_id,
48 | chat_id,
49 | session_id,
50 | session_expires
51 | ):
52 | adder = SESSION.query(LydiaAI).get((user_id, chat_id))
53 | if adder:
54 | adder.session_id = session_id
55 | adder.session_expires = session_expires
56 | else:
57 | adder = LydiaAI(
58 | user_id,
59 | chat_id,
60 | session_id,
61 | session_expires
62 | )
63 | SESSION.add(adder)
64 | SESSION.commit()
65 |
66 |
67 | def remove_s(
68 | user_id,
69 | chat_id
70 | ):
71 | note = SESSION.query(LydiaAI).get((user_id, chat_id))
72 | if note:
73 | SESSION.delete(note)
74 | SESSION.commit()
75 |
--------------------------------------------------------------------------------
/userbot/utils/chrome.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2020 Adek Maulana
2 | #
3 | # SPDX-License-Identifier: GPL-3.0-or-later
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program. If not, see .
16 |
17 |
18 | import os
19 |
20 | from selenium import webdriver
21 | from selenium.webdriver.chrome.options import Options
22 |
23 | from userbot import TEMP_DOWNLOAD_DIRECTORY, GOOGLE_CHROME_BIN, CHROME_DRIVER
24 |
25 |
26 | async def chrome(chrome_options=None):
27 | if chrome_options is None:
28 | chrome_options = await options()
29 | if not os.path.isdir(TEMP_DOWNLOAD_DIRECTORY):
30 | os.mkdir(TEMP_DOWNLOAD_DIRECTORY)
31 | prefs = {'download.default_directory': TEMP_DOWNLOAD_DIRECTORY}
32 | chrome_options.add_experimental_option('prefs', prefs)
33 | return webdriver.Chrome(executable_path=CHROME_DRIVER,
34 | options=chrome_options)
35 |
36 |
37 | async def options():
38 | chrome_options = Options()
39 | chrome_options.binary_location = GOOGLE_CHROME_BIN
40 | chrome_options.add_argument("--headless")
41 | chrome_options.add_argument("--window-size=1920x1080")
42 | chrome_options.add_argument("--disable-dev-shm-usage")
43 | chrome_options.add_argument("--no-sandbox")
44 | chrome_options.add_argument("--disable-gpu")
45 | return chrome_options
46 |
--------------------------------------------------------------------------------
/userbot/modules/figlet.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.
2 | #
3 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
4 | # you may not use this file except in compliance with the License.
5 | #
6 |
7 | import pyfiglet
8 | from userbot import CMD_HELP
9 | from userbot.events import register
10 |
11 |
12 | @register(outgoing=True, pattern=r"^\.fg(?: |$)(.*)")
13 | async def figlet(e):
14 | if e.fwd_from:
15 | return
16 | CMD_FIG = {
17 | "slant": "slant",
18 | "3D": "3-d",
19 | "5line": "5lineoblique",
20 | "alpha": "alphabet",
21 | "banner": "banner3-D",
22 | "doh": "doh",
23 | "iso": "isometric1",
24 | "letter": "letters",
25 | "allig": "alligator",
26 | "dotm": "dotmatrix",
27 | "bubble": "bubble",
28 | "bulb": "bulbhead",
29 | "digi": "digital"}
30 | input_str = e.pattern_match.group(1)
31 | if "." in input_str:
32 | text, cmd = input_str.split(".", maxsplit=1)
33 | elif input_str is not None:
34 | cmd = None
35 | text = input_str
36 | else:
37 | await e.edit("`Please add some text to figlet`")
38 | return
39 | if cmd is not None:
40 | try:
41 | font = CMD_FIG[cmd]
42 | except KeyError:
43 | await e.edit("`Invalid selected font.`")
44 | return
45 | result = pyfiglet.figlet_format(text, font=font)
46 | else:
47 | result = pyfiglet.figlet_format(text)
48 | await e.respond("`{}`".format(result))
49 | await e.delete()
50 |
51 | CMD_HELP.update({
52 | "figlet":
53 | ">`.fg`"
54 | "\nUsage: Enhance ur text to strip line with anvil."
55 | "\n\nExample: `.figlet TEXT.STYLE`"
56 | "\nSTYLE LIST: `slant`, `3D`, `5line`, `alpha`, `banner`, `doh`, `iso`, `letter`, `allig`, `dotm`, `bubble`, `bulb`, `digi`"
57 | })
58 |
--------------------------------------------------------------------------------
/userbot/modules/lordtt.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2020 Frizzy.
2 | # All rights reserved.
3 | #
4 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # Lord Userbot
7 |
8 | from telethon.errors.rpcerrorlist import YouBlockedUserError
9 | from userbot import bot, CMD_HELP
10 | from userbot.events import register
11 |
12 | # Alvin Gans
13 |
14 |
15 | @register(outgoing=True, pattern="^.tiktok(?: |$)(.*)")
16 | async def _(event):
17 | if event.fwd_from:
18 | return
19 | d_link = event.pattern_match.group(1)
20 | if ".com" not in d_link:
21 | await event.edit("`Mohon Maaf Lord, Saya Membutuhkan Link Video Tiktok Untuk Download Video Tiktok` **(._.)**")
22 | else:
23 | await event.edit("```Video Sedang Diproses.....```")
24 | chat = "@ttsavebot"
25 | async with bot.conversation(chat) as conv:
26 | try:
27 | msg_start = await conv.send_message("/start")
28 | r = await conv.get_response()
29 | msg = await conv.send_message(d_link)
30 | details = await conv.get_response()
31 | video = await conv.get_response()
32 | """ - don't spam notif - """
33 | await bot.send_read_acknowledge(conv.chat_id)
34 | except YouBlockedUserError:
35 | await event.edit("**Kesalahan:** `Lord Mohon Buka Blokir` @ttsavebot `Dan Coba Lagi!`")
36 | return
37 | await bot.send_file(event.chat_id, video)
38 | await event.client.delete_messages(conv.chat_id,
39 | [msg_start.id, r.id, msg.id, details.id, video.id])
40 | await event.delete()
41 |
42 | # Alvin Gans
43 | CMD_HELP.update(
44 | {
45 | "tiktok": "**Modules:** __Tik Tok__\n\n**Perintah:** `.tiktok `"
46 | "\n**Penjelasan:** Download Video Tiktok Tanpa Watermark"})
47 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/notes_sql.py:
--------------------------------------------------------------------------------
1 | try:
2 | from userbot.modules.sql_helper import SESSION, BASE
3 | except ImportError:
4 | raise AttributeError
5 | from sqlalchemy import Column, UnicodeText, Numeric, String
6 |
7 |
8 | class Notes(BASE):
9 | __tablename__ = "notes"
10 | chat_id = Column(String(14), primary_key=True)
11 | keyword = Column(UnicodeText, primary_key=True, nullable=False)
12 | reply = Column(UnicodeText)
13 | f_mesg_id = Column(Numeric)
14 |
15 | def __init__(self, chat_id, keyword, reply, f_mesg_id):
16 | self.chat_id = str(chat_id)
17 | self.keyword = keyword
18 | self.reply = reply
19 | self.f_mesg_id = f_mesg_id
20 |
21 |
22 | Notes.__table__.create(checkfirst=True)
23 |
24 |
25 | def get_note(chat_id, keyword):
26 | try:
27 | return SESSION.query(Notes).get((str(chat_id), keyword))
28 | finally:
29 | SESSION.close()
30 |
31 |
32 | def get_notes(chat_id):
33 | try:
34 | return SESSION.query(Notes).filter(Notes.chat_id == str(chat_id)).all()
35 | finally:
36 | SESSION.close()
37 |
38 |
39 | def add_note(chat_id, keyword, reply, f_mesg_id):
40 | to_check = get_note(chat_id, keyword)
41 | if not to_check:
42 | adder = Notes(str(chat_id), keyword, reply, f_mesg_id)
43 | SESSION.add(adder)
44 | SESSION.commit()
45 | return True
46 | else:
47 | rem = SESSION.query(Notes).get((str(chat_id), keyword))
48 | SESSION.delete(rem)
49 | SESSION.commit()
50 | adder = Notes(str(chat_id), keyword, reply, f_mesg_id)
51 | SESSION.add(adder)
52 | SESSION.commit()
53 | return False
54 |
55 |
56 | def rm_note(chat_id, keyword):
57 | to_check = get_note(chat_id, keyword)
58 | if not to_check:
59 | return False
60 | else:
61 | rem = SESSION.query(Notes).get((str(chat_id), keyword))
62 | SESSION.delete(rem)
63 | SESSION.commit()
64 | return True
65 |
--------------------------------------------------------------------------------
/userbot/modules/mentions.py:
--------------------------------------------------------------------------------
1 | import re
2 |
3 | from telethon.tl import types
4 |
5 | from userbot import CMD_HELP, bot
6 | from userbot.events import register
7 |
8 | usernexp = re.compile(r"@(\w{3,32})\[(.+?)\]")
9 | nameexp = re.compile(r"\[([\w\S]+)\]\(tg://user\?id=(\d+)\)\[(.+?)\]")
10 |
11 |
12 | @register(outgoing=True, ignore_unsafe=True, disable_errors=True)
13 | async def mention(event):
14 | newstr = event.text
15 | if event.entities:
16 | newstr = nameexp.sub(r'\3', newstr, 0)
17 | for match in usernexp.finditer(newstr):
18 | user = match.group(1)
19 | text = match.group(2)
20 | name, entities = await bot._parse_message_text(text, "md")
21 | rep = f'{name}'
22 | if entities:
23 | for e in entities:
24 | tag = None
25 | if isinstance(e, types.MessageEntityBold):
26 | tag = "{}"
27 | elif isinstance(e, types.MessageEntityItalic):
28 | tag = "{}"
29 | elif isinstance(e, types.MessageEntityCode):
30 | tag = "{}"
31 | elif isinstance(e, types.MessageEntityStrike):
32 | tag = "{}"
33 | elif isinstance(e, types.MessageEntityPre):
34 | tag = "{}"
35 | elif isinstance(e, types.MessageEntityUnderline):
36 | tag = "{}"
37 | if tag:
38 | rep = tag.format(rep)
39 | newstr = re.sub(re.escape(match.group(0)), rep, newstr)
40 | if newstr != event.text:
41 | await event.edit(newstr, parse_mode="html")
42 |
43 |
44 | CMD_HELP.update(
45 | {
46 | "mentions": "Mentions users with a custom name."
47 | "\nUsage: `Hi @ender1324[bluid boi]`"
48 | "\nResult: Hi [bluid boi](tg://resolve?domain=ender1324)"
49 | }
50 | )
51 |
--------------------------------------------------------------------------------
/userbot/modules/adzan.py:
--------------------------------------------------------------------------------
1 | import json
2 |
3 | import requests
4 |
5 | from userbot import CMD_HELP
6 | from userbot.events import register
7 |
8 | PLACE = ""
9 |
10 |
11 | @register(pattern=r"^\.adzan(?: |$)(.*)")
12 | async def get_adzan(adzan):
13 | if not adzan.pattern_match.group(1):
14 | LOCATION = PLACE
15 | if not LOCATION:
16 | await adzan.edit("`Harap Menentukan Kota Atau Negara.`")
17 | return
18 | else:
19 | LOCATION = adzan.pattern_match.group(1)
20 |
21 | # url = f'http://muslimsalat.com/{LOCATION}.json?key=bd099c5825cbedb9aa934e255a81a5fc'
22 | url = f"https://api.pray.zone/v2/times/today.json?city={LOCATION}"
23 | request = requests.get(url)
24 | if request.status_code == 500:
25 | return await adzan.edit(f"**Tidak Dapat Menemukan Kota** `{LOCATION}`")
26 |
27 | parsed = json.loads(request.text)
28 |
29 | city = parsed["results"]["location"]["city"]
30 | country = parsed["results"]["location"]["country"]
31 | timezone = parsed["results"]["location"]["timezone"]
32 | date = parsed["results"]["datetime"][0]["date"]["gregorian"]
33 |
34 | imsak = parsed["results"]["datetime"][0]["times"]["Imsak"]
35 | subuh = parsed["results"]["datetime"][0]["times"]["Fajr"]
36 | zuhur = parsed["results"]["datetime"][0]["times"]["Dhuhr"]
37 | ashar = parsed["results"]["datetime"][0]["times"]["Asr"]
38 | maghrib = parsed["results"]["datetime"][0]["times"]["Maghrib"]
39 | isya = parsed["results"]["datetime"][0]["times"]["Isha"]
40 |
41 | result = (
42 | f"**Jadwal Sholat**:\n"
43 | f"📅 `{date} | {timezone}`\n"
44 | f"🌏 `{city} | {country}`\n\n"
45 | f"**Imsak :** `{imsak}`\n"
46 | f"**Subuh :** `{subuh}`\n"
47 | f"**Zuhur :** `{zuhur}`\n"
48 | f"**Ashar :** `{ashar}`\n"
49 | f"**Maghrib :** `{maghrib}`\n"
50 | f"**Isya :** `{isya}`\n"
51 | )
52 |
53 | await adzan.edit(result)
54 |
55 |
56 | CMD_HELP.update({"adzan": "\n\n`>.adzan `"
57 | "\nPenjelasan: Memberikan Informasi Waktu Sholat."})
58 |
--------------------------------------------------------------------------------
/userbot/modules/emojigames.py:
--------------------------------------------------------------------------------
1 | # fix by @heyworld for OUB
2 | # bug fixed by @d3athwarrior
3 |
4 | from telethon.tl.types import InputMediaDice
5 | from userbot.events import register
6 | from userbot import CMD_HELP
7 |
8 |
9 | @register(outgoing=True, pattern="^.dice(?: |$)(.*)")
10 | async def _(event):
11 | if event.fwd_from:
12 | return
13 | input_str = event.pattern_match.group(1)
14 | await event.delete()
15 | r = await event.reply(file=InputMediaDice(''))
16 | if input_str:
17 | try:
18 | required_number = int(input_str)
19 | while not r.media.value == required_number:
20 | await r.delete()
21 | r = await event.reply(file=InputMediaDice(''))
22 | except BaseException:
23 | pass
24 |
25 |
26 | @register(outgoing=True, pattern="^.dart(?: |$)(.*)")
27 | async def _(event):
28 | if event.fwd_from:
29 | return
30 | input_str = event.pattern_match.group(1)
31 | await event.delete()
32 | r = await event.reply(file=InputMediaDice('🎯'))
33 | if input_str:
34 | try:
35 | required_number = int(input_str)
36 | while not r.media.value == required_number:
37 | await r.delete()
38 | r = await event.reply(file=InputMediaDice('🎯'))
39 | except BaseException:
40 | pass
41 |
42 |
43 | @register(outgoing=True, pattern="^.ball(?: |$)(.*)")
44 | async def _(event):
45 | if event.fwd_from:
46 | return
47 | input_str = event.pattern_match.group(1)
48 | await event.delete()
49 | r = await event.reply(file=InputMediaDice('🏀'))
50 | if input_str:
51 | try:
52 | required_number = int(input_str)
53 | while not r.media.value == required_number:
54 | await r.delete()
55 | r = await event.reply(file=InputMediaDice('🏀'))
56 | except BaseException:
57 | pass
58 |
59 | CMD_HELP.update({
60 | "emojigames":
61 | "`.dice` 1-6 or `.dart`1-6 or `.ball`1-5\
62 | \nUsage: hahaha just a magic.\nWarning:`Don't use any other values or bot will crash`"
63 | })
64 |
--------------------------------------------------------------------------------
/userbot/modules/github.py:
--------------------------------------------------------------------------------
1 | import aiohttp
2 | from userbot.events import register
3 | from userbot import CMD_HELP
4 |
5 |
6 | @register(pattern=r".git (.*)", outgoing=True)
7 | async def github(event):
8 | URL = f"https://api.github.com/users/{event.pattern_match.group(1)}"
9 | await event.get_chat()
10 | async with aiohttp.ClientSession() as session:
11 | async with session.get(URL) as request:
12 | if request.status == 404:
13 | return await event.reply("`" + event.pattern_match.group(1) +
14 | " not found`")
15 |
16 | result = await request.json()
17 |
18 | url = result.get("html_url", None)
19 | name = result.get("name", None)
20 | company = result.get("company", None)
21 | bio = result.get("bio", None)
22 | created_at = result.get("created_at", "Not Found")
23 |
24 | REPLY = (
25 | f"Info Akun GitHub `{username}`\n"
26 | f"`Nama Pengguna :` {name}\n"
27 | f"`Bio :` {bio}\n"
28 | f"`URL :` {url}\n"
29 | f"`Perusahaan :` {company}\n"
30 | f"`Dibuat pada :` {created_at}`\n"
31 | f"`Info lainnya : [Disini](https://api.github.com/users/{username}/events/public)"
32 | )
33 |
34 | if not result.get("repos_url", None):
35 | return await event.edit(REPLY)
36 | async with session.get(result.get("repos_url", None)) as request:
37 | result = request.json
38 | if request.status == 404:
39 | return await event.edit(REPLY)
40 |
41 | result = await request.json()
42 |
43 | REPLY += "\nRepo:\n"
44 |
45 | for nr in range(len(result)):
46 | REPLY += f"[{result[nr].get('name', None)}]({result[nr].get('html_url', None)})\n"
47 |
48 | await event.edit(REPLY)
49 |
50 |
51 | CMD_HELP.update({
52 | "github": ".git "
53 | "\nPenjelasan: Seperti .whois tetapi untuk nama pengguna GitHub."
54 | })
55 |
--------------------------------------------------------------------------------
/userbot/modules/lorddeteksi.py:
--------------------------------------------------------------------------------
1 | # Ported From Cat Userbot For Lord Userbot By Alvin/LiuAlvinas # Jangan Hapus # Jangan Ubah
2 | # Based On Plugins
3 | # Alvin Ganteng
4 |
5 |
6 | from telethon.errors.rpcerrorlist import YouBlockedUserError
7 | from userbot import CMD_HELP, bot
8 | from userbot.events import register
9 |
10 |
11 | @register(outgoing=True, pattern=r"^\.deteksi(?: |$)(.*)")
12 | async def _(event):
13 | if event.fwd_from:
14 | return
15 | input_str = "".join(event.text.split(maxsplit=1)[1:])
16 | reply_message = await event.get_reply_message()
17 | if not event.reply_to_msg_id:
18 | await event.edit("```Lord, Mohon Balas Ke Pesan Pengguna atau ketik .deteksi (ID/Username) Yang mau Anda deteksi```")
19 | return
20 | if input_str:
21 | try:
22 | uid = int(input_str)
23 | except ValueError:
24 | try:
25 | u = await event.client.get_entity(input_str)
26 | except ValueError:
27 | await edit.event("`Lord, Mohon Berikan ID/Username untuk menemukan Riwayat`"
28 | )
29 | uid = u.id
30 | else:
31 | uid = reply_message.sender_id
32 | chat = "@tgscanrobot"
33 | event = await event.edit("`Mendeteksi...`")
34 | async with bot.conversation(chat) as conv:
35 | try:
36 | await conv.send_message(f"{uid}")
37 | except YouBlockedUserError:
38 | await steal.reply(
39 | "```Lord Mohon Unblock @tgscanrobot Dan Coba Lagi```"
40 | )
41 | response = await conv.get_response()
42 | await event.client.send_read_acknowledge(conv.chat_id)
43 | await event.edit(response.text)
44 |
45 |
46 | def inline_mention(user):
47 | full_name = user_full_name(user) or "No Name"
48 | return f"[{full_name}](tg://user?id={user.id})"
49 |
50 |
51 | def user_full_name(user):
52 | names = [user.first_name, user.last_name]
53 | names = [i for i in list(names) if i]
54 | return " ".join(names)
55 |
56 |
57 | # Alvin Ganteng
58 | CMD_HELP.update({
59 | "deteksi":
60 | "`.deteksi`\
61 | \nPenjelasan: Melihat Riwayat Grup Yang Pernah/Sedang dimasuki."
62 | })
63 |
--------------------------------------------------------------------------------
/userbot/modules/webupload.py:
--------------------------------------------------------------------------------
1 | # credits: SNAPDRAGON (@s_n_a_p_s)
2 | # originally from xtra-telegram
3 | # ported by @heyworld
4 |
5 | import asyncio
6 | import time
7 | from userbot.events import register
8 | from userbot import CMD_HELP, bot
9 | from userbot import TEMP_DOWNLOAD_DIRECTORY
10 |
11 |
12 | @register(outgoing=True, pattern="^.webupload ?(.+?|) (?:--)(anonfiles|transfer|filebin|anonymousfiles|megaupload|bayfiles)")
13 | async def _(event):
14 | if event.fwd_from:
15 | return
16 | await event.edit("Processing ...")
17 | PROCESS_RUN_TIME = 100
18 | input_str = event.pattern_match.group(1)
19 | selected_transfer = event.pattern_match.group(2)
20 | if input_str:
21 | file_name = input_str
22 | else:
23 | reply = await event.get_reply_message()
24 | file_name = await bot.download_media(reply.media, TEMP_DOWNLOAD_DIRECTORY)
25 | event.message.id
26 | CMD_WEB = {
27 | "anonfiles": "curl -F \"file=@{}\" https://anonfiles.com/api/upload",
28 | "transfer": "curl --upload-file \"{}\" https://transfer.sh/{os.path.basename(file_name)}",
29 | "filebin": "curl -X POST --data-binary \"@test.png\" -H \"filename: {}\" \"https://filebin.net\"",
30 | "anonymousfiles": "curl -F file=\"@{}\" https://api.anonymousfiles.io/",
31 | "megaupload": "curl -F \"file=@{}\" https://megaupload.is/api/upload",
32 | "bayfiles": ".exec curl -F \"file=@{}\" https://bayfiles.com/api/upload"}
33 | try:
34 | selected_one = CMD_WEB[selected_transfer].format(file_name)
35 | except KeyError:
36 | await event.edit("Invalid selected Transfer")
37 | cmd = selected_one
38 | time.time() + PROCESS_RUN_TIME
39 | process = await asyncio.create_subprocess_shell(
40 | cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
41 | )
42 | stdout, stderr = await process.communicate()
43 | await event.edit(f"{stdout.decode()}")
44 |
45 | CMD_HELP.update({
46 | "webupload":
47 | "\n`.webupload --`(`anonfiles`|`transfer`|`filebin`|`anonymousfiles`|`megaupload`|`bayfiles`)\
48 | \nUsage: reply `.webupload --anonfiles` or `.webupload --filebin` and the file will be uploaded to that website. "
49 | })
50 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/filter_sql.py:
--------------------------------------------------------------------------------
1 | try:
2 | from userbot.modules.sql_helper import SESSION, BASE
3 | except ImportError:
4 | raise AttributeError
5 | from sqlalchemy import Column, UnicodeText, Numeric, String
6 |
7 |
8 | class Filters(BASE):
9 | __tablename__ = "filters"
10 | chat_id = Column(String(14), primary_key=True)
11 | keyword = Column(UnicodeText, primary_key=True, nullable=False)
12 | reply = Column(UnicodeText)
13 | f_mesg_id = Column(Numeric)
14 |
15 | def __init__(self, chat_id, keyword, reply, f_mesg_id):
16 | self.chat_id = str(chat_id)
17 | self.keyword = keyword
18 | self.reply = reply
19 | self.f_mesg_id = f_mesg_id
20 |
21 | def __eq__(self, other):
22 | return bool(
23 | isinstance(other, Filters) and self.chat_id == other.chat_id
24 | and self.keyword == other.keyword)
25 |
26 |
27 | Filters.__table__.create(checkfirst=True)
28 |
29 |
30 | def get_filter(chat_id, keyword):
31 | try:
32 | return SESSION.query(Filters).get((str(chat_id), keyword))
33 | finally:
34 | SESSION.close()
35 |
36 |
37 | def get_filters(chat_id):
38 | try:
39 | return SESSION.query(Filters).filter(
40 | Filters.chat_id == str(chat_id)).all()
41 | finally:
42 | SESSION.close()
43 |
44 |
45 | def add_filter(chat_id, keyword, reply, f_mesg_id):
46 | to_check = get_filter(chat_id, keyword)
47 | if not to_check:
48 | adder = Filters(str(chat_id), keyword, reply, f_mesg_id)
49 | SESSION.add(adder)
50 | SESSION.commit()
51 | return True
52 | else:
53 | rem = SESSION.query(Filters).get((str(chat_id), keyword))
54 | SESSION.delete(rem)
55 | SESSION.commit()
56 | adder = Filters(str(chat_id), keyword, reply, f_mesg_id)
57 | SESSION.add(adder)
58 | SESSION.commit()
59 | return False
60 |
61 |
62 | def remove_filter(chat_id, keyword):
63 | to_check = get_filter(chat_id, keyword)
64 | if not to_check:
65 | return False
66 | else:
67 | rem = SESSION.query(Filters).get((str(chat_id), keyword))
68 | SESSION.delete(rem)
69 | SESSION.commit()
70 | return True
71 |
--------------------------------------------------------------------------------
/userbot/utils/progress.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2020 Adek Maulana
2 | #
3 | # SPDX-License-Identifier: GPL-3.0-or-later
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program. If not, see .
16 |
17 |
18 | import time
19 | import math
20 |
21 | from .tools import humanbytes, time_formatter
22 | from .exceptions import CancelProcess
23 |
24 |
25 | async def progress(
26 | current, total, gdrive, start, prog_type, file_name=None, is_cancelled=False
27 | ):
28 | now = time.time()
29 | diff = now - start
30 | if is_cancelled is True:
31 | raise CancelProcess
32 |
33 | if round(diff % 10.00) == 0 or current == total:
34 | percentage = current * 100 / total
35 | speed = current / diff
36 | elapsed_time = round(diff)
37 | eta = round((total - current) / speed)
38 | if "upload" in prog_type.lower():
39 | status = "Uploading"
40 | elif "download" in prog_type.lower():
41 | status = "Downloading"
42 | else:
43 | status = "Unknown"
44 | progress_str = "[{0}{1}] `{2}%`".format(
45 | "".join("█" for i in range(math.floor(percentage / 10))),
46 | "".join("░" for i in range(10 - math.floor(percentage / 10))),
47 | round(percentage, 2),
48 | )
49 | tmp = (
50 | f"{progress_str} - {status}\n"
51 | f"`Size:` {humanbytes(current)} of {humanbytes(total)}\n"
52 | f"`Speed:` {humanbytes(speed)}\n"
53 | f"`ETA:` {time_formatter(eta)}\n"
54 | f"`Duration:` {time_formatter(elapsed_time)}"
55 | )
56 | await gdrive.edit(f"`{prog_type}`\n\n" f"`Status`\n{tmp}")
57 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/welcome_sql.py:
--------------------------------------------------------------------------------
1 | try:
2 | from userbot.modules.sql_helper import SESSION, BASE
3 | except ImportError:
4 | raise AttributeError
5 |
6 | from sqlalchemy import BigInteger, Column, Numeric, String, UnicodeText
7 |
8 |
9 | class Welcome(BASE):
10 | __tablename__ = "welcome"
11 | chat_id = Column(String(14), primary_key=True)
12 | previous_welcome = Column(BigInteger)
13 | reply = Column(UnicodeText)
14 | f_mesg_id = Column(Numeric)
15 |
16 | def __init__(self, chat_id, previous_welcome, reply, f_mesg_id):
17 | self.chat_id = str(chat_id)
18 | self.previous_welcome = previous_welcome
19 | self.reply = reply
20 | self.f_mesg_id = f_mesg_id
21 |
22 |
23 | Welcome.__table__.create(checkfirst=True)
24 |
25 |
26 | def get_welcome(chat_id):
27 | try:
28 | return SESSION.query(Welcome).get(str(chat_id))
29 | finally:
30 | SESSION.close()
31 |
32 |
33 | def get_current_welcome_settings(chat_id):
34 | try:
35 | return SESSION.query(Welcome).filter(
36 | Welcome.chat_id == str(chat_id)).one()
37 | except BaseException:
38 | return None
39 | finally:
40 | SESSION.close()
41 |
42 |
43 | def add_welcome_setting(chat_id, previous_welcome, reply, f_mesg_id):
44 | to_check = get_welcome(chat_id)
45 | if not to_check:
46 | adder = Welcome(chat_id, previous_welcome, reply, f_mesg_id)
47 | SESSION.add(adder)
48 | SESSION.commit()
49 | return True
50 | else:
51 | rem = SESSION.query(Welcome).get(str(chat_id))
52 | SESSION.delete(rem)
53 | SESSION.commit()
54 | adder = Welcome(chat_id, previous_welcome, reply, f_mesg_id)
55 | SESSION.commit()
56 | return False
57 |
58 |
59 | def rm_welcome_setting(chat_id):
60 | try:
61 | rem = SESSION.query(Welcome).get(str(chat_id))
62 | if rem:
63 | SESSION.delete(rem)
64 | SESSION.commit()
65 | return True
66 | except BaseException:
67 | return False
68 |
69 |
70 | def update_previous_welcome(chat_id, previous_welcome):
71 | row = SESSION.query(Welcome).get(str(chat_id))
72 | row.previous_welcome = previous_welcome
73 | SESSION.commit()
74 |
--------------------------------------------------------------------------------
/userbot/modules/gban.py:
--------------------------------------------------------------------------------
1 | """Globally Ban users from all the
2 | Group Administrations bots where you are SUDO
3 | Available Commands:
4 | .gban REASON
5 | .ungban REASON"""
6 | import asyncio
7 | from userbot.events import register
8 | from userbot import ALIVE_NAME, G_BAN_LOGGER_GROUP, bot
9 | # imported from uniborg by @heyworld
10 |
11 | # ================= CONSTANT =================
12 | DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else uname().node
13 | # ============================================
14 |
15 |
16 | @register(outgoing=True, pattern="^.gbanb(?: |$)(.*)")
17 | async def _(event):
18 | if G_BAN_LOGGER_GROUP is None:
19 | await event.edit("Set G_BAN_LOGGER_GROUP in vars otherwise module won't work.")
20 | return
21 | if event.fwd_from:
22 | return
23 | reason = event.pattern_match.group(1)
24 | if event.reply_to_msg_id:
25 | r = await event.get_reply_message()
26 | if r.forward:
27 | r_from_id = r.forward.from_id or r.from_id
28 | else:
29 | r_from_id = r.from_id
30 | await bot.send_message(
31 | G_BAN_LOGGER_GROUP,
32 | "/gban [user](tg://user?id={}) {}".format(r_from_id, reason)
33 | )
34 | await event.delete()
35 | await event.reply("**gbanning...**")
36 | asyncio.sleep(3.5)
37 | await event.edit(f"**User gbanned by {DEFAULTUSER}**")
38 | asyncio.sleep(5)
39 | await event.delete()
40 |
41 |
42 | @register(outgoing=True, pattern="^.ungbanb(?: |$)(.*)")
43 | async def _(event):
44 | if G_BAN_LOGGER_GROUP is None:
45 | await event.edit("Set G_BAN_LOGGER_GROUP in vars otherwise module won't work.")
46 | return
47 | if event.fwd_from:
48 | return
49 | reason = event.pattern_match.group(1)
50 | if event.reply_to_msg_id:
51 | r = await event.get_reply_message()
52 | r_from_id = r.from_id
53 | await bot.send_message(
54 | G_BAN_LOGGER_GROUP,
55 | "/ungban [user](tg://user?id={}) {}".format(r_from_id, reason)
56 | )
57 | await event.delete()
58 | await event.reply("**ungbanning...**")
59 | asyncio.sleep(3.5)
60 | await event.edit(f"**User ungbanned by {DEFAULTUSER}**")
61 | asyncio.sleep(5)
62 | await event.delete()
63 |
--------------------------------------------------------------------------------
/userbot/modules/spotifynow.py:
--------------------------------------------------------------------------------
1 | # Ported by Aidil Aryanto
2 |
3 | import os
4 | from telethon.errors.rpcerrorlist import YouBlockedUserError
5 |
6 | from userbot.events import register
7 | from userbot import bot, TEMP_DOWNLOAD_DIRECTORY, CMD_HELP
8 |
9 |
10 | @register(outgoing=True, pattern=r'^\.spotnow(:? |$)(.*)?')
11 | async def _(event):
12 | if event.fwd_from:
13 | return
14 | chat = "@SpotifyNowBot"
15 | now = f"/now"
16 | await event.edit("`Processing...`")
17 | async with event.client.conversation(chat) as conv:
18 | try:
19 | msg = await conv.send_message(now)
20 | response = await conv.get_response()
21 | """ - don't spam notif - """
22 | await bot.send_read_acknowledge(conv.chat_id)
23 | except YouBlockedUserError:
24 | await event.reply("`Please unblock` @SpotifyNowBot`...`")
25 | return
26 | if response.text.startswith("You're"):
27 | await event.edit("`You're not listening to anything on Spotify at the moment`")
28 | await event.client.delete_messages(conv.chat_id,
29 | [msg.id, response.id])
30 | return
31 | if response.text.startswith("Ads."):
32 | await event.edit("`You're listening to those annoying ads.`")
33 | await event.client.delete_messages(conv.chat_id,
34 | [msg.id, response.id])
35 | return
36 | else:
37 | downloaded_file_name = await event.client.download_media(
38 | response.media,
39 | TEMP_DOWNLOAD_DIRECTORY
40 | )
41 | await event.client.send_file(
42 | event.chat_id,
43 | downloaded_file_name,
44 | force_document=False,
45 | )
46 | """ - cleanup chat after completed - """
47 | await event.client.delete_messages(conv.chat_id,
48 | [msg.id, response.id])
49 | await event.delete()
50 | return os.remove(downloaded_file_name)
51 |
52 |
53 | CMD_HELP.update({
54 | "spotifynow":
55 | ">`.spotnow`"
56 | "\nUsage: Show what you're listening on spotify."
57 | "\n@SpotifyNowBot"
58 | })
59 |
--------------------------------------------------------------------------------
/Getstring.sh:
--------------------------------------------------------------------------------
1 | export LANG=C.UTF-8
2 |
3 | echo -e "\nChecking dependencies...\n"
4 |
5 | if command -v python3 >/dev/null 2>&1 ; then
6 | echo -e "python3 found "
7 | echo -e "version: $(python3 -V)"
8 | else
9 | echo -e "python not found "
10 | if [ "$(command -v pkg)" != "" ]; then
11 | arr+=(python ) #termux python3 is in python
12 | else
13 | arr+=(python3 )
14 | fi
15 | fi
16 |
17 | sleep 1
18 |
19 | if command -v wget >/dev/null 2>&1 ; then
20 | echo -e "\nwget found\n"
21 | else
22 | echo -e "\nwget not found\n"
23 | arr+=(wget )
24 | fi
25 |
26 | DEPENDENCIES=${arr[@]}
27 | sleep 1
28 |
29 | if [ ! -z "$DEPENDENCIES" ]; then
30 | echo -e "\nInstalling required dependencies\n"
31 | sleep 1
32 |
33 | if [ "$(command -v pkg)" != "" ]; then # termux
34 | pkg install "$DEPENDENCIES" -y
35 |
36 | elif [ "$(command -v apt-get)" != "" ]; then # debian
37 | sudo apt-get install "$DEPENDENCIES" -y
38 |
39 | elif [ "$(command -v pacman)" != "" ]; then # arch
40 | sudo pacman -S "$DEPENDENCIES" -y
41 |
42 | # Free to PR to add others
43 | else
44 | echo -e "\nDistro not supported \nInstall this packages yourself: $DEPENDENCIES\n"
45 | fi
46 |
47 | else
48 | echo -e "\nDependencies have been installed. \nContinuing to install python packages(PyPI)\n"
49 | sleep 1
50 | fi
51 |
52 | echo -e "\nUpgrading python pip\n"
53 | pip3 install --upgrade pip setuptools
54 | echo -e "\nInstalling telethon...\n"
55 | pip3 install telethon
56 | sleep 2
57 |
58 | if [ ! -e string_session.py ]; then
59 | echo -e "\nDownloading string_session.py\n"
60 | wget https://raw.githubusercontent.com/Zora24/Lord-Userbot/Lord-Userbot/string_session.py
61 |
62 | echo -e "\nRunning script...\n"
63 | sleep 1
64 | python3 string_session.py
65 | else
66 | echo -e "\nstring_session.py detected... \nrunning file\n"
67 | sleep 1
68 | python3 string_session.py
69 | fi
70 |
71 | echo -e "Do you want to cleanup your file?"
72 | echo -e "[1] cleanup: this delete string_session.py and this file"
73 | echo -e "[2] exit"
74 | echo -ne "\nEnter your choice[1-2]: "
75 | read choice
76 | if [ "$choice" = "1" ]; then
77 | echo -e "Cleanup: removing file"
78 | rm -f string_session.py Getstring.sh
79 | elif [ "$choice" = "2" ]; then
80 | exit
81 | fi
82 |
--------------------------------------------------------------------------------
/userbot/modules/lyrics.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.
2 | #
3 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
4 | # you may not use this file except in compliance with the License.
5 | #
6 |
7 | import os
8 | import lyricsgenius
9 |
10 | from userbot.events import register
11 | from userbot import CMD_HELP, GENIUS, lastfm, LASTFM_USERNAME
12 | from pylast import User
13 |
14 | if GENIUS is not None:
15 | genius = lyricsgenius.Genius(GENIUS)
16 |
17 |
18 | @register(outgoing=True, pattern="^.lyrics (?:(now)|(.*) - (.*))")
19 | async def lyrics(lyric):
20 | await lyric.edit("`Getting information...`")
21 | if GENIUS is None:
22 | await lyric.edit(
23 | "`Provide genius access token to Heroku ConfigVars...`")
24 | return False
25 | if lyric.pattern_match.group(1) == "now":
26 | playing = User(LASTFM_USERNAME, lastfm).get_now_playing()
27 | if playing is None:
28 | await lyric.edit(
29 | "`No information current lastfm scrobbling...`"
30 | )
31 | return False
32 | artist = playing.get_artist()
33 | song = playing.get_title()
34 | else:
35 | artist = lyric.pattern_match.group(2)
36 | song = lyric.pattern_match.group(3)
37 | await lyric.edit(f"`Searching lyrics for {artist} - {song}...`")
38 | songs = genius.search_song(song, artist)
39 | if songs is None:
40 | await lyric.edit(f"`Song` **{artist} - {song}** `not found...`")
41 | return False
42 | if len(songs.lyrics) > 4096:
43 | await lyric.edit("`Lyrics is too big, view the file to see it.`")
44 | with open("lyrics.txt", "w+") as f:
45 | f.write(f"Search query: \n{artist} - {song}\n\n{songs.lyrics}")
46 | await lyric.client.send_file(
47 | lyric.chat_id,
48 | "lyrics.txt",
49 | reply_to=lyric.id,
50 | )
51 | os.remove("lyrics.txt")
52 | return True
53 | else:
54 | await lyric.edit(
55 | f"**Search query**:\n`{artist}` - `{song}`"
56 | f"\n\n```{songs.lyrics}```"
57 | )
58 | return True
59 |
60 |
61 | CMD_HELP.update({
62 | "lyrics":
63 | "`.lyrics` ** - **"
64 | "\nUsage: Get lyrics matched artist and song."
65 | "\n\n`.lyrics now`"
66 | "\nUsage: Get lyrics artist and song from current lastfm scrobbling."
67 | })
68 |
--------------------------------------------------------------------------------
/userbot/modules/wallpaper.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2020 Alfiananda P.A
2 | #
3 | # Licensed under the General Public License, Version 3.0;
4 | # you may not use this file except in compliance with the License.
5 | #
6 |
7 | import asyncio
8 | import os
9 | from asyncio.exceptions import TimeoutError
10 |
11 | from telethon.errors.rpcerrorlist import YouBlockedUserError
12 |
13 | from userbot import CMD_HELP, bot
14 | from userbot.events import register
15 |
16 |
17 | @register(outgoing=True, pattern=r"^\.wall(?: |$)(.*)")
18 | async def _(event):
19 | try:
20 | query = event.pattern_match.group(1)
21 | await event.edit("`Mohon Menunggu Lord Saya Sedang Mencari Wallpaper.....`")
22 | async with bot.conversation("@SaitamaRobot") as conv:
23 | try:
24 | query1 = await conv.send_message(f"/wall {query}")
25 | asyncio.sleep(3)
26 | r1 = await conv.get_response()
27 | r2 = await conv.get_response()
28 | await bot.send_read_acknowledge(conv.chat_id)
29 | except YouBlockedUserError:
30 | return await event.reply("`Maaf Tidak Bisa`")
31 | if r1.text.startswith("No"):
32 | return await event.edit(f"`Saya Tidak Menemukan Wallpaper Yang Anda Cari`")
33 | else:
34 | img = await event.client.download_media(r1)
35 | img2 = await event.client.download_media(r2)
36 | await event.edit("`Sedang Mengunggah Wallpaper....`")
37 | p = await event.client.send_file(
38 | event.chat_id,
39 | img,
40 | force_document=False,
41 | caption="Wallpaper Yang Anda Cari",
42 | reply_to=event.reply_to_msg_id,
43 | )
44 | await event.client.send_file(
45 | event.chat_id,
46 | img2,
47 | force_document=True,
48 | caption=f"{query}",
49 | reply_to=p,
50 | )
51 | await event.client.delete_messages(
52 | conv.chat_id, [r1.id, r2.id, query1.id]
53 | )
54 | await event.delete()
55 | os.system("rm *.png *.jpg")
56 | except TimeoutError:
57 | return await event.edit("`Saya Tidak Menemukan Wallpaper Yang Anda Cari`")
58 |
59 |
60 | CMD_HELP.update({"wallpaper": ">`.wall `"
61 | "\nUsage: Mencari Wallpaper Bagus."})
62 |
--------------------------------------------------------------------------------
/userbot/modules/antiflood.py:
--------------------------------------------------------------------------------
1 | import asyncio
2 | from telethon.tl.functions.channels import EditBannedRequest
3 | from telethon.tl.types import ChatBannedRights
4 | from userbot.utils.tools import is_admin
5 | import userbot.modules.sql_helper.antiflood_sql as sql
6 | from userbot.events import register
7 |
8 |
9 | CHAT_FLOOD = sql.__load_flood_settings()
10 | # warn mode for anti flood
11 | ANTI_FLOOD_WARN_MODE = ChatBannedRights(
12 | until_date=None,
13 | view_messages=None,
14 | send_messages=True
15 | )
16 |
17 |
18 | @register(incoming=True, disable_edited=True, disable_errors=True)
19 | async def _(event):
20 | # logger.info(CHAT_FLOOD)
21 | if not CHAT_FLOOD:
22 | return
23 | admin_c = await is_admin(event.chat_id, event.message.from_id)
24 | if admin_c:
25 | return
26 | if not (str(event.chat_id) in CHAT_FLOOD):
27 | return
28 | should_ban = sql.update_flood(event.chat_id, event.message.from_id)
29 | if not should_ban:
30 | return
31 | try:
32 | await event.client(EditBannedRequest(
33 | event.chat_id,
34 | event.message.from_id,
35 | ANTI_FLOOD_WARN_MODE
36 | ))
37 | except Exception as e: # pylint:disable=C0103,W0703
38 | no_admin_privilege_message = await event.client.send_message(
39 | entity=event.chat_id,
40 | message="""**Automatic AntiFlooder**
41 | @admin [User](tg://user?id={}) is flooding this chat.
42 |
43 | `{}`""".format(event.message.from_id, str(e)),
44 | reply_to=event.message.id
45 | )
46 | await asyncio.sleep(10)
47 | await no_admin_privilege_message.edit(
48 | "Sadly u don't have admin privilege")
49 | else:
50 | await event.client.send_message(
51 | entity=event.chat_id,
52 | message="""**Automatic AntiFlooder**
53 | [User](tg://user?id={}) has been automatically restricted
54 | because he reached the defined flood limit.""".format(event.message.from_id),
55 | reply_to=event.message.id
56 | )
57 |
58 |
59 | @register(outgoing=True, pattern="^.setflood(?: |$)(.*)")
60 | async def _(event):
61 | if event.fwd_from:
62 | return
63 | input_str = event.pattern_match.group(1)
64 | try:
65 | sql.set_flood(event.chat_id, input_str)
66 | sql.__load_flood_settings()
67 | await event.edit("Antiflood updated to {} in the current chat".format(input_str))
68 | except Exception as e: # pylint:disable=C0103,W0703
69 | await event.edit(str(e))
70 |
--------------------------------------------------------------------------------
/userbot/modules/ss_video.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2020 Alfiananda P.A
2 | #
3 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
4 | # you may not use this file except in compliance with the License.
5 | #
6 |
7 | import asyncio
8 | import os
9 | import time
10 |
11 | from telethon.tl.types import DocumentAttributeFilename
12 |
13 | from userbot import CMD_HELP, bot
14 | from userbot.events import register
15 | from userbot.utils import progress
16 |
17 |
18 | @register(outgoing=True, pattern=r"^\.ssvideo(?: |$)(.*)")
19 | async def ssvideo(event):
20 | if not event.reply_to_msg_id:
21 | await event.edit("`Reply to any media..`")
22 | return
23 | reply_message = await event.get_reply_message()
24 | if not reply_message.media:
25 | await event.edit("`reply to a video..`")
26 | return
27 | try:
28 | frame = int(event.pattern_match.group(1))
29 | if frame > 10:
30 | return await event.edit("`hey..dont put that much`")
31 | except BaseException:
32 | return await event.edit("`Please input number of frame!`")
33 | if reply_message.photo:
34 | return await event.edit("`Hey..this is an image!`")
35 | if (
36 | DocumentAttributeFilename(file_name="AnimatedSticker.tgs")
37 | in reply_message.media.document.attributes
38 | ):
39 | return await event.edit("`Unsupported files..`")
40 | elif (
41 | DocumentAttributeFilename(file_name="sticker.webp")
42 | in reply_message.media.document.attributes
43 | ):
44 | return await event.edit("`Unsupported files..`")
45 | c_time = time.time()
46 | await event.edit("`Downloading media..`")
47 | ss = await bot.download_media(
48 | reply_message,
49 | "anu.mp4",
50 | progress_callback=lambda d, t: asyncio.get_event_loop().create_task(
51 | progress(d, t, event, c_time, "[DOWNLOAD]")
52 | ),
53 | )
54 | try:
55 | await event.edit("`Proccessing..`")
56 | command = f"vcsi -g {frame}x{frame} {ss} -o ss.png "
57 | os.system(command)
58 | await event.client.send_file(
59 | event.chat_id,
60 | "ss.png",
61 | reply_to=event.reply_to_msg_id,
62 | )
63 | await event.delete()
64 | os.system("rm -rf *.png")
65 | os.system("rm -rf *.mp4")
66 | except BaseException as e:
67 | os.system("rm -rf *.png")
68 | os.system("rm -rf *.mp4")
69 | return await event.edit(f"{e}")
70 |
71 |
72 | CMD_HELP.update(
73 | {"ssvideo": "`>.ssvideo `" "\nUsage: to ss video frame per frame"}
74 | )
75 |
--------------------------------------------------------------------------------
/userbot/modules/sangmata.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.
2 | #
3 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
4 | # you may not use this file except in compliance with the License.
5 | #
6 | # Port to userbot by @MoveAngel
7 |
8 | from telethon.errors.rpcerrorlist import YouBlockedUserError
9 | from userbot import bot, CMD_HELP
10 | from userbot.events import register
11 | from asyncio.exceptions import TimeoutError
12 |
13 |
14 | @register(outgoing=True, pattern=r"^\.sa(?: |$)(.*)")
15 | async def lastname(steal):
16 | if steal.fwd_from:
17 | return
18 | if not steal.reply_to_msg_id:
19 | await steal.edit("```Mohon Balas Ke Pesan Pengguna Lord.```")
20 | return
21 | message = await steal.get_reply_message()
22 | chat = "@SangMataInfo_bot"
23 | user_id = message.sender.id
24 | id = f"/search_id {user_id}"
25 | if message.sender.bot:
26 | await steal.edit("```Balas Ke Pesan Pengguna Yang Sebenarnya.```")
27 | return
28 | await steal.edit("```Lord Memerintahku Mengambil Informasi Riwayat Pergantian Nama Orang Ini ツ```")
29 | try:
30 | async with bot.conversation(chat) as conv:
31 | try:
32 | msg = await conv.send_message(id)
33 | r = await conv.get_response()
34 | response = await conv.get_response()
35 | except YouBlockedUserError:
36 | await steal.reply(
37 | "```Lord Mohon Unblock @sangmatainfo_bot Dan Coba Lagi```"
38 | )
39 | return
40 | if r.text.startswith("Name"):
41 | respond = await conv.get_response()
42 | await steal.edit(f"`{r.message}`")
43 | await steal.client.delete_messages(
44 | conv.chat_id, [msg.id, r.id, response.id, respond.id]
45 | )
46 | return
47 | if response.text.startswith("No records") or r.text.startswith(
48 | "No records"
49 | ):
50 | await steal.edit("```Saya Tidak Menemukan Informasi Pergantian Nama, Lord Orang Ini Belum Pernah Mengganti Namanya ツ```")
51 | await steal.client.delete_messages(
52 | conv.chat_id, [msg.id, r.id, response.id]
53 | )
54 | return
55 | else:
56 | respond = await conv.get_response()
57 | await steal.edit(f"```{response.message}```")
58 | await steal.client.delete_messages(
59 | conv.chat_id, [msg.id, r.id, response.id, respond.id]
60 | )
61 | except TimeoutError:
62 | return await steal.edit("`Saya Sedang Sakit Lord Maaf`")
63 |
64 |
65 | CMD_HELP.update({
66 | "sangmata":
67 | "`.sa`\
68 | \nUsage: Mendapatkan Riwayat Nama Pengguna."
69 | })
70 |
--------------------------------------------------------------------------------
/userbot/modules/coolprofilepics.py:
--------------------------------------------------------------------------------
1 | # credits to the respective owner xD
2 | # imported by @heyworld
3 | import requests
4 | import re
5 | import random
6 |
7 | import urllib
8 | import os
9 |
10 | from telethon.tl import functions
11 |
12 |
13 | import asyncio
14 |
15 |
16 | from userbot.events import register
17 |
18 | COLLECTION_STRING = [
19 |
20 | "epic-fantasy-wallpaper",
21 |
22 | "castle-in-the-sky-wallpaper",
23 |
24 | "fantasy-forest-wallpaper",
25 |
26 | "fantasy-wallpaper-1080p",
27 |
28 | "toothless-wallpaper-hd"
29 |
30 | "japanese-art-wallpaper"
31 |
32 | "star-wars-landscape-wallpaper"
33 |
34 | "4k-sci-fi-wallpaper"
35 |
36 | "minion-screensavers-wallpaper"
37 |
38 | "zootopia-hd-wallpaper"
39 |
40 | "gravity-falls-hd-wallpaper"
41 |
42 | "cool-cartoon-wallpaper"
43 |
44 | "disney-movie-wallpaper"
45 |
46 | "cute-pokemon-wallpapers"
47 |
48 | "4k-anime-wallpaper"
49 |
50 | "balance-druid-wallpaper"
51 |
52 | "harry-potter-wallpaper"
53 |
54 | "funny-meme-wallpaper"
55 |
56 | "minimalist-hd-wallpaper"
57 |
58 | "cute-animal-wallpaper-backgrounds"
59 |
60 | "3840-x-1080-wallpaper"
61 |
62 | "wallpaper-outer-space"
63 |
64 | "best-wallpapers-in-the-world"
65 |
66 | "funny-desktop-backgrounds"
67 |
68 | "funny-cats-wallpapers"
69 |
70 | "cool-cat-wallpaper"
71 |
72 | "doge-wallpaper-hd"
73 |
74 | "ice-cream-cone-wallpaper"
75 |
76 | "food-wallpaper-background"
77 |
78 | "snowy-christmas-scenes-wallpaper"
79 |
80 | "life-quotes-wallpaper"
81 |
82 | ]
83 |
84 |
85 | async def animepp():
86 |
87 | os.system("rm -rf donot.jpg")
88 |
89 | rnd = random.randint(0, len(COLLECTION_STRING) - 1)
90 |
91 | pack = COLLECTION_STRING[rnd]
92 |
93 | pc = requests.get("http://getwallpapers.com/collection/" + pack).text
94 |
95 | f = re.compile(r'/\w+/full.+.jpg')
96 |
97 | f = f.findall(pc)
98 |
99 | fy = "http://getwallpapers.com" + random.choice(f)
100 |
101 | print(fy)
102 |
103 | if not os.path.exists("f.ttf"):
104 |
105 | urllib.request.urlretrieve(
106 | "https://github.com/rebel6969/mym/raw/master/Rebel-robot-Regular.ttf", "f.ttf")
107 |
108 | urllib.request.urlretrieve(fy, "donottouch.jpg")
109 |
110 |
111 | @register(outgoing=True, pattern="^.randompp(?: |$)(.*)")
112 | async def main(event):
113 |
114 | await event.edit("`Mengubah Foto Profil Anda...`")
115 |
116 | while True:
117 |
118 | await animepp()
119 |
120 | file = await event.client.upload_file("donottouch.jpg")
121 |
122 | await event.client(functions.photos.UploadProfilePhotoRequest(file))
123 |
124 | os.system("rm -rf donottouch.jpg")
125 |
126 | await asyncio.sleep(3600) # Edit this to your required needs
127 |
--------------------------------------------------------------------------------
/userbot/modules/fakegban.py:
--------------------------------------------------------------------------------
1 | # This is a troll indeed ffs *facepalm*
2 | # Ported from xtra-telegram by @heyworld
3 | import asyncio
4 | from telethon.tl.functions.users import GetFullUserRequest
5 | from telethon.tl.types import ChannelParticipantsAdmins
6 | #from userbot.utils import admin_cmd
7 | from userbot.events import register
8 | from userbot import ALIVE_NAME, CMD_HELP, bot
9 |
10 | # ================= CONSTANT =================
11 | DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else uname().node
12 | # ============================================
13 |
14 |
15 | @register(outgoing=True, pattern="^.fgban(?: |$)(.*)")
16 | async def gbun(event):
17 | if event.fwd_from:
18 | return
19 | gbunVar = event.text
20 | gbunVar = gbunVar[6:]
21 | mentions = f"`Warning!! User 𝙂𝘽𝘼𝙉𝙉𝙀𝘿 By` {DEFAULTUSER}\n"
22 | no_reason = "No Reason Given "
23 | await event.edit("**Summoning out the mighty gban hammer ☠️**")
24 | asyncio.sleep(3.5)
25 | chat = await event.get_input_chat()
26 | async for x in bot.iter_participants(chat, filter=ChannelParticipantsAdmins):
27 | mentions += f""
28 | reply_message = None
29 | if event.reply_to_msg_id:
30 | reply_message = await event.get_reply_message()
31 | replied_user = await event.client(GetFullUserRequest(reply_message.from_id))
32 | firstname = replied_user.user.first_name
33 | usname = replied_user.user.username
34 | idd = reply_message.from_id
35 | # make meself invulnerable cuz why not xD
36 | if idd == 1036951071:
37 | await reply_message.reply("`Wait a second, This is my master!`\n**How dare you threaten to ban my master nigger!**\n\n__Your account has been hacked! Pay 6969$ to my master__ [Heyworld](tg://user?id=1036951071) __to release your account__😏")
38 | else:
39 | jnl = ("`Warning!!`"
40 | "[{}](tg://user?id={})"
41 | f"` 𝙂𝘽𝘼𝙉𝙉𝙀𝘿 By` {DEFAULTUSER}\n\n"
42 | "**Name: ** __{}__\n"
43 | "**ID : ** `{}`\n"
44 | ).format(firstname, idd, firstname, idd)
45 | if usname is None:
46 | jnl += "**Username: ** `Doesn't own a username!`\n"
47 | elif usname != "None":
48 | jnl += "**Username** : @{}\n".format(usname)
49 | if len(gbunVar) > 0:
50 | gbunm = "`{}`".format(gbunVar)
51 | gbunr = "**Reason: **" + gbunm
52 | jnl += gbunr
53 | else:
54 | jnl += no_reason
55 | await reply_message.reply(jnl)
56 | else:
57 | mention = (
58 | f"Warning!! User 𝙂𝘽𝘼𝙉𝙉𝙀𝘿 By {DEFAULTUSER} \nReason: No Reason Given. ")
59 | await event.reply(mention)
60 | await event.delete()
61 |
62 | CMD_HELP.update({
63 | "fakegban": "`.fgban`\
64 | \nUsage: Type .fgban or Reply .fgban reason and see it yourself. "
65 | })
66 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/antiflood_sql.py:
--------------------------------------------------------------------------------
1 | try:
2 | from userbot.modules.sql_helper import SESSION, BASE
3 | except ImportError:
4 | raise AttributeError
5 | import threading
6 | from sqlalchemy import Column, Integer, String
7 |
8 | DEF_COUNT = 0
9 | DEF_LIMIT = 0
10 | DEF_OBJ = (None, DEF_COUNT, DEF_LIMIT)
11 |
12 |
13 | class FloodControl(BASE):
14 | __tablename__ = "antiflood"
15 | chat_id = Column(String(14), primary_key=True)
16 | user_id = Column(Integer)
17 | count = Column(Integer, default=DEF_COUNT)
18 | limit = Column(Integer, default=DEF_LIMIT)
19 |
20 | def __init__(self, chat_id):
21 | self.chat_id = str(chat_id) # ensure string
22 |
23 | def __repr__(self):
24 | return "" % self.chat_id
25 |
26 |
27 | FloodControl.__table__.create(checkfirst=True)
28 |
29 | INSERTION_LOCK = threading.RLock()
30 |
31 | CHAT_FLOOD = {}
32 |
33 |
34 | def set_flood(chat_id, amount):
35 | with INSERTION_LOCK:
36 | flood = SESSION.query(FloodControl).get(str(chat_id))
37 | if not flood:
38 | flood = FloodControl(str(chat_id))
39 |
40 | flood.user_id = None
41 | flood.limit = amount
42 |
43 | CHAT_FLOOD[str(chat_id)] = (None, DEF_COUNT, amount)
44 |
45 | SESSION.add(flood)
46 | SESSION.commit()
47 |
48 |
49 | def update_flood(chat_id: str, user_id) -> bool:
50 | if str(chat_id) in CHAT_FLOOD:
51 | curr_user_id, count, limit = CHAT_FLOOD.get(str(chat_id), DEF_OBJ)
52 |
53 | if limit == 0: # no antiflood
54 | return False
55 |
56 | if user_id != curr_user_id or user_id is None: # other user
57 | CHAT_FLOOD[str(chat_id)] = (user_id, DEF_COUNT + 1, limit)
58 | return False
59 |
60 | count += 1
61 | if count > limit: # too many msgs, kick
62 | CHAT_FLOOD[str(chat_id)] = (None, DEF_COUNT, limit)
63 | return True
64 |
65 | # default -> update
66 | CHAT_FLOOD[str(chat_id)] = (user_id, count, limit)
67 | return False
68 |
69 |
70 | def get_flood_limit(chat_id):
71 | return CHAT_FLOOD.get(str(chat_id), DEF_OBJ)[2]
72 |
73 |
74 | def migrate_chat(old_chat_id, new_chat_id):
75 | with INSERTION_LOCK:
76 | flood = SESSION.query(FloodControl).get(str(old_chat_id))
77 | if flood:
78 | CHAT_FLOOD[str(new_chat_id)] = CHAT_FLOOD.get(
79 | str(old_chat_id), DEF_OBJ)
80 | flood.chat_id = str(new_chat_id)
81 | SESSION.commit()
82 |
83 | SESSION.close()
84 |
85 |
86 | def __load_flood_settings():
87 | global CHAT_FLOOD
88 | try:
89 | all_chats = SESSION.query(FloodControl).all()
90 | CHAT_FLOOD = {
91 | chat.chat_id: (
92 | None,
93 | DEF_COUNT,
94 | chat.limit) for chat in all_chats}
95 | finally:
96 | SESSION.close()
97 | return CHAT_FLOOD
98 |
--------------------------------------------------------------------------------
/userbot/modules/create.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.
2 | #
3 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
4 | # you may not use this file except in compliance with the License.
5 | #
6 | # (c) Spechide - UniBorg
7 | # Port From UniBorg to UserBot by @afdulfauzan
8 |
9 | # LORD - USERBOT
10 |
11 | from telethon.tl import functions
12 | from userbot.events import register
13 | from userbot import CMD_HELP
14 |
15 |
16 | @register(outgoing=True, pattern="^.buat (gb|g|c)(?: |$)(.*)")
17 | async def telegraphs(grop):
18 | """ For .create command, Creating New Group & Channel """
19 | if not grop.text[0].isalpha() and grop.text[0] not in ("/", "#", "@", "!"):
20 | if grop.fwd_from:
21 | return
22 | type_of_group = grop.pattern_match.group(1)
23 | group_name = grop.pattern_match.group(2)
24 | if type_of_group == "gb":
25 | try:
26 | result = await grop.client(functions.messages.CreateChatRequest( # pylint:disable=E0602
27 | users=["@MissRose_bot"],
28 | # Not enough users (to create a chat, for example)
29 | # Telegram, no longer allows creating a chat with ourselves
30 | title=group_name
31 | ))
32 | created_chat_id = result.chats[0].id
33 | result = await grop.client(functions.messages.ExportChatInviteRequest(
34 | peer=created_chat_id,
35 | ))
36 | await grop.edit("Lord, Grup/Channel {} Berhasil Dibuat. Tekan [{}]({}) Untuk Melihatnya".format(group_name, group_name, result.link))
37 | except Exception as e: # pylint:disable=C0103,W0703
38 | await grop.edit(str(e))
39 | elif type_of_group == "g" or type_of_group == "c":
40 | try:
41 | r = await grop.client(functions.channels.CreateChannelRequest( # pylint:disable=E0602
42 | title=group_name,
43 | about="`Welcome!`",
44 | megagroup=False if type_of_group == "c" else True
45 | ))
46 | created_chat_id = r.chats[0].id
47 | result = await grop.client(functions.messages.ExportChatInviteRequest(
48 | peer=created_chat_id,
49 | ))
50 | await grop.edit("Lord, Grup/Channel {} Berhasil Dibuat. Tekan [{}]({}) Untuk Melihatnya".format(group_name, group_name, result.link))
51 | except Exception as e: # pylint:disable=C0103,W0703
52 | await grop.edit(str(e))
53 |
54 | CMD_HELP.update({
55 | "membuat": "\
56 | Membuat\
57 | \nPenjelasan: Untuk membuat Channel, Grup dan Grup bersama Bot.\
58 | \n\n`.buat g` \
59 | \nPenjelasan: Membuat grup mu.\
60 | \n\n`.buat gb` \
61 | \nPenjelasan: Membuat Grup bersama bot.\
62 | \n\n`.buat c` \
63 | \nPenjelasan: Membuat sebuah Channel.\
64 | "})
65 |
--------------------------------------------------------------------------------
/userbot/modules/hash.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.
2 | #
3 | # Licensed under the Raphielscape Public License, Version 1.c (the "License");
4 | # you may not use this file except in compliance with the License.
5 | #
6 | """ Userbot module containing hash and encode/decode commands. """
7 | from subprocess import PIPE
8 | from subprocess import run as runapp
9 |
10 | import pybase64
11 |
12 | from userbot import CMD_HELP
13 | from userbot.events import register
14 |
15 |
16 | @register(outgoing=True, pattern=r"^\.hash (.*)")
17 | async def gethash(hash_q):
18 | """ For .hash command, find the md5, sha1, sha256, sha512 of the string. """
19 | hashtxt_ = hash_q.pattern_match.group(1)
20 | hashtxt = open("hashdis.txt", "w+")
21 | hashtxt.write(hashtxt_)
22 | hashtxt.close()
23 | md5 = runapp(["md5sum", "hashdis.txt"], stdout=PIPE)
24 | md5 = md5.stdout.decode()
25 | sha1 = runapp(["sha1sum", "hashdis.txt"], stdout=PIPE)
26 | sha1 = sha1.stdout.decode()
27 | sha256 = runapp(["sha256sum", "hashdis.txt"], stdout=PIPE)
28 | sha256 = sha256.stdout.decode()
29 | sha512 = runapp(["sha512sum", "hashdis.txt"], stdout=PIPE)
30 | runapp(["rm", "hashdis.txt"], stdout=PIPE)
31 | sha512 = sha512.stdout.decode()
32 | ans = (
33 | "Text: `"
34 | + hashtxt_
35 | + "`\nMD5: `"
36 | + md5
37 | + "`SHA1: `"
38 | + sha1
39 | + "`SHA256: `"
40 | + sha256
41 | + "`SHA512: `"
42 | + sha512[:-1]
43 | + "`"
44 | )
45 | if len(ans) > 4096:
46 | hashfile = open("hashes.txt", "w+")
47 | hashfile.write(ans)
48 | hashfile.close()
49 | await hash_q.client.send_file(
50 | hash_q.chat_id,
51 | "hashes.txt",
52 | reply_to=hash_q.id,
53 | caption="`It's too big, sending a text file instead. `",
54 | )
55 | runapp(["rm", "hashes.txt"], stdout=PIPE)
56 | else:
57 | await hash_q.reply(ans)
58 |
59 |
60 | @register(outgoing=True, pattern=r"^\.base64 (en|de) (.*)")
61 | async def endecrypt(query):
62 | """ For .base64 command, find the base64 encoding of the given string. """
63 | if query.pattern_match.group(1) == "en":
64 | lething = str(pybase64.b64encode(
65 | bytes(query.pattern_match.group(2), "utf-8")))[2:]
66 | await query.reply("Encoded: `" + lething[:-1] + "`")
67 | else:
68 | lething = str(
69 | pybase64.b64decode(
70 | bytes(query.pattern_match.group(2), "utf-8"), validate=True
71 | )
72 | )[2:]
73 | await query.reply("Decoded: `" + lething[:-1] + "`")
74 |
75 |
76 | CMD_HELP.update(
77 | {
78 | "hash": ">`.hash`"
79 | "\nUsage: Find the md5, sha1, sha256, sha512 of the string when written into a txt file.",
80 | "base64": ">`.base64 [en or de]`"
81 | "\nUsage: Find the base64 encoding of the given string or decode it.",
82 | })
83 |
--------------------------------------------------------------------------------
/userbot/modules/createstickers.py:
--------------------------------------------------------------------------------
1 | # Random RGB Sticklet by @PhycoNinja13b
2 | # modified by @UniBorg
3 | # ported to userbot by @heyworld & thanks to @Xcruzhd2 for Fonts
4 |
5 |
6 | import io
7 | import os
8 | import random
9 | import textwrap
10 |
11 | from PIL import Image, ImageDraw, ImageFont
12 | from telethon.tl.types import InputMessagesFilterDocument
13 | from userbot.events import register
14 |
15 |
16 | @register(outgoing=True, pattern="^.cs(?: |$)(.*)")
17 | async def sticklet(event):
18 | R = random.randint(0, 256)
19 | G = random.randint(0, 256)
20 | B = random.randint(0, 256)
21 |
22 | # get the input text
23 | # the text on which we would like to do the magic on
24 | sticktext = event.pattern_match.group(1)
25 |
26 | # delete the userbot command,
27 | # i don't know why this is required
28 | await event.delete()
29 |
30 | # https://docs.python.org/3/library/textwrap.html#textwrap.wrap
31 | sticktext = textwrap.wrap(sticktext, width=10)
32 | # converts back the list to a string
33 | sticktext = '\n'.join(sticktext)
34 |
35 | image = Image.new("RGBA", (512, 512), (255, 255, 255, 0))
36 | draw = ImageDraw.Draw(image)
37 | fontsize = 230
38 |
39 | FONT_FILE = await get_font_file(event.client, "@xcruzfont")
40 |
41 | font = ImageFont.truetype(FONT_FILE, size=fontsize)
42 |
43 | while draw.multiline_textsize(sticktext, font=font) > (512, 512):
44 | fontsize -= 3
45 | font = ImageFont.truetype(FONT_FILE, size=fontsize)
46 |
47 | width, height = draw.multiline_textsize(sticktext, font=font)
48 | draw.multiline_text(
49 | ((512 - width) / 2,
50 | (512 - height) / 2),
51 | sticktext,
52 | font=font,
53 | fill=(
54 | R,
55 | G,
56 | B))
57 |
58 | image_stream = io.BytesIO()
59 | image_stream.name = "@lord.webp"
60 | image.save(image_stream, "WebP")
61 | image_stream.seek(0)
62 |
63 | # finally, reply the sticker
64 | # await event.reply( file=image_stream, reply_to=event.message.reply_to_msg_id)
65 | # replacing upper line with this to get reply tags
66 |
67 | await event.client.send_file(event.chat_id, image_stream, reply_to=event.message.reply_to_msg_id)
68 | # cleanup
69 | try:
70 | os.remove(FONT_FILE)
71 | except BaseException:
72 | pass
73 |
74 |
75 | async def get_font_file(client, channel_id):
76 | # first get the font messages
77 | font_file_message_s = await client.get_messages(
78 | entity=channel_id,
79 | filter=InputMessagesFilterDocument,
80 | # this might cause FLOOD WAIT,
81 | # if used too many times
82 | limit=None
83 | )
84 | # get a random font from the list of fonts
85 | # https://docs.python.org/3/library/random.html#random.choice
86 | font_file_message = random.choice(font_file_message_s)
87 | # download and return the file path
88 | return await client.download_media(font_file_message)
89 |
--------------------------------------------------------------------------------
/userbot/modules/lordig.py:
--------------------------------------------------------------------------------
1 | # Koala Ganteng, Kode Dari Koala Bangsul Press F untuk Koala @Manusiarakitann
2 | # Keredit Motor Eh Maksudnya Kredit Kampang Bot (c) Koala Bgke @ManusiaRakitann
3 | # Karna Aku Gabut Aku Pasang Keredit Lagi # Keredit
4 | # Yak Pasang Credit Banyak Banyak Biar Makin Keren
5 | # Copyright (C) 2021 Alvin / @LiuAlvinas By Lord Userbot
6 | # All rights reserved.
7 | # Keredit
8 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
9 | # you may not use this file except in compliance with the License.
10 | # Lord Userbot - From Lord To Lord
11 | # Yang Gbs Basa Enggres bisa Terjemahkan di atas
12 | # Ngefork Doang Gak Bintang Anjg
13 | # Kalo Clone Ini Jangan dihapus ya anjg nanti Koala Ngamuk, Ok Mksh Sma Sma
14 |
15 | from telethon import events
16 | from telethon.errors.rpcerrorlist import YouBlockedUserError
17 | from userbot.events import register
18 | from userbot import bot, CMD_HELP
19 |
20 | # Alvin Gans
21 | # Apin Gansssss Anjjjayy Yahahaha
22 |
23 |
24 | @register(outgoing=True, pattern="^.ig ?(.*)")
25 | async def insta(event):
26 | if event.fwd_from:
27 | return
28 | if not event.reply_to_msg_id:
29 | await event.edit("`Lord, Mohon Balas Ke Link Instagram`")
30 | return
31 | reply_message = await event.get_reply_message()
32 | if not reply_message.text:
33 | await event.edit("`Mohon Maaf Lord, Saya Membutuhkan Link Media Instagram Untuk Download`")
34 | return
35 | chat = "@SaveAsBot"
36 | reply_message.sender
37 | if reply_message.sender.bot:
38 | await event.edit("`Memproses....`")
39 | return
40 | await event.edit("`Memproses.....`")
41 | async with event.client.conversation(chat) as conv:
42 | try:
43 | response = conv.wait_event(
44 | events.NewMessage(incoming=True, from_users=523131145)
45 | )
46 | await event.client.send_message(chat, reply_message)
47 | response = await response
48 | except YouBlockedUserError:
49 | await event.edit("`Lord, Mohon Buka Blokir` @SaveAsbot `Lalu Coba Lagi`")
50 | return
51 | if response.text.startswith("Forward"):
52 | await event.edit(
53 | "Uhmm Sepertinya Private."
54 | )
55 | else:
56 | await event.delete()
57 | await event.client.send_file(
58 | event.chat_id,
59 | response.message.media,
60 | caption=f"**Download By @Lorduserbot_Group**",
61 | )
62 | await event.client.send_read_acknowledge(conv.chat_id)
63 | await bot(functions.messages.DeleteHistoryRequest(peer=chat, max_id=0))
64 | await event.delete()
65 |
66 |
67 | # By Lord - Userbot
68 | # Alvin Gansssssss Mksh Sma Sma
69 | # Alvin Gans
70 | CMD_HELP.update({"instagram": "**Modules:** __Instagram__\n\n**Perintah:** `.ig`"
71 | "\n**Penjelasan:** Download Media di Postingan Instagram, Balas ke link instagram ketik `.ig`"})
72 |
--------------------------------------------------------------------------------
/varshelper.txt:
--------------------------------------------------------------------------------
1 | # Telegram App KEY and HASH this vars are important
2 | API_KEY =
3 | API_HASH =
4 |
5 |
6 | # Userbot Session String this var is important
7 | STRING_SESSION =
8 |
9 | # Logging channel/group ID configuration. this var is important
10 | BOTLOG_CHATID =
11 |
12 | # Userbot logging feature switch.
13 | BOTLOG = True or False
14 | LOGSPAMMER = True or False
15 |
16 | # Bleep Blop, this is a bot ;)
17 | PM_AUTO_BAN = True or False
18 |
19 | # Heroku Credentials for updater. this vars are important
20 | HEROKU_MEMEZ = True or False
21 | HEROKU_APP_NAME =
22 | HEROKU_API_KEY =
23 |
24 | # Github Credentials for updater and Gitupload. this vars are important
25 | GIT_REPO_NAME =
26 | GITHUB_ACCESS_TOKEN =
27 | Get GitHub access token from :https://github.com/settings/tokens
28 | Click on generate new token
29 | Enable this permissions:https://telegra.ph/file/0262c512e2b82fcd0260a.jpg
30 |
31 | # Custom (forked) repo URL for updater. this vars are important
32 | UPSTREAM_REPO_URL = https://github.com/mkaraniya/OpenUserBot.git
33 | REPO_URL = https://github.com/mkaraniya/OpenUserBot.git
34 | REPO_LINK = https://github.com/mkaraniya/OpenUserBot.git
35 |
36 | # Console verbose logging
37 | CONSOLE_LOGGER_VERBOSE = False
38 |
39 | # SQL Database URI
40 | DB_URI = no need to change this value
41 |
42 | # OCR API key
43 | OCR_SPACE_API_KEY =
44 |
45 | # remove.bg API key
46 | REM_BG_API_KEY =
47 |
48 | # Chrome Driver and Headless Google Chrome Binaries
49 | CHROME_DRIVER = no need to change this value
50 | GOOGLE_CHROME_BIN = no need to change this value
51 |
52 | # OpenWeatherMap API Key
53 | OPEN_WEATHER_MAP_APPID =
54 | WEATHER_DEFCITY =
55 |
56 | # Lydia API
57 | LYDIA_API_KEY =
58 |
59 | # set blacklist_chats where you do not want userbot's features
60 | UB_BLACK_LIST_CHAT = no need to change this value
61 |
62 | # Anti Spambot Config
63 | ANTI_SPAMBOT = True or False
64 | ANTI_SPAMBOT_SHOUT = True or False
65 |
66 | # Youtube API key
67 | YOUTUBE_API_KEY =
68 |
69 | # Default .alive name
70 | ALIVE_NAME = any name
71 |
72 | # Time & Date - Country and Time Zone
73 | COUNTRY =
74 | TZ_NUMBER =
75 |
76 | # Clean Welcome
77 | CLEAN_WELCOME = True or False
78 |
79 | # Last.fm Module
80 | BIO_PREFIX = any txt
81 | DEFAULT_BIO = any txt
82 |
83 | LASTFM_API =
84 | LASTFM_SECRET =
85 | LASTFM_USERNAME =
86 | LASTFM_PASSWORD_PLAIN =
87 | LASTFM_PASS =
88 |
89 |
90 | # Google Drive Module
91 | G_DRIVE_CLIENT_ID =
92 | G_DRIVE_CLIENT_SECRET =
93 | G_DRIVE_AUTH_TOKEN_DATA =
94 | G_DRIVE_FOLDER_ID =
95 | G_DRIVE_DATA
96 | **TYPE .remixhelp AND CHECK GDRIVE TUTORIAL**
97 | **YOU ONLY NEED TWO GDRIVE VARS AS SHOWN IN THE PICTURE https://prnt.sc/sguzo2**
98 | TEMP_DOWNLOAD_DIRECTORY = no need to change this value
99 |
100 | # Genius lyrics get this value from https://genius.com/developers both has same values
101 | GENIUS_API_TOKEN =
102 | # Genius lyrics get this value from https://genius.com/developers both has same values
103 | GENIUS =
104 |
105 |
106 |
--------------------------------------------------------------------------------
/userbot/core.py:
--------------------------------------------------------------------------------
1 | from userbot.utils import command, remove_plugin, load_module
2 | from pathlib import Path
3 | import asyncio
4 | import os
5 | from datetime import datetime
6 |
7 | DELETE_TIMEOUT = 5
8 |
9 |
10 | @command(pattern="^.install", outgoing=True)
11 | async def install(event):
12 | if event.fwd_from:
13 | return
14 | if event.reply_to_msg_id:
15 | try:
16 | downloaded_file_name = await event.client.download_media( # pylint:disable=E0602
17 | await event.get_reply_message(),
18 | "userbot/modules/" # pylint:disable=E0602
19 | )
20 | if "(" not in downloaded_file_name:
21 | path1 = Path(downloaded_file_name)
22 | shortname = path1.stem
23 | load_module(shortname.replace(".py", ""))
24 | await event.edit("Installed Plugin `{}`".format(os.path.basename(downloaded_file_name)))
25 | else:
26 | os.remove(downloaded_file_name)
27 | await event.edit("Errors! This plugin is already installed/pre-installed.")
28 | except Exception as e: # pylint:disable=C0103,W0703
29 | await event.edit(str(e))
30 | os.remove(downloaded_file_name)
31 | await asyncio.sleep(DELETE_TIMEOUT)
32 | await event.delete()
33 |
34 |
35 | @command(pattern=r"^.send (?P\w+)$", outgoing=True)
36 | async def send(event):
37 | if event.fwd_from:
38 | return
39 | message_id = event.message.id
40 | input_str = event.pattern_match["shortname"]
41 | the_plugin_file = "./userbot/modules/{}.py".format(input_str)
42 | start = datetime.now()
43 | await event.client.send_file( # pylint:disable=E0602
44 | event.chat_id,
45 | the_plugin_file,
46 | force_document=True,
47 | allow_cache=False,
48 | reply_to=message_id
49 | )
50 | end = datetime.now()
51 | time_taken_in_ms = (end - start).seconds
52 | await event.edit("Uploaded {} in {} seconds".format(input_str, time_taken_in_ms))
53 | await asyncio.sleep(DELETE_TIMEOUT)
54 | await event.delete()
55 |
56 |
57 | @command(pattern=r"^.unload (?P\w+)$", outgoing=True)
58 | async def unload(event):
59 | if event.fwd_from:
60 | return
61 | shortname = event.pattern_match["shortname"]
62 | try:
63 | remove_plugin(shortname)
64 | await event.edit(f"Unloaded {shortname} successfully")
65 | except Exception as e:
66 | await event.edit("Successfully unload {shortname}\n{}".format(shortname, str(e)))
67 |
68 |
69 | @command(pattern=r"^.load (?P\w+)$", outgoing=True)
70 | async def load(event):
71 | if event.fwd_from:
72 | return
73 | shortname = event.pattern_match["shortname"]
74 | try:
75 | try:
76 | remove_plugin(shortname)
77 | except BaseException:
78 | pass
79 | load_module(shortname)
80 | await event.edit(f"Successfully loaded {shortname}")
81 | except Exception as e:
82 | await event.edit(f"Could not load {shortname} because of the following error.\n{str(e)}")
83 |
--------------------------------------------------------------------------------
/userbot/modules/covid.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2020 The Raphielscape Company LLC.
2 | #
3 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
4 | # you may not use this file except in compliance with the License.
5 |
6 | from covid import Covid
7 | from userbot import CMD_HELP
8 | from userbot.events import register
9 |
10 |
11 | @register(outgoing=True, pattern="^.covid (.*)")
12 | async def corona(event):
13 | await event.edit("`Memproses Informasi....`")
14 | country = event.pattern_match.group(1)
15 | covid = Covid(source="worldometers")
16 | country_data = covid.get_status_by_country_name(country)
17 | if country_data:
18 | output_text = f"`⚠️Terkonfirmasi : {country_data['confirmed']} (+{country_data['new_cases']})`\n"
19 | output_text += f"`☢️Aktif : {country_data['active']}`\n"
20 | output_text += f"`🤕Kritis : {country_data['critical']}`\n"
21 | output_text += f"`😟Kematian Baru : {country_data['new_deaths']}`\n\n"
22 | output_text += f"`⚰️Meninggal : {country_data['deaths']} (+{country_data['new_deaths']})`\n"
23 | output_text += f"`😔Kasus Baru : {country_data['new_cases']}`\n"
24 | output_text += f"`😇Sembuh : {country_data['recovered']}`\n"
25 | output_text += "`📍Total Tes : N/A`\n\n"
26 | output_text += f"Data disediakan oleh [Worldometer](https://www.worldometers.info/coronavirus/country/{country})"
27 | else:
28 | output_text = "Tidak ada informasi ditemukan untuk Negara ini!"
29 |
30 | await event.edit(f"`Info Virus corona di {country}:`\n\n{output_text}")
31 |
32 |
33 | @register(outgoing=True, pattern="^.covid$")
34 | async def corona(event):
35 | await event.edit("`Memproses...`")
36 | country = "World"
37 | covid = Covid(source="worldometers")
38 | country_data = covid.get_status_by_country_name(country)
39 | if country_data:
40 | output_text = f"`⚠️Terkonfirmasi : {country_data['confirmed']} (+{country_data['new_cases']})`\n"
41 | output_text += f"`☢️Aktif : {country_data['active']}`\n"
42 | output_text += f"`🤕Kritis : {country_data['critical']}`\n"
43 | output_text += f"`😟Kematian Baru : {country_data['new_deaths']}`\n\n"
44 | output_text += f"`⚰️Meninggal : {country_data['deaths']} (+{country_data['new_deaths']})`\n"
45 | output_text += f"`😔Kasus Baru : {country_data['new_cases']}`\n"
46 | output_text += f"`😇Sembuh : {country_data['recovered']}`\n"
47 | output_text += "`📍Total Tes : N/A`\n\n"
48 | output_text += f"Data disediakan oleh [Worldometer](https://www.worldometers.info/coronavirus/country/{country})"
49 | else:
50 | output_text = "Tidak ada informasi ditemukan untuk Negara ini!"
51 |
52 | await event.edit(f"`Info Virus corona di {country}:`\n\n{output_text}")
53 |
54 |
55 | CMD_HELP.update({"covid": "`.covid` ****"
56 | "\nPenjelasan: Dapatkan informasi tentang data covid-19 di suatu Negara.`\n\n"
57 | "`.covid`"
58 | "\nPenjelasan: Dapatkan informasi tentang data covid-19 di Seluruh Dunia.\n"})
59 |
--------------------------------------------------------------------------------
/userbot/modules/lordtiny.py:
--------------------------------------------------------------------------------
1 | # Port By LiuAlvinas/Alvin For Lord Userbot From Ultroid, Thanks
2 | # Based Plugins
3 | # Fixed By ManusiaRakitann/Koala
4 | # Dont Remove
5 |
6 |
7 | # Alvin Ganteng
8 |
9 | from PIL import Image
10 | import cv2
11 | import os
12 | from userbot.events import register
13 | from userbot import CMD_HELP, bot
14 |
15 | # Ngapain Kesini Ajg Hus
16 |
17 |
18 | @register(outgoing=True, pattern="^.tiny(?: |$)(.*)", disable_errors=True)
19 | async def ultiny(event):
20 | reply = await event.get_reply_message()
21 | if not (reply and (reply.media)):
22 | await event.edit("`Lord, Mohon Balas Ke Sticker`")
23 | return
24 | xx = await event.edit("`Memproses Tiny....`")
25 | ik = await bot.download_media(reply)
26 | im1 = Image.open("LordUserbot/lorduserbot.png")
27 | if ik.endswith(".tgs"):
28 | await event.client.download_media(reply, "ult.tgs")
29 | os.system("lottie_convert.py ult.tgs json.json")
30 | json = open("json.json", "r")
31 | jsn = json.read()
32 | json.close()
33 | jsn = jsn.replace("512", "2000")
34 | open("json.json", "w").write(jsn)
35 | os.system("lottie_convert.py json.json ult.tgs")
36 | file = "ult.tgs"
37 | os.remove("json.json")
38 | elif ik.endswith((".gif", ".mp4")):
39 | iik = cv2.VideoCapture(ik)
40 | dani, busy = iik.read()
41 | cv2.imwrite("i.png", busy)
42 | fil = "i.png"
43 | im = Image.open(fil)
44 | z, d = im.size
45 | if z == d:
46 | xxx, yyy = 200, 200
47 | else:
48 | t = z + d
49 | a = z / t
50 | b = d / t
51 | aa = (a * 100) - 50
52 | bb = (b * 100) - 50
53 | xxx = 200 + 5 * aa
54 | yyy = 200 + 5 * bb
55 | k = im.resize((int(xxx), int(yyy)))
56 | k.save("k.png", format="PNG", optimize=True)
57 | im2 = Image.open("k.png")
58 | back_im = im1.copy()
59 | back_im.paste(im2, (150, 0))
60 | back_im.save("o.webp", "WEBP", quality=95)
61 | file = "o.webp"
62 | os.remove(fil)
63 | os.remove("k.png")
64 | else:
65 | im = Image.open(ik)
66 | z, d = im.size
67 | if z == d:
68 | xxx, yyy = 200, 200
69 | else:
70 | t = z + d
71 | a = z / t
72 | b = d / t
73 | aa = (a * 100) - 50
74 | bb = (b * 100) - 50
75 | xxx = 200 + 5 * aa
76 | yyy = 200 + 5 * bb
77 | k = im.resize((int(xxx), int(yyy)))
78 | k.save("k.png", format="PNG", optimize=True)
79 | im2 = Image.open("k.png")
80 | back_im = im1.copy()
81 | back_im.paste(im2, (150, 0))
82 | back_im.save("o.webp", "WEBP", quality=95)
83 | file = "o.webp"
84 | os.remove("k.png")
85 | await event.client.send_file(event.chat_id, file, reply_to=event.reply_to_msg_id)
86 | await xx.delete()
87 | os.remove(file)
88 | os.remove(ik)
89 |
90 | # Port By Alvin Ganteng/liualvinas
91 | # Lord - Userbot
92 |
93 | CMD_HELP.update({"tiny": "`.tiny`\
94 | \nPenjelasan: Untuk Memperkecil Sticker."})
95 |
--------------------------------------------------------------------------------
/termux_install.sh:
--------------------------------------------------------------------------------
1 | clear
2 | echo -E " ******,*,. ... "
3 | echo -E " /////*****,*... . . "
4 | echo -E " . . /((//*/*,*///*. . .. "
5 | echo -E ".. . . .((*,,. .*//*. . . . .. "
6 | echo -E ". . ../(((**((//,,/.......... .. .. .. "
7 | echo -E ". . . ./(/, ., , . . ...... "
8 | echo -E "..,,.... .. .. . **//*/*/*.... . . ...*,. "
9 | echo -E " .,,,..,,,.,...... //((/. /**,. ... .. .....,*,** "
10 | echo -E " /(/(*,/// ..,,,,,,,.,,,,,,,,*, "
11 | echo -E ". ((((((/ ., . ..**** "
12 | echo -E "....... */(##//((/ ,.*, ..... .,,,*** "
13 | echo -E "......................../((##(((###( .,.,. ,.... . ,.,*/ "
14 | echo -E " ...*, *,,...,//(((((((####(((*,.**.. **, ,*/***((# "
15 | echo -E " *((/,***(((((((((####((//*/*,,**(//(//(//((((( "
16 | echo -E " .(/ ,(#((((###((((((((#((/(#(*(#/(*((/((((.*,(//// "
17 | echo -E " (((//(( (###(((((/(##(*/((.(#/##((((((/**(/(#*( "
18 | echo -E "/////**/ /((//,*,,../(/,((((/((#(##/(*(/#%#(((/(((/. *****/ "
19 | echo -E " .*////(/((/(/*,**/((((##((//.,####/((#(#%#(((((((/ , .**** "
20 | echo -E ". /(//(#( (#(#(*,/#(#/#####%##(((((((/(////*, "
21 | echo -E "........ ((/((#( /((#(((/ /((#/###%%%#(((/(((//////(( "
22 | echo -E "........./((#(#*.... ((,(((((# /((#((#%%%/* **((. . .., "
23 | echo -E "........./((#(/(.......((((((///(/*((#((%%%%%##(((,*/. , . "
24 | echo -E "........./((((((......*###(((/(/*(# ####%%%%#(.*((..,. "
25 | echo -E ".........((####(......(#(##.(#(((,*((.#%%%%##(*((/..,,*. "
26 | echo -E "//(/***,*(###(//,,..,///#/(. /(((/((((*#%%##(/(,,,.. "
27 | echo -E "**/**,,,,####(/**//((////(##(.*..*((/*##%%%(((,/ .,/ . "
28 | echo -E ",,,,,,,,,#####%(,*///////(((((/(((((((###%##//*., ,/. "
29 | echo -E ",,,,,,,,,#####%(,,,,///((((((///*.,.. (##((((#/(*///*.. "
30 | echo -E " "
31 | sleep 5
32 | clear
33 |
34 | pkg update && pkg upgrade -y
35 | pkg install clang curl git libcrypt libffi libiconv libjpeg* libjpeg-turbo libwebp libxml2 libxslt make ndk-sysroot openssl postgresql python readline wget zlib -y
36 |
37 | git clone https://github.com/Zora24/Lord-Userbot.git
38 | cd Lord-Userbot
39 |
40 | pip install --upgrade pip setuptools
41 | pip install -r requirements.txt
42 |
43 | mv sample_config.env config.env
44 |
45 | mkdir -p $PREFIX/var/lib/postgresql
46 | initdb $PREFIX/var/lib/postgresql
47 | pg_ctl -D $PREFIX/var/lib/postgresql start
48 | createdb botdb
49 | createuser botuser
50 |
51 | cd ..
52 | echo "pg_ctl -D $PREFIX/var/lib/postgresql start" > startbot.sh
53 | echo "cd Lord-Userbot" >> startbot.sh
54 | echo "python3 -m userbot" >> startbot.sh
55 | chmod 755 startbot.sh
56 |
57 | echo "Done."
58 | echo "Now edit config.env with nano or anything you want, then run the userbot with startbot.sh"
59 | echo "Please edit the db to postgresql://botuser:@localhost:5432/botdb"
60 | echo "Good luck!"
61 |
--------------------------------------------------------------------------------
/userbot/modules/lordhz.py:
--------------------------------------------------------------------------------
1 | # Based Code by @adekmaulana
2 | # Improve by @aidilaryanto
3 | #
4 | #
5 | import os
6 | from telethon.errors.rpcerrorlist import YouBlockedUserError
7 | from userbot.events import register
8 | from userbot import bot, TEMP_DOWNLOAD_DIRECTORY, CMD_HELP
9 |
10 |
11 | @register(outgoing=True, pattern=r"^.hz(:? |$)(.*)?")
12 | async def _(hazmat):
13 | await hazmat.edit("`Lord Ingin Mengaktifkan Perintah Hazmat ヅ`")
14 | level = hazmat.pattern_match.group(2)
15 | if hazmat.fwd_from:
16 | return
17 | if not hazmat.reply_to_msg_id:
18 | await hazmat.edit("`Lord, Mohon Balas Ke Sticker/Gambar ヅ`")
19 | return
20 | reply_message = await hazmat.get_reply_message()
21 | if not reply_message.media:
22 | await hazmat.edit("`Kata Bisa Menghancurkan Apapun Lord ヅ`")
23 | return
24 | chat = "@hazmat_suit_bot"
25 | await hazmat.edit("```Perintah Hazmat Diaktifkan, Sedang Memproses.... ヅ```")
26 | message_id_to_reply = hazmat.message.reply_to_msg_id
27 | msg_reply = None
28 | async with hazmat.client.conversation(chat) as conv:
29 | try:
30 | msg = await conv.send_message(reply_message)
31 | if level:
32 | m = f"/hazmat {level}"
33 | msg_reply = await conv.send_message(m, reply_to=msg.id)
34 | r = await conv.get_response()
35 | elif reply_message.gif:
36 | m = "/hazmat"
37 | msg_reply = await conv.send_message(m, reply_to=msg.id)
38 | r = await conv.get_response()
39 | response = await conv.get_response()
40 | """ - don't spam notif - """
41 | await bot.send_read_acknowledge(conv.chat_id)
42 | except YouBlockedUserError:
43 | await hazmat.reply("`Lord, Mohon Buka Blokir` @hazmat_suit_bot `Lalu Coba Lagi`")
44 | return
45 | if response.text.startswith("I can't"):
46 | await hazmat.edit("`Mohon Maaf Lord, GIF Tidak Bisa...`")
47 | await hazmat.client.delete_messages(
48 | conv.chat_id, [msg.id, response.id, r.id, msg_reply.id]
49 | )
50 | return
51 | else:
52 | downloaded_file_name = await hazmat.client.download_media(
53 | response.media, TEMP_DOWNLOAD_DIRECTORY
54 | )
55 | await hazmat.client.send_file(
56 | hazmat.chat_id,
57 | downloaded_file_name,
58 | force_document=False,
59 | reply_to=message_id_to_reply,
60 | )
61 | """ - cleanup chat after completed - """
62 | if msg_reply is not None:
63 | await hazmat.client.delete_messages(
64 | conv.chat_id, [msg.id, msg_reply.id, r.id, response.id]
65 | )
66 | else:
67 | await hazmat.client.delete_messages(conv.chat_id, [msg.id, response.id])
68 | await hazmat.delete()
69 | return os.remove(downloaded_file_name)
70 |
71 |
72 | CMD_HELP.update(
73 | {
74 | "hazmat": ">`.hz` atau >`.hz [flip, x2, rotate (level), background (nomer), black]`"
75 | "\nUsage: Balas ke gambar/sticker untuk menyesuaikan!"
76 | }
77 | )
78 |
--------------------------------------------------------------------------------
/userbot/modules/spam.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.
2 | #
3 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
4 | # you may not use this file except in compliance with the License.
5 |
6 | import asyncio
7 | from asyncio import sleep
8 |
9 | from userbot import BOTLOG, BOTLOG_CHATID, CMD_HELP
10 | from userbot.events import register
11 |
12 |
13 | @register(outgoing=True, pattern="^.cspam (.*)")
14 | async def tmeme(e):
15 | cspam = str(e.pattern_match.group(1))
16 | message = cspam.replace(" ", "")
17 | await e.delete()
18 | for letter in message:
19 | await e.respond(letter)
20 | if BOTLOG:
21 | await e.client.send_message(
22 | BOTLOG_CHATID, "#CSPAM\n"
23 | "TSpam was executed successfully")
24 |
25 |
26 | @register(outgoing=True, pattern="^.wspam (.*)")
27 | async def tmeme(e):
28 | wspam = str(e.pattern_match.group(1))
29 | message = wspam.split()
30 | await e.delete()
31 | for word in message:
32 | await e.respond(word)
33 | if BOTLOG:
34 | await e.client.send_message(
35 | BOTLOG_CHATID, "#WSPAM\n"
36 | "WSpam was executed successfully")
37 |
38 |
39 | @register(outgoing=True, pattern="^.spam (.*)")
40 | async def spammer(e):
41 | counter = int(e.pattern_match.group(1).split(' ', 1)[0])
42 | spam_message = str(e.pattern_match.group(1).split(' ', 1)[1])
43 | await e.delete()
44 | await asyncio.wait([e.respond(spam_message) for i in range(counter)])
45 | if BOTLOG:
46 | await e.client.send_message(BOTLOG_CHATID, "#SPAM\n"
47 | "Spam was executed successfully")
48 |
49 |
50 | @register(outgoing=True, pattern="^.picspam")
51 | async def tiny_pic_spam(e):
52 | message = e.text
53 | text = message.split()
54 | counter = int(text[1])
55 | link = str(text[2])
56 | await e.delete()
57 | for _ in range(1, counter):
58 | await e.client.send_file(e.chat_id, link)
59 | if BOTLOG:
60 | await e.client.send_message(
61 | BOTLOG_CHATID, "#PICSPAM\n"
62 | "PicSpam was executed successfully")
63 |
64 |
65 | @register(outgoing=True, pattern="^.delayspam (.*)")
66 | async def spammer(e):
67 | spamDelay = float(e.pattern_match.group(1).split(' ', 2)[0])
68 | counter = int(e.pattern_match.group(1).split(' ', 2)[1])
69 | spam_message = str(e.pattern_match.group(1).split(' ', 2)[2])
70 | await e.delete()
71 | for _ in range(1, counter):
72 | await e.respond(spam_message)
73 | await sleep(spamDelay)
74 | if BOTLOG:
75 | await e.client.send_message(
76 | BOTLOG_CHATID, "#DelaySPAM\n"
77 | "DelaySpam was executed successfully")
78 |
79 |
80 | CMD_HELP.update({
81 | "spam":
82 | "`.cspam` \
83 | \nUsage: Spam the text letter by letter.\
84 | \n\n`.spam` \
85 | \nUsage: Floods text in the chat !!\
86 | \n\n`.wspam` \
87 | \nUsage: Spam the text word by word.\
88 | \n\n`.picspam` \
89 | \nUsage: As if text spam was not enough !!\
90 | \n\n`.delayspam` \
91 | \nUsage: `.bigspam` but with custom delay.\
92 | \n\n\nNOTE : Spam at your own risk !!"
93 | })
94 |
--------------------------------------------------------------------------------
/userbot/modules/rastick.py:
--------------------------------------------------------------------------------
1 | import random
2 | import re
3 |
4 | from userbot import bot, CMD_HELP
5 | from userbot.events import register
6 | from asyncio import sleep
7 | EMOJI_PATTERN = re.compile(
8 | "["
9 | "\U0001F1E0-\U0001F1FF" # flags (iOS)
10 | "\U0001F300-\U0001F5FF" # symbols & pictographs
11 | "\U0001F600-\U0001F64F" # emoticons
12 | "\U0001F680-\U0001F6FF" # transport & map symbols
13 | "\U0001F700-\U0001F77F" # alchemical symbols
14 | "\U0001F780-\U0001F7FF" # Geometric Shapes Extended
15 | "\U0001F800-\U0001F8FF" # Supplemental Arrows-C
16 | "\U0001F900-\U0001F9FF" # Supplemental Symbols and Pictographs
17 | "\U0001FA00-\U0001FA6F" # Chess Symbols
18 | "\U0001FA70-\U0001FAFF" # Symbols and Pictographs Extended-A
19 | "\U00002702-\U000027B0" # Dingbats
20 | "]+"
21 | )
22 |
23 |
24 | def deEmojify(inputString: str) -> str:
25 | return re.sub(EMOJI_PATTERN, "", inputString)
26 |
27 |
28 | @register(outgoing=True, pattern=r"^\.rst(?: |$)(.*)")
29 | async def rastick(animu):
30 | text = animu.pattern_match.group(1)
31 | if not text:
32 | if animu.is_reply:
33 | text = (await animu.get_reply_message()).message
34 | else:
35 | await animu.answer("`No text given, hence no stickers.`")
36 | return
37 | animus = [
38 | 1,
39 | 2,
40 | 3,
41 | 4,
42 | 5,
43 | 6,
44 | 7,
45 | 8,
46 | 9,
47 | 10,
48 | 11,
49 | 12,
50 | 13,
51 | 14,
52 | 15,
53 | 16,
54 | 17,
55 | 18,
56 | 19,
57 | 20,
58 | 21,
59 | 22,
60 | 23,
61 | 24,
62 | 25,
63 | 26,
64 | 27,
65 | 28,
66 | 29,
67 | 30,
68 | 31,
69 | 32,
70 | 33,
71 | 34,
72 | 35,
73 | 36,
74 | 37,
75 | 38,
76 | 39,
77 | 40,
78 | 41,
79 | 42,
80 | 43,
81 | 44,
82 | 45,
83 | 46,
84 | 47,
85 | 48,
86 | 49,
87 | 50,
88 | 51,
89 | 52,
90 | 53,
91 | 54,
92 | 55,
93 | 56,
94 | 57,
95 | 58,
96 | 59,
97 | 60,
98 | 61,
99 | 62,
100 | 63,
101 | ]
102 | sticcers = await bot.inline_query(
103 | "stickerizerbot", f"#{random.choice(animus)}{(deEmojify(text))}"
104 | )
105 | try:
106 | await sticcers[0].click(
107 | animu.chat_id,
108 | reply_to=animu.reply_to_msg_id,
109 | silent=True if animu.is_reply else False,
110 | hide_via=True,
111 | )
112 | except Exception:
113 | return await animu.edit(
114 | "`You cannot send inline results in this chat (caused by SendInlineBotResultRequest)`"
115 | )
116 | await sleep(5)
117 | await animu.delete()
118 |
119 |
120 | CMD_HELP.update(
121 | {
122 | "rastick": ">`.rst`"
123 | "\nUsage: To stickerize your text with random sticker templates."
124 | "\n@StickerizerBot"
125 | }
126 | )
127 |
--------------------------------------------------------------------------------
/userbot/modules/lordimp.py:
--------------------------------------------------------------------------------
1 | # Alvin Gans
2 | # Copyright (C) 2019 The Raphielscape Company LLC.
3 | #
4 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
5 | # you may not use this file except in compliance with the License.
6 | #
7 |
8 | from io import BytesIO
9 | from random import choice, randint
10 | from textwrap import wrap
11 |
12 | from PIL import Image, ImageDraw, ImageFont
13 | from requests import get
14 |
15 | from userbot import CMD_HELP
16 | from userbot.events import register
17 |
18 |
19 | @register(outgoing=True, pattern="^.imp (.*)")
20 | async def f_load(message):
21 | clrs = {
22 | "red": 1,
23 | "lime": 2,
24 | "green": 3,
25 | "blue": 4,
26 | "cyan": 5,
27 | "brown": 6,
28 | "purple": 7,
29 | "pink": 8,
30 | "orange": 9,
31 | "yellow": 10,
32 | "white": 11,
33 | "black": 12,
34 | }
35 | clr = randint(1, 12)
36 | text = message.pattern_match.group(1)
37 | reply = await message.get_reply_message()
38 | if text in clrs:
39 | clr = clrs[text]
40 | text = None
41 | if not text:
42 | if not reply:
43 | await bruh(message, message.sender)
44 | return
45 | if not reply.text:
46 | await bruh(message, reply.sender)
47 | return
48 | text = reply.pattern_match.group(1)
49 |
50 | if text.split(" ")[0] in clrs:
51 | clr = clrs[text.split(" ")[0]]
52 | text = " ".join(text.split(" ")[1:])
53 |
54 | if text == "colors":
55 | await message.edit(
56 | "Cores disponíveis:\n"
57 | + ("\n".join([f"• `{i}`" for i in list(clrs.keys())]))
58 | )
59 | return
60 |
61 | url = "https://raw.githubusercontent.com/KeyZenD/AmongUs/master/"
62 | font = ImageFont.truetype(BytesIO(get(url + "bold.ttf").content), 60)
63 | imposter = Image.open(BytesIO(get(f"{url}{clr}.png").content))
64 | text_ = "\n".join(["\n".join(wrap(part, 30)) for part in text.split("\n")])
65 | w, h = ImageDraw.Draw(Image.new("RGB", (1, 1))).multiline_textsize(
66 | text_, font, stroke_width=2
67 | )
68 | text = Image.new("RGBA", (w + 30, h + 30))
69 | ImageDraw.Draw(text).multiline_text(
70 | (15, 15), text_, "#FFF", font, stroke_width=2, stroke_fill="#000"
71 | )
72 | w = imposter.width + text.width + 10
73 | h = max(imposter.height, text.height)
74 | image = Image.new("RGBA", (w, h))
75 | image.paste(imposter, (0, h - imposter.height), imposter)
76 | image.paste(text, (w - text.width, 0), text)
77 | image.thumbnail((512, 512))
78 | output = BytesIO()
79 | output.name = "imposter.webp"
80 | image.save(output)
81 | output.seek(0)
82 | await message.delete()
83 | await message.client.send_file(message.to_id, output, reply_to=reply)
84 |
85 |
86 | async def bruh(message, user):
87 | fn = user.first_name
88 | ln = user.last_name
89 | name = fn + (" " + ln if ln else "")
90 | name = "***" + name
91 | await message.edit(name + choice([" ", " Tidak "]) + "Adalah Seorang Penipu! ***")
92 |
93 |
94 | CMD_HELP.update(
95 | {
96 | "amongus": "`.imp`\
97 | \nUsage: Kirimkan gambar seorang impostor Among US dengan kalimat dari Anda."
98 | }
99 | )
100 |
--------------------------------------------------------------------------------
/userbot/modules/lordwc.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2020 Alfiananda P.A
2 | #
3 | # Licensed under the General Public License, Version 3.0;
4 | # you may not use this file except in compliance with the License.
5 | #
6 |
7 | import os
8 |
9 | import numpy as np
10 | from hachoir.metadata import extractMetadata
11 | from hachoir.parser import createParser
12 | from PIL import Image
13 | from scipy.ndimage import gaussian_gradient_magnitude
14 | from telethon.tl.types import DocumentAttributeFilename
15 | from wordcloud import ImageColorGenerator, WordCloud
16 |
17 | from userbot import CMD_HELP, bot
18 | from userbot.events import register
19 |
20 |
21 | @register(outgoing=True, pattern=r"^\.(wc)$")
22 | async def _(event):
23 | if not event.reply_to_msg_id:
24 | await event.edit("`Mohon Balas Ke Media Apapun Lord`")
25 | return
26 | reply_message = await event.get_reply_message()
27 | if not reply_message.media:
28 | await event.edit("`Mohon Balas Ke Gambar/Sticker/Video Lord`")
29 | return
30 | await event.edit("`Mendownload Media.....`")
31 | if reply_message.photo:
32 | await bot.download_media(
33 | reply_message,
34 | "wc.png",
35 | )
36 | elif (
37 | DocumentAttributeFilename(file_name="AnimatedSticker.tgs")
38 | in reply_message.media.document.attributes
39 | ):
40 | await bot.download_media(
41 | reply_message,
42 | "wc.tgs",
43 | )
44 | os.system("lottie_convert.py wc.tgs wc.png")
45 | elif reply_message.video:
46 | video = await bot.download_media(
47 | reply_message,
48 | "wc.mp4",
49 | )
50 | extractMetadata(createParser(video))
51 | os.system("ffmpeg -i wc.mp4 -vframes 1 -an -s 480x360 -ss 1 wc.png")
52 | else:
53 | await bot.download_media(
54 | reply_message,
55 | "wc.png",
56 | )
57 | try:
58 | await event.edit("`Sedang Memproses....`")
59 | text = open("userbot/utils/styles/alice.txt", encoding="utf-8").read()
60 | image_color = np.array(Image.open("wc.png"))
61 | image_color = image_color[::1, ::1]
62 | image_mask = image_color.copy()
63 | image_mask[image_mask.sum(axis=2) == 0] = 255
64 | edges = np.mean(
65 | [
66 | gaussian_gradient_magnitude(image_color[:, :, i] / 255.0, 2)
67 | for i in range(3)
68 | ],
69 | axis=0,
70 | )
71 | image_mask[edges > 0.08] = 255
72 | wc = WordCloud(
73 | max_words=2000,
74 | mask=image_mask,
75 | max_font_size=40,
76 | random_state=42,
77 | relative_scaling=0,
78 | )
79 | wc.generate(text)
80 | image_colors = ImageColorGenerator(image_color)
81 | wc.recolor(color_func=image_colors)
82 | wc.to_file("wc.png")
83 | await event.client.send_file(
84 | event.chat_id,
85 | "wc.png",
86 | reply_to=event.reply_to_msg_id,
87 | )
88 | await event.delete()
89 | os.system("rm *.png *.mp4 *.tgs *.webp")
90 | except BaseException as e:
91 | os.system("rm *.png *.mp4 *.tgs *.webp")
92 | return await event.edit(str(e))
93 |
94 |
95 | CMD_HELP.update(
96 | {"wordcloud": ">`.wc`\n" "Usage: membuat seni wordcloud dari media\n\n"}
97 | )
98 |
--------------------------------------------------------------------------------
/sample_config.env:
--------------------------------------------------------------------------------
1 | # Remove this line first before doing anything
2 | ___________PLOX_______REMOVE_____THIS_____LINE__________=True
3 |
4 | # Get these from https://my.telegram.org/
5 | API_KEY = "YOUR API KEY"
6 | API_HASH = "YOUR API HASH"
7 |
8 | # OpenWeather Map API Key for .weather command
9 | # Get from https://openweathermap.org/
10 | OPEN_WEATHER_MAP_APPID = ""
11 | WEATHER_DEFCITY = ""
12 |
13 | # Location of ChromeDriver for .carbon module
14 | # Example for Linux Machines : "/usr/bin/chromedriver"
15 | CHROME_DRIVER = ""
16 |
17 | # Get this value by running python3 string_session.py locally
18 | STRING_SESSION = ""
19 |
20 | # Headless GoogleChrome location for .carbon module
21 | # Example for Linux Machines : "/usr/bin/chromium-browser"
22 | GOOGLE_CHROME_BIN = ""
23 |
24 | # OCR Space API Key for .ocr command
25 | # Get from https://ocr.space/ocrapi
26 | OCR_SPACE_API_KEY = ""
27 |
28 | # Genius lyrics get this value from https://genius.com/developers both has same values
29 | GENIUS_API_TOKEN = ""
30 | # Genius lyrics get this value from https://genius.com/developers both has same values
31 | GENIUS = ""
32 |
33 | # remove.bg API Key for .rbg command
34 | # Get from https://www.remove.bg/api
35 | REM_BG_API_KEY = ""
36 |
37 | # ChatID for the Log group
38 | # Add a Hypen or a Negative Sign before ID
39 | # This is a integer, Please don't use Strings
40 | BOTLOG_CHATID = # this is an integer, please don't use quotes.
41 |
42 | # Incase you want to turn off logging, put this to false
43 | BOTLOG = True
44 |
45 | # Set this to True if you want the error logs to be stored in
46 | # the userbot log, rather than spamming other chats with it.
47 | # Note that this requires a valid BOTLOG_CHATID to be set.
48 | LOGSPAMMER = True
49 |
50 | # If you need Verbosity on the Logging
51 | CONSOLE_LOGGER_VERBOSE = False
52 |
53 | # PM Auto-Ban Feature Switch
54 | PM_AUTO_BAN = False
55 |
56 | # Custom Default name for .alive
57 | ALIVE_NAME = None
58 |
59 | # set blacklist_chats where you do not want userbot's features
60 | UB_BLACK_LIST_CHAT = ""
61 |
62 | # Your Database URL
63 | # Example: 'postgres://userbot:userbot@localhost:5432/userbot'
64 | DATABASE_URL = ""
65 |
66 | # YouTube Data API Key for .yt command
67 | # Get from https://console.cloud.google.com
68 | YOUTUBE_API_KEY = ""
69 |
70 | # Country and Time Zone setup for
71 | # .time and .date modules
72 | COUNTRY = ""
73 | TZ_NUMBER = # this is an integer, please don't use quotes.
74 |
75 | # Google Drive Credentials
76 | # for .gdrive module.
77 | # Get from https://console.cloud.google.com
78 | G_DRIVE_CLIENT_ID = ""
79 | G_DRIVE_CLIENT_SECRET = ""
80 | G_DRIVE_AUTH_TOKEN_DATA = ""
81 | TEMP_DOWNLOAD_DIRECTORY = ""
82 |
83 | # You have to have your own unique two values for API_KEY and API_SECRET
84 | # Obtain yours from https://www.last.fm/api/account/create for Last.fm
85 | LASTFM_API = None
86 | LASTFM_SECRET = None
87 | LASTFM_USERNAME = None # Your last.fm username
88 | LASTFM_PASSWORD = "Your last.fm password"
89 |
90 | # Bot will add before song name. For last.fm module.
91 | # Example: GitHub: MacTavishAO : Skillet - Feel Invincible
92 | BIO_PREFIX = ""
93 |
94 | # default bio message
95 | DEFAULT_BIO = ""
96 |
97 | # FOR Lydia Access
98 | LYDIA_API_KEY = ""
99 | LYDIA_ANTI-PM = ""
100 |
101 |
102 | # Report or kick some known spammer bots after
103 | # they joins
104 | ANTI_SPAMBOT = False
105 | ANTI_SPAMBOT_SHOUT = False
106 |
--------------------------------------------------------------------------------
/userbot/modules/sql_helper/blacklist_sql.py:
--------------------------------------------------------------------------------
1 | try:
2 | from userbot.modules.sql_helper import SESSION, BASE
3 | except ImportError:
4 | raise AttributeError
5 | from sqlalchemy import Column, String, UnicodeText
6 | import threading
7 |
8 |
9 | class BlackListFilters(BASE):
10 | __tablename__ = "blacklist"
11 | chat_id = Column(String(14), primary_key=True)
12 | trigger = Column(UnicodeText, primary_key=True, nullable=False)
13 |
14 | def __init__(self, chat_id, trigger):
15 | self.chat_id = str(chat_id) # ensure string
16 | self.trigger = trigger
17 |
18 | def __repr__(self):
19 | return "" % (self.trigger, self.chat_id)
20 |
21 | def __eq__(self, other):
22 | return bool(isinstance(other, BlackListFilters)
23 | and self.chat_id == other.chat_id
24 | and self.trigger == other.trigger)
25 |
26 |
27 | BlackListFilters.__table__.create(checkfirst=True)
28 |
29 | BLACKLIST_FILTER_INSERTION_LOCK = threading.RLock()
30 |
31 | CHAT_BLACKLISTS = {}
32 |
33 |
34 | def add_to_blacklist(chat_id, trigger):
35 | with BLACKLIST_FILTER_INSERTION_LOCK:
36 | blacklist_filt = BlackListFilters(str(chat_id), trigger)
37 |
38 | SESSION.merge(blacklist_filt) # merge to avoid duplicate key issues
39 | SESSION.commit()
40 | CHAT_BLACKLISTS.setdefault(str(chat_id), set()).add(trigger)
41 |
42 |
43 | def rm_from_blacklist(chat_id, trigger):
44 | with BLACKLIST_FILTER_INSERTION_LOCK:
45 | blacklist_filt = SESSION.query(
46 | BlackListFilters).get((str(chat_id), trigger))
47 | if blacklist_filt:
48 | if trigger in CHAT_BLACKLISTS.get(
49 | str(chat_id), set()): # sanity check
50 | CHAT_BLACKLISTS.get(str(chat_id), set()).remove(trigger)
51 |
52 | SESSION.delete(blacklist_filt)
53 | SESSION.commit()
54 | return True
55 |
56 | SESSION.close()
57 | return False
58 |
59 |
60 | def get_chat_blacklist(chat_id):
61 | return CHAT_BLACKLISTS.get(str(chat_id), set())
62 |
63 |
64 | def num_blacklist_filters():
65 | try:
66 | return SESSION.query(BlackListFilters).count()
67 | finally:
68 | SESSION.close()
69 |
70 |
71 | def num_blacklist_chat_filters(chat_id):
72 | try:
73 | return SESSION.query(BlackListFilters.chat_id).filter(
74 | BlackListFilters.chat_id == str(chat_id)).count()
75 | finally:
76 | SESSION.close()
77 |
78 |
79 | def num_blacklist_filter_chats():
80 | try:
81 | return SESSION.query(
82 | func.count(
83 | distinct(
84 | BlackListFilters.chat_id))).scalar()
85 | finally:
86 | SESSION.close()
87 |
88 |
89 | def __load_chat_blacklists():
90 | global CHAT_BLACKLISTS
91 | try:
92 | chats = SESSION.query(BlackListFilters.chat_id).distinct().all()
93 | for (chat_id,) in chats: # remove tuple by ( ,)
94 | CHAT_BLACKLISTS[chat_id] = []
95 |
96 | all_filters = SESSION.query(BlackListFilters).all()
97 | for x in all_filters:
98 | CHAT_BLACKLISTS[x.chat_id] += [x.trigger]
99 |
100 | CHAT_BLACKLISTS = {x: set(y) for x, y in CHAT_BLACKLISTS.items()}
101 |
102 | finally:
103 | SESSION.close()
104 |
105 |
106 | __load_chat_blacklists()
107 |
--------------------------------------------------------------------------------
/userbot/modules/blacklist.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.
2 | #
3 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
4 | # you may not use this file except in compliance with the License.
5 |
6 | # port to userbot from uniborg by @keselekpermen69
7 |
8 |
9 | import io
10 | import re
11 |
12 | import userbot.modules.sql_helper.blacklist_sql as sql
13 | from userbot import CMD_HELP
14 | from userbot.events import register
15 |
16 |
17 | @register(incoming=True, disable_edited=True, disable_errors=True)
18 | async def on_new_message(event):
19 | # TODO: exempt admins from locks
20 | name = event.raw_text
21 | snips = sql.get_chat_blacklist(event.chat_id)
22 | for snip in snips:
23 | pattern = r"( |^|[^\w])" + re.escape(snip) + r"( |$|[^\w])"
24 | if re.search(pattern, name, flags=re.IGNORECASE):
25 | try:
26 | await event.delete()
27 | except Exception:
28 | await event.reply("`Lord, Anda Tidak Punya Izin Untuk Menghapus Pesan Disini`")
29 | await sleep(1)
30 | await reply.delete()
31 | sql.rm_from_blacklist(event.chat_id, snip.lower())
32 | break
33 |
34 |
35 | @register(outgoing=True, pattern=r"^\.addbl(?: |$)(.*)")
36 | async def on_add_black_list(addbl):
37 | text = addbl.pattern_match.group(1)
38 | to_blacklist = list(
39 | {trigger.strip() for trigger in text.split("\n") if trigger.strip()}
40 | )
41 |
42 | for trigger in to_blacklist:
43 | sql.add_to_blacklist(addbl.chat_id, trigger.lower())
44 | await addbl.edit(
45 | "`Menambahkan Kata` **{}** `Ke Blacklist Untuk Obrolan Ini`".format(text)
46 | )
47 |
48 |
49 | @register(outgoing=True, pattern=r"^\.listbl(?: |$)(.*)")
50 | async def on_view_blacklist(listbl):
51 | all_blacklisted = sql.get_chat_blacklist(listbl.chat_id)
52 | OUT_STR = "Blacklists in the Current Chat:\n"
53 | if len(all_blacklisted) > 0:
54 | for trigger in all_blacklisted:
55 | OUT_STR += f"`{trigger}`\n"
56 | else:
57 | OUT_STR = "`Tidak Ada Blacklist Dalam Obrolan Ini.`"
58 | if len(OUT_STR) > 4096:
59 | with io.BytesIO(str.encode(OUT_STR)) as out_file:
60 | out_file.name = "blacklist.text"
61 | await listbl.client.send_file(
62 | listbl.chat_id,
63 | out_file,
64 | force_document=True,
65 | allow_cache=False,
66 | caption="Blacklist Dalam Obrolan Ini",
67 | reply_to=listbl,
68 | )
69 | await listbl.delete()
70 | else:
71 | await listbl.edit(OUT_STR)
72 |
73 |
74 | @register(outgoing=True, pattern=r"^\.rmbl(?: |$)(.*)")
75 | async def on_delete_blacklist(rmbl):
76 | text = rmbl.pattern_match.group(1)
77 | to_unblacklist = list(
78 | {trigger.strip() for trigger in text.split("\n") if trigger.strip()}
79 | )
80 |
81 | successful = 0
82 | for trigger in to_unblacklist:
83 | if sql.rm_from_blacklist(rmbl.chat_id, trigger.lower()):
84 | successful += 1
85 | if not successful:
86 | await rmbl.edit("`Lord,` **{}** `Tidak Ada Di Blacklist`".format(text))
87 | else:
88 | await rmbl.edit("`Berhasil Menghapus` **{}** `Di Blacklist`".format(text))
89 |
90 |
91 | CMD_HELP.update({"blacklist": ">`.listbl`"
92 | "\nUsage: Melihat daftar blacklist yang aktif di obrolan."
93 | "\n\n>`.addbl `"
94 | "\nUsage: Memasukan pesan ke blacklist 'kata blacklist'."
95 | "\nlord bot akan otomatis menghapus 'kata blacklist'."
96 | "\n\n>`.rmbl `"
97 | "\nUsage: Menghapus kata blacklist."})
98 |
--------------------------------------------------------------------------------
/userbot/modules/help.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.
2 | #
3 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
4 | # you may not use this file except in compliance with the License.
5 | #
6 | """ Lord Userbot help command """
7 |
8 | # LORD USERBOT
9 | # @LORDUSERBOT_GROUP
10 |
11 | import asyncio
12 | from userbot import CMD_HELP
13 | from userbot.events import register
14 |
15 | modules = CMD_HELP
16 |
17 | # EDIT BY ALVIN / @LIUALVINAS FOR LORD USERBOT
18 | # CREDIT EDIT FROM LORD
19 | # JANGAN HAPUS!!!
20 |
21 | @register(outgoing=True, pattern="^.help(?: |$)(.*)")
22 | async def help(lord):
23 | """ For .help command,"""
24 | args = lord.pattern_match.group(1).lower()
25 | if args:
26 | if args in CMD_HELP:
27 | await lord.edit(str(CMD_HELP[args]))
28 | else:
29 | await lord.edit("**Maaf Lord, Saya Tidak Punya Perintah Itu ツ**")
30 | await asyncio.sleep(200)
31 | await lord.delete()
32 | else:
33 | await lord.edit("⚡")
34 | await lord.edit("**⚡️ MODULES 1:**\n"
35 | "`admin` `adzan` `afk` `gabut` `vip` `animasi` `android` `anime` `anti_spambot` `aria` `ascii`\n\n"
36 | "**⚡️ MODULES 2:**\n"
37 | "`blacklist` `carbon` `chat` `mutechat` `covid` `membuat` `deepfry` `emojigames`\n\n"
38 | "**⚡️ MODULES 3:**\n"
39 | "`eval` `exec` `term` `fakegban` `federations` `figlet` `filter` `gban` `gcast` `gdrive` `gcommit` `github`\n\n"
40 | "**⚡️ MODULES 4:**\n"
41 | "`glitch` `gps` `hash` `base64` `hentai` `heroku` `id` `imgmeme` `kekuatan`\n\n"
42 | "**⚡️ MODULES 5:**\n"
43 | "`lastfm` `locks` `lord` `aeshtetic` `deteksi` `lordfun` `lordhelper` `hazmat`\n\n"
44 | "**⚡️ MODULES 6:**\n"
45 | "`instagram` `amongus` `lordmemes` `misc` `app` `undelete` `grab` `clone`\n\n"
46 | "**⚡️ MODULES 7:**\n"
47 | "`randomprofil` `song` `tiny` `tempmail` `tiktok` `wordcloud`\n\n"
48 | "**⚡️ MODULES 8:**\n"
49 | "`lyrics` `mega` `memes` `memify` `mentions` `purge` `purgeme` `del` `edit`\n\n"
50 | "**⚡️ MODULES 9:**\n"
51 | "`sd` `random` `sleep` `shutdown` `repo` `readme` `repeat` `restart`\n\n"
52 | "**⚡️ MODULES 10:**\n"
53 | "`raw` `nekobot` `notes` `off` `phreaker` `pm` `profil` `quotly` `rastick` `resi` `reverse` `salam` `sangmata`\n\n"
54 | "**⚡️ MODULES 11:**\n"
55 | "`santetonline` `image_search` `currency` `google` `wiki` `ud` `tts` `translate` `youtube` `rip`\n\n"
56 | "**⚡️ MODULES 12:**\n"
57 | "`removebg` `ocr` `qrcode` `barcode` `paste` `getpaste` `nekobin` `direct` `screenshot` `sed` `snips` `spam` `spotifynow` `ssvideo`\n\n"
58 | "**⚡️ MODULES 13:**\n"
59 | "`stickers` `stickers2` `sysd` `botver` `pip` `alive` `tag_all` `telegraph` `timedate` `torrent`\n\n"
60 | "**⚡️ MODULES 14:**\n"
61 | "`transform` `update` `download` `getid` `waifu` `wallpaper` `weather`\n\n"
62 | "**⚡️ MODULES 15:**\n"
63 | "`webupload` `welcome` `whois` `ping` `sinyal` `xiaomi` `zipfile`")
64 | await lord.reply("\n**CARA MENGGUNAKAN,** **CONTOH:**\n**KETIK** `.help afk` **UNTUK INFORMASI MODULES**\n**GROUP SUPPORT:** [TEKAN](t.me/LordUserbot_Group)")
65 | await asyncio.sleep(1000)
66 | await lord.delete()
67 |
68 | # ALVIN GANTENG
69 |
--------------------------------------------------------------------------------
/userbot/modules/sed.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.
2 | #
3 | # Licensed under the Raphielscape Public License, Version 1.c (the "License");
4 | # you may not use this file except in compliance with the License.
5 | #
6 | # The entire source code is OSSRPL except 'sed' which is GPLv3
7 | # License: GPLv3 and OSSRPL
8 | """ Userbot command for sed. """
9 |
10 | import re
11 | from sre_constants import error as sre_err
12 | from userbot import CMD_HELP
13 | from userbot.events import register
14 |
15 | DELIMITERS = ("/", ":", "|", "_")
16 |
17 |
18 | async def separate_sed(sed_string):
19 | """ Separate sed arguments. """
20 |
21 | if len(sed_string) < 2:
22 | return
23 |
24 | if (len(sed_string) >= 2 and sed_string[2] in DELIMITERS
25 | and sed_string.count(sed_string[2]) >= 2):
26 | delim = sed_string[2]
27 | start = counter = 3
28 | while counter < len(sed_string):
29 | if sed_string[counter] == "\\":
30 | counter += 1
31 |
32 | elif sed_string[counter] == delim:
33 | replace = sed_string[start:counter]
34 | counter += 1
35 | start = counter
36 | break
37 |
38 | counter += 1
39 |
40 | else:
41 | return None
42 |
43 | while counter < len(sed_string):
44 | if (sed_string[counter] == "\\" and counter + 1 < len(sed_string)
45 | and sed_string[counter + 1] == delim):
46 | sed_string = sed_string[:counter] + sed_string[counter + 1:]
47 |
48 | elif sed_string[counter] == delim:
49 | replace_with = sed_string[start:counter]
50 | counter += 1
51 | break
52 |
53 | counter += 1
54 | else:
55 | return replace, sed_string[start:], ""
56 |
57 | flags = ""
58 | if counter < len(sed_string):
59 | flags = sed_string[counter:]
60 | return replace, replace_with, flags.lower()
61 | return None
62 |
63 |
64 | @register(outgoing=True, pattern=r"^\.s")
65 | async def sed(command):
66 | """ For sed command, use sed on Telegram. """
67 | sed_result = await separate_sed(command.text)
68 | textx = await command.get_reply_message()
69 | if sed_result:
70 | if textx:
71 | to_fix = textx.text
72 | else:
73 | return await command.edit(
74 | "`Master, I don't have brains. Well you too don't I guess.`")
75 |
76 | repl, repl_with, flags = sed_result
77 |
78 | if not repl:
79 | return await command.edit(
80 | "`Master, I don't have brains. Well you too don't I guess.`")
81 |
82 | try:
83 | check = re.match(repl, to_fix, flags=re.IGNORECASE)
84 | if check and check.group(0).lower() == to_fix.lower():
85 | return await command.edit("`Boi!, that's a reply. Don't use sed`")
86 |
87 | if "i" in flags and "g" in flags:
88 | text = re.sub(repl, repl_with, to_fix, flags=re.I).strip()
89 | elif "i" in flags:
90 | text = re.sub(repl, repl_with, to_fix, count=1,
91 | flags=re.I).strip()
92 | elif "g" in flags:
93 | text = re.sub(repl, repl_with, to_fix).strip()
94 | else:
95 | text = re.sub(repl, repl_with, to_fix, count=1).strip()
96 | except sre_err:
97 | return await command.edit("B O I! [Learn Regex](https://regexone.com)")
98 | if text:
99 | await command.edit(f"Did you mean? \n\n{text}")
100 |
101 |
102 | CMD_HELP.update({
103 | "sed":
104 | ">`.s`"
105 | "\nUsage: Replaces a word or words using sed."
106 | "\nDelimiters: `/, :, |, _`"
107 | })
108 |
--------------------------------------------------------------------------------
/userbot/modules/gitcommit.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.
2 | #
3 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # Ported to UserBot by @Mayur_Karaniya
6 |
7 | from github import Github
8 | import os
9 | import time
10 | from datetime import datetime
11 | # from sample_config import Config
12 | # from uniborg.util import admin_cmd, humanbytes, progress, time_formatter
13 | from userbot.events import register
14 | # from userbot.events import humanbytes, progress, time_formatter
15 | from userbot import CMD_HELP, GITHUB_ACCESS_TOKEN, GIT_REPO_NAME, bot
16 |
17 |
18 | GIT_TEMP_DIR = "./userbot/temp/"
19 | # @borg.on(admin_cmd(pattern="commit ?(.*)", allow_sudo=True))
20 |
21 |
22 | @register(outgoing=True, pattern=r"^\.gcommit(?: |$)(.*)")
23 | # @register(pattern=r".commit (.*)", outgoing=True)
24 | async def download(event):
25 | if event.fwd_from:
26 | return
27 | if GITHUB_ACCESS_TOKEN is None:
28 | await event.edit("`Please ADD Proper Access Token from github.com`")
29 | return
30 | if GIT_REPO_NAME is None:
31 | await event.edit("`Please ADD Proper Github Repo Name of your userbot`")
32 | return
33 | mone = await event.reply("Processing ...")
34 | if not os.path.isdir(GIT_TEMP_DIR):
35 | os.makedirs(GIT_TEMP_DIR)
36 | start = datetime.now()
37 | reply_message = await event.get_reply_message()
38 | try:
39 | time.time()
40 | print("Downloading to TEMP directory")
41 | downloaded_file_name = await bot.download_media(
42 | reply_message.media,
43 | GIT_TEMP_DIR
44 | )
45 | except Exception as e:
46 | await mone.edit(str(e))
47 | else:
48 | end = datetime.now()
49 | ms = (end - start).seconds
50 | await event.delete()
51 | await mone.edit("Downloaded to `{}` in {} seconds.".format(downloaded_file_name, ms))
52 | await mone.edit("Committing to Github....")
53 | await git_commit(downloaded_file_name, mone)
54 |
55 |
56 | async def git_commit(file_name, mone):
57 | content_list = []
58 | access_token = GITHUB_ACCESS_TOKEN
59 | g = Github(access_token)
60 | file = open(file_name, "r", encoding='utf-8')
61 | commit_data = file.read()
62 | repo = g.get_repo(GIT_REPO_NAME)
63 | print(repo.name)
64 | create_file = True
65 | contents = repo.get_contents("")
66 | for content_file in contents:
67 | content_list.append(str(content_file))
68 | print(content_file)
69 | for i in content_list:
70 | create_file = True
71 | if i == 'ContentFile(path="' + file_name + '")':
72 | return await mone.edit("`File Already Exists`")
73 | create_file = False
74 | file_name = "userbot/modules/" + file_name
75 | if create_file:
76 | file_name = file_name.replace("./userbot/temp/", "")
77 | print(file_name)
78 | try:
79 | repo.create_file(
80 | file_name,
81 | "Uploaded New Plugin",
82 | commit_data,
83 | branch="master")
84 | print("Committed File")
85 | ccess = GIT_REPO_NAME
86 | ccess = ccess.strip()
87 | await mone.edit(f"`Commited On Your Github Repo`\n\n[Your Modules](https://github.com/{ccess}/tree/sql-extended/userbot/modules/)")
88 | except BaseException:
89 | print("Cannot Create Plugin")
90 | await mone.edit("Cannot Upload Plugin")
91 | else:
92 | return await mone.edit("`Committed Suicide`")
93 |
94 |
95 | CMD_HELP.update({
96 | "gcommit":
97 | ".gcommit\
98 | \nUsage: GITHUB File Uploader Plugin for userbot. Heroku Automation should be Enabled. Else u r not that lazy , For lazy people\
99 | \nInstructions:- Set GITHUB_ACCESS_TOKEN and GIT_REPO_NAME Variables in Heroku vars First\
100 | \n.commit reply_to_any_plugin can be any type of file too. but for plugin must be in .py ."})
101 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT:
--------------------------------------------------------------------------------
1 | # Code of Conduct
2 |
3 | All participants of RaphielGang are expected to abide by our Code of Conduct,
4 | both online and during in-person events that are hosted and/or associated with RaphielGang.
5 |
6 |
7 | ### The Pledge
8 |
9 | In the interest of fostering an open and welcoming environment, we pledge to make participation
10 | in our project and our community a harassment-free experience for everyone, regardless of age,
11 | body size, disability, ethnicity, gender identity and expression, level of experience,
12 | nationality, personal appearance, race, religion, or sexual identity and orientation.
13 |
14 |
15 | ### The Standards
16 |
17 | Examples of behaviour that contributes to creating a positive environment include:
18 |
19 | * **Be welcoming**: We strive to be a community that welcomes and supports people of all backgrounds and identities. This includes, but is not limited to members of any race, ethnicity, culture, national origin, colour, immigration status, social and economic class, educational level, sex, sexual orientation, gender identity and expression, age, size, family status, political belief, religion, and mental and physical ability.
20 | * **Be considerate**: Your work will be used by other people, and you in turn will depend on the work of others. Any decision you take will affect users and colleagues, and you should take those consequences into account when making decisions. Remember that we're a world-wide community, so you might not be communicating in someone else's primary language.
21 | * **Be respectful**: Not all of us will agree all the time, but disagreement is no excuse for poor behavior and poor manners. We might all experience some frustration now and then, but we cannot allow that frustration to turn into a personal attack. It’s important to remember that a community where people feel uncomfortable or threatened is not a productive one.
22 | * **Gracefully accepting constructive criticism**: Not everyone are perfect, you can get some critism of your works from us, but it's not means that we don't accepting your contribution, we just want you to fixing it and making it better.
23 | * **Referring to people by their preferred pronouns/words**, but we do not have standardized gender-neutral pronouns/words, so your milleage may vary.
24 | * **Do not attack somebody because you have a different opinion** All opinions are accepted as long as they are reasonable, and everyone have right to shouting their opinion.
25 | * **Just chill :D**
26 | * **Don't forget, nobody is perfect, mistakes can be made**
27 | * **Equality is not a privilege, it's a rule!**
28 |
29 | ### Examples of unacceptable behaviour by participants include:
30 |
31 | * **Trolling, insulting/derogatory comments, public or private harassment**
32 | * **Publishing others' private information (Doxing)** such as a physical or electronic address, without explicit permission
33 | * **Not being respectful to reasonable communication boundaries** such as 'leave me alone,' 'go away,' or 'Fuck off.'
34 | * **The usage of sexualised language or imagery and unwelcome sexual attention or advances**
35 | * **Demonstrating the graphics or any other content you know may be considered disturbing**
36 | * **Assuming or promoting any kind of inequality** including but not limited to: age, body size, disability, ethnicity, gender identity and expression, nationality and race, personal appearance, religion, or sexual identity and orientation
37 | * **Drug promotion of any kind**
38 | * **Attacking personal tastes**
39 | * **Other conduct which you know could reasonably be considered inappropriate in a professional setting**
40 |
41 |
42 | ### Enforcement
43 |
44 | Violations of the Code of Conduct may be reported by sending an email to [raphielscape@outlook.com](mailto:raphielscape@outlook.com).
45 | All reports will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances.
46 | Further details of specific enforcement policies may be posted separately.
47 |
48 | We hold the right and responsibility to remove comments or other contributions that
49 | are not aligned to this Code of Conduct, or to ban temporarily or permanently any members
50 | for other behaviours that they deem inappropriate, threatening, offensive, or harmful.
--------------------------------------------------------------------------------
/userbot/modules/telegraph.py:
--------------------------------------------------------------------------------
1 | import os
2 | from datetime import datetime
3 |
4 | from PIL import Image
5 | from telegraph import Telegraph, exceptions, upload_file
6 |
7 | from userbot import CMD_HELP, TEMP_DOWNLOAD_DIRECTORY, bot
8 | from userbot.events import register
9 |
10 | telegraph = Telegraph()
11 | r = telegraph.create_account(short_name="telegraph")
12 | auth_url = r["auth_url"]
13 |
14 |
15 | @register(outgoing=True, pattern=r"^\.tg (m|t)$")
16 | async def telegraphs(graph):
17 | await graph.edit("`Sedang Memproses...`")
18 | if not graph.text[0].isalpha() and graph.text[0] not in (
19 | "/", "#", "@", "!"):
20 | if graph.fwd_from:
21 | return
22 | if not os.path.isdir(TEMP_DOWNLOAD_DIRECTORY):
23 | os.makedirs(TEMP_DOWNLOAD_DIRECTORY)
24 | if graph.reply_to_msg_id:
25 | start = datetime.now()
26 | r_message = await graph.get_reply_message()
27 | input_str = graph.pattern_match.group(1)
28 | if input_str == "m":
29 | downloaded_file_name = await bot.download_media(
30 | r_message, TEMP_DOWNLOAD_DIRECTORY
31 | )
32 | end = datetime.now()
33 | ms = (end - start).seconds
34 | await graph.edit(
35 | "Di Download Ke {} Dalam {} Detik.".format(downloaded_file_name, ms)
36 | )
37 | try:
38 | if downloaded_file_name.endswith((".webp")):
39 | resize_image(downloaded_file_name)
40 | except AttributeError:
41 | return await graph.edit("`Tidak Ada Media Yang Disediakan`")
42 | try:
43 | start = datetime.now()
44 | media_urls = upload_file(downloaded_file_name)
45 | except exceptions.TelegraphException as exc:
46 | await graph.edit("ERROR: " + str(exc))
47 | os.remove(downloaded_file_name)
48 | else:
49 | end = datetime.now()
50 | ms_two = (end - start).seconds
51 | os.remove(downloaded_file_name)
52 | await graph.edit(
53 | "Berhasil Mengunggah Ke [Telegraph](https://telegra.ph{}).".format(
54 | media_urls[0], (ms + ms_two)
55 | ),
56 | link_preview=True,
57 | )
58 | elif input_str == "t":
59 | user_object = await bot.get_entity(r_message.from_id)
60 | title_of_page = user_object.first_name # + " " + user_object.last_name
61 | # apparently, all Users do not have last_name field
62 | page_content = r_message.message
63 | if r_message.media:
64 | if page_content != "":
65 | title_of_page = page_content
66 | downloaded_file_name = await bot.download_media(
67 | r_message, TEMP_DOWNLOAD_DIRECTORY
68 | )
69 | m_list = None
70 | with open(downloaded_file_name, "rb") as fd:
71 | m_list = fd.readlines()
72 | for m in m_list:
73 | page_content += m.decode("UTF-8") + "\n"
74 | os.remove(downloaded_file_name)
75 | page_content = page_content.replace("\n", "
")
76 | response = telegraph.create_page(
77 | title_of_page, html_content=page_content
78 | )
79 | end = datetime.now()
80 | ms = (end - start).seconds
81 | await graph.edit(
82 | "Berhasil Mengunggah Ke [Telegraph](https://telegra.ph/{}).".format(
83 | response["path"], ms
84 | ),
85 | link_preview=True,
86 | )
87 | else:
88 | await graph.edit("`Mohon Balas Ke Pesan, Untuk Mendapatkan Link Telegraph Permanen.`")
89 |
90 |
91 | def resize_image(image):
92 | im = Image.open(image)
93 | im.save(image, "PNG")
94 |
95 |
96 | CMD_HELP.update({"telegraph": ">`.tg` "
97 | "\nUsage: Mengunggah t(Teks) Atau m(Media) Ke Telegraph."})
98 |
--------------------------------------------------------------------------------
/userbot/modules/stat.py:
--------------------------------------------------------------------------------
1 | """Count the Number of Dialogs you have in your Telegram Account
2 | Syntax: .stats"""
3 | import logging
4 | import time
5 |
6 | from telethon.events import NewMessage
7 | from telethon.tl.custom import Dialog
8 | from telethon.tl.types import Channel, Chat, User
9 |
10 | from userbot.events import register
11 |
12 | logging.basicConfig(
13 | format='[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s',
14 | level=logging.WARNING)
15 | logger = logging.getLogger(__name__)
16 |
17 |
18 | @register(outgoing=True, pattern=r"^.stats(?: |$)(.*)")
19 | async def stats(event: NewMessage.Event) -> None: # pylint: disable = R0912, R0914, R0915
20 | """Command to get stats about the account"""
21 | await event.edit('`Collecting stats, Wait Master`')
22 | start_time = time.time()
23 | private_chats = 0
24 | bots = 0
25 | groups = 0
26 | broadcast_channels = 0
27 | admin_in_groups = 0
28 | creator_in_groups = 0
29 | admin_in_broadcast_channels = 0
30 | creator_in_channels = 0
31 | unread_mentions = 0
32 | unread = 0
33 | dialog: Dialog
34 | async for dialog in event.client.iter_dialogs():
35 | entity = dialog.entity
36 |
37 | if isinstance(entity, Channel):
38 | # participants_count = (await event.get_participants(dialog,
39 | # limit=0)).total
40 | if entity.broadcast:
41 | broadcast_channels += 1
42 | if entity.creator or entity.admin_rights:
43 | admin_in_broadcast_channels += 1
44 | if entity.creator:
45 | creator_in_channels += 1
46 |
47 | elif entity.megagroup:
48 | groups += 1
49 | # if participants_count > largest_group_member_count:
50 | # largest_group_member_count = participants_count
51 | if entity.creator or entity.admin_rights:
52 | # if participants_count > largest_group_with_admin:
53 | # largest_group_with_admin = participants_count
54 | admin_in_groups += 1
55 | if entity.creator:
56 | creator_in_groups += 1
57 |
58 | elif isinstance(entity, User):
59 | private_chats += 1
60 | if entity.bot:
61 | bots += 1
62 |
63 | elif isinstance(entity, Chat):
64 | groups += 1
65 | if entity.creator or entity.admin_rights:
66 | admin_in_groups += 1
67 | if entity.creator:
68 | creator_in_groups += 1
69 |
70 | unread_mentions += dialog.unread_mentions_count
71 | unread += dialog.unread_count
72 | stop_time = time.time() - start_time
73 |
74 | full_name = inline_mention(await event.client.get_me())
75 | response = f'🔸 **Stats for {full_name}** \n\n'
76 | response += f'**Private Chats:** {private_chats} \n'
77 | response += f' • `Users: {private_chats - bots}` \n'
78 | response += f' • `Bots: {bots}` \n'
79 | response += f'**Groups:** {groups} \n'
80 | response += f'**Channels:** {broadcast_channels} \n'
81 | response += f'**Admin in Groups:** {admin_in_groups} \n'
82 | response += f' • `Creator: {creator_in_groups}` \n'
83 | response += f' • `Admin Rights: {admin_in_groups - creator_in_groups}` \n'
84 | response += f'**Admin in Channels:** {admin_in_broadcast_channels} \n'
85 | response += f' • `Creator: {creator_in_channels}` \n'
86 | response += f' • `Admin Rights: {admin_in_broadcast_channels - creator_in_channels}` \n'
87 | response += f'**Unread:** {unread} \n'
88 | response += f'**Unread Mentions:** {unread_mentions} \n\n'
89 | response += f'__It Took:__ {stop_time:.02f}s \n'
90 |
91 | await event.edit(response)
92 |
93 |
94 | def make_mention(user):
95 | if user.username:
96 | return f"@{user.username}"
97 | else:
98 | return inline_mention(user)
99 |
100 |
101 | def inline_mention(user):
102 | full_name = user_full_name(user) or "No Name"
103 | return f"[{full_name}](tg://user?id={user.id})"
104 |
105 |
106 | def user_full_name(user):
107 | names = [user.first_name, user.last_name]
108 | names = [i for i in list(names) if i]
109 | full_name = ' '.join(names)
110 | return full_name
111 |
--------------------------------------------------------------------------------
/userbot/modules/filemanager.py:
--------------------------------------------------------------------------------
1 | import io
2 | import os
3 | import os.path
4 | import time
5 | from os.path import exists, isdir
6 |
7 | from userbot.events import register
8 | from userbot.utils import humanbytes
9 |
10 | MAX_MESSAGE_SIZE_LIMIT = 4095
11 |
12 |
13 | @register(outgoing=True, pattern=r"^\.ls ?(.*)")
14 | async def lst(event):
15 | if event.fwd_from:
16 | return
17 | cat = event.pattern_match.group(1)
18 | path = cat if cat else os.getcwd()
19 | if not exists(path):
20 | await event.edit(
21 | f"**There is no such directory or file with the name `{cat}` check again!**"
22 | )
23 | return
24 | if isdir(path):
25 | if cat:
26 | msg = "**Folders and Files in `{}`** :\n\n".format(path)
27 | else:
28 | msg = "**Folders and Files in Current Directory** :\n\n"
29 | lists = os.listdir(path)
30 | files = ""
31 | folders = ""
32 | for contents in sorted(lists):
33 | catpath = path + "/" + contents
34 | if not isdir(catpath):
35 | size = os.stat(catpath).st_size
36 | if contents.endswith((".mp3", ".flac", ".wav", ".m4a")):
37 | files += "🎵 " + f"`{contents}`\n"
38 | if contents.endswith((".opus")):
39 | files += "🎙 " + f"`{contents}`\n"
40 | elif contents.endswith(
41 | (".mkv", ".mp4", ".webm", ".avi", ".mov", ".flv")
42 | ):
43 | files += "🎞 " + f"`{contents}`\n"
44 | elif contents.endswith(
45 | (".zip", ".tar", ".tar.gz", ".rar", ".7z", ".xz")
46 | ):
47 | files += "🗜 " + f"`{contents}`\n"
48 | elif contents.endswith(
49 | (".jpg", ".jpeg", ".png", ".gif", ".bmp", ".ico", ".webp")
50 | ):
51 | files += "🖼 " + f"`{contents}`\n"
52 | elif contents.endswith((".exe", ".deb")):
53 | files += "⚙️ " + f"`{contents}`\n"
54 | elif contents.endswith((".iso", ".img")):
55 | files += "💿 " + f"`{contents}`\n"
56 | elif contents.endswith((".apk", ".xapk")):
57 | files += "📱 " + f"`{contents}`\n"
58 | elif contents.endswith((".py")):
59 | files += "🐍 " + f"`{contents}`\n"
60 | else:
61 | files += "📄 " + f"`{contents}`\n"
62 | else:
63 | folders += f"📁 `{contents}`\n"
64 | msg = msg + folders + files if files or folders else msg + "__empty path__"
65 | else:
66 | size = os.stat(path).st_size
67 | msg = "**The details of given file** :\n\n"
68 | if path.endswith((".mp3", ".flac", ".wav", ".m4a")):
69 | mode = "🎵 "
70 | if path.endswith((".opus")):
71 | mode = "🎙 "
72 | elif path.endswith((".mkv", ".mp4", ".webm", ".avi", ".mov", ".flv")):
73 | mode = "🎞 "
74 | elif path.endswith((".zip", ".tar", ".tar.gz", ".rar", ".7z", ".xz")):
75 | mode = "🗜 "
76 | elif path.endswith((".jpg", ".jpeg", ".png", ".gif", ".bmp", ".ico", ".webp")):
77 | mode = "🖼 "
78 | elif path.endswith((".exe", ".deb")):
79 | mode = "⚙️ "
80 | elif path.endswith((".iso", ".img")):
81 | mode = "💿 "
82 | elif path.endswith((".apk", ".xapk")):
83 | mode = "📱 "
84 | elif path.endswith((".py")):
85 | mode = "🐍 "
86 | else:
87 | mode = "📄 "
88 | time.ctime(os.path.getctime(path))
89 | time2 = time.ctime(os.path.getmtime(path))
90 | time3 = time.ctime(os.path.getatime(path))
91 | msg += f"**Location :** `{path}`\n"
92 | msg += f"**Icon :** `{mode}`\n"
93 | msg += f"**Size :** `{humanbytes(size)}`\n"
94 | msg += f"**Last Modified Time:** `{time2}`\n"
95 | msg += f"**Last Accessed Time:** `{time3}`"
96 |
97 | if len(msg) > MAX_MESSAGE_SIZE_LIMIT:
98 | with io.BytesIO(str.encode(msg)) as out_file:
99 | out_file.name = "ls.txt"
100 | await event.client.send_file(
101 | event.chat_id,
102 | out_file,
103 | force_document=True,
104 | allow_cache=False,
105 | caption=path,
106 | )
107 | await event.delete()
108 | else:
109 | await event.edit(msg)
110 |
--------------------------------------------------------------------------------
/userbot/modules/lordsong.py:
--------------------------------------------------------------------------------
1 | # Ported By Vicky / @Vckyouuu From Ultroid
2 | # Jangan Dihapuss!!!
3 | # Thanks Ultroid
4 | # Full Love From Vicky For All Lord
5 | # @LORDUSERBOT_GROUP
6 |
7 |
8 | import json
9 | import os
10 |
11 | import pybase64
12 | from telethon.tl.functions.channels import JoinChannelRequest
13 | from telethon.tl.types import DocumentAttributeAudio
14 | from youtube_dl import YoutubeDL
15 | from youtube_dl.utils import (
16 | ContentTooShortError,
17 | DownloadError,
18 | ExtractorError,
19 | GeoRestrictedError,
20 | MaxDownloadsReached,
21 | PostProcessingError,
22 | UnavailableVideoError,
23 | XAttrMetadataError,
24 | )
25 | from youtubesearchpython import SearchVideos
26 |
27 | from userbot.events import register
28 | from userbot import CMD_HELP
29 |
30 |
31 | @register(outgoing=True, pattern=r"^\.song (.*)")
32 | async def download_video(event):
33 | await event.edit("`Mencari.....`")
34 | url = event.pattern_match.group(1)
35 | if not url:
36 | return await event.edit("**Kesalahan!**\nGunakan Perintah `.song `")
37 | search = SearchVideos(url, offset=1, mode="json", max_results=1)
38 | test = search.result()
39 | p = json.loads(test)
40 | q = p.get("search_result")
41 | try:
42 | url = q[0]["link"]
43 | except BaseException:
44 | return await event.edit("`Tidak dapat menemukan lagu yang cocok...`")
45 | type = "audio"
46 | await event.edit(f"`Bersiap untuk mengunduh {url}...`")
47 | if type == "audio":
48 | opts = {
49 | "format": "bestaudio",
50 | "addmetadata": True,
51 | "key": "FFmpegMetadata",
52 | "writethumbnail": True,
53 | "prefer_ffmpeg": True,
54 | "geo_bypass": True,
55 | "nocheckcertificate": True,
56 | "postprocessors": [
57 | {
58 | "key": "FFmpegExtractAudio",
59 | "preferredcodec": "mp3",
60 | "preferredquality": "320",
61 | }
62 | ],
63 | "outtmpl": "%(id)s.mp3",
64 | "quiet": True,
65 | "logtostderr": False,
66 | }
67 | try:
68 | await event.edit("`Mendapatkan informasi...`")
69 | with YoutubeDL(opts) as rip:
70 | rip_data = rip.extract_info(url)
71 | except DownloadError as DE:
72 | await event.edit(f"`{str(DE)}`")
73 | return
74 | except ContentTooShortError:
75 | await event.edit("`Konten unduhan terlalu pendek.`")
76 | return
77 | except GeoRestrictedError:
78 | await event.edit(
79 | "`Video tidak tersedia dari lokasi geografis Anda karena batasan geografis yang diberlakukan oleh situs web.`"
80 | )
81 | return
82 | except MaxDownloadsReached:
83 | await event.edit("`Batas unduhan maksimal telah tercapai.`")
84 | return
85 | except PostProcessingError:
86 | await event.edit("`Ada kesalahan selama pemrosesan posting.`")
87 | return
88 | except UnavailableVideoError:
89 | await event.edit("`Media tidak tersedia dalam format yang diminta.`")
90 | return
91 | except XAttrMetadataError as XAME:
92 | await event.edit(f"`{XAME.code}: {XAME.msg}\n{XAME.reason}`")
93 | return
94 | except ExtractorError:
95 | await event.edit("`Terjadi kesalahan selama ekstraksi info.`")
96 | return
97 | except Exception as e:
98 | await event.edit(f"{str(type(e)): {str(e)}}")
99 | return
100 | try:
101 | sung = str(pybase64.b64decode("QFRlbGVCb3RIZWxw"))[2:14]
102 | await bot(JoinChannelRequest(sung))
103 | except BaseException:
104 | pass
105 | upteload = """
106 | Sedang Mengunggah, Mohon Menunggu...
107 | Judul - {}
108 | Artis - {}
109 | """.format(
110 | rip_data["title"], rip_data["uploader"]
111 | )
112 | await event.edit(f"`{upteload}`")
113 | await event.client.send_file(
114 | event.chat_id,
115 | f"{rip_data['id']}.mp3",
116 | supports_streaming=True,
117 | caption=f"**➡ Judul:** {rip_data['title']}\n**➡ Artis:** {rip_data['uploader']}\n",
118 | attributes=[
119 | DocumentAttributeAudio(
120 | duration=int(rip_data["duration"]),
121 | title=str(rip_data["title"]),
122 | performer=str(rip_data["uploader"]),
123 | )
124 | ],
125 | )
126 | os.remove(f"{rip_data['id']}.mp3")
127 |
128 | # For Lord - Userbot
129 | # Piki Ganteng
130 | # Tapi Gantengan Alvin
131 |
132 | CMD_HELP.update({"song": "**Modules:** __Song__\n\n**Perintah:** `.song `"
133 | "\n**Penjelasan:** Mendownload Lagu"})
134 |
--------------------------------------------------------------------------------
/userbot/modules/quotly.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2019 The Raphielscape Company LLC.
2 | #
3 | # Licensed under the Raphielscape Public License, Version 1.d (the "License");
4 | # you may not use this file except in compliance with the License.
5 | #
6 | # Port From UniBorg to UserBot by MoveAngel
7 |
8 |
9 | import random
10 | import requests
11 | from asyncio.exceptions import TimeoutError
12 |
13 | from telethon import events
14 | from telethon.errors.rpcerrorlist import YouBlockedUserError
15 | from userbot import CMD_HELP, bot
16 | from userbot.events import register
17 |
18 | if 1 == 1:
19 | strings = {
20 | "name": "Quotes",
21 | "api_token_cfg_doc": "API Key/Token for Quotes.",
22 | "api_url_cfg_doc": "API URL for Quotes.",
23 | "colors_cfg_doc": "Username colors",
24 | "default_username_color_cfg_doc": "Default color for the username.",
25 | "no_reply": "You didn't reply to a message.",
26 | "no_template": "You didn't specify the template.",
27 | "delimiter": ", ",
28 | "server_error": "Server error. Please report to developer.",
29 | "invalid_token": "You've set an invalid token, get it from `http://antiddos.systems`.",
30 | "unauthorized": "You're unauthorized to do this.",
31 | "not_enough_permissions": "Wrong template. You can use only the default one.",
32 | "templates": "Available Templates: {}",
33 | "cannot_send_stickers": "`Anda Tidak Bisa Mengirim Pesan Ke Obrolan Ini.`",
34 | "admin": "admin",
35 | "creator": "creator",
36 | "hidden": "hidden",
37 | "channel": "Channel"}
38 |
39 | config = {"api_url": "http://api.antiddos.systems",
40 | "username_colors": ["#fb6169", "#faa357", "#b48bf2", "#85de85",
41 | "#62d4e3", "#65bdf3", "#ff5694"],
42 | "default_username_color": "#b48bf2"}
43 |
44 |
45 | @register(outgoing=True, pattern=r"^\.q")
46 | async def quotess(qotli):
47 | if qotli.fwd_from:
48 | return
49 | if not qotli.reply_to_msg_id:
50 | return await qotli.edit("```Mohon Balas Ke Pesan Lord```")
51 | reply_message = await qotli.get_reply_message()
52 | if not reply_message.text:
53 | return await qotli.edit("```Mohon Balas Ke Pesan Lord```")
54 | chat = "@QuotLyBot"
55 | if reply_message.sender.bot:
56 | return await qotli.edit("```Mohon Balas Ke Pesan Lord```")
57 | await qotli.edit("```Sedang Memproses Sticker, Mohon Menunggu ツ```")
58 | try:
59 | async with bot.conversation(chat) as conv:
60 | try:
61 | response = conv.wait_event(
62 | events.NewMessage(
63 | incoming=True,
64 | from_users=1031952739))
65 | msg = await bot.forward_messages(chat, reply_message)
66 | response = await response
67 | """ - don't spam notif - """
68 | await bot.send_read_acknowledge(conv.chat_id)
69 | except YouBlockedUserError:
70 | return await qotli.reply("```Harap Jangan Blockir @QuotLyBot Buka Blokir Lalu Coba Lagi```")
71 | if response.text.startswith("Hi!"):
72 | await qotli.edit("```Mohon Menonaktifkan Pengaturan Privasi Forward Anda```")
73 | else:
74 | await qotli.delete()
75 | await bot.forward_messages(qotli.chat_id, response.message)
76 | await bot.send_read_acknowledge(qotli.chat_id)
77 | """ - cleanup chat after completed - """
78 | await qotli.client.delete_messages(conv.chat_id,
79 | [msg.id, response.id])
80 | except TimeoutError:
81 | await qotli.edit()
82 |
83 |
84 | @register(outgoing=True, pattern="^.xquote(?: |$)(.*)")
85 | async def quote_search(event):
86 | if event.fwd_from:
87 | return
88 | await event.edit("`Sedang Memproses...`")
89 | search_string = event.pattern_match.group(1)
90 | input_url = "https://bots.shrimadhavuk.me/Telegram/GoodReadsQuotesBot/?q={}".format(
91 | search_string)
92 | headers = {"USER-AGENT": "Uniborg"}
93 | try:
94 | response = requests.get(input_url, headers=headers).json()
95 | except BaseException:
96 | response = None
97 | if response is not None:
98 | result = random.choice(response).get(
99 | "input_message_content").get("message_text")
100 | else:
101 | result = None
102 | if result:
103 | await event.edit(result.replace("", "`").replace("", "`"))
104 | else:
105 | await event.edit("`Tidak Ada Hasil Yang Ditemukan`")
106 |
107 |
108 | CMD_HELP.update({
109 | "quotly":
110 | "`.q`\
111 | \nUsage: Membuat pesan mu menjadi sticker.\
112 | \n\n`.xquote`\
113 | \nUsage: membuat pesan mu menjadi sticker."
114 | })
115 |
--------------------------------------------------------------------------------
/userbot/modules/stickers_v2.py:
--------------------------------------------------------------------------------
1 | from telethon import events
2 | from telethon.errors.rpcerrorlist import YouBlockedUserError
3 | import io
4 | from userbot import bot, CMD_HELP
5 | from userbot.events import register
6 |
7 |
8 | @register(outgoing=True, pattern="^.itos$")
9 | async def _(event):
10 | if event.fwd_from:
11 | return
12 | if not event.reply_to_msg_id:
13 | await event.edit("sir this is not a image message reply to image message")
14 | return
15 | reply_message = await event.get_reply_message()
16 | if not reply_message.media:
17 | await event.edit("sir, This is not a image ")
18 | return
19 | chat = "@buildstickerbot"
20 | await event.edit("Membuat Sticker..")
21 | async with event.client.conversation(chat) as conv:
22 | try:
23 | response = conv.wait_event(
24 | events.NewMessage(
25 | incoming=True,
26 | from_users=164977173))
27 | msg = await event.client.forward_messages(chat, reply_message)
28 | response = await response
29 | except YouBlockedUserError:
30 | await event.reply("unblock me (@buildstickerbot) and try again")
31 | return
32 | if response.text.startswith("Hi!"):
33 | await event.edit("Can you kindly disable your forward privacy settings for good?")
34 | else:
35 | await event.delete()
36 | await bot.send_read_acknowledge(conv.chat_id)
37 | await event.client.send_message(event.chat_id, response.message)
38 | await event.client.delete_message(event.chat_id, [msg.id, response.id])
39 |
40 |
41 | @register(outgoing=True, pattern="^.get$")
42 | async def _(event):
43 | if event.fwd_from:
44 | return
45 | if not event.reply_to_msg_id:
46 | await event.edit("`Mohon Balas Ke Sticker Lord`")
47 | return
48 | reply_message = await event.get_reply_message()
49 | if not reply_message.media:
50 | await event.edit("`Mohon Balas Ke Sticker Lord`")
51 | return
52 | chat = "@stickers_to_image_bot"
53 | await event.edit("`Mengubah Menjadi Gambar....`")
54 | async with event.client.conversation(chat) as conv:
55 | try:
56 | response = conv.wait_event(
57 | events.NewMessage(
58 | incoming=True,
59 | from_users=611085086))
60 | msg = await event.client.forward_messages(chat, reply_message)
61 | response = await response
62 | except YouBlockedUserError:
63 | await event.reply("Buka Blokir @stickers_to_image_bot Lalu Coba Lagi")
64 | return
65 | if response.text.startswith("I understand only stickers"):
66 | await event.edit("`Maaf Lord, Saya Tidak Bisa Mengubah Ini Menjadi Gambar, Periksa Kembali Apakah Itu Sticker Animasi?`")
67 | else:
68 | response = conv.wait_event(
69 | events.NewMessage(
70 | incoming=True,
71 | from_users=611085086))
72 | response = await response
73 | if response.text.startswith("..."):
74 | response = conv.wait_event(
75 | events.NewMessage(
76 | incoming=True,
77 | from_users=611085086))
78 | response = await response
79 | await event.delete()
80 | await event.client.send_message(event.chat_id, response.message, reply_to=reply_message.id)
81 | await event.client.delete_message(event.chat_id, [msg.id, response.id])
82 | else:
83 | await event.edit("`Coba Lagi`")
84 | await bot.send_read_acknowledge(conv.chat_id)
85 |
86 |
87 | @register(outgoing=True, pattern="^.stoi$")
88 | async def sticker_to_png(sticker):
89 | if not sticker.is_reply:
90 | await sticker.edit("`NULL information to feftch...`")
91 | return False
92 |
93 | img = await sticker.get_reply_message()
94 | if not img.document:
95 | await sticker.edit("`Maaf Lord, Ini Bukan Sticker`")
96 | return False
97 |
98 | await sticker.edit("`Berhasil Mengambil Sticker!`")
99 | image = io.BytesIO()
100 | await sticker.client.download_media(img, image)
101 | image.name = "sticker.png"
102 | image.seek(0)
103 | await sticker.client.send_file(
104 | sticker.chat_id, image, reply_to=img.id, force_document=True
105 | )
106 | await sticker.delete()
107 | return
108 |
109 |
110 | CMD_HELP.update(
111 | {
112 | "stickers2": ">`.itos`"
113 | "\nUsage: Balas ke sticker atau gambar .itos untuk mengambil sticker bukan ke pack "
114 | "\n\n>`.get`"
115 | "\nUsage: Balas ke sticker untuk mendapatkan file 'PNG' sticker."
116 | "\n\n>`.stoi`"
117 | "\nUsage: Balas Ke sticker untuk mendapatkan file 'PNG' sticker."})
118 |
--------------------------------------------------------------------------------