├── resources ├── __init__.py ├── fonts │ └── __init__.py ├── rrc.png ├── black.png ├── hejo.png ├── assfont.ttf ├── extras │ ├── 1.ttf │ ├── 2.ttf │ ├── 3.ttf │ ├── 4.ttf │ ├── 5.ttf │ ├── 6.ttf │ ├── 7.ttf │ ├── 8.ttf │ ├── 9.ttf │ ├── 10.ttf │ ├── 11.otf │ ├── 12.otf │ ├── 1646180477-picsa.jpg │ └── IMG_20211216_160240_756.jpg ├── kertas.jpg ├── sky_blank.png ├── Roboto-Light.ttf ├── Roboto-Medium.ttf ├── thumb5029102919.png ├── ezgif-1-47328533dd.gif └── lv_0_20220507233314.mp4 ├── userbot ├── files │ ├── font.otf │ └── RobotoMono-Regular.ttf ├── modules │ ├── .bin │ │ └── readme.md │ ├── sql_helper │ │ ├── __init__.py │ │ ├── keep_read_sql.py │ │ ├── gmute_sql.py │ │ ├── no_log_pms_sql.py │ │ ├── mute_sql.py │ │ ├── fban_sql.py │ │ ├── spam_mute_sql.py │ │ ├── pm_permit_sql.py │ │ ├── tede_chatbot_sql.py │ │ ├── gban_sql.py │ │ ├── globals.py │ │ ├── google_drive_sql.py │ │ ├── snips.py │ │ ├── lydia_sql.py │ │ ├── notes_sql.py │ │ ├── bot_starters.py │ │ ├── filter_sql.py │ │ ├── welcome_sql.py │ │ ├── bot_blacklists.py │ │ ├── locks_sql.py │ │ └── antiflood_sql.py │ ├── __init__.py │ ├── aesthetic.py │ ├── total_message.py │ ├── allunban.py │ ├── surat.py │ ├── xahelper.py │ ├── grouplink.py │ ├── direct_message.py │ ├── limited.py │ ├── dbs.py │ ├── resi.py │ ├── hentai.py │ ├── salam.py │ ├── gps.py │ ├── inlineon.py │ ├── image.py │ ├── tempmail.py │ ├── cping.py │ ├── xgban.py │ ├── gabut2.py │ ├── nulis.py │ ├── gid.py │ ├── fakeaddress.py │ ├── tiktok.py │ ├── games.py │ ├── get_user_id.py │ ├── bitly.py │ ├── logo.py │ ├── carikata.py │ ├── honkasays.py │ ├── buatbot.py │ ├── stickertext.py │ ├── animasi6.py │ ├── deteksigrub.py │ ├── meadmin.py │ ├── mentions.py │ ├── adzan.py │ ├── __help.py │ ├── rgif.py │ ├── button.py │ ├── webupload.py │ ├── specialtools.py │ ├── spotifynow.py │ ├── saver.py │ ├── shazam.py │ ├── gban_bot.py │ ├── lyrics.py │ ├── wallpaper.py │ ├── antiflood.py │ ├── chatbot.py │ ├── sangmata.py │ ├── ss_video.py │ ├── detection.py │ ├── pdf.py │ ├── animasi10.py │ ├── coolprofilepics.py │ ├── create.py │ ├── truth_dare.py │ ├── wibu2.py │ ├── core.py │ ├── asupan.py │ ├── tiny.py │ ├── hash.py │ ├── fakegban.py │ ├── tags.py │ ├── covid.py │ ├── github.py │ └── scraper.py ├── utils │ ├── queues │ │ ├── __init__.py │ │ └── queues.py │ ├── styles │ │ └── KyyFont.otf │ ├── logger.py │ ├── converter │ │ ├── __init__.py │ │ └── converter.py │ ├── start.py │ ├── exceptions.py │ ├── __init__.py │ ├── chrome.py │ ├── thumbnail.py │ └── events.py ├── core │ └── logger.py ├── storage.py └── __main__.py ├── Procfile ├── heroku.yml ├── Procfile.txt ├── .deepsource.toml ├── .github ├── ISSUE_TEMPLATE │ ├── custom.md │ └── bug_report.md ├── FUNDING.yml └── workflows │ ├── python-app.yml │ ├── pylint.yml │ └── main.yml ├── init ├── start.sh ├── userbot ├── Merge.sh ├── CI_Test_Script.sh └── telegram ├── .gitignore ├── Dockerfile ├── sample_config.env ├── string_session.py ├── requirements.txt ├── app.json ├── README.md └── varshelper.txt /resources/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/fonts/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /userbot/files/font.otf: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/rrc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/resources/rrc.png -------------------------------------------------------------------------------- /resources/black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/resources/black.png -------------------------------------------------------------------------------- /resources/hejo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/resources/hejo.png -------------------------------------------------------------------------------- /userbot/modules/.bin/readme.md: -------------------------------------------------------------------------------- 1 | /bin/sh -c curl https://cli-assets.heroku.com/install.sh 2 | -------------------------------------------------------------------------------- /resources/assfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/resources/assfont.ttf -------------------------------------------------------------------------------- /resources/extras/1.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/resources/extras/1.ttf -------------------------------------------------------------------------------- /resources/extras/2.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/resources/extras/2.ttf -------------------------------------------------------------------------------- /resources/extras/3.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/resources/extras/3.ttf -------------------------------------------------------------------------------- /resources/extras/4.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/resources/extras/4.ttf -------------------------------------------------------------------------------- /resources/extras/5.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/resources/extras/5.ttf -------------------------------------------------------------------------------- /resources/extras/6.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/resources/extras/6.ttf -------------------------------------------------------------------------------- /resources/extras/7.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/resources/extras/7.ttf -------------------------------------------------------------------------------- /resources/extras/8.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/resources/extras/8.ttf -------------------------------------------------------------------------------- /resources/extras/9.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/resources/extras/9.ttf -------------------------------------------------------------------------------- /resources/kertas.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/resources/kertas.jpg -------------------------------------------------------------------------------- /resources/extras/10.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/resources/extras/10.ttf -------------------------------------------------------------------------------- /resources/extras/11.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/resources/extras/11.otf -------------------------------------------------------------------------------- /resources/extras/12.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/resources/extras/12.otf -------------------------------------------------------------------------------- /resources/sky_blank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/resources/sky_blank.png -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | build: 2 | docker: 3 | worker: Dockerfile 4 | run: 5 | worker: python3 -m userbot 6 | -------------------------------------------------------------------------------- /heroku.yml: -------------------------------------------------------------------------------- 1 | build: 2 | docker: 3 | worker: Dockerfile 4 | run: 5 | worker: python3 -m userbot 6 | -------------------------------------------------------------------------------- /resources/Roboto-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/resources/Roboto-Light.ttf -------------------------------------------------------------------------------- /resources/Roboto-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/resources/Roboto-Medium.ttf -------------------------------------------------------------------------------- /userbot/utils/queues/__init__.py: -------------------------------------------------------------------------------- 1 | from .queues import add_to_queue, clear_queue, get_queue, pop_an_item 2 | -------------------------------------------------------------------------------- /Procfile.txt: -------------------------------------------------------------------------------- 1 | build: 2 | docker: 3 | worker: Dockerfile 4 | run: 5 | worker: python3 -m userbot 6 | -------------------------------------------------------------------------------- /resources/thumb5029102919.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/resources/thumb5029102919.png -------------------------------------------------------------------------------- /resources/ezgif-1-47328533dd.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/resources/ezgif-1-47328533dd.gif -------------------------------------------------------------------------------- /userbot/utils/styles/KyyFont.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/userbot/utils/styles/KyyFont.otf -------------------------------------------------------------------------------- /resources/lv_0_20220507233314.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/resources/lv_0_20220507233314.mp4 -------------------------------------------------------------------------------- /resources/extras/1646180477-picsa.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/resources/extras/1646180477-picsa.jpg -------------------------------------------------------------------------------- /userbot/files/RobotoMono-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/userbot/files/RobotoMono-Regular.ttf -------------------------------------------------------------------------------- /resources/extras/IMG_20211216_160240_756.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rexashh/Xa-Userbot/HEAD/resources/extras/IMG_20211216_160240_756.jpg -------------------------------------------------------------------------------- /.deepsource.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [[analyzers]] 4 | name = "python" 5 | enabled = true 6 | 7 | [analyzers.meta] 8 | runtime_version = "3.x.x" 9 | -------------------------------------------------------------------------------- /userbot/utils/logger.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | logging.basicConfig( 4 | format="[%(name)s] - [%(levelname)s] - %(message)s", 5 | level=logging.INFO, 6 | ) 7 | -------------------------------------------------------------------------------- /userbot/utils/converter/__init__.py: -------------------------------------------------------------------------------- 1 | from os import listdir, mkdir 2 | 3 | if "raw_files" not in listdir(): 4 | mkdir("raw_files") 5 | 6 | from .converter import convert 7 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/custom.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Custom issue template 3 | about: Describe this issue template's purpose here. 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | -------------------------------------------------------------------------------- /userbot/core/logger.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | logging.basicConfig( 4 | format="[%(levelname)s- %(asctime)s]- %(name)s- %(message)s", 5 | level=logging.INFO, 6 | datefmt="%H:%M:%S", 7 | ) 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.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 | /*.mp4 11 | /*.jpg 12 | /*.png 13 | .vscode/* 14 | bin/* 15 | TG_BOT_TOKEN.session 16 | *.mp3 17 | *.mp4 18 | *.webm 19 | *.mkv 20 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [adekmaulana] # 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 | -------------------------------------------------------------------------------- /userbot/modules/__init__.py: -------------------------------------------------------------------------------- 1 | """ Init file which loads all of the modules """ 2 | from userbot import LOGS 3 | 4 | 5 | def __list_all_modules(): 6 | from os.path import dirname, basename, isfile 7 | import glob 8 | 9 | mod_paths = glob.glob(dirname(__file__) + "/*.py") 10 | all_modules = [ 11 | basename(f)[:-3] for f in mod_paths 12 | if isfile(f) and f.endswith(".py") and not f.endswith("__init__.py") 13 | ] 14 | return all_modules 15 | 16 | 17 | ALL_MODULES = sorted(__list_all_modules()) 18 | LOGS.info("Modules to load: %s", str(ALL_MODULES)) 19 | __all__ = ALL_MODULES + ["ALL_MODULES"] 20 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Using Python Slim-Buster 2 | FROM kyyex/kyy-userbot:busterv2 3 | #━━━━━ XaUserbot ━━━━━ 4 | 5 | RUN apt-get update && apt-get upgrade -y 6 | RUN apt-get install ffmpeg -y 7 | RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && \ 8 | apt-get install -y nodejs && \ 9 | npm i -g npm 10 | 11 | RUN git clone -b Xa-Userbot https://github.com/Rexashh/Xa-Userbot /root/userbot 12 | RUN mkdir /root/userbot/.bin 13 | RUN pip install --upgrade pip setuptools 14 | WORKDIR /root/userbot 15 | 16 | #Install python requirements 17 | RUN pip3 install -r https://raw.githubusercontent.com/Rexashh/Xa-Userbot/Xa-Userbot/requirements.txt 18 | 19 | EXPOSE 80 443 20 | 21 | # Finalization 22 | CMD ["python3", "-m", "userbot"] 23 | -------------------------------------------------------------------------------- /userbot/utils/start.py: -------------------------------------------------------------------------------- 1 | from telethon import Button 2 | 3 | from userbot import BOTLOG, BOTLOG_CHATID, LOGS, tgbot 4 | 5 | 6 | async def startupmessage(): 7 | """ 8 | Start up message in telegram logger group 9 | """ 10 | try: 11 | if BOTLOG: 12 | await tgbot.send_file( 13 | BOTLOG_CHATID, 14 | "https://telegra.ph/file/9b010ead0692e3bc28df6.jpg", 15 | caption="🦖 **Xa Userbot Has Been Actived**!!\n━━━━━━━━━━━━━\n⌬ **Userbot Version** - 8.0@Xa-Userbot\n━━━━━━━━━━━━━\n⌬ **Powered By:** @tirexgugel ", 16 | buttons=[(Button.url("ꜱᴜᴘᴘᴏʀᴛ", "https://t.me/tirexgugel"),)], 17 | ) 18 | except Exception as e: 19 | LOGS.error(e) 20 | return None 21 | -------------------------------------------------------------------------------- /userbot/utils/queues/queues.py: -------------------------------------------------------------------------------- 1 | QUEUE = {} 2 | 3 | 4 | def add_to_queue(chat_id, songname, link, ref, type, quality): 5 | if chat_id in QUEUE: 6 | chat_queue = QUEUE[chat_id] 7 | chat_queue.append([songname, link, ref, type, quality]) 8 | return int(len(chat_queue) - 1) 9 | QUEUE[chat_id] = [[songname, link, ref, type, quality]] 10 | 11 | 12 | def get_queue(chat_id): 13 | if chat_id in QUEUE: 14 | return QUEUE[chat_id] 15 | return 0 16 | 17 | 18 | def pop_an_item(chat_id): 19 | if chat_id not in QUEUE: 20 | return 0 21 | 22 | chat_queue = QUEUE[chat_id] 23 | chat_queue.pop(0) 24 | return 1 25 | 26 | 27 | def clear_queue(chat_id: int): 28 | if chat_id not in QUEUE: 29 | return 0 30 | 31 | QUEUE.pop(chat_id) 32 | return 1 33 | -------------------------------------------------------------------------------- /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/aesthetic.py: -------------------------------------------------------------------------------- 1 | from telethon import events 2 | from userbot.utils import Xa_cmd 3 | from userbot import CMD_HELP, CMD_HANDLER as cmd 4 | 5 | PRINTABLE_ASCII = range(0x21, 0x7F) 6 | 7 | 8 | def aesthetify(string): 9 | for c in string: 10 | c = ord(c) 11 | if c in PRINTABLE_ASCII: 12 | c += 0xFF00 - 0x20 13 | elif c == ord(" "): 14 | c = 0x3000 15 | yield chr(c) 16 | 17 | 18 | @Xa_cmd(pattern="ae(?: |$)(.*)") 19 | async def _(event): 20 | if event.fwd_from: 21 | return 22 | text = event.pattern_match.group(1) 23 | text = "".join(aesthetify(text)) 24 | await event.edit(text=text, parse_mode=None, link_preview=False) 25 | raise events.StopPropagation 26 | 27 | 28 | CMD_HELP.update({ 29 | "aeshtetic": 30 | f"𝙋𝙚𝙧𝙞𝙣𝙩𝙖𝙝`{cmd}ae `\ 31 | \n⌬ Mengubah fonts teks" 32 | }) 33 | -------------------------------------------------------------------------------- /userbot/utils/converter/converter.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from os import path 3 | 4 | from userbot.utils.exceptions import FFmpegReturnCodeError 5 | 6 | 7 | async def convert(file_path: str) -> str: 8 | out = path.join("raw_files", path.basename(file_path + ".raw")) 9 | if path.isfile(out): 10 | return out 11 | proc = await asyncio.create_subprocess_shell( 12 | cmd=( 13 | "ffmpeg " 14 | "-y -i " 15 | f"{file_path} " 16 | "-f s16le " 17 | "-ac 1 " 18 | "-ar 48000 " 19 | "-acodec pcm_s16le " 20 | f"{out}" 21 | ), 22 | stdin=asyncio.subprocess.PIPE, 23 | stderr=asyncio.subprocess.PIPE, 24 | ) 25 | await proc.communicate() 26 | if proc.returncode != 0: 27 | raise FFmpegReturnCodeError("FFmpeg did not return 0") 28 | return out 29 | -------------------------------------------------------------------------------- /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 | # Custom Default name for .alive 9 | ALIVE_NAME = None 10 | 11 | # Get this value by running python3 string_session.py locally 12 | STRING_SESSION = "" 13 | 14 | # Set this to enable inline bot helper. get the token from @BotFather 15 | BOT_TOKEN = "" 16 | BOT_USERNAME = "" 17 | 18 | # ChatID for the Log group 19 | # Add a Hypen or a Negative Sign before ID 20 | # This is a integer, Please don't use Strings 21 | BOTLOG_CHATID = # this is an integer, please don't use quotes. 22 | 23 | # Your Database URL 24 | # Example: 'postgres://userbot:userbot@localhost:5432/userbot' 25 | DATABASE_URL = "" 26 | 27 | # PM Auto-Ban Feature Switch 28 | PM_AUTO_BAN = False 29 | -------------------------------------------------------------------------------- /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/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/total_message.py: -------------------------------------------------------------------------------- 1 | from userbot.utils import Xa_cmd 2 | from userbot import CMD_HELP, bot, CMD_HANDLER as cmd 3 | 4 | 5 | # Port By @VckyouuBitch From GeezProject 6 | # Untuk Siapapun Yang Hapus Credits Ini, Kamu Anjing:) 7 | @Xa_cmd(pattern="tmsg (.*)") 8 | async def _(event): 9 | k = await event.get_reply_message() 10 | if k: 11 | a = await bot.get_messages(event.chat_id, 0, from_user=k.sender_id) 12 | return await event.edit(f"Total Message Dari {u}. Total Chats `{a.total}`") 13 | u = event.pattern_match.group(1) 14 | if not u: 15 | u = "me" 16 | a = await bot.get_messages(event.chat_id, 0, from_user=u) 17 | await event.edit(f"Total Message Dari {u}. Total Chats `{a.total}`") 18 | 19 | CMD_HELP.update( 20 | { 21 | "totalmsg": f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}tmsg` | `{cmd}tmsg` \ 22 | \n↳ : Mengembalikan jumlah pesan total pengguna dalam obrolan saat ini." 23 | } 24 | ) 25 | -------------------------------------------------------------------------------- /userbot/modules/sql_helper/no_log_pms_sql.py: -------------------------------------------------------------------------------- 1 | from sqlalchemy import Column, Numeric 2 | 3 | from userbot.modules.sql_helper import BASE, SESSION 4 | 5 | 6 | class NOLogPMs(BASE): 7 | __tablename__ = "no_log_pms" 8 | chat_id = Column(Numeric, primary_key=True) 9 | 10 | def __init__(self, chat_id, reason=""): 11 | self.chat_id = chat_id 12 | 13 | 14 | NOLogPMs.__table__.create(checkfirst=True) 15 | 16 | 17 | def is_approved(chat_id): 18 | try: 19 | return SESSION.query(NOLogPMs).filter( 20 | NOLogPMs.chat_id == chat_id).one() 21 | except BaseException: 22 | return None 23 | finally: 24 | SESSION.close() 25 | 26 | 27 | def approve(chat_id): 28 | adder = NOLogPMs(chat_id) 29 | SESSION.add(adder) 30 | SESSION.commit() 31 | 32 | 33 | def disapprove(chat_id): 34 | rem = SESSION.query(NOLogPMs).get(chat_id) 35 | if rem: 36 | SESSION.delete(rem) 37 | SESSION.commit() 38 | -------------------------------------------------------------------------------- /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 Geez-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 Geez-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 Geez-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: Geez-UserBot 25 | tg_sendinfo "I have merged all commits from staging into Geez-UserBot" 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /userbot/modules/allunban.py: -------------------------------------------------------------------------------- 1 | # Port By @VckyouuBitch From GeezProjects 2 | # Copyright © 2021 Geez-Projects 3 | from telethon.tl.types import ( 4 | ChannelParticipantsKicked, 5 | ) 6 | 7 | from userbot.utils import Xa_cmd 8 | from userbot import CMD_HELP, CMD_HANDLER as cmd 9 | 10 | 11 | @Xa_cmd(pattern="allunban(?: |$)(.*)") 12 | async def _(event): 13 | await event.edit("`Sedang Mencari List Banning.`") 14 | p = 0 15 | (await event.get_chat()).title 16 | async for i in event.client.iter_participants( 17 | event.chat_id, 18 | filter=ChannelParticipantsKicked, 19 | aggressive=True, 20 | ): 21 | try: 22 | await event.client.edit_permissions(event.chat_id, i, view_messages=True) 23 | p += 1 24 | except BaseException: 25 | pass 26 | await event.edit("`Sukses Menghapus List Banning`") 27 | 28 | 29 | CMD_HELP.update( 30 | { 31 | "allunban": f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}allunban`\ 32 | \n↳ : Membatalkan semua Ban Di Anggota Grup." 33 | } 34 | ) 35 | -------------------------------------------------------------------------------- /.github/workflows/python-app.yml: -------------------------------------------------------------------------------- 1 | #repoUserbot 2 | name: FailCheck 3 | 4 | on: [push, pull_request] 5 | 6 | jobs: 7 | build: 8 | 9 | runs-on: ubuntu-latest 10 | strategy: 11 | max-parallel: 5 12 | matrix: 13 | python-version: [3.9] 14 | 15 | steps: 16 | - uses: actions/checkout@v1 17 | - name: Set up Python ${{ matrix.python-version }} 18 | uses: actions/setup-python@v1 19 | with: 20 | python-version: ${{ matrix.python-version }} 21 | - name: Install dependencies 22 | run: | 23 | sudo apt-get install libpq-dev 24 | python -m pip install --upgrade pip 25 | pip install -r requirements.txt 26 | pip install flake8 flake8-print flake8-quotes 27 | - name: Check for showstoppers 28 | run: | 29 | flake8 . --count --select=E999 --show-source --statistics 30 | shellcheck: 31 | 32 | runs-on: ubuntu-latest 33 | 34 | steps: 35 | - uses: actions/checkout@v1 36 | - name: Check for install script errors 37 | uses: ludeeus/action-shellcheck@0.1.0 38 | -------------------------------------------------------------------------------- /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/surat.py: -------------------------------------------------------------------------------- 1 | from time import sleep 2 | 3 | from userbot import CMD_HELP, CMD_HANDLER as cmd 4 | from userbot.utils import Xa_cmd 5 | 6 | 7 | @Xa_cmd(pattern='alfatihah(?: |$)(.*)') 8 | async def typewriter(typew): 9 | typew.pattern_match.group(1) 10 | sleep(1) 11 | await typew.edit("**SURAT ALFATIHAH**") 12 | sleep(1) 13 | await typew.edit("**bismillāhir-raḥmānir-raḥīm**") 14 | sleep(1) 15 | await typew.edit("**al-ḥamdu lillāhi rabbil-'ālamīn**") 16 | sleep(1) 17 | await typew.edit("**ar-raḥmānir-raḥīm**") 18 | sleep(1) 19 | await typew.edit("**māliki yaumid-dīn**") 20 | sleep(1) 21 | await typew.edit("**iyyāka na'budu wa iyyāka nasta'īn**") 22 | sleep(1) 23 | await typew.edit("**ihdinaṣ-ṣirāṭal-mustaqīm**") 24 | sleep(1) 25 | await typew.edit("**ṣirāṭallażīna an'amta 'alaihim gairil-magḍụbi 'alaihim wa laḍ-ḍāllīn**") 26 | sleep(1) 27 | await typew.edit("**Amin..**") 28 | # Create by myself @localheart 29 | 30 | CMD_HELP.update({ 31 | "surat": 32 | f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}alfatihah`\ 33 | \n↳ : Surat Alfatihah." 34 | }) 35 | -------------------------------------------------------------------------------- /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/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/xahelper.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"**Halo {DEFAULTUSER} Jika Anda Tidak Tau Perintah Untuk Memerintah Ku Ketik** `.help` Atau Bisa Minta Bantuan Ke:\n" 15 | "\n[Telegram](t.me/JustRex)" 16 | "\n[Repo](https://github.com/S/Xa-Userbot)" 17 | "\n[Instagram](instagram.com/syhndr_)") 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/Rexashh/Xa-Userbot/Xa-Userbot/varshelper.txt)") 25 | 26 | 27 | CMD_HELP.update({ 28 | "helper": 29 | "`.lhelp`\ 30 | \nUsage: Bantuan Untuk Xa-Userbot.\ 31 | \n`.vars`\ 32 | \nUsage: Melihat Daftar Vars." 33 | }) 34 | -------------------------------------------------------------------------------- /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 | 41 | 42 | def get_all_approved(): 43 | rem = SESSION.query(PMPermit).all() 44 | SESSION.close() 45 | return rem 46 | -------------------------------------------------------------------------------- /.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 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: Rexashh 33 | commit_user_email: tirexijo@gmail.com 34 | commit_author: Rexashh 35 | -------------------------------------------------------------------------------- /userbot/modules/grouplink.py: -------------------------------------------------------------------------------- 1 | # port by KOALA 🐨 /@manusiarakitann 2 | 3 | from userbot.utils import Xa_cmd 4 | from userbot import CMD_HELP, CMD_HANDLER as cmd 5 | 6 | 7 | @Xa_cmd(pattern="gsend ?(.*)") 8 | async def remoteaccess(event): 9 | 10 | p = event.pattern_match.group(1) 11 | m = p.split(" ") 12 | 13 | chat_id = m[0] 14 | try: 15 | chat_id = int(chat_id) 16 | except BaseException: 17 | 18 | pass 19 | 20 | msg = "" 21 | mssg = await event.get_reply_message() 22 | if event.reply_to_msg_id: 23 | await event.client.send_message(chat_id, mssg) 24 | await event.edit("`Pesan Di Di Teruskan Ke Grup Tujuan`") 25 | for i in m[1:]: 26 | msg += i + " " 27 | if msg == "": 28 | return 29 | try: 30 | await event.client.send_message(chat_id, msg) 31 | await event.edit("Pesan Di Di Teruskan Ke Grup Tujuan`") 32 | except BaseException: 33 | await event.edit("** Gagal Mengirim Pesan, Emang Lu Join Grup Nya Goblok ? **") 34 | 35 | CMD_HELP.update( 36 | { 37 | "grouplink": f"{cmd}gsend\ 38 | \nMengirim Pesan Jarak Jauh Ke Grup Lain .gsend ." 39 | }) 40 | -------------------------------------------------------------------------------- /userbot/modules/sql_helper/tede_chatbot_sql.py: -------------------------------------------------------------------------------- 1 | import threading 2 | 3 | from sqlalchemy import Column, String 4 | from userbot.modules.sql_helper import BASE, SESSION 5 | 6 | 7 | class TedeChatBot(BASE): 8 | __tablename__ = "tede_chatbot" 9 | chat_id = Column(String(14), primary_key=True) 10 | 11 | def __init__(self, chat_id): 12 | self.chat_id = str(chat_id) 13 | 14 | 15 | TedeChatBot.__table__.create(checkfirst=True) 16 | 17 | INSERTION_LOCK = threading.RLock() 18 | 19 | 20 | def is_tede(chat_id): 21 | try: 22 | chat = SESSION.query(TedeChatBot).get(str(chat_id)) 23 | return bool(chat) 24 | finally: 25 | SESSION.close() 26 | 27 | 28 | def set_tede(chat_id): 29 | with INSERTION_LOCK: 30 | tedechat = SESSION.query(TedeChatBot).get(str(chat_id)) 31 | if not tedechat: 32 | tedechat = TedeChatBot(str(chat_id)) 33 | SESSION.add(tedechat) 34 | SESSION.commit() 35 | 36 | 37 | def rem_tede(chat_id): 38 | with INSERTION_LOCK: 39 | tedechat = SESSION.query(TedeChatBot).get(str(chat_id)) 40 | if tedechat: 41 | SESSION.delete(tedechat) 42 | SESSION.commit() 43 | -------------------------------------------------------------------------------- /userbot/modules/direct_message.py: -------------------------------------------------------------------------------- 1 | from userbot.events import register 2 | from userbot import CMD_HELP 3 | 4 | # Ported By @VckyouuBitch From GeezProject 5 | # Devoted To GeezProject 6 | 7 | 8 | @register(outgoing=True, pattern=r"^\.(?:dm)\s?(.*)?") 9 | async def remoteaccess(event): 10 | 11 | p = event.pattern_match.group(1) 12 | m = p.split(" ") 13 | 14 | chat_id = m[0] 15 | try: 16 | chat_id = int(chat_id) 17 | except BaseException: 18 | 19 | pass 20 | 21 | msg = "" 22 | mssg = await event.get_reply_message() 23 | if event.reply_to_msg_id: 24 | await event.client.send_message(chat_id, mssg) 25 | await event.edit("`Success Mengirim Pesan Anda.`") 26 | for i in m[1:]: 27 | msg += i + " " 28 | if msg == "": 29 | return 30 | try: 31 | await event.client.send_message(chat_id, msg) 32 | await event.edit("`Success Mengirim Pesan Anda.`") 33 | except BaseException: 34 | await event.edit("**Terjadi Error. Gagal Mengirim Pesan.**") 35 | 36 | CMD_HELP.update( 37 | { 38 | "message": "`.dm`\ 39 | \nMengirim Pesan Dengan Jarak Jauh Dengan .dm ." 40 | }) 41 | -------------------------------------------------------------------------------- /userbot/modules/limited.py: -------------------------------------------------------------------------------- 1 | # Credits By @VckyouuBitch From Geez - Project 2 | # BUATLO NI ANAK ANAK ANJING YANG KALO NGAMBIL MODUL DENGAN HAPUS CREDITS. 3 | # INTINYA LO ANJING!!!!!! 4 | 5 | from telethon import events 6 | from telethon.errors.rpcerrorlist import YouBlockedUserError 7 | 8 | from userbot import bot, CMD_HELP, CMD_HANDLER as cmd 9 | from userbot.utils import Xa_cmd 10 | 11 | 12 | @Xa_cmd(pattern="limit(?: |$)(.*)") 13 | async def _(event): 14 | await event.edit("`Bentar, lagi cek lu limit apa engga...`") 15 | async with bot.conversation("@SpamBot") as conv: 16 | try: 17 | response = conv.wait_event( 18 | events.NewMessage(incoming=True, from_users=178220800) 19 | ) 20 | await conv.send_message("/start") 21 | response = await response 22 | await bot.send_read_acknowledge(conv.chat_id) 23 | except YouBlockedUserError: 24 | await event.edit("`Woi!Buka Block nya @SpamBot`") 25 | return 26 | await event.edit(f"~ {response.message.message}") 27 | 28 | 29 | CMD_HELP.update({"limit": f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}limit`" 30 | "\n•: ngecek akun kena limit"}) 31 | -------------------------------------------------------------------------------- /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 = """😼 Thank u for Support Xa-Userbot | Channel: @tirexgugel 23 | STRING_SESSION: {} 24 | ⚠️ Please be careful before passing this value to third parties""".format(session_string) 25 | client.send_message("me", saved_messages_template, parse_mode="html") 26 | -------------------------------------------------------------------------------- /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="-1001180648994" 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/muhammadrizky16/Kyy-Userbot/${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/muhammadrizky16/Kyy-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( 22 | GBan.chat_id == str(chat_id)).one() 23 | except BaseException: 24 | return None 25 | finally: 26 | SESSION.close() 27 | 28 | 29 | def get_gbanuser(chat_id): 30 | try: 31 | return SESSION.query(GBan).get(str(chat_id)) 32 | finally: 33 | SESSION.close() 34 | 35 | 36 | def freakgban(chat_id): 37 | adder = GBan(str(chat_id)) 38 | SESSION.add(adder) 39 | SESSION.commit() 40 | 41 | 42 | def freakungban(chat_id): 43 | rem = SESSION.query(GBan).get(str(chat_id)) 44 | if rem: 45 | SESSION.delete(rem) 46 | SESSION.commit() 47 | 48 | 49 | def get_all_gbanned(): 50 | rem = SESSION.query(GBan).all() 51 | SESSION.close() 52 | return rem 53 | -------------------------------------------------------------------------------- /userbot/modules/dbs.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"**Kyy-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 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | 3 | name: CI 4 | 5 | # Controls when the action will run. 6 | on: 7 | # Triggers the workflow on push or pull request events but only for the Kyy-Userbot branch 8 | push: 9 | branches: [ Xa-Userbot ] 10 | pull_request: 11 | branches: [ Xa-Userbot ] 12 | 13 | # Allows you to run this workflow manually from the Actions tab 14 | workflow_dispatch: 15 | 16 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 17 | jobs: 18 | # This workflow contains a single job called "build" 19 | build: 20 | # The type of runner that the job will run on 21 | runs-on: ubuntu-latest 22 | 23 | # Steps represent a sequence of tasks that will be executed as part of the job 24 | steps: 25 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 26 | - uses: actions/checkout@v2 27 | 28 | # Runs a single command using the runners shell 29 | - name: Run a one-line script 30 | run: echo Hello, world! 31 | 32 | # Runs a set of commands using the runners shell 33 | - name: Run a multi-line script 34 | run: | 35 | echo Add other actions to build, 36 | echo test, and deploy your project. 37 | -------------------------------------------------------------------------------- /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/salam.py: -------------------------------------------------------------------------------- 1 | from platform import uname 2 | from userbot import ALIVE_NAME, CMD_HELP, CMD_HANDLER as cmd 3 | from userbot.utils import Xa_cmd 4 | 5 | # ================= CONSTANT ================= 6 | DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else uname().node 7 | # ============================================ 8 | 9 | 10 | @Xa_cmd(pattern='^P(?: |$)(.*)') 11 | async def typewriter(typew): 12 | typew.pattern_match.group(1) 13 | await typew.edit("Assalamualaikum, yang ga jawab KAFIR!") 14 | 15 | 16 | @Xa_cmd(pattern='atg(?: |$)(.*)') 17 | async def typewriter(typew): 18 | typew.pattern_match.group(1) 19 | await typew.edit("𝐀𝐒𝐓𝐀𝐆𝐇𝐅𝐈𝐑𝐔𝐋𝐋𝐀𝐇....SAYANG!!!!") 20 | 21 | 22 | @Xa_cmd(pattern='^L(?: |$)(.*)') 23 | async def typewriter(typew): 24 | typew.pattern_match.group(1) 25 | await typew.edit("Wallaikumsalam") 26 | 27 | 28 | @Xa_cmd(pattern='ast(?: |$)(.*)') 29 | async def typewriter(typew): 30 | typew.pattern_match.group(1) 31 | await typew.edit("𝐀𝐒𝐓𝐀𝐆𝐇𝐅𝐈𝐑𝐔𝐋𝐋𝐀𝐇......") 32 | 33 | 34 | CMD_HELP.update({ 35 | "salam": 36 | "P\ 37 | \nUsage: Untuk Memberi salam.\ 38 | \n\nL\ 39 | \nUsage: Untuk Menjawab Salam." 40 | }) 41 | 42 | 43 | CMD_HELP.update({ 44 | "salam2": 45 | f"{cmd}atg\ 46 | \nUsage: Istighfar 1.\ 47 | \n\n{cmd}ast\ 48 | \nUsage: Istighfaf 2." 49 | }) 50 | -------------------------------------------------------------------------------- /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("`Mohon Berikan Tempat Yang Dicari`") 19 | 20 | await event.edit("`Menemukan Lokasi Ini Di Server Map....`") 21 | 22 | geolocator = Nominatim(user_agent="Geez") 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("`Saya Tidak Dapat Menemukannya`") 39 | 40 | CMD_HELP.update({ 41 | "gps": 42 | ">.`gps`" 43 | "\nUsage: Untuk Mendapatkan Lokasi Map" 44 | }) 45 | -------------------------------------------------------------------------------- /userbot/modules/inlineon.py: -------------------------------------------------------------------------------- 1 | # inspiration from Man-Userbot 2 | # plugins by Fariz 3 | # Jangan di hapus ya:) 4 | # Kalo mau ambil ambil aja:D 5 | 6 | from telethon import events 7 | from telethon.errors.rpcerrorlist import YouBlockedUserError 8 | 9 | from userbot import bot, BOT_USERNAME 10 | from userbot.utils import Xa_cmd 11 | 12 | 13 | @Xa_cmd(pattern="inlineon(?: |$)(.*)") 14 | async def _(event): 15 | await event.edit(f"Sedang menyalakan inline untuk `@{BOT_USERNAME}` tunggu sebentar") 16 | async with bot.conversation("@BotFather") as conv: 17 | try: 18 | response = conv.wait_event( 19 | events.NewMessage(incoming=True, from_users=93372553) 20 | ) 21 | await conv.send_message("/setinline") 22 | await conv.get_response() 23 | await conv.send_message(f"@{BOT_USERNAME}") 24 | await conv.get_response() 25 | await conv.send_message("Search") 26 | await conv.get_response() 27 | await bot.send_read_acknowledge(conv.chat_id) 28 | except YouBlockedUserError: 29 | await event.edit("Harap unblock `@BotFather` dan coba lagi") 30 | return 31 | await event.edit(f"**Berhasil Menyalakan Mode Inline untuk `@{BOT_USERNAME}`**\n\n**Ketik** `.helpme` **lagi untuk membuka menu bantuan.**") 32 | -------------------------------------------------------------------------------- /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/image.py: -------------------------------------------------------------------------------- 1 | # Ported By VCKYOU @VckyouuBitch 2 | # Credits © Rose-Userbot 3 | # Ya gitu deh:') 4 | 5 | from shutil import rmtree 6 | from userbot.utils import Xa_cmd 7 | from userbot import CMD_HELP, CMD_HANDLER as cmd 8 | from userbot.utils import googleimagesdownload 9 | 10 | 11 | @Xa_cmd(pattern="img (.*)") 12 | async def goimg(event): 13 | query = event.pattern_match.group(1) 14 | if not query: 15 | return await event.edit("`Give something to search...`") 16 | await event.edit("`Processing Keep Patience...`") 17 | if ";" in query: 18 | try: 19 | lmt = int(query.split(";")[1]) 20 | query = query.split(";")[0] 21 | except BaseExceptaion: 22 | lmt = 5 23 | else: 24 | lmt = 5 25 | gi = googleimagesdownload() 26 | args = { 27 | "keywords": query, 28 | "limit": lmt, 29 | "format": "jpg", 30 | "output_directory": "./downloads/", 31 | } 32 | pth = gi.download(args) 33 | ok = pth[0][query] 34 | await event.client.send_file(event.chat_id, ok, caption=query, album=True) 35 | rmtree(f"./downloads/{query}/") 36 | await event.delete() 37 | 38 | 39 | CMD_HELP.update( 40 | { 41 | "img": f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}img `\ 42 | \n↳ : Does an image search on Google and shows 5 images." 43 | } 44 | ) 45 | -------------------------------------------------------------------------------- /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/tempmail.py: -------------------------------------------------------------------------------- 1 | from telethon import events 2 | from userbot import CMD_HELP, bot 3 | from userbot.events import register 4 | from telethon.errors.rpcerrorlist import YouBlockedUserError 5 | import asyncio 6 | 7 | 8 | @register(outgoing=True, pattern=r"^\.tm(?: |$)(.*)") 9 | async def _(event): 10 | chat = "@TempMailBot" 11 | geez = await event.edit("Sedang Memprosess...") 12 | async with bot.conversation(chat) as conv: 13 | try: 14 | response = conv.wait_event(events.NewMessage( 15 | incoming=True, 16 | from_users=220112646 17 | ) 18 | ) 19 | await conv.send_message("/start") 20 | await asyncio.sleep(1) 21 | await conv.send_message("Generate New") 22 | response = await response 23 | geezuserbot = ((response).reply_markup.rows[2].buttons[0].url) 24 | await event.client.send_read_acknowledge(conv.chat_id) 25 | except YouBlockedUserError: 26 | await geez.edit("`Mohon Maaf, Silahkan Buka` @TempMailBot `Lalu Tekan Start dan Coba Lagi.`") 27 | return 28 | await event.edit(f"**GEEZ TEMPMAIL** ~ `{response.message.message}`\n\n[KLIK DISINI UNTUK VERIFIKASI]({geezuserbot})") 29 | 30 | 31 | CMD_HELP.update({"tempmail": "𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `.tm`" 32 | "\n•: Mendapatkan Email Gratis Dari Temp Mail"}) 33 | -------------------------------------------------------------------------------- /userbot/modules/cping.py: -------------------------------------------------------------------------------- 1 | # OWN MY CODE RENDY 2 | # Credits Rendy 3 | 4 | """ Userbot module containing commands related to the \ 5 | Information Superhighway (yes, Internet). """ 6 | 7 | import random 8 | from userbot.events import register 9 | 10 | # OWN BY RENDY CODE 11 | # CPING 12 | 13 | cping = [ 14 | "**Hadir cping** `100.699` ", 15 | "**Hadir speed** `999.999` ", 16 | "**Hadir boosted** `565.930` ", 17 | "**Hadir pingers power** `789.666` ", 18 | ] 19 | 20 | 21 | async def get_readable_time(seconds: int) -> str: 22 | count = 0 23 | up_time = "" 24 | time_list = [] 25 | time_suffix_list = ["Dtk", "Mnt", "Jam", "Hari"] 26 | 27 | while count < 4: 28 | count += 50 29 | remainder, result = divmod( 30 | seconds, 60) if count < 3 else divmod( 31 | seconds, 24) 32 | if seconds == 0 and remainder == 0: 33 | break 34 | time_list.append(int(result)) 35 | seconds = int(remainder) 36 | 37 | for x in range(len(time_list)): 38 | time_list[x] = str(time_list[x]) + time_suffix_list[x] 39 | if len(time_list) == 4: 40 | up_time += time_list.pop() + ", " 41 | 42 | time_list.reverse() 43 | up_time += ":".join(time_list) 44 | 45 | return up_time 46 | 47 | 48 | @register(incoming=True, from_users=1224143544, pattern=r"^.cping$") 49 | async def _(Xa): 50 | await Xa.reply(random.choice(cping)) 51 | -------------------------------------------------------------------------------- /userbot/modules/xgban.py: -------------------------------------------------------------------------------- 1 | from asyncio import sleep 2 | from telethon.tl.types import ChatBannedRights 3 | from telethon.tl.functions.channels import EditBannedRequest 4 | from userbot.utils import Xa_cmd 5 | from userbot import CMD_HELP, CMD_HANDLER as cmd 6 | 7 | 8 | # Port By @VckyouuBitch From GeezProject 9 | # Perkontolan Dengan Hapus Credits 10 | @Xa_cmd(pattern="allban(?: |$)(.*)") 11 | async def testing(event): 12 | nikal = await event.get_chat() 13 | chutiya = await event.client.get_me() 14 | admin = nikal.admin_rights 15 | creator = nikal.creator 16 | if not admin and not creator: 17 | await event.edit("Anda Tidak Mempunyai Hak") 18 | return 19 | await event.edit("Tidak Melakukan Apa-apa") 20 | # Thank for Dark_Cobra 21 | everyone = await event.client.get_participants(event.chat_id) 22 | for user in everyone: 23 | if user.id == chutiya.id: 24 | pass 25 | try: 26 | await event.client(EditBannedRequest(event.chat_id, int(user.id), ChatBannedRights(until_date=None, view_messages=True))) 27 | except Exception as e: 28 | await event.edit(str(e)) 29 | await sleep(.5) 30 | await event.edit("Tidak Ada yang Terjadi di sini🙃🙂") 31 | 32 | CMD_HELP.update( 33 | { 34 | "allban": f"**Plugin : **`allban`\ 35 | \n\n**Syntax : **`{cmd}allban`\ 36 | \n**Function : **ban all members in 1 cmnd" 37 | } 38 | ) 39 | -------------------------------------------------------------------------------- /userbot/modules/gabut2.py: -------------------------------------------------------------------------------- 1 | from time import sleep 2 | from userbot import CMD_HELP, CMD_HANDLER as cmd 3 | from userbot.utils import Xa_cmd 4 | 5 | 6 | @Xa_cmd(pattern='Rexa(?: |$)(.*)') 7 | async def typewriter(typew): 8 | typew.pattern_match.group(1) 9 | sleep(3) 10 | await typew.edit("`Hai Perkenalkan Namaku Rexa`") 11 | sleep(3) 12 | await typew.edit("`20 Tahun`") 13 | sleep(1) 14 | await typew.edit("`Tinggal Di Bekasi, Salam Kenal:)`") 15 | # Create by myself @localheart 16 | 17 | 18 | @Xa_cmd(pattern='sayang(?: |$)(.*)') 19 | async def typewriter(typew): 20 | typew.pattern_match.group(1) 21 | sleep(3) 22 | await typew.edit("`Cuma Mau Bilang`") 23 | sleep(3) 24 | await typew.edit("`Aku Sayang Kamu`") 25 | sleep(1) 26 | await typew.edit("`I LOVE YOU 💞`") 27 | # Create by myself @localheart 28 | 29 | 30 | @Xa_cmd(pattern='semangat(?: |$)(.*)') 31 | async def typewriter(typew): 32 | typew.pattern_match.group(1) 33 | sleep(3) 34 | await typew.edit("`Apapun Yang Terjadi`") 35 | sleep(3) 36 | await typew.edit("`Tetaplah Bernapas`") 37 | sleep(1) 38 | await typew.edit("`Dan Selalu Bersyukur`") 39 | # Create by myself @localheart 40 | 41 | 42 | CMD_HELP.update({ 43 | "oi": f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}Rexa`\ 44 | \n↳ : perkenalan Xa\ 45 | \n\n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}sayang`\ 46 | \n↳ : Gombalan maut`\ 47 | \n\n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}semangat`\ 48 | \n↳ : Jan Lupa Semangat." 49 | }) 50 | -------------------------------------------------------------------------------- /userbot/modules/nulis.py: -------------------------------------------------------------------------------- 1 | # from ultroid 2 | # © @greyyvbss 3 | # ⚠️ Don't Remove Credits 4 | 5 | import os 6 | 7 | from PIL import Image, ImageDraw, ImageFont 8 | from userbot.utils import Xa_cmd, edit_or_reply, edit_delete, text_set 9 | from userbot import CMD_HANDLER as cmd 10 | from userbot import CMD_HELP 11 | 12 | 13 | @Xa_cmd(pattern="nulis(?: |$)(.*)") 14 | async def writer(event): 15 | if event.reply_to: 16 | reply = await event.get_reply_message() 17 | text = reply.message 18 | elif event.pattern_match.group(1).strip(): 19 | text = event.text.split(maxsplit=1)[1] 20 | else: 21 | return await edit_delete(event, "Berikan Beberapa Teks") 22 | k = await edit_or_reply(event, "Sedang Memproses..") 23 | img = Image.open("resources/kertas.jpg") 24 | draw = ImageDraw.Draw(img) 25 | font = ImageFont.truetype("resources/assfont.ttf", 30) 26 | x, y = 150, 140 27 | lines = text_set(text) 28 | line_height = font.getsize("hg")[1] 29 | for line in lines: 30 | draw.text((x, y), line, fill=(1, 22, 55), font=font) 31 | y = y + line_height - 5 32 | file = "Xa.jpg" 33 | img.save(file) 34 | await event.reply(file=file) 35 | os.remove(file) 36 | await k.delete() 37 | 38 | 39 | CMD_HELP.update( 40 | { 41 | "nulis": f"**plugin : **`nulis`\ 42 | \n\n • **syntax :** `{cmd}nulis` \ 43 | \n • **function : **menulis Teks Di buku ,buat Lu Yang mager nulis\ 44 | " 45 | } 46 | ) 47 | -------------------------------------------------------------------------------- /userbot/modules/gid.py: -------------------------------------------------------------------------------- 1 | from PIL import Image, ImageDraw, ImageFont 2 | 3 | from userbot import CMD_HELP, CMD_HANDLER as cmd 4 | from userbot.utils import Xa_cmd 5 | 6 | 7 | @Xa_cmd(pattern="gid$") 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 | "gid": f"✨**CMD**✨ : `{cmd}gid`\ 43 | \n↳ : Reply to a user to generate ID Card." 44 | } 45 | ) 46 | -------------------------------------------------------------------------------- /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 | from .start import startupmessage 17 | from . import format as _format 18 | from .format import parse_pre 19 | from .chrome import chrome, options 20 | from .decorator import asst_cmd, callback, Xa_cmd, Xa_handler 21 | from .google_images_download import googleimagesdownload 22 | from .progress import progress, CancelProcess 23 | from .tools import ( 24 | bash, 25 | humanbytes, 26 | reply_id, 27 | time_formatter, 28 | human_to_bytes, 29 | run_cmd, md5, 30 | post_to_telegraph, 31 | take_screen_shot, 32 | runcmd, 33 | edit_delete, 34 | edit_or_reply, 35 | text_set, 36 | media_type, 37 | ) 38 | from .utils import ( 39 | autobot, 40 | load_module, 41 | remove_plugin, 42 | start_assistant, 43 | create_supergroup, 44 | autopilot, 45 | ) 46 | -------------------------------------------------------------------------------- /userbot/modules/fakeaddress.py: -------------------------------------------------------------------------------- 1 | import json 2 | import urllib.request 3 | 4 | 5 | from userbot.events import register 6 | from userbot import CMD_HELP 7 | 8 | 9 | # Port By @VckyouuBitch From GeezProject 10 | # Buat Kamu Yang Hapus Credits. Intinya Kamu Anjing:) 11 | @register(outgoing=True, pattern="^.ip(?: |$)(.*)") 12 | async def _(event): 13 | if event.fwd_from: 14 | return 15 | input_str = event.pattern_match.group(1) 16 | 17 | adress = input_str 18 | 19 | token = "19e7f2b6fe27deb566140aae134dec6b" 20 | 21 | api = "http://api.ipstack.com/" + adress + "?access_key=" + token + "&format=1" 22 | 23 | result = urllib.request.urlopen(api).read() 24 | result = result.decode() 25 | 26 | result = json.loads(result) 27 | geez1 = result["type"] 28 | geez2 = result["country_code"] 29 | geez3 = result["region_name"] 30 | geez4 = result["city"] 31 | geez5 = result["zip"] 32 | geez6 = result["latitude"] 33 | geez7 = result["longitude"] 34 | await event.edit( 35 | f"INFORMASI BERHASIL DIKUMPULKAN\n\nIp type :-{geez1}\nCountry code:- {geez2}\nState name :-{geez3}\nCity name :- {geez4}\nzip :-{geez5}\nLatitude:- {geez6}\nLongitude :- {geez7}\n", 36 | parse_mode="HTML", 37 | ) 38 | 39 | 40 | CMD_HELP.update( 41 | { 42 | "fakeaddress": "**IP HACK**\ 43 | \n\n**Syntax : **`.ip `\ 44 | \n**Usage :** Memberikan detail tentang alamat ip." 45 | } 46 | ) 47 | -------------------------------------------------------------------------------- /userbot/modules/tiktok.py: -------------------------------------------------------------------------------- 1 | from telethon.errors.rpcerrorlist import YouBlockedUserError 2 | from userbot import bot, CMD_HELP, CMD_HANDLER as cmd 3 | from userbot.utils import Xa_cmd 4 | 5 | 6 | @Xa_cmd(pattern="tiktok(?: |$)(.*)") 7 | async def _(event): 8 | if event.fwd_from: 9 | return 10 | d_link = event.pattern_match.group(1) 11 | if ".com" not in d_link: 12 | await event.edit("`Mohon Maaf, Saya Membutuhkan Link Video Tiktok Untuk Mendownload Nya`") 13 | else: 14 | await event.edit("```Video Sedang Diproses.....```") 15 | chat = "@ttsavebot" 16 | async with bot.conversation(chat) as conv: 17 | try: 18 | msg_start = await conv.send_message("/start") 19 | r = await conv.get_response() 20 | msg = await conv.send_message(d_link) 21 | details = await conv.get_response() 22 | video = await conv.get_response() 23 | """ - don't spam notif - """ 24 | await bot.send_read_acknowledge(conv.chat_id) 25 | except YouBlockedUserError: 26 | await event.edit("**Kesalahan:** `Mohon Buka Blokir` @ttsavebot `Dan Coba Lagi !`") 27 | return 28 | await bot.send_file(event.chat_id, video) 29 | await event.client.delete_messages(conv.chat_id, 30 | [msg_start.id, r.id, msg.id, details.id, video.id]) 31 | await event.delete() 32 | 33 | 34 | CMD_HELP.update( 35 | { 36 | "tiktok": f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}tiktok `" 37 | "\n• : Download Video Tiktok Tanpa Watermark" 38 | } 39 | ) 40 | -------------------------------------------------------------------------------- /userbot/modules/games.py: -------------------------------------------------------------------------------- 1 | from userbot import CMD_HELP, bot 2 | from userbot.events import register 3 | 4 | 5 | @register(outgoing=True, pattern=r"^\.xogame(?: |$)(.*)") 6 | async def _(event): 7 | if event.fwd_from: 8 | return 9 | botusername = "@xobot" 10 | noob = "play" 11 | if event.reply_to_msg_id: 12 | await event.get_reply_message() 13 | tap = await bot.inline_query(botusername, noob) 14 | await tap[0].click(event.chat_id) 15 | await event.delete() 16 | 17 | 18 | @register(outgoing=True, pattern=r"^\.whisp(?: |$)(.*)") 19 | async def _(event): 20 | if event.fwd_from: 21 | return 22 | wwwspr = event.pattern_match.group(1) 23 | botusername = "@whisperBot" 24 | if event.reply_to_msg_id: 25 | await event.get_reply_message() 26 | tap = await bot.inline_query(botusername, wwwspr) 27 | await tap[0].click(event.chat_id) 28 | await event.delete() 29 | 30 | 31 | @register(outgoing=True, pattern=r"^\.mod(?: |$)(.*)") 32 | async def _(event): 33 | if event.fwd_from: 34 | return 35 | modr = event.pattern_match.group(1) 36 | botusername = "@PremiumAppBot" 37 | if event.reply_to_msg_id: 38 | await event.get_reply_message() 39 | tap = await bot.inline_query(botusername, modr) 40 | await tap[0].click(event.chat_id) 41 | await event.delete() 42 | 43 | CMD_HELP.update({ 44 | "games": "\ 45 | 𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `.xogame`\ 46 | \n↳ : Mainkan game XO bersama temanmu.\ 47 | \n\n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `.mod `\ 48 | \n↳ : Dapatkan applikasi mod\ 49 | \n\n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `.whisp `\ 50 | \n↳ : Berikan pesan rahasia"}) 51 | -------------------------------------------------------------------------------- /userbot/modules/get_user_id.py: -------------------------------------------------------------------------------- 1 | from telethon import events 2 | from telethon.errors.rpcerrorlist import YouBlockedUserError 3 | from userbot.utils import Xa_cmd 4 | from userbot import bot, CMD_HELP, CMD_HANDLER as cmd 5 | 6 | 7 | @Xa_cmd(pattern="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 Reply Ke Pesan`") 13 | return 14 | reply_message = await event.get_reply_message() 15 | if not reply_message.text: 16 | await event.edit("```Mohon Balas Ke Reply```") 17 | return 18 | chat = "@getidsbot" 19 | reply_message.sender 20 | if reply_message.sender.bot: 21 | await event.edit("`Mohon Reply Ke Pesan`") 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=1663258664)) 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("`Mohon Maaf, Orang Ini Tidak Mempunyai ID`") 37 | else: 38 | await event.edit(f"{response.message.message}") 39 | 40 | 41 | CMD_HELP.update({ 42 | "getid": 43 | f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}getid`" 44 | "\n↳ : Balas Ke Pesan Pengguna Untuk Mendapatkan ID Nya." 45 | }) 46 | -------------------------------------------------------------------------------- /userbot/modules/sql_helper/snips.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/logo.py: -------------------------------------------------------------------------------- 1 | # 🍀 © @tofik_dn 2 | # ⚠️ Do not remove credits 3 | import asyncio 4 | 5 | from telethon.errors.rpcerrorlist import YouBlockedUserError 6 | 7 | from userbot import ALIVE_NAME, CMD_HELP 8 | from userbot.utils import Xa_cmd 9 | 10 | 11 | @Xa_cmd(pattern="logo(?: |$)(.*)") 12 | async def _(event): 13 | if event.fwd_from: 14 | return 15 | aing = await event.client.get_me() 16 | text = event.pattern_match.group(1) 17 | if not text: 18 | await event.edit("`Give a name too!`") 19 | else: 20 | await event.edit("`Processing`") 21 | chat = "@HikariManageRobot" 22 | async with event.client.conversation(chat) as conv: 23 | try: 24 | msg = await conv.send_message(f"/logo {text}") 25 | response = await conv.get_response() 26 | logo = await conv.get_response() 27 | """ - don't spam notif - """ 28 | await event.client.send_read_acknowledge(conv.chat_id) 29 | except YouBlockedUserError: 30 | await event.edit( 31 | "**Error: Mohon Buka Blokir** @HikariManageRobot **Dan Coba Lagi!**" 32 | ) 33 | return 34 | await asyncio.sleep(0.5) 35 | await event.client.send_file( 36 | event.chat_id, 37 | logo, 38 | caption=f"Logo by [{ALIVE_NAME}](tg://user?id={aing.id})", 39 | ) 40 | await event.client.delete_messages(conv.chat_id, [msg.id, response.id, logo.id]) 41 | await event.delete() 42 | 43 | 44 | CMD_HELP.update({"logo": "𝙋𝙚𝙧𝙞𝙣𝙩𝙖𝙝: `{cmd}logo `" 45 | "\n⌬𝙁𝙪𝙣𝙜𝙨𝙞 : Hasilkan logo dari Teks atau Balas Ke gambar yang diberikan, untuk menulis teks Anda di atasnya. Atau Balas Ke File Font, Untuk menulis dengan font itu."}) 46 | -------------------------------------------------------------------------------- /userbot/modules/carikata.py: -------------------------------------------------------------------------------- 1 | # " Made by @e3ris for Ultroid. " 2 | # < https://github.com/TeamUltroid/Ultroid > 3 | # idea: https://t.me/TelethonChat/256160 4 | # recode by @JustRex 5 | 6 | 7 | from userbot import CMD_HANDLER as cmd 8 | from userbot import CMD_HELP 9 | from userbot.utils import edit_or_reply, edit_delete, Xa_cmd 10 | 11 | 12 | @Xa_cmd(pattern="cari( -r|) ?(.*)") 13 | async def searcher(e): 14 | rex = await edit_or_reply(e, "`Mencari Pesan..`") 15 | args = e.pattern_match.group(2) 16 | limit = 5 17 | if not args or len(args) < 2: 18 | await edit_delete(rex, "Invalid argument!, Coba Lagi") 19 | return 20 | 21 | if ":" in args: 22 | args, limit = args.split(":", 1) 23 | try: 24 | limit = int(limit) 25 | except BaseException: 26 | limit = 5 27 | 28 | limit = 99 if limit > 99 else limit 29 | text, c = "", 0 30 | async for msg in e.client.iter_messages( 31 | e.chat_id, 32 | search=args.strip(), 33 | limit=limit, 34 | reverse=bool(e.pattern_match.group(1)), 35 | ): 36 | text += f" [»» {msg.id}](t.me/c/{e.chat.id}/{msg.id})\n" 37 | c += 1 38 | 39 | txt = ( 40 | f"**Hasil Pencarian Kata :** `{args}` \n\n{text}" 41 | if c > 0 42 | else f"**Tidak ada Hasil Pencarian Kata :** `{args}`" 43 | ) 44 | await rex.edit(txt) 45 | 46 | CMD_HELP.update( 47 | { 48 | "carikata": f"**Plugin : **carikata\ 49 | \n\n • **𝙋𝙚𝙧𝙞𝙣𝙩𝙖𝙝 :** {cmd}cari\ 50 | \n ⌬ **𝙁𝙪𝙣𝙜𝙨𝙞 : **kamu bisa mencari kata digroup, contoh {cmd}cari Heroku.\ 51 | \n\n • **𝙋𝙚𝙧𝙞𝙣𝙩𝙖𝙝 :** {cmd}cari -r\ 52 | \n ⌬ **𝙁𝙪𝙣𝙜𝙨𝙞 : **Untuk mencari kata dengan jumlah, contoh {cmd}cari -r heroku : 10.\ 53 | " 54 | } 55 | ) 56 | -------------------------------------------------------------------------------- /userbot/storage.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 | import json 5 | from pathlib import Path 6 | 7 | FILE_NAME = "data.json" 8 | 9 | 10 | class Storage: 11 | class _Guard: 12 | def __init__(self, storage): 13 | self._storage = storage 14 | 15 | def __enter__(self): 16 | self._storage._autosave = False 17 | 18 | def __exit__(self, *args): 19 | self._storage._autosave = True 20 | self._storage._save() 21 | 22 | def __init__(self, root): 23 | self._root = Path(root) 24 | self._autosave = True 25 | self._guard = self._Guard(self) 26 | if (self._root / FILE_NAME).is_file(): 27 | with open(self._root / FILE_NAME) as file_pointer: 28 | self._data = json.load(file_pointer) 29 | else: 30 | self._data = {} 31 | 32 | def bulk_save(self): 33 | return self._guard 34 | 35 | def __getattr__(self, name): 36 | if name.startswith("_"): 37 | raise ValueError( 38 | "Anda hanya dapat mengakses anggota pribadi yang ada") 39 | return self._data.get(name, None) 40 | 41 | def __setattr__(self, name, value): 42 | if name.startswith("_"): 43 | self.__dict__[name] = value 44 | else: 45 | self._data[name] = value 46 | if self._autosave: 47 | self._save() 48 | 49 | def _save(self): 50 | if not self._root.is_dir(): 51 | self._root(parents=True, exist_ok=True) 52 | with open(self._root / FILE_NAME, "w") as file_pointer: 53 | json.dump(self._data, file_pointer) 54 | -------------------------------------------------------------------------------- /userbot/modules/honkasays.py: -------------------------------------------------------------------------------- 1 | 2 | from telethon.errors import ChatSendInlineForbiddenError, ChatSendStickersForbiddenError 3 | from userbot.events import register 4 | from userbot import CMD_HELP, bot 5 | 6 | 7 | @register(outgoing=True, pattern=r"^\.frog (.*)") 8 | async def honkasays(event): 9 | await event.edit("`Sedang Memproses, Mohon Tunggu Sebentar...`") 10 | text = event.pattern_match.group(1) 11 | if not text: 12 | return await event.edit("Beri Aku Bebeberapa Text, Contoh : `.honka space `") 13 | try: 14 | if not text.endswith("."): 15 | text = text + "." 16 | if len(text) <= 9: 17 | results = await bot.inline_query("honka_says_bot", text) 18 | await results[2].click( 19 | event.chat_id, 20 | silent=True, 21 | hide_via=True, 22 | ) 23 | elif len(text) >= 14: 24 | results = await bot.inline_query("honka_says_bot", text) 25 | await results[0].click( 26 | event.chat_id, 27 | silent=True, 28 | hide_via=True, 29 | ) 30 | else: 31 | results = await bot.inline_query("honka_says_bot", text) 32 | await results[1].click( 33 | event.chat_id, 34 | silent=True, 35 | hide_via=True, 36 | ) 37 | await event.delete() 38 | except ChatSendInlineForbiddenError: 39 | await event.edit("`Mohon Maaf, Saya Tidak Bisa Menggunakan Hal-Hal Sebaris Disini.`") 40 | except ChatSendStickersForbiddenError: 41 | await event.edit("Mohon Maaf, Tidak Bisa Mengirim Sticker Disini.") 42 | 43 | 44 | CMD_HELP.update( 45 | { 46 | "frog": "𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `.frog` space \ 47 | \n↳ : Menampilkan Pesan (text) di Sticker Animasi." 48 | } 49 | ) 50 | -------------------------------------------------------------------------------- /userbot/modules/buatbot.py: -------------------------------------------------------------------------------- 1 | # nyenyenyenye 2 | # FROM skyzu-userbot 3 | 4 | from telethon.errors.rpcerrorlist import YouBlockedUserError 5 | from telethon.tl.functions.contacts import UnblockRequest 6 | 7 | from userbot import CMD_HELP, CMD_HANDLER as cmd 8 | from userbot.utils import Xa_cmd 9 | 10 | chat = "@BotFather" 11 | 12 | 13 | @Xa_cmd(pattern="botbaru ?(.*)") 14 | async def _(event): 15 | if event.fwd_from: 16 | return 17 | if event.pattern_match.group(1): 18 | text, username = event.pattern_match.group(1).split() 19 | 20 | else: 21 | await event.edit("`Masukan Yang Benar Cok Biar Bisa Bikin Bot!!`") 22 | return 23 | 24 | async with event.client.conversation(chat) as conv: 25 | try: 26 | await conv.send_message("/newbot") 27 | audio = await conv.get_response() 28 | await conv.send_message(text) 29 | audio = await conv.get_response() 30 | await conv.send_message(username) 31 | audio = await conv.get_response() 32 | await event.client.forward_messages(event.chat_id, audio) 33 | await event.delete() 34 | except YouBlockedUserError: 35 | await event.client(UnblockRequest("93372553")) 36 | await conv.send_message("/newbot") 37 | audio = await conv.get_response() 38 | await conv.send_message(text) 39 | audio = await conv.get_response() 40 | await conv.send_message(username) 41 | audio = await conv.get_response() 42 | await event.client.forward_messages(event.chat_id, audio) 43 | await event.delete() 44 | 45 | 46 | CMD_HELP.update( 47 | { 48 | "botfather": f"{cmd}botbaru\ 49 | \nUntuk Membuat Bot Dari Botfather, .botbaru < bot_name > ." 50 | } 51 | ) 52 | -------------------------------------------------------------------------------- /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/utils/thumbnail.py: -------------------------------------------------------------------------------- 1 | import os 2 | import random 3 | 4 | import aiofiles 5 | import aiohttp 6 | from PIL import Image, ImageDraw, ImageFont 7 | 8 | themes = ["rrc", "hejo", "black"] 9 | 10 | 11 | def changeImageSize(maxWidth, maxHeight, image): 12 | widthRatio = maxWidth / image.size[0] 13 | heightRatio = maxHeight / image.size[1] 14 | newWidth = int(widthRatio * image.size[0]) 15 | newHeight = int(heightRatio * image.size[1]) 16 | newImage = image.resize((newWidth, newHeight)) 17 | return newImage 18 | 19 | 20 | async def gen_thumb(thumbnail, title, userid, ctitle): 21 | async with aiohttp.ClientSession() as session: 22 | async with session.get(thumbnail) as resp: 23 | if resp.status == 200: 24 | f = await aiofiles.open( 25 | f"resources/thumb{userid}.png", mode="wb" 26 | ) 27 | await f.write(await resp.read()) 28 | await f.close() 29 | theme = random.choice(themes) 30 | image1 = Image.open(f"resources/thumb{userid}.png") 31 | image2 = Image.open(f"resources/{theme}.png") 32 | image3 = changeImageSize(1280, 720, image1) 33 | image4 = changeImageSize(1280, 720, image2) 34 | image5 = image3.convert("RGBA") 35 | image6 = image4.convert("RGBA") 36 | Image.alpha_composite(image5, image6).save( 37 | f"resources/temp{userid}.png") 38 | img = Image.open(f"resources/temp{userid}.png") 39 | draw = ImageDraw.Draw(img) 40 | font = ImageFont.truetype("resources/Roboto-Light.ttf", 52) 41 | font2 = ImageFont.truetype("resources/Roboto-Medium.ttf", 76) 42 | draw.text((27, 538), f"Playing on {ctitle[:15]}...", (0, 0, 0), font=font) 43 | draw.text((27, 612), f"{title[:20]}...", (0, 0, 0), font=font2) 44 | img.save(f"resources/final{userid}.png") 45 | os.remove(f"resources/temp{userid}.png") 46 | os.remove(f"resources/thumb{userid}.png") 47 | final = f"resources/final{userid}.png" 48 | return final 49 | -------------------------------------------------------------------------------- /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/stickertext.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 | # Modified by Vckyouuu @VckyouuBitch 7 | # Using By Geez Project GPL-3.0 License 8 | 9 | import io 10 | import textwrap 11 | 12 | 13 | from PIL import Image, ImageDraw, ImageFont 14 | from userbot import CMD_HELP, CMD_HANDLER as cmd 15 | from userbot.utils import Xa_cmd 16 | 17 | 18 | @Xa_cmd(pattern="stick (.*)") 19 | async def stext(event): 20 | sticktext = event.pattern_match.group(1) 21 | 22 | if not sticktext: 23 | await event.edit("`Kasih Teks nya woii.`") 24 | return 25 | 26 | await event.delete() 27 | 28 | sticktext = textwrap.wrap(sticktext, width=10) 29 | sticktext = '\n'.join(sticktext) 30 | 31 | image = Image.new("RGBA", (512, 512), (255, 255, 255, 0)) 32 | draw = ImageDraw.Draw(image) 33 | fontsize = 220 34 | font = ImageFont.truetype( 35 | "userbot/files/RobotoMono-Regular.ttf", 36 | size=fontsize) 37 | 38 | while draw.multiline_textsize(sticktext, font=font) > (512, 512): 39 | fontsize -= 3 40 | font = ImageFont.truetype( 41 | "userbot/files/RobotoMono-Regular.ttf", 42 | size=fontsize) 43 | 44 | width, height = draw.multiline_textsize(sticktext, font=font) 45 | draw.multiline_text( 46 | ((512 - width) / 2, 47 | (512 - height) / 2), 48 | sticktext, 49 | font=font, 50 | fill="white") 51 | 52 | image_stream = io.BytesIO() 53 | image_stream.name = "sticker.webp" 54 | image.save(image_stream, "WebP") 55 | image_stream.seek(0) 56 | 57 | await event.client.send_file(event.chat_id, image_stream) 58 | 59 | 60 | CMD_HELP.update({ 61 | 'stickertext': 62 | f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}stick` " 63 | "\nUsage: Mengubah Teks/Kata-Kata, Menjadi Stiker Anda." 64 | }) 65 | -------------------------------------------------------------------------------- /userbot/modules/sql_helper/bot_starters.py: -------------------------------------------------------------------------------- 1 | from sqlalchemy import Column, String, UnicodeText 2 | 3 | from userbot.modules.sql_helper import BASE, SESSION 4 | 5 | 6 | class Bot_Starters(BASE): 7 | __tablename__ = "bot_starters" 8 | user_id = Column(String(14), primary_key=True) 9 | first_name = Column(UnicodeText) 10 | date = Column(UnicodeText) 11 | username = Column(UnicodeText) 12 | 13 | def __init__(self, user_id, first_name, date, username): 14 | self.user_id = str(user_id) 15 | self.first_name = first_name 16 | self.date = date 17 | self.username = username 18 | 19 | 20 | Bot_Starters.__table__.create(checkfirst=True) 21 | 22 | 23 | def add_starter_to_db( 24 | user_id, 25 | first_name, 26 | date, 27 | username, 28 | ): 29 | to_check = get_starter_details(user_id) 30 | if not to_check: 31 | user = Bot_Starters(str(user_id), first_name, date, username) 32 | SESSION.add(user) 33 | SESSION.commit() 34 | return True 35 | rem = SESSION.query(Bot_Starters).get(str(user_id)) 36 | SESSION.delete(rem) 37 | SESSION.commit() 38 | user = Bot_Starters(str(user_id), first_name, date, username) 39 | SESSION.add(user) 40 | SESSION.commit() 41 | return True 42 | 43 | 44 | def del_starter_from_db(user_id): 45 | to_check = get_starter_details(user_id) 46 | if not to_check: 47 | return False 48 | rem = SESSION.query(Bot_Starters).get(str(user_id)) 49 | SESSION.delete(rem) 50 | SESSION.commit() 51 | return True 52 | 53 | 54 | def get_starter_details(user_id): 55 | try: 56 | _result = SESSION.query(Bot_Starters).get(str(user_id)) 57 | if _result: 58 | return _result 59 | return None 60 | finally: 61 | SESSION.close() 62 | 63 | 64 | def get_all_starters(): 65 | try: 66 | return SESSION.query(Bot_Starters).all() 67 | except BaseException: 68 | return None 69 | finally: 70 | SESSION.close() 71 | -------------------------------------------------------------------------------- /userbot/modules/animasi6.py: -------------------------------------------------------------------------------- 1 | # Edit By @pikyus1 2 | 3 | from userbot import CMD_HELP, CMD_HANDLER as cmd 4 | from userbot.utils import Xa_cmd 5 | 6 | 7 | @Xa_cmd(pattern='thanks(?: |$)(.*)') 8 | async def typewriter(typew): 9 | typew.pattern_match.group(1) 10 | await typew.edit("●▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬●\n" 11 | "▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄\n" 12 | "╔══╦╗────╔╗─╔╗╔╗\n" 13 | "╚╗╔╣╚╦═╦═╣╚╗║╚╝╠═╦╦╗\n" 14 | "─║║║║║╬║║║╩║╚╗╔╣║║║║\n" 15 | "─╚╝╚╩╩╩╩╩╩╩╝─╚╝╚═╩═╝\n" 16 | "▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄\n" 17 | "●▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬●") 18 | 19 | 20 | @Xa_cmd(pattern='malam(?: |$)(.*)') 21 | async def typewriter(typew): 22 | typew.pattern_match.group(1) 23 | await typew.edit("╔═╦═╦╗╔═╦══╦═╦══╗\n" 24 | "║═╣═╣║║╬║║║║╬╠╗╔╝\n" 25 | "╠═║═╣╚╣║║║║║║║║║\n" 26 | "╚═╩═╩═╩╩╩╩╩╩╩╝╚╝\n\n" 27 | "╔══╦═╦╗╔═╦══╗\n" 28 | "║║║║╬║║║╬║║║║\n" 29 | "║║║║║║╚╣║║║║║\n" 30 | "╚╩╩╩╩╩═╩╩╩╩╩╝") 31 | 32 | 33 | @Xa_cmd(pattern='rumah(?: |$)(.*)') 34 | async def typewriter(typew): 35 | typew.pattern_match.group(1) 36 | await typew.edit("**GAMBAR RUMAH**\n" 37 | "╱◥◣\n" 38 | "│∩ │◥███◣ ╱◥███◣\n" 39 | "╱◥◣ ◥████◣▓∩▓│∩ ║\n" 40 | "│╱◥█◣║∩∩∩ ║◥█▓ ▓█◣\n" 41 | "││∩│ ▓ ║∩田│║▓ ▓ ▓∩ ║\n" 42 | "๑۩๑๑۩๑๑ ۩๑๑۩๑▓๑۩๑๑۩๑") 43 | 44 | 45 | @Xa_cmd(pattern='join(?: |$)(.*)') 46 | async def typewriter(typew): 47 | typew.pattern_match.group(1) 48 | await typew.edit("_/﹋\\_\n" 49 | "(҂`_´)\n" 50 | "<,︻╦╤─ ҉\n" 51 | r"_/﹋\_" 52 | "\n**ᴊᴏɪɴ ʟɪɴᴋ ʙɪᴏ😡**") 53 | 54 | 55 | CMD_HELP.update({ 56 | "animasi6": 57 | f"`{cmd}rumah` ; `{cmd}join` ; `{cmd}malam` ; `{cmd}thanks`\ 58 | \nUsage: test aja." 59 | }) 60 | -------------------------------------------------------------------------------- /userbot/modules/deteksigrub.py: -------------------------------------------------------------------------------- 1 | from telethon.errors.rpcerrorlist import YouBlockedUserError 2 | from userbot import CMD_HELP, bot, CMD_HANDLER as cmd 3 | from userbot.utils import Xa_cmd 4 | 5 | 6 | @Xa_cmd(pattern="(?:dgrup|dg)\\s?(.*)?") 7 | async def _(event): 8 | if event.fwd_from: 9 | return 10 | input_str = "".join(event.text.split(maxsplit=1)[1:]) 11 | reply_message = await event.get_reply_message() 12 | if not event.reply_to_msg_id: 13 | await event.edit("```Mohon Balas Ke Pesan Pengguna atau ketik .dgrup (ID/Username) Yang mau Anda deteksi```") 14 | return 15 | if input_str: 16 | try: 17 | uid = int(input_str) 18 | except ValueError: 19 | try: 20 | u = await event.client.get_entity(input_str) 21 | except ValueError: 22 | await edit.event("`Mohon Berikan ID/Username untuk menemukan Riwayat`" 23 | ) 24 | uid = u.id 25 | else: 26 | uid = reply_message.sender_id 27 | chat = "@tgscanrobot" 28 | event = await event.edit("`Sedang Mendeteksi...`") 29 | async with bot.conversation(chat) as conv: 30 | try: 31 | await conv.send_message(f"{uid}") 32 | except YouBlockedUserError: 33 | await steal.reply( 34 | "```Mohon Unblock @tgscanrobot Dan Coba Lagi```" 35 | ) 36 | response = await conv.get_response() 37 | await event.client.send_read_acknowledge(conv.chat_id) 38 | await event.edit(response.text) 39 | 40 | 41 | def inline_mention(user): 42 | full_name = user_full_name(user) or "No Name" 43 | return f"[{full_name}](tg://user?id={user.id})" 44 | 45 | 46 | def user_full_name(user): 47 | names = [user.first_name, user.last_name] 48 | names = [i for i in list(names) if i] 49 | return " ".join(names) 50 | 51 | 52 | CMD_HELP.update({ 53 | "deteksi": 54 | f"`{cmd}dgrup` ; `{cmd}dg`\ 55 | \nPenjelasan: Melihat Riwayat Grup Yang Pernah / Sedang dimasuki." 56 | }) 57 | -------------------------------------------------------------------------------- /userbot/modules/meadmin.py: -------------------------------------------------------------------------------- 1 | # COPYRIGHT ULTROID USERBOT 2 | # edit by @JustRex Xa-Userbot 3 | # Jangan hapus Anjg 4 | 5 | import asyncio 6 | import os 7 | 8 | from userbot import bot 9 | from userbot import CMD_HANDLER as cmd 10 | from userbot import CMD_HELP 11 | from userbot.utils import edit_or_reply, Xa_cmd 12 | 13 | 14 | @Xa_cmd(pattern="meadmin(?: |$)(.*)") 15 | async def _(event): 16 | if event.fwd_from: 17 | return 18 | here = event.chat_id 19 | args = event.pattern_match.group(1) 20 | xa = await edit_or_reply(event, "`Processing...`") 21 | admin_list = [] 22 | dialogue = await bot.get_dialogs() 23 | for dialog in dialogue: 24 | if dialog.is_group or dialog.is_channel: 25 | ids = await bot.get_entity(dialog) 26 | try: 27 | if ids.admin_rights or ids.creator: 28 | info = f"{ids.id}: {ids.title}" 29 | admin_list.append(info) 30 | except BaseException: 31 | pass 32 | except Exception: 33 | continue 34 | 35 | if len(admin_list) > 0: 36 | await xa.edit('`Berhasil, Sedang Membuat File 🖨️`') 37 | with open('me_admin.txt', 'w') as book: 38 | for groups_channels in admin_list: 39 | book.write(groups_channels + '\n') 40 | await asyncio.sleep(1) 41 | caption = f'reply pesan ini dengan ketik {cmd}carbon untuk melihat list Admin anda, [total: {len(admin_list)}]' 42 | if args and "pv" in args: 43 | await bot.send_file("me", "me_admin.txt", caption=caption) 44 | await xa.respond("`File terkirim ke Pesan Tersimpan mu`") 45 | else: 46 | await bot.send_file(here, "me_admin.txt", caption=caption) 47 | os.remove("me_admin.txt") 48 | await xa.delete() 49 | else: 50 | await xa.edit("`Sad, I'm not Admin anywhere 🤧`") 51 | 52 | 53 | CMD_HELP.update({ 54 | "meadmin": 55 | f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}meadmin`\ 56 | \n↳ : memberikan list group dimana kamu menjadi admin." 57 | }) 58 | -------------------------------------------------------------------------------- /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, CMD_HANDLER as cmd 6 | from userbot.utils import Xa_cmd 7 | PLACE = "" 8 | 9 | 10 | @Xa_cmd(pattern="adzan(?: |$)(.*)") 11 | async def get_adzan(adzan): 12 | if not adzan.pattern_match.group(1): 13 | LOCATION = PLACE 14 | if not LOCATION: 15 | await adzan.edit("`Harap Menentukan Kota Atau Negara.`") 16 | return 17 | else: 18 | LOCATION = adzan.pattern_match.group(1) 19 | 20 | # url = f'http://muslimsalat.com/{LOCATION}.json?key=bd099c5825cbedb9aa934e255a81a5fc' 21 | url = f"https://api.pray.zone/v2/times/today.json?city={LOCATION}" 22 | request = requests.get(url) 23 | if request.status_code == 500: 24 | return await adzan.edit(f"**Tidak Dapat Menemukan Kota** `{LOCATION}`") 25 | 26 | parsed = json.loads(request.text) 27 | 28 | city = parsed["results"]["location"]["city"] 29 | country = parsed["results"]["location"]["country"] 30 | timezone = parsed["results"]["location"]["timezone"] 31 | date = parsed["results"]["datetime"][0]["date"]["gregorian"] 32 | 33 | imsak = parsed["results"]["datetime"][0]["times"]["Imsak"] 34 | subuh = parsed["results"]["datetime"][0]["times"]["Fajr"] 35 | zuhur = parsed["results"]["datetime"][0]["times"]["Dhuhr"] 36 | ashar = parsed["results"]["datetime"][0]["times"]["Asr"] 37 | maghrib = parsed["results"]["datetime"][0]["times"]["Maghrib"] 38 | isya = parsed["results"]["datetime"][0]["times"]["Isha"] 39 | 40 | result = ( 41 | f"**Jadwal Sholat**:\n" 42 | f"📅 `{date} | {timezone}`\n" 43 | f"🌏 `{city} | {country}`\n\n" 44 | f"**Imsak :** `{imsak}`\n" 45 | f"**Subuh :** `{subuh}`\n" 46 | f"**Zuhur :** `{zuhur}`\n" 47 | f"**Ashar :** `{ashar}`\n" 48 | f"**Maghrib :** `{maghrib}`\n" 49 | f"**Isya :** `{isya}`\n" 50 | ) 51 | 52 | await adzan.edit(result) 53 | 54 | 55 | CMD_HELP.update({"adzan": f"\n\n𝙋𝙚𝙧𝙞𝙣𝙩𝙖𝙝: `{cmd}adzan` " 56 | "\n⌬ Memberikan Informasi Waktu Sholat."}) 57 | -------------------------------------------------------------------------------- /userbot/modules/__help.py: -------------------------------------------------------------------------------- 1 | # TeleBot - UserBot 2 | # Copyright (C) 2020 TeleBot 3 | 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU Affero 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 Affero General Public License for more details. 13 | 14 | # You should have received a copy of the GNU Affero General Public License 15 | # along with this program. If not, see . 16 | 17 | # Recode by Fariz 18 | # From Flicks-Userbot 19 | # 20 | 21 | 22 | from userbot import BOT_USERNAME, CMD_HELP, bot 23 | from userbot.utils import edit_or_reply, edit_delete, Xa_cmd 24 | 25 | user = bot.get_me() 26 | DEFAULTUSER = user.first_name 27 | CUSTOM_HELP_EMOJI = "⌬" 28 | 29 | 30 | @Xa_cmd(pattern="help ?(.*)") 31 | async def cmd_list(event): 32 | args = event.pattern_match.group(1).lower() 33 | if args: 34 | if args in CMD_HELP: 35 | await edit_or_reply(event, f"**⌬ Commands available in {args} ⌬** \n\n" + str(CMD_HELP[args]) + "\n\n**© @tirexgugel**") 36 | else: 37 | await edit_delete(event, f"**Module** `{args}` **Gak ada, Ngetik Yang bener!**") 38 | else: 39 | try: 40 | results = await bot.inline_query( # pylint:disable=E0602 41 | BOT_USERNAME, "@XaUserbot" 42 | ) 43 | await results[0].click( 44 | event.chat_id, reply_to=event.reply_to_msg_id, hide_via=True 45 | ) 46 | await event.delete() 47 | except BaseException: 48 | await edit_delete(event, 49 | f"** Sepertinya obrolan atau bot ini tidak mendukung inline mode.**" 50 | ) 51 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | aiohttp[speedups]>=3.5.4 2 | aiofiles 3 | aria2p 4 | aiofile 5 | asyncurban 6 | async_generator 7 | bitlyshortener 8 | beautifulsoup4>=4.8.1bs4 9 | base 10 | cffi>=1.0.0 11 | covid>=2.2.9 12 | coffeehouse>=2.1.0 13 | colour 14 | cowpy 15 | cryptg 16 | csvfaker 17 | deezloader 18 | dnspython 19 | emoji 20 | fontTools 21 | gitpython 22 | git+https://github.com/ahupp/python-magic 23 | git+https://github.com/johnwmillr/LyricsGenius.git 24 | git+https://github.com/voins/google-images-download.git@2cd68173c961324a2c41c61e8b6f40a49663ce60 25 | git+https://github.com/yt-dlp/yt-dlp@master 26 | geopy 27 | glitch_this 28 | google-api-python-client==2.3.0 29 | google-auth-httplib2 30 | google_trans_new 31 | googletrans==4.0.0rc1 32 | google-auth-oauthlib 33 | google_images_download 34 | gTTS>=2.1.1 35 | gTTS-token>=1.1.3 36 | heroku3>=3.4.0 37 | httplib2>=0.18.0 38 | humanize 39 | html_telegraph_poster 40 | hachoir>=3.0a5 41 | jikanpy 42 | justwatch 43 | jotquote 44 | lxml 45 | lottie 46 | lyrics_extractor 47 | lyricsgenius 48 | markdown 49 | moviepy 50 | opencv-python 51 | oauth2client 52 | patool 53 | pendulum 54 | Pillow>=6.0.0 55 | psutil 56 | py-tgcalls==0.9.0b1 57 | psycopg2 58 | psycopg2-binary 59 | pybase64 60 | pylast 61 | pydub 62 | pySmartDL 63 | python-barcode 64 | python-dotenv 65 | pytz 66 | pyaztro 67 | pytube>=9.5.1 68 | pymongo[srv] 69 | python-dateutil 70 | pyfiglet 71 | PyGithub 72 | pip>=19.2.3 73 | PyPDF2 74 | PyDrive2 75 | pyDownload 76 | qrcode 77 | requests>=2.18.4 78 | redis>=3.3.10 79 | REPO_LINK 80 | search-engine-parser>=0.6.1 81 | speedtest-cli>=2.0.2 82 | sqlalchemy<=1.3.23 83 | scikit-image 84 | scipy 85 | setuptools>=28.8.0 86 | selenium>=3.141.0 87 | telethon>=1.24.0 88 | telethon-session-sqlalchemy 89 | twitter_scraper 90 | telegraph 91 | telethon 92 | telethon-tgcrypto 93 | urbandict>=0.5 94 | vcsi 95 | validators 96 | wheel 97 | wget 98 | wikipedia>=1.4.0 99 | wand 100 | wordcloud 101 | youtube-search-python 102 | youtube-dl 103 | youtube_dl 104 | youtube_search 105 | youtube-search-python==1.4.9 106 | zipfile38 107 | -------------------------------------------------------------------------------- /userbot/modules/rgif.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import os 3 | 4 | import cv2 5 | import PIL 6 | import time 7 | 8 | from userbot.events import register 9 | from userbot import CMD_HELP 10 | from userbot.utils import progress 11 | 12 | path = "./downloads/" 13 | if not os.path.isdir(path): 14 | os.makedirs(path) 15 | 16 | 17 | @register(outgoing=True, pattern='^.rgif(?: |$)(.*)') 18 | async def _(event): 19 | if event.fwd_from: 20 | return 21 | reply = await event.get_reply_message() 22 | await event.edit("`Checking...`") 23 | download = await bot.download_media(reply.media) 24 | img = cv2.VideoCapture(download) 25 | ret, frame = img.read() 26 | cv2.imwrite("danish.png", frame) 27 | danish = PIL.Image.open("danish.png") 28 | dark, python = danish.size 29 | cobra = f"""ffmpeg -f lavfi -i color=c=00ff00:s={dark}x{python}:d=10 -loop 1 -i danish.png -filter_complex "[1]rotate=angle=PI*t:fillcolor=none:ow='hypot(iw,ih)':oh=ow[fg];[0][fg]overlay=x=(W-w)/2:y=(H-h)/2:shortest=1:format=auto,format=yuv420p" -movflags +faststart danish.mp4 -y""" 30 | await event.edit("```Processing ...```") 31 | process = await asyncio.create_subprocess_shell( 32 | cobra, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE 33 | ) 34 | stdout, stderr = await process.communicate() 35 | await event.edit("```Uploading...```") 36 | c_time = time.time() 37 | await event.client.send_file( 38 | event.chat_id, 39 | "danish.mp4", 40 | force_document=False, 41 | reply_to=event.reply_to_msg_id, 42 | progress_callback=lambda d, t: asyncio.get_event_loop().create_task( 43 | progress(d, t, event, c_time, "[UPLOAD]") 44 | ), 45 | ) 46 | await event.delete() 47 | os.system("rm -f downloads/*.jpg") 48 | os.system("rm -f downloads/*.png") 49 | os.system("rm -f downloads/*.webp") 50 | os.system("rm -f *.jpg") 51 | os.system("rm -f *.png") 52 | os.remove("danish.mp4") 53 | 54 | 55 | CMD_HELP.update({ 56 | "rgif": 57 | "`.rgif`\ 58 | \nUsage: Reply a image to convert image to rotate gif." 59 | }) 60 | -------------------------------------------------------------------------------- /userbot/modules/button.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2020 sandeep.n(π.$) 2 | # button post makker for catuserbot thanks to uniborg for the base 3 | # by @sandy1709 (@mrconfused) 4 | # Man-Userbot 5 | 6 | import re 7 | 8 | from telethon import Button 9 | 10 | from userbot import BOT_USERNAME 11 | from userbot import CMD_HANDLER as cmd 12 | from userbot import CMD_HELP 13 | from userbot.utils import edit_delete, Xa_cmd, reply_id 14 | 15 | # regex obtained from: 16 | # https://github.com/PaulSonOfLars/tgbot/blob/master/tg_bot/modules/helper_funcs/string_handling.py#L23 17 | BTN_URL_REGEX = re.compile( 18 | r"(\[([^\[]+?)\]\)") 19 | 20 | 21 | @Xa_cmd(pattern="button(?:\\s|$)([\\s\\S]*)") 22 | async def _(event): 23 | reply_to_id = await reply_id(event) 24 | reply_message = await event.get_reply_message() 25 | if reply_message: 26 | markdown_note = reply_message.text 27 | else: 28 | markdown_note = "".join(event.text.split(maxsplit=1)[1:]) 29 | if not markdown_note: 30 | return await edit_delete( 31 | event, "**Teks apa yang harus saya gunakan di pesan button?**" 32 | ) 33 | catinput = "Inline buttons " + markdown_note 34 | results = await event.client.inline_query(BOT_USERNAME, catinput) 35 | await results[0].click(event.chat_id, reply_to=reply_to_id, hide_via=True) 36 | await event.delete() 37 | 38 | 39 | def build_keyboard(buttons): 40 | keyb = [] 41 | for btn in buttons: 42 | if btn[2] and keyb: 43 | keyb[-1].append(Button.url(btn[0], btn[1])) 44 | else: 45 | keyb.append([Button.url(btn[0], btn[1])]) 46 | return keyb 47 | 48 | 49 | CMD_HELP.update( 50 | { 51 | "button": f"**Plugin : **`button`\ 52 | \n\n ⌬ **Syntax :** `{cmd}button` [Name on button]\ 53 | \n ⌬ **Function : **Untuk membuat pesan button melalui inline\ 54 | \n ⌬ **Examples : **`{cmd}button test [Xvideos] [Channel] [Support]`\ 55 | " 56 | } 57 | ) 58 | -------------------------------------------------------------------------------- /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/modules/specialtools.py: -------------------------------------------------------------------------------- 1 | # Credits By @VckyouuBitch From Geez-Project 2 | # Tolong Haragai ya:) 3 | # Kalo emg Bisa Menghargai seseorang pasti pahamm la ya:) 4 | # Credits © Geez - Projects 5 | 6 | import os 7 | 8 | import moviepy.editor as m 9 | 10 | from userbot import CMD_HELP, CMD_HANDLER as cmd 11 | from userbot.utils import Xa_cmd 12 | 13 | 14 | @Xa_cmd(pattern="getaudio(?: |$)(.*)") 15 | async def _(event): 16 | ureply = await event.get_reply_message() 17 | if not (ureply and ("audio" in ureply.document.mime_type)): 18 | await event.edit("`Reply To Audio Only..`") 19 | return 20 | await event.edit("`processing...`") 21 | d = os.path.join("resources/extras", "ul.mp3") 22 | await event.edit("`Downloading... Large Files Takes Time..`") 23 | await event.client.download_media(ureply, d) 24 | await event.edit("`Done.. Now reply to video In which u want to add that Audio`") 25 | 26 | 27 | @Xa_cmd(pattern="addaudio(?: |$)(.*)") 28 | async def _(event): 29 | ureply = await event.get_reply_message() 30 | if not (ureply and ("video" in ureply.document.mime_type)): 31 | await event.edit("`Reply To Gif/Video In which u want to add audio.`") 32 | return 33 | xx = await event.edit("`processing...`") 34 | ultt = await ureply.download_media() 35 | ls = os.listdir("resources/extras") 36 | z = "ul.mp3" 37 | x = "resources/extras/ul.mp3" 38 | if z not in ls: 39 | await event.edit("`First reply an audio with .aw`") 40 | return 41 | video = m.VideoFileClip(ultt) 42 | audio = m.AudioFileClip(x) 43 | out = video.set_audio(audio) 44 | out.write_videofile("ok.mp4", fps=30) 45 | await event.client.send_file( 46 | event.chat_id, 47 | file="ok.mp4", 48 | force_document=False, 49 | reply_to=event.reply_to_msg_id, 50 | ) 51 | os.remove("ok.mp4") 52 | os.remove(x) 53 | os.remove(ultt) 54 | await xx.delete() 55 | 56 | CMD_HELP.update( 57 | { 58 | "specialtools": f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}getaudio`\ 59 | \n↳ : Download Audio To put in ur Desired Video/Gif..\ 60 | \n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}addaudio`\ 61 | \n↳ : It will put the above audio to the replied video/gif.." 62 | } 63 | ) 64 | -------------------------------------------------------------------------------- /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/sql_helper/bot_blacklists.py: -------------------------------------------------------------------------------- 1 | from sqlalchemy import Column, String, UnicodeText 2 | 3 | from userbot.modules.sql_helper import BASE, SESSION 4 | 5 | 6 | class Bot_BlackList(BASE): 7 | __tablename__ = "bot_blacklist" 8 | chat_id = Column(String(14), primary_key=True) 9 | first_name = Column(UnicodeText) 10 | username = Column(UnicodeText) 11 | reason = Column(UnicodeText) 12 | date = Column(UnicodeText) 13 | 14 | def __init__(self, chat_id, first_name, username, reason, date): 15 | self.chat_id = str(chat_id) 16 | self.username = username 17 | self.reason = reason 18 | self.date = date 19 | self.first_name = first_name 20 | 21 | def __repr__(self): 22 | return "" % self.chat_id 23 | 24 | 25 | Bot_BlackList.__table__.create(checkfirst=True) 26 | 27 | 28 | def add_user_to_bl( 29 | chat_id: int, first_name: str, username: str, reason: str, date: str 30 | ): 31 | """add the user to the blacklist""" 32 | to_check = check_is_black_list(chat_id) 33 | if not to_check: 34 | __user = Bot_BlackList( 35 | str(chat_id), 36 | first_name, 37 | username, 38 | reason, 39 | date) 40 | SESSION.add(__user) 41 | SESSION.commit() 42 | rem = SESSION.query(Bot_BlackList).get(str(chat_id)) 43 | SESSION.delete(rem) 44 | SESSION.commit() 45 | user = Bot_BlackList(str(chat_id), first_name, username, reason, date) 46 | SESSION.add(user) 47 | SESSION.commit() 48 | return True 49 | 50 | 51 | def check_is_black_list(chat_id: int): 52 | """check if user_id is blacklisted""" 53 | try: 54 | return SESSION.query(Bot_BlackList).get(str(chat_id)) 55 | finally: 56 | SESSION.close() 57 | 58 | 59 | def rem_user_from_bl(chat_id: int): 60 | """remove the user from the blacklist""" 61 | s__ = SESSION.query(Bot_BlackList).get(str(chat_id)) 62 | if s__: 63 | SESSION.delete(s__) 64 | SESSION.commit() 65 | return True 66 | SESSION.close() 67 | return False 68 | 69 | 70 | def get_all_bl_users(): 71 | try: 72 | return SESSION.query(Bot_BlackList).all() 73 | except BaseException: 74 | return None 75 | finally: 76 | SESSION.close() 77 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /userbot/modules/saver.py: -------------------------------------------------------------------------------- 1 | 2 | from telethon import events 3 | from telethon.errors.rpcerrorlist import YouBlockedUserError 4 | from userbot.utils import Xa_cmd 5 | from userbot import bot, CMD_HELP, ALIVE_NAME, CMD_HANDLER as cmd 6 | from platform import uname 7 | 8 | 9 | # ================= CONSTANT ================= 10 | DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else uname().node 11 | # ============================================ 12 | 13 | 14 | @Xa_cmd(pattern="igsaver ?(.*)") 15 | async def igsaver(event): 16 | if event.fwd_from: 17 | return 18 | if not event.reply_to_msg_id: 19 | await event.edit("`Mohon Reply Ke Link Instagram Ya..`") 20 | return 21 | reply_message = await event.get_reply_message() 22 | if not reply_message.text: 23 | await event.edit("`Mohon Maaf, Saya Membutuhkan Link Media Instagram Untuk di Download`") 24 | return 25 | chat = "@SaveAsBot" 26 | reply_message.sender 27 | if reply_message.sender.bot: 28 | await event.edit("`Sedang Memproses...`") 29 | return 30 | await event.edit("`Sedang Memproses...`") 31 | async with event.client.conversation(chat) as conv: 32 | try: 33 | response = conv.wait_event( 34 | events.NewMessage(incoming=True, from_users=523131145) 35 | ) 36 | await event.client.send_message(chat, reply_message) 37 | response = await response 38 | except YouBlockedUserError: 39 | await event.edit("`Mohon Pergi ke ` @SaveAsbot `Lalu Tekan Start dan Coba Lagi.`") 40 | return 41 | if response.text.startswith("Forward"): 42 | await event.edit( 43 | "Uhmm Sepertinya Private." 44 | ) 45 | else: 46 | await event.delete() 47 | await event.client.send_file( 48 | event.chat_id, 49 | response.message.media, 50 | caption=f"**Download By {DEFAULTUSER}**", 51 | ) 52 | await event.client.send_read_acknowledge(conv.chat_id) 53 | await bot(functions.messages.DeleteHistoryRequest(peer=chat, max_id=0)) 54 | await event.delete() 55 | 56 | 57 | CMD_HELP.update({"instasaver": f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}igsaver`" 58 | f"\n↳ : Download Postingan di Instagram, Silahkan Salin Link Postingan Instagram Yang Ingin Anda Download Terus Kirim Link, Lalu Reply dan Ketik `{cmd}igsaver`"}) 59 | -------------------------------------------------------------------------------- /userbot/modules/shazam.py: -------------------------------------------------------------------------------- 1 | # Ported By VICKY <@VckyouuBitch> 2 | # 3 | # Geez Projects UserBot 4 | # Copyright (C) 2021 GeezProjects 5 | # 6 | # This file is a part of 7 | # PLease read the GNU Affero General Public License in 8 | # . 9 | 10 | 11 | from telethon.errors.rpcerrorlist import YouBlockedUserError 12 | from userbot import CMD_HELP 13 | from userbot.events import register 14 | 15 | 16 | @register(outgoing=True, pattern=r"^\.shazam(?: |$)(.*)") 17 | async def _(event): 18 | "To reverse search music by bot." 19 | if not event.reply_to_msg_id: 20 | return await event.edit("```Membalas pesan audio.```") 21 | reply_message = await event.get_reply_message() 22 | chat = "@auddbot" 23 | try: 24 | async with event.client.conversation(chat) as conv: 25 | try: 26 | await event.edit("```Mengidentifikasi lagu```") 27 | start_msg = await conv.send_message("/start") 28 | response = await conv.get_response() 29 | send_audio = await conv.send_message(reply_message) 30 | check = await conv.get_response() 31 | if not check.text.startswith("Audio received"): 32 | return await event.edit( 33 | "Terjadi kesalahan saat mengidentifikasi lagu. Coba gunakan pesan audio berdurasi 5-10 detik." 34 | ) 35 | await event.edit("```Tunggu sebentar...```") 36 | result = await conv.get_response() 37 | await event.client.send_read_acknowledge(conv.chat_id) 38 | except YouBlockedUserError: 39 | await event.edit("```Mohon buka blokir (@auddbot) dan coba lagi```") 40 | return 41 | namem = f"**Judul : **{result.text.splitlines()[0]}\ 42 | \n\n**Details : **__{result.text.splitlines()[2]}__" 43 | await event.edit(namem) 44 | await event.client.delete_messages( 45 | conv.chat_id, [start_msg.id, send_audio.id, check.id, result.id, response.id] 46 | ) 47 | except TimeoutError: 48 | return await event.edit("`Error: `@auddbot` tidak merespons, coba lagi nanti") 49 | 50 | CMD_HELP.update( 51 | { 52 | "shazam": ">`.shazam " 53 | "\nUsage: Reverse search audio file using (@auddbot)" 54 | } 55 | ) 56 | -------------------------------------------------------------------------------- /userbot/modules/gban_bot.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 import CMD_HELP, CMD_HANDLER as cmd 8 | from userbot.utils import Xa_cmd 9 | from userbot import ALIVE_NAME, G_BAN_LOGGER_GROUP, bot 10 | # imported from uniborg by @heyworld 11 | 12 | # ================= CONSTANT ================= 13 | DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else uname().node 14 | # ============================================ 15 | 16 | 17 | @Xa_cmd(pattern="gbanb(?: |$)(.*)") 18 | async def _(event): 19 | if G_BAN_LOGGER_GROUP is None: 20 | await event.edit("Set G_BAN_LOGGER_GROUP in vars otherwise module won't work.") 21 | return 22 | if event.fwd_from: 23 | return 24 | reason = event.pattern_match.group(1) 25 | if event.reply_to_msg_id: 26 | r = await event.get_reply_message() 27 | if r.forward: 28 | r_from_id = r.forward.from_id or r.from_id 29 | else: 30 | r_from_id = r.from_id 31 | await bot.send_message( 32 | G_BAN_LOGGER_GROUP, 33 | "/gban [user](tg://user?id={}) {}".format(r_from_id, reason) 34 | ) 35 | await event.delete() 36 | await event.reply("**gbanning...**") 37 | asyncio.sleep(3.5) 38 | await event.edit(f"**User gbanned by {DEFAULTUSER}**") 39 | asyncio.sleep(5) 40 | await event.delete() 41 | 42 | 43 | @Xa_cmd(pattern="ungbanb(?: |$)(.*)") 44 | async def _(event): 45 | if G_BAN_LOGGER_GROUP is None: 46 | await event.edit("Set G_BAN_LOGGER_GROUP in vars otherwise module won't work.") 47 | return 48 | if event.fwd_from: 49 | return 50 | reason = event.pattern_match.group(1) 51 | if event.reply_to_msg_id: 52 | r = await event.get_reply_message() 53 | r_from_id = r.from_id 54 | await bot.send_message( 55 | G_BAN_LOGGER_GROUP, 56 | "/ungban [user](tg://user?id={}) {}".format(r_from_id, reason) 57 | ) 58 | await event.delete() 59 | await event.reply("**ungbanning...**") 60 | asyncio.sleep(3.5) 61 | await event.edit(f"**User ungbanned by {DEFAULTUSER}**") 62 | asyncio.sleep(5) 63 | await event.delete() 64 | 65 | CMD_HELP.update({ 66 | "gbanbot": f"`{cmd}gbanb`\ 67 | \nUsage: globally Ban Bot.\ 68 | \n\n`{cmd}ungbanb` :\ 69 | \nUsage: Cancel globally Ban Bot." 70 | }) 71 | -------------------------------------------------------------------------------- /userbot/modules/sql_helper/locks_sql.py: -------------------------------------------------------------------------------- 1 | from sqlalchemy import Boolean, Column, String 2 | 3 | from userbot.modules.sql_helper import BASE, SESSION 4 | 5 | 6 | class Locks(BASE): 7 | __tablename__ = "locks" 8 | chat_id = Column(String(14), primary_key=True) 9 | # Booleans are for "is this locked", _NOT_ "is this allowed" 10 | bots = Column(Boolean, default=False) 11 | commands = Column(Boolean, default=False) 12 | email = Column(Boolean, default=False) 13 | forward = Column(Boolean, default=False) 14 | url = Column(Boolean, default=False) 15 | 16 | def __init__(self, chat_id): 17 | self.chat_id = str(chat_id) # ensure string 18 | self.bots = False 19 | self.commands = False 20 | self.email = False 21 | self.forward = False 22 | self.url = False 23 | 24 | 25 | Locks.__table__.create(checkfirst=True) 26 | 27 | 28 | def init_locks(chat_id, reset=False): 29 | curr_restr = SESSION.query(Locks).get(str(chat_id)) 30 | if reset: 31 | SESSION.delete(curr_restr) 32 | SESSION.flush() 33 | restr = Locks(str(chat_id)) 34 | SESSION.add(restr) 35 | SESSION.commit() 36 | return restr 37 | 38 | 39 | def update_lock(chat_id, lock_type, locked): 40 | curr_perm = SESSION.query(Locks).get(str(chat_id)) 41 | if not curr_perm: 42 | curr_perm = init_locks(chat_id) 43 | if lock_type == "bots": 44 | curr_perm.bots = locked 45 | elif lock_type == "commands": 46 | curr_perm.commands = locked 47 | elif lock_type == "email": 48 | curr_perm.email = locked 49 | elif lock_type == "forward": 50 | curr_perm.forward = locked 51 | elif lock_type == "url": 52 | curr_perm.url = locked 53 | SESSION.add(curr_perm) 54 | SESSION.commit() 55 | 56 | 57 | def is_locked(chat_id, lock_type): 58 | curr_perm = SESSION.query(Locks).get(str(chat_id)) 59 | SESSION.close() 60 | if not curr_perm: 61 | return False 62 | if lock_type == "bots": 63 | return curr_perm.bots 64 | if lock_type == "commands": 65 | return curr_perm.commands 66 | if lock_type == "email": 67 | return curr_perm.email 68 | if lock_type == "forward": 69 | return curr_perm.forward 70 | if lock_type == "url": 71 | return curr_perm.url 72 | 73 | 74 | def get_locks(chat_id): 75 | try: 76 | return SESSION.query(Locks).get(str(chat_id)) 77 | finally: 78 | SESSION.close() 79 | -------------------------------------------------------------------------------- /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.utils import Xa_cmd 11 | from userbot import CMD_HELP, GENIUS, lastfm, LASTFM_USERNAME 12 | from userbot import CMD_HANDLER as cmd 13 | from pylast import User 14 | 15 | if GENIUS is not None: 16 | genius = lyricsgenius.Genius(GENIUS) 17 | 18 | 19 | @Xa_cmd(pattern="lyrics (?:(now)|(.*) - (.*))") 20 | async def lyrics(lyric): 21 | await lyric.edit("`Getting information...`") 22 | if GENIUS is None: 23 | await lyric.edit( 24 | "`Provide genius access token to Heroku ConfigVars...`") 25 | return False 26 | if lyric.pattern_match.group(1) == "now": 27 | playing = User(LASTFM_USERNAME, lastfm).get_now_playing() 28 | if playing is None: 29 | await lyric.edit( 30 | "`No information current lastfm scrobbling...`" 31 | ) 32 | return False 33 | artist = playing.get_artist() 34 | song = playing.get_title() 35 | else: 36 | artist = lyric.pattern_match.group(2) 37 | song = lyric.pattern_match.group(3) 38 | await lyric.edit(f"`Searching lyrics for {artist} - {song}...`") 39 | songs = genius.search_song(song, artist) 40 | if songs is None: 41 | await lyric.edit(f"`Song` **{artist} - {song}** `not found...`") 42 | return False 43 | if len(songs.lyrics) > 4096: 44 | await lyric.edit("`Lyrics is too big, view the file to see it.`") 45 | with open("lyrics.txt", "w+") as f: 46 | f.write(f"Search query: \n{artist} - {song}\n\n{songs.lyrics}") 47 | await lyric.client.send_file( 48 | lyric.chat_id, 49 | "lyrics.txt", 50 | reply_to=lyric.id, 51 | ) 52 | os.remove("lyrics.txt") 53 | return True 54 | else: 55 | await lyric.edit( 56 | f"**Search query**:\n`{artist}` - `{song}`" 57 | f"\n\n```{songs.lyrics}```" 58 | ) 59 | return True 60 | 61 | 62 | CMD_HELP.update({ 63 | "lyrics": 64 | f"`{cmd}lyrics` ** - **" 65 | "\nUsage: Get lyrics matched artist and song." 66 | f"\n\n`{cmd}lyrics now`" 67 | "\nUsage: Get lyrics artist and song from current lastfm scrobbling." 68 | }) 69 | -------------------------------------------------------------------------------- /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, Saya Sedang Mencari Wallpaper.....`") 22 | async with bot.conversation("@tdapibot") 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 | from userbot.utils import Xa_cmd 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 | @Xa_cmd(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/chatbot.py: -------------------------------------------------------------------------------- 1 | # 🍀 © @tofik_dn 2 | # ⚠️ Do not remove credits 3 | 4 | import requests 5 | from googletrans import Translator 6 | from telethon import events 7 | from telethon.tl.types import User 8 | 9 | from userbot import CMD_HELP, LOGS, bot 10 | from userbot import CMD_HANDLER as cmd 11 | from userbot.utils import Xa_cmd 12 | from userbot.modules.sql_helper.tede_chatbot_sql import is_tede, rem_tede, set_tede 13 | 14 | translator = Translator() 15 | LANGUAGE = "id" 16 | 17 | url = "https://apitede.herokuapp.com/api/chatbot?message={message}" 18 | 19 | 20 | async def ngapain_rep(message): 21 | hayulo_link_apa = url.format(message=message) 22 | try: 23 | data = requests.get(hayulo_link_apa) 24 | if data.status_code == 200: 25 | return (data.json())["msg"] 26 | else: 27 | LOGS.info("ERROR: API chatbot sedang down, report ke @tedesupport.") 28 | except Exception as e: 29 | LOGS.info(str(e)) 30 | 31 | 32 | async def chat_bot_toggle(event): 33 | status = event.pattern_match.group(1).lower() 34 | chat_id = event.chat_id 35 | if status == "on": 36 | if not is_tede(chat_id): 37 | set_tede(chat_id) 38 | return await event.edit("ChatBot Diaktifkan!") 39 | await event.edit("ChatBot Sudah Diaktifkan.") 40 | elif status == "off": 41 | if is_tede(chat_id): 42 | rem_tede(chat_id) 43 | return await event.edit("ChatBot Dinonaktifkan!") 44 | await event.edit("ChatBot Sudah Dinonaktifkan.") 45 | else: 46 | await event.edit("**Usage:** `.chatbot` ") 47 | 48 | 49 | @Xa_cmd(pattern="chatbot(?: |$)(.*)") 50 | async def on_apa_off(event): 51 | await chat_bot_toggle(event) 52 | 53 | 54 | @bot.on( 55 | events.NewMessage( 56 | incoming=True, 57 | func=lambda e: (e.mentioned), 58 | ), 59 | ) 60 | async def tede_chatbot(event): 61 | sender = await event.get_sender() 62 | if not is_tede(event.chat_id): 63 | return 64 | if not isinstance(sender, User): 65 | return 66 | if event.text: 67 | rep = await ngapain_rep(event.message.message) 68 | tr = translator.translate(rep, LANGUAGE) 69 | if tr: 70 | await event.reply(tr.text) 71 | else: 72 | await event.reply(rep) 73 | 74 | 75 | CMD_HELP.update( 76 | { 77 | "chatbot": f"**Plugin : **`chatbot`\ 78 | \n\n • **Syntax :** `{cmd}chatbot` \ 79 | \n • **Function :** Untuk membalas chat dengan chatbot AI.\ 80 | " 81 | } 82 | ) 83 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Xa-Userbot", 3 | "description": "USERBOT KHUSUS YANG DIGUNAKAN UNTUK BERSENANG-SENANG DI TELEGRAM.", 4 | "logo": "https://telegra.ph/file/9b010ead0692e3bc28df6.jpg", 5 | "keywords": [ 6 | "telegram", 7 | "userbot", 8 | "plugin", 9 | "modular", 10 | "productivity" 11 | ], 12 | "repository": "https://github.com/Rexashh/Xa-Userbot/Xa-Userbot", 13 | "telegram": "https://t.me/JustRex", 14 | "success_url": "https://t.me/rexaprivateroom", 15 | "stack": "container", 16 | "env": { 17 | "API_KEY": { 18 | "description": "Dapatkan Api Key di web my.telegram.org", 19 | "required": true 20 | }, 21 | "API_HASH": { 22 | "description": "Dapatkan Api Hash Di Web my.telegram.org", 23 | "required": true 24 | }, 25 | "STRING_SESSION": { 26 | "description": "Dapatkan String Session di bot @xastringronbot", 27 | "required": true 28 | }, 29 | "HEROKU_APP_NAME": { 30 | "description": "Nama App heroku, Nama App yang paling pertama di isi (liat paling atas)", 31 | "required": true 32 | }, 33 | "HEROKU_API_KEY": { 34 | "description": "Heroku API KEY mu, dapatkan dari web 'https://dashboard.heroku.com/account'", 35 | "value": "Check Di Heroku Dashboard Mu", 36 | "required": true 37 | }, 38 | "PM_AUTO_BAN": { 39 | "description": "Ini buat aktifin PMPERMIT, kalo ga mau aktif ketik : /skip", 40 | "value": "False", 41 | "required": true 42 | }, 43 | "ALIVE_NAME": { 44 | "description": "Ketik Nama Telegram Mu Saja, ini untuk nama di perintah .alive", 45 | "required": true 46 | } 47 | }, 48 | "addons": [ 49 | { 50 | "plan": "heroku-postgresql", 51 | "options": { 52 | "version": "12" 53 | } 54 | } 55 | ],"buildpacks": [{ 56 | "url": "https://github.com/heroku/heroku-buildpack-python.git" 57 | }, { 58 | "url": "https://github.com/heroku/heroku-buildpack-redis" 59 | }, { 60 | "url": "https://github.com/heroku/heroku-buildpack-google-chrome" 61 | }, { 62 | "url": "https://github.com/HasibulKabir/heroku-buildpack-rarlab" 63 | },{ 64 | "url": "https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest" 65 | }, { 66 | "url": "https://github.com/opendoor-labs/heroku-buildpack-p7zip" 67 | }, { 68 | "url": "https://github.com/amivin/aria2-heroku" 69 | }, { 70 | "url": "https://github.com/stevo550/buildpack-slug-cleaner" 71 | }], 72 | "formation": { 73 | "worker": { 74 | "quantity": 1, 75 | "size": "free" 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /userbot/modules/sangmata.py: -------------------------------------------------------------------------------- 1 | from telethon.errors.rpcerrorlist import YouBlockedUserError 2 | from userbot import bot, CMD_HELP, CMD_HANDLER as cmd 3 | from userbot.utils import Xa_cmd 4 | from asyncio.exceptions import TimeoutError 5 | 6 | 7 | @Xa_cmd(pattern="sg(?: |$)(.*)") 8 | async def lastname(steal): 9 | if steal.fwd_from: 10 | return 11 | if not steal.reply_to_msg_id: 12 | await steal.edit("```Mohon Balas Ke Pesan Pengguna.```") 13 | return 14 | message = await steal.get_reply_message() 15 | chat = "@SangMataInfo_bot" 16 | user_id = message.sender.id 17 | id = f"/search_id {user_id}" 18 | if message.sender.bot: 19 | await steal.edit("```Balas Ke Pesan Pengguna Yang Sebenarnya.```") 20 | return 21 | await steal.edit("```Mengambil Informasi Pengguna Tersebut, Mohon Menunggu..```") 22 | try: 23 | async with bot.conversation(chat) as conv: 24 | try: 25 | msg = await conv.send_message(id) 26 | r = await conv.get_response() 27 | response = await conv.get_response() 28 | except YouBlockedUserError: 29 | await steal.reply( 30 | "```Mohon Unblock @sangmatainfo_bot Dan Coba Lagi```" 31 | ) 32 | return 33 | if r.text.startswith("Name"): 34 | respond = await conv.get_response() 35 | await steal.edit(f"`{r.message}`") 36 | await steal.client.delete_messages( 37 | conv.chat_id, [msg.id, r.id, response.id, respond.id] 38 | ) 39 | return 40 | if response.text.startswith("No records") or r.text.startswith( 41 | "No records" 42 | ): 43 | await steal.edit("```Saya Tidak Menemukan Informasi Pengguna Ini, Pengguna Ini Belum Pernah Mengganti Nama Sebelumnya```") 44 | await steal.client.delete_messages( 45 | conv.chat_id, [msg.id, r.id, response.id] 46 | ) 47 | return 48 | else: 49 | respond = await conv.get_response() 50 | await steal.edit(f"```{response.message}```") 51 | await steal.client.delete_messages( 52 | conv.chat_id, [msg.id, r.id, response.id, respond.id] 53 | ) 54 | except TimeoutError: 55 | return await steal.edit("`Saya Sedang Sakit Mohon Maaf`") 56 | 57 | 58 | CMD_HELP.update({ 59 | "sangmata": 60 | f"`{cmd}sg`\ 61 | \nUsage: Mendapatkan Riwayat Nama Pengguna." 62 | }) 63 | -------------------------------------------------------------------------------- /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/detection.py: -------------------------------------------------------------------------------- 1 | from userbot.utils import Xa_cmd 2 | from userbot import CMD_HELP, bot, CMD_HANDLER as cmd 3 | from telethon.errors.rpcerrorlist import YouBlockedUserError 4 | 5 | 6 | @Xa_cmd(pattern="detect(?: |$)(.*)") 7 | async def detect(event): 8 | if event.fwd_from: 9 | return 10 | input_str = "".join(event.text.split(maxsplit=1)[1:]) 11 | reply_message = await event.get_reply_message() 12 | if not event.reply_to_msg_id: 13 | await event.edit("```Please reply to the user or type .detect (ID/Username) that you want to detect.```") 14 | return 15 | if input_str: 16 | try: 17 | uid = int(input_str) 18 | except ValueError: 19 | try: 20 | u = await event.client.get_entity(input_str) 21 | except ValueError: 22 | await edit.event("`Please Give ID/Username to Find History.`" 23 | ) 24 | uid = u.id 25 | else: 26 | uid = reply_message.sender_id 27 | chat = "@tgscanrobot" 28 | event = await event.edit("`Currently Doing Account Detection...`") 29 | event = await event.edit("__Checking.__") 30 | event = await event.edit("__Checking..__") 31 | event = await event.edit("__Checking...__") 32 | event = await event.edit("__Checking.__") 33 | event = await event.edit("__Checking..__") 34 | event = await event.edit("__Checking...__") 35 | event = await event.edit("__Connecting.__") 36 | event = await event.edit("__Connecting..__") 37 | event = await event.edit("__Connecting...__") 38 | event = await event.edit("__Connecting.__") 39 | event = await event.edit("__Connecting..__") 40 | event = await event.edit("__Connecting...__") 41 | async with bot.conversation(chat) as conv: 42 | try: 43 | await conv.send_message(f"{uid}") 44 | except YouBlockedUserError: 45 | await steal.reply( 46 | "```Please Unblock @tgscanrobot And Try Again.```" 47 | ) 48 | response = await conv.get_response() 49 | await event.client.send_read_acknowledge(conv.chat_id) 50 | await event.edit(response.text) 51 | 52 | 53 | def inline_mention(user): 54 | full_name = user_full_name(user) or "No Name" 55 | return f"[{full_name}](tg://user?id={user.id})" 56 | 57 | 58 | def user_full_name(user): 59 | names = [user.first_name, user.last_name] 60 | names = [i for i in list(names) if i] 61 | return " ".join(names) 62 | 63 | 64 | CMD_HELP.update({ 65 | "detection": 66 | f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}detect`\ 67 | \n📌 : Melihat Riwayat Grup Yang Pernah/Sedang dimasuki." 68 | }) 69 | -------------------------------------------------------------------------------- /userbot/modules/pdf.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2021 Man-Userbot 2 | # Created by mrismanaziz 3 | # FROM 4 | # t.me/SharingUserbot & t.me/Lunatic0de 5 | 6 | from asyncio.exceptions import TimeoutError 7 | from telethon.errors.rpcerrorlist import YouBlockedUserError 8 | 9 | from userbot import CMD_HELP, bot 10 | from userbot.events import register 11 | 12 | 13 | @register(outgoing=True, pattern=r"^\.pdf(?: |$)(.*)") 14 | async def _(event): 15 | if not event.reply_to_msg_id: 16 | return await event.edit("**Mohon Reply ke teks apa pun**") 17 | reply_message = await event.get_reply_message() 18 | chat = "@office2pdf_bot" 19 | await event.edit("`Mengubah menjadi PDF...`") 20 | try: 21 | async with bot.conversation(chat) as conv: 22 | try: 23 | msg_start = await conv.send_message("/start") 24 | response = await conv.get_response() 25 | msg = await conv.send_message(reply_message) 26 | convert = await conv.send_message("/ready2conv") 27 | cnfrm = await conv.get_response() 28 | editfilename = await conv.send_message("Yes") 29 | enterfilename = await conv.get_response() 30 | filename = await conv.send_message("Flicks-Userbot") 31 | started = await conv.get_response() 32 | pdf = await conv.get_response() 33 | """- jangan spam notif -""" 34 | await bot.send_read_acknowledge(conv.chat_id) 35 | except YouBlockedUserError: 36 | await event.edit("**Unblock @office2pdf_bot dan coba lagi**") 37 | return 38 | await event.client.send_message(event.chat_id, pdf) 39 | await event.client.delete_messages( 40 | conv.chat_id, 41 | [ 42 | msg_start.id, 43 | response.id, 44 | msg.id, 45 | started.id, 46 | filename.id, 47 | editfilename.id, 48 | enterfilename.id, 49 | cnfrm.id, 50 | pdf.id, 51 | convert.id, 52 | ], 53 | ) 54 | await event.delete() 55 | except TimeoutError: 56 | return await event.edit( 57 | "**ERROR: Bot tidak merespon, coba lagi nanti**" 58 | ) 59 | 60 | 61 | CMD_HELP.update( 62 | { 63 | "pdf": f"**Plugin : **`pdf`\ 64 | \n\n • **Syntax :** `.pdf` \ 65 | \n • **Function : **Untuk Mengconvert teks menjadi file PDF\ 66 | " 67 | } 68 | ) 69 | -------------------------------------------------------------------------------- /userbot/modules/animasi10.py: -------------------------------------------------------------------------------- 1 | # @greyyvbss 2 | 3 | from userbot import CMD_HANDLER as cmd 4 | from userbot import CMD_HELP 5 | from userbot.utils import edit_or_reply, Xa_cmd 6 | 7 | 8 | @Xa_cmd(pattern="sponge(?: |$)(.*)") 9 | async def _(event): 10 | await edit_or_reply( 11 | event, 12 | "┈┈╱▔▔▔▔▔▔▔▔▔▔▔▏\n" 13 | "┈╱╭▏╮╭┻┻╮╭┻┻╮╭▏ \n" 14 | "▕╮╰▏╯┃╭╮┃┃╭╮┃╰▏ \n" 15 | "▕╯┈▏┈┗┻┻┛┗┻┻┻╮▏ \n" 16 | "▕╭╮▏╮┈┈┈┈┏━━━╯▏\n" 17 | "▕╰╯▏╯╰┳┳┳┳┳┳╯╭▏ \n" 18 | "▕┈╭▏╭╮┃┗┛┗┛┃┈╰▏ \n" 19 | "▕┈╰▏╰╯╰━━━━╯┈┈▏ν2.ο\n" 20 | " **BOBBB** ") 21 | 22 | 23 | @Xa_cmd(pattern="ngok(?: |$)(.*)") 24 | async def _(event): 25 | await edit_or_reply( 26 | event, 27 | "┈┏━╮╭━┓┈╭━━━━╮\n" 28 | "┈┃┏┗┛┓┃╭┫NGOKKKK┃\n" 29 | "┈╰┓▋▋┏╯╯╰━━━━╯\n" 30 | "╭━┻╮╲┗━━━━╮╭╮┈\n" 31 | "┃▎▎┃╲╲╲╲╲╲┣━╯┈\n" 32 | "╰━┳┻▅╯╲╲╲╲┃┈┈┈\n" 33 | "┈┈╰━┳┓┏┳┓┏╯┈┈┈\n" 34 | "┈┈┈┈┗┻┛┗┻┛┈┈┈┈") 35 | 36 | 37 | @Xa_cmd(pattern="musang(?: |$)(.*)") 38 | async def _(event): 39 | await edit_or_reply( 40 | event, 41 | " ╱▏┈┈┈┈┈┈▕╲▕╲┈┈┈\n" 42 | "▏▏┈┈┈┈┈┈▕▏▔▔╲┈┈\n" 43 | "▏╲┈┈┈┈┈┈╱┈▔┈▔╲┈\n" 44 | "╲▏▔▔▔▔▔▔╯╯╰┳━━▀\n" 45 | "┈▏╯╯╯╯╯╯╯╯╱┃┈┈┈\n" 46 | "┈┃┏┳┳━━━┫┣┳┃┈┈┈\n" 47 | "┈┃┃┃┃┈┈┈┃┃┃┃┈┈┈\n" 48 | "┈┗┛┗┛┈┈┈┗┛┗┛┈┈┈") 49 | 50 | 51 | @Xa_cmd(pattern="gajah(?: |$)(.*)") 52 | async def _(event): 53 | await edit_or_reply( 54 | event, 55 | "┈┈┈┈╱▔▔▔▔▔╲┈╱▔╲\n" 56 | "┈┈┈┈▏┈┈▏╭╮▕┈▏╳▕\n" 57 | "┈┈┈┈▏┈┈▏┈┈▕┈╲▂╱\n" 58 | "┈╱▔▔╲▂╱╲▂▂┈╲▂▏▏\n" 59 | "╭▏┈┈┈┈┈┈┈▏╲▂▂╱┈\n" 60 | "┃▏┈┈┈┈▏┈┈▏┈┈┈┈┈\n" 61 | "╯▏┈╲╱▔╲▅▅▏┈┈┈┈\n" 62 | "┈╲▅▅▏▕▔▔▔▔▏┈┈┈┈") 63 | 64 | 65 | @Xa_cmd(pattern="liat(?: |$)(.*)") 66 | async def _(event): 67 | await edit_or_reply( 68 | event, 69 | "┈┈┈╭━━━━━╮┈┈┈┈┈\n" 70 | "┈┈┈┃┊┊┊┊┊┃┈┈┈┈┈\n" 71 | "┈┈┈┃┊┊╭━╮┻╮┈┈┈┈\n" 72 | "┈┈┈╱╲┊┃▋┃▋┃┈┈┈┈\n" 73 | "┈┈╭┻┊┊╰━┻━╮┈┈┈┈\n" 74 | "┈┈╰┳┊╭━━━┳╯┈┈┈┈\n" 75 | "┈┈┈┃┊┃╰━━┫┈Liatin Aja\n" 76 | "┈┈┈┈┈┈┏━┓┈┈┈┈┈┈") 77 | 78 | 79 | CMD_HELP.update( 80 | { 81 | "animasi10": f"➢ **Plugin : **`animasi10`\ 82 | \n\n ┌✪ **Command :** `{cmd}sponge`\ 83 | \n └✪ **Function : **Mengirim Gambar SpongeBoob.\ 84 | \n\n ┌✪ **Command :** `{cmd}ngok`\ 85 | \n └✪ **Function : **Mengirim Gambar Babi.\ 86 | \n\n ┌✪ **Command :** `{cmd}musang`\ 87 | \n └✪ **Function : **Mengirim Gambar Musang.\ 88 | \n\n ┌✪ **Command :** `{cmd}gajah`\ 89 | \n └✪ **Function : **Mengirim Gambar Gajah.\ 90 | \n\n ┌✪ **Command :** `{cmd}liat`\ 91 | \n └✪ **Function : **Mengirim Gambar see." 92 | }) 93 | -------------------------------------------------------------------------------- /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 | import sys 9 | from importlib import import_module 10 | 11 | import requests 12 | from telethon.tl.functions.channels import InviteToChannelRequest as Addbot 13 | from userbot import ( 14 | BOTLOG_CHATID, 15 | BOT_USERNAME, 16 | BOT_TOKEN, 17 | BOT_VER, 18 | ALIVE_LOGO, 19 | LOGS, 20 | kyyblacklist, 21 | bot, 22 | call_py, 23 | ) 24 | from userbot import CMD_HANDLER as cmd 25 | from userbot.modules import ALL_MODULES 26 | from userbot.utils import autobot, autopilot 27 | 28 | try: 29 | bot.start() 30 | call_py.start() 31 | user = bot.get_me() 32 | kyyblacklist = requests.get( 33 | "https://raw.githubusercontent.com/muhammadrizky16/Kyyblack/master/kyyblacklist.json" 34 | ).json() 35 | if user.id in kyyblacklist: 36 | LOGS.warning( 37 | "MAKANYA GA USAH BERTINGKAH GOBLOK, USERBOTnya GUA MATIIN NAJIS BANGET DIPAKE ORANG KEK LU.\nCredits: @IDnyaKosong" 38 | ) 39 | sys.exit(1) 40 | except Exception as e: 41 | LOGS.info(str(e), exc_info=True) 42 | sys.exit(1) 43 | 44 | for module_name in ALL_MODULES: 45 | imported_module = import_module("userbot.modules." + module_name) 46 | 47 | if not BOTLOG_CHATID: 48 | LOGS.info( 49 | "BOTLOG_CHATID Vars tidak terisi, Memulai Membuat Grup Otomatis..." 50 | ) 51 | bot.loop.run_until_complete(autopilot()) 52 | 53 | LOGS.info( 54 | f"Jika {user.first_name} Membutuhkan Bantuan, Silahkan Tanyakan di Grup https://t.me/rexaprivateroom") 55 | LOGS.info( 56 | f"🦖Xa-Userbot🦖 ⚙️ V{BOT_VER} [TELAH DIAKTIFKAN!]") 57 | 58 | 59 | async def check_alive(): 60 | try: 61 | if BOTLOG_CHATID != 0: 62 | await bot.send_file(BOTLOG_CHATID, ALIVE_LOGO, caption=f"🦖**Xa Userbot Berhasil Diaktifkan**!!\n━━━━━━━━━━━━━━━\n➠ **Userbot Version** - `8.1@Xa-Userbot`\n➠ **Ketik** `{cmd}ping` **Untuk Mengecheck Bot**\n━━━━━━━━━━━━━━━\n➠ **Powered By:** @tirexgugel ") 63 | except Exception as e: 64 | LOGS.info(str(e)) 65 | try: 66 | await bot(Addbot(int(BOTLOG_CHATID), [BOT_USERNAME])) 67 | except BaseException: 68 | pass 69 | 70 | bot.loop.run_until_complete(check_alive()) 71 | if not BOT_TOKEN: 72 | LOGS.info( 73 | "BOT_TOKEN Vars tidak terisi, Memulai Membuat BOT Otomatis di @Botfather..." 74 | ) 75 | bot.loop.run_until_complete(autobot()) 76 | 77 | if len(sys.argv) not in (1, 3, 4): 78 | bot.disconnect() 79 | else: 80 | bot.run_until_disconnected() 81 | -------------------------------------------------------------------------------- /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 | import asyncio 13 | 14 | 15 | from userbot.events import register 16 | from userbot import CMD_HELP 17 | 18 | COLLECTION_STRING = [ 19 | "epic-fantasy-wallpaper", 20 | "castle-in-the-sky-wallpaper", 21 | "fantasy-forest-wallpaper", 22 | "fantasy-wallpaper-1080p", 23 | "toothless-wallpaper-hd", 24 | "japanese-art-wallpaper", 25 | "star-wars-landscape-wallpaper", 26 | "4k-sci-fi-wallpaper", 27 | "minion-screensavers-wallpaper", 28 | "zootopia-hd-wallpaper", 29 | "gravity-falls-hd-wallpaper", 30 | "cool-cartoon-wallpaper", 31 | "disney-movie-wallpaper", 32 | "cute-pokemon-wallpapers", 33 | "4k-anime-wallpaper", 34 | "balance-druid-wallpaper", 35 | "harry-potter-wallpaper", 36 | "funny-meme-wallpaper", 37 | "minimalist-hd-wallpaper", 38 | "cute-animal-wallpaper-backgrounds", 39 | "3840-x-1080-wallpaper", 40 | "wallpaper-outer-space", 41 | "best-wallpapers-in-the-world", 42 | "funny-desktop-backgrounds", 43 | "funny-cats-wallpapers", 44 | "cool-cat-wallpaper", 45 | "doge-wallpaper-hd", 46 | "ice-cream-cone-wallpaper", 47 | "food-wallpaper-background", 48 | "snowy-christmas-scenes-wallpaper", 49 | "life-quotes-wallpaper" 50 | ] 51 | 52 | 53 | async def animepp(): 54 | 55 | os.system("rm -rf donot.jpg") 56 | rnd = random.randint(0, len(COLLECTION_STRING) - 1) 57 | pack = COLLECTION_STRING[rnd] 58 | pc = requests.get("http://getwallpapers.com/collection/" + pack).text 59 | f = re.compile(r'/\w+/full.+.jpg') 60 | f = f.findall(pc) 61 | fy = "http://getwallpapers.com" + random.choice(f) 62 | print(fy) 63 | 64 | if not os.path.exists("f.ttf"): 65 | urllib.request.urlretrieve( 66 | "https://github.com/rebel6969/mym/raw/master/Rebel-robot-Regular.ttf", "f.ttf") 67 | urllib.request.urlretrieve(fy, "donottouch.jpg") 68 | 69 | 70 | @register(outgoing=True, pattern="^.pprandom(?: |$)(.*)") 71 | async def main(event): 72 | await event.edit("`Sedang Mengubah Photo Profile Anda...`") 73 | 74 | while True: 75 | await animepp() 76 | 77 | file = await event.client.upload_file("donottouch.jpg") 78 | 79 | await event.client(functions.photos.UploadProfilePhotoRequest(file)) 80 | os.system("rm -rf donottouch.jpg") 81 | await asyncio.sleep(3600) # Edit this to your required needs 82 | 83 | CMD_HELP.update({ 84 | "randompp": "\n\n𝙋𝙚𝙧𝙞𝙣𝙩𝙖𝙝: `.pprandom`" 85 | "\n⌬𝙁𝙪𝙣𝙜𝙨𝙞 : Mengubah Photo Profile Anda Secara Random."}) 86 | -------------------------------------------------------------------------------- /userbot/modules/create.py: -------------------------------------------------------------------------------- 1 | # lorduserbot 2 | from telethon.tl import functions 3 | from userbot.utils import Xa_cmd 4 | from userbot import CMD_HELP, CMD_HANDLER as cmd 5 | 6 | 7 | @Xa_cmd(pattern="buat (gb|g|c)(?: |$)(.*)") 8 | async def telegraphs(grop): 9 | """ For .create command, Creating New Group & Channel """ 10 | if not grop.text[0].isalpha() and grop.text[0] not in ("/", "#", "@", "!"): 11 | if grop.fwd_from: 12 | return 13 | type_of_group = grop.pattern_match.group(1) 14 | group_name = grop.pattern_match.group(2) 15 | if type_of_group == "gb": 16 | try: 17 | result = await grop.client(functions.messages.CreateChatRequest( # pylint:disable=E0602 18 | users=["@MissRose_bot"], 19 | # Not enough users (to create a chat, for example) 20 | # Telegram, no longer allows creating a chat with ourselves 21 | title=group_name 22 | )) 23 | created_chat_id = result.chats[0].id 24 | result = await grop.client(functions.messages.ExportChatInviteRequest( 25 | peer=created_chat_id, 26 | )) 27 | await grop.edit("Grup/Channel {} Berhasil Dibuat. Tekan [{}]({}) Untuk Melihatnya".format(group_name, group_name, result.link)) 28 | except Exception as e: # pylint:disable=C0103,W0703 29 | await grop.edit(str(e)) 30 | elif type_of_group == "g" or type_of_group == "c": 31 | try: 32 | r = await grop.client(functions.channels.CreateChannelRequest( # pylint:disable=E0602 33 | title=group_name, 34 | about="`Selamat Datang Di Channel Ini!`", 35 | megagroup=False if type_of_group == "c" else True 36 | )) 37 | created_chat_id = r.chats[0].id 38 | result = await grop.client(functions.messages.ExportChatInviteRequest( 39 | peer=created_chat_id, 40 | )) 41 | await grop.edit("Grup/Channel {} Berhasil Dibuat. Tekan [{}]({}) Untuk Melihatnya".format(group_name, group_name, result.link)) 42 | except Exception as e: # pylint:disable=C0103,W0703 43 | await grop.edit(str(e)) 44 | 45 | CMD_HELP.update( 46 | { 47 | "membuat": f"**Plugin : **`membuat`\ 48 | \n\n • **Syntax :** `{cmd}buat g` \ 49 | \n • **Function : **Membuat grup telegram.\ 50 | \n\n • **Syntax :** `{cmd}buat gb` \ 51 | \n • **Function : **Membuat Grup bersama bot.\ 52 | \n\n • **Syntax :** `{cmd}buat c` \ 53 | \n • **Function : **Membuat sebuah Channel.\ 54 | " 55 | } 56 | ) 57 | -------------------------------------------------------------------------------- /userbot/modules/truth_dare.py: -------------------------------------------------------------------------------- 1 | # Ported by Fariz (Flicks-Userbot) 2 | from telethon import events 3 | from telethon.errors.rpcerrorlist import YouBlockedUserError 4 | 5 | from userbot import bot, CMD_HELP, CMD_HANDLER as cmd 6 | from userbot.utils import Xa_cmd 7 | 8 | 9 | @Xa_cmd(pattern="truth(?: |$)(.*)") 10 | async def _(event): 11 | await event.edit("Mengirim pesan truth...") 12 | async with bot.conversation("@truthordares_bot") as conv: 13 | try: 14 | response = conv.wait_event( 15 | events.NewMessage(incoming=True, from_users=1335899453) 16 | ) 17 | await conv.send_message("/truth") 18 | response = await response 19 | await bot.send_read_acknowledge(conv.chat_id) 20 | except YouBlockedUserError: 21 | await event.edit("Harap unblock `@truthordares_bot` dan coba lagi") 22 | return 23 | await event.edit(f"**Pesan truth**\n\n{response.message.message}") 24 | 25 | 26 | @Xa_cmd(pattern="dare(?: |$)(.*)") 27 | async def _(event): 28 | await event.edit("Mengirim pesan dare...") 29 | async with bot.conversation("@truthordares_bot") as conv: 30 | try: 31 | response = conv.wait_event( 32 | events.NewMessage(incoming=True, from_users=1335899453) 33 | ) 34 | await conv.send_message("/dare") 35 | response = await response 36 | await bot.send_read_acknowledge(conv.chat_id) 37 | except YouBlockedUserError: 38 | await event.edit("Harap unblock `@truthordares_bot` dan coba lagi") 39 | return 40 | await event.edit(f"**Pesan dare**\n\n{response.message.message}") 41 | 42 | 43 | @Xa_cmd(pattern="spill(?: |$)(.*)") 44 | async def _(event): 45 | await event.edit("Mengirim pesan spill...") 46 | async with bot.conversation("@Spillgame_bot") as conv: 47 | try: 48 | response = conv.wait_event( 49 | events.NewMessage(incoming=True, from_users=1361222893) 50 | ) 51 | await conv.send_message("/spill") 52 | response = await response 53 | await bot.send_read_acknowledge(conv.chat_id) 54 | except YouBlockedUserError: 55 | await event.edit("Harap unblock `@Spillgame_bot` dan coba lagi") 56 | return 57 | await event.edit(f"**Pesan spill**\n\n{response.message.message}") 58 | 59 | 60 | CMD_HELP.update( 61 | { 62 | "truth_dare": f"** Plugin :** truth_dare\ 63 | \n\n • Perintah : `{cmd}truth`\ 64 | \n • Function : Untuk mengirim pesan truth\ 65 | \n\n • Perintah : `{cmd}dare`\ 66 | \n • Function : Untuk mengirim pesan dare\ 67 | \n\n • Perintah : `{cmd}spill`\ 68 | \n • Function : Untuk Pertanyaan\ 69 | " 70 | } 71 | ) 72 | -------------------------------------------------------------------------------- /userbot/utils/events.py: -------------------------------------------------------------------------------- 1 | 2 | from telethon.tl.types import MessageEntityMentionName 3 | 4 | 5 | from userbot.core.logger import logging 6 | from userbot.utils.tools import edit_delete 7 | 8 | LOGS = logging.getLogger("userbot") 9 | 10 | 11 | async def get_user_from_event( 12 | event, Xaevent=None, secondgroup=None, nogroup=False, noedits=False 13 | ): # sourcery no-metrics 14 | if Xaevent is None: 15 | Xaevent = event 16 | if nogroup is False: 17 | if secondgroup: 18 | args = event.pattern_match.group(2).split(" ", 1) 19 | else: 20 | args = event.pattern_match.group(1).split(" ", 1) 21 | extra = None 22 | try: 23 | if args: 24 | user = args[0] 25 | if len(args) > 1: 26 | extra = "".join(args[1:]) 27 | if user.isnumeric() or (user.startswith("-") 28 | and user[1:].isnumeric()): 29 | user = int(user) 30 | if event.message.entities: 31 | probable_user_mention_entity = event.message.entities[0] 32 | if isinstance( 33 | probable_user_mention_entity, 34 | MessageEntityMentionName): 35 | user_id = probable_user_mention_entity.user_id 36 | user_obj = await event.client.get_entity(user_id) 37 | return user_obj, extra 38 | if isinstance(user, int) or user.startswith("@"): 39 | user_obj = await event.client.get_entity(user) 40 | return user_obj, extra 41 | except Exception: 42 | pass 43 | try: 44 | if nogroup is False: 45 | if secondgroup: 46 | extra = event.pattern_match.group(2) 47 | else: 48 | extra = event.pattern_match.group(1) 49 | if event.is_private: 50 | user_obj = await event.get_chat() 51 | return user_obj, extra 52 | if event.reply_to_msg_id: 53 | previous_message = await event.get_reply_message() 54 | if previous_message.from_id is None: 55 | if not noedits: 56 | await edit_delete(Xaevent, "`Well that's an anonymous admin !`") 57 | return None, None 58 | user_obj = await event.client.get_entity(previous_message.sender_id) 59 | return user_obj, extra 60 | elif not args: 61 | if not noedits: 62 | await edit_delete( 63 | Xaevent, "`Pass the user's username, id or reply!`", 5 64 | ) 65 | return None, None 66 | except Exception as e: 67 | LOGS.error(str(e)) 68 | if not noedits: 69 | await edit_delete(Xaevent, "__Couldn't fetch user to proceed further__") 70 | return None, None 71 | -------------------------------------------------------------------------------- /userbot/modules/wibu2.py: -------------------------------------------------------------------------------- 1 | # JANGAN HAPUS INI! © @JustRex 2 | # Copyright Milik Xa-Userbot 3 | 4 | 5 | import random 6 | 7 | from userbot import CMD_HANDLER as cmd 8 | from userbot import CMD_HELP 9 | from userbot.utils import Xa_cmd 10 | 11 | from userbot import owner 12 | from telethon.tl.types import InputMessagesFilterPhotos 13 | from telethon.tl.types import InputMessagesFilterVideo 14 | 15 | 16 | @Xa_cmd(pattern="ppanime$") 17 | async def _(event): 18 | try: 19 | ppanimenya = [ 20 | ppanime 21 | async for ppanime in event.client.iter_messages( 22 | "@animehikarixa", filter=InputMessagesFilterPhotos 23 | ) 24 | ] 25 | aing = await event.client.get_me() 26 | await event.client.send_file( 27 | event.chat_id, 28 | file=random.choice(ppanimenya), 29 | caption=f"**nih pp anime buat** [{owner}](tg://user?id={aing.id})", 30 | ) 31 | await event.delete() 32 | except Exception: 33 | await event.edit("**Lagi Ga Nemu pp anime!.**") 34 | 35 | 36 | @Xa_cmd(pattern="wallanime$") 37 | async def _(event): 38 | try: 39 | wallpapernya = [ 40 | wallpaper 41 | async for wallpaper in event.client.iter_messages( 42 | "@Anime_WallpapersHD", filter=InputMessagesFilterPhotos 43 | ) 44 | ] 45 | aing = await event.client.get_me() 46 | await event.client.send_file( 47 | event.chat_id, 48 | file=random.choice(wallpapernya), 49 | caption=f"**Anime Wallpaper By** [{owner}](tg://user?id={aing.id})", 50 | ) 51 | await event.delete() 52 | except Exception: 53 | await event.edit("**Silahkan coba lagi.**") 54 | 55 | 56 | @Xa_cmd(pattern="shortanime$") 57 | async def _(event): 58 | try: 59 | shortanimenya = [ 60 | shortanime 61 | async for shortanime in event.client.iter_messages( 62 | "@anime_status998", filter=InputMessagesFilterVideo 63 | ) 64 | ] 65 | aing = await event.client.get_me() 66 | await event.client.send_file( 67 | event.chat_id, 68 | file=random.choice(shortanimenya), 69 | caption=f"**short anime video by** [{owner}](tg://user?id={aing.id})", 70 | ) 71 | await event.delete() 72 | except Exception: 73 | await event.edit("**maaf lagi ga ada videonya, coba lagi deh.**") 74 | 75 | 76 | CMD_HELP.update({ 77 | "wibu2": f"𝙋𝙚𝙧𝙞𝙣𝙩𝙖𝙝: `{cmd}ppanime`\ 78 | \n↳ : untuk mendapatkan pp anime random.\ 79 | \n\n𝙋𝙚𝙧𝙞𝙣𝙩𝙖𝙝: `{cmd}wallanime`\ 80 | \n↳ : Untuk Mendapatkan Wallpaper Aninme Random.\ 81 | \n\n𝙋𝙚𝙧𝙞𝙣𝙩𝙖𝙝: `{cmd}shortanime`\ 82 | \n↳ : Untuk Mendapatkan Video Anime Pendek untuk Status whatsapp." 83 | }) 84 | -------------------------------------------------------------------------------- /userbot/modules/core.py: -------------------------------------------------------------------------------- 1 | # Recode By @mrismanaziz 2 | # FROM Geez-Project 3 | 4 | import importlib 5 | import logging 6 | import os 7 | import sys 8 | from pathlib import Path 9 | 10 | from userbot import CMD_HELP, LOGS, bot # pylint:disable=E0602 11 | from userbot.events import register 12 | 13 | DELETE_TIMEOUT = 5 14 | 15 | 16 | def load_module(shortname): 17 | if shortname.startswith("__"): 18 | pass 19 | elif shortname.endswith("_"): 20 | path = Path(f"userbot/modules/{shortname}.py") 21 | name = "userbot.modules.{}".format(shortname) 22 | spec = importlib.util.spec_from_file_location(name, path) 23 | mod = importlib.util.module_from_spec(spec) 24 | spec.loader.exec_module(mod) 25 | LOGS.info("Successfully imported " + shortname) 26 | else: 27 | 28 | path = Path(f"userbot/modules/{shortname}.py") 29 | name = "userbot.modules.{}".format(shortname) 30 | spec = importlib.util.spec_from_file_location(name, path) 31 | mod = importlib.util.module_from_spec(spec) 32 | mod.bot = bot 33 | mod.LOGS = LOGS 34 | mod.CMD_HELP = CMD_HELP 35 | mod.logger = logging.getLogger(shortname) 36 | spec.loader.exec_module(mod) 37 | # for imports 38 | sys.modules["userbot.modules." + shortname] = mod 39 | LOGS.info("Successfully imported " + shortname) 40 | 41 | 42 | @register(outgoing=True, pattern=r"^\.install$") 43 | async def _(event): 44 | if event.fwd_from: 45 | return 46 | if event.reply_to_msg_id: 47 | try: 48 | await event.edit("`Installing Modules...`") 49 | downloaded_file_name = ( 50 | await event.client.download_media( # pylint:disable=E0602 51 | await event.get_reply_message(), 52 | "userbot/modules/", # pylint:disable=E0602 53 | ) 54 | ) 55 | if "(" not in downloaded_file_name: 56 | path1 = Path(downloaded_file_name) 57 | shortname = path1.stem 58 | load_module(shortname.replace(".py", "")) 59 | await event.edit( 60 | "**Plugin** `{}` **Berhasil di install**".format( 61 | os.path.basename(downloaded_file_name) 62 | ) 63 | ) 64 | else: 65 | os.remove(downloaded_file_name) 66 | await event.edit("**Error!** Plugin ini sudah terinstall di userbot.") 67 | except Exception as e: # pylint:disable=C0103,W0703 68 | await event.edit(str(e)) 69 | os.remove(downloaded_file_name) 70 | 71 | 72 | CMD_HELP.update( 73 | { 74 | "core": "**Plugin : **`core`\ 75 | \n\n • **Syntax :** `.install` \ 76 | \n • **Function : **Untuk Menginstall plugins userbot secara instan.\ 77 | " 78 | } 79 | ) 80 | -------------------------------------------------------------------------------- /userbot/modules/asupan.py: -------------------------------------------------------------------------------- 1 | # © @tofik_dn 2 | # ⚠️ Do not remove credits 3 | # recode by @greyyvbss @JustRex 4 | 5 | import random 6 | 7 | from userbot import CMD_HANDLER as cmd 8 | from userbot import CMD_HELP 9 | from userbot.utils import Xa_cmd 10 | 11 | from userbot import owner 12 | from telethon.tl.types import InputMessagesFilterVideo 13 | from telethon.tl.types import InputMessagesFilterVoice 14 | 15 | 16 | @Xa_cmd(pattern="asupan$") 17 | async def _(event): 18 | try: 19 | asupannya = [ 20 | asupan 21 | async for asupan in event.client.iter_messages( 22 | "@asupancilikbot", filter=InputMessagesFilterVideo 23 | ) 24 | ] 25 | aing = await event.client.get_me() 26 | await event.client.send_file( 27 | event.chat_id, 28 | file=random.choice(asupannya), 29 | caption=f"Nih kak asupan buat [{owner}](tg://user?id={aing.id})", 30 | ) 31 | await event.delete() 32 | except Exception: 33 | await event.edit("Tidak bisa menemukan video asupan.") 34 | 35 | 36 | @Xa_cmd(pattern="desah$") 37 | async def _(event): 38 | try: 39 | desahnya = [ 40 | desah 41 | async for desah in event.client.iter_messages( 42 | "@deshanhiroshi", filter=InputMessagesFilterVoice 43 | ) 44 | ] 45 | aing = await event.client.get_me() 46 | await event.client.send_file( 47 | event.chat_id, 48 | file=random.choice(desahnya), 49 | caption=f"Jangan Sange ya kak, nih desah buat [{owner}](tg://user?id={aing.id})", 50 | ) 51 | await event.delete() 52 | except Exception: 53 | await event.edit("sange nya ditahan dulu ya kak.") 54 | 55 | 56 | @Xa_cmd(pattern="asupan2$") 57 | async def _(event): 58 | try: 59 | asupannya = [ 60 | asupan 61 | async for asupan in event.client.iter_messages( 62 | "@Okeokelhh", filter=InputMessagesFilterVideo 63 | ) 64 | ] 65 | aing = await event.client.get_me() 66 | await event.client.send_file( 67 | event.chat_id, 68 | file=random.choice(asupannya), 69 | caption=f"Nih kak asupan buat [{owner}](tg://user?id={aing.id})", 70 | ) 71 | await event.delete() 72 | except Exception: 73 | await event.edit("Tidak bisa menemukan video asupan.") 74 | 75 | 76 | CMD_HELP.update( 77 | { 78 | "asupan": f"**Plugin : **asupan\ 79 | \n\n • **𝙋𝙚𝙧𝙞𝙣𝙩𝙖𝙝 :** {cmd}asupan\ 80 | \n ⌬ **𝙁𝙪𝙣𝙜𝙨𝙞 : **Untuk Mengirim video asupan secara random.\ 81 | \n\n • **𝙋𝙚𝙧𝙞𝙣𝙩𝙖𝙝 :** {cmd}asupan2\ 82 | \n ⌬ **𝙁𝙪𝙣𝙜𝙨𝙞 : **Untuk Mengirim video asupan Cewe.\ 83 | \n\n • **𝙋𝙚𝙧𝙞𝙣𝙩𝙖𝙝 :** {cmd}desah\ 84 | \n ⌬ **𝙁𝙪𝙣𝙜𝙨𝙞 : **Untuk Mengirim voice desah secara random.\ 85 | " 86 | } 87 | ) 88 | -------------------------------------------------------------------------------- /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/tiny.py: -------------------------------------------------------------------------------- 1 | # Ported By VCKYOU @VckyouuBitch 2 | # Fixes By Koala @Manusiarakitann 3 | 4 | from PIL import Image 5 | import cv2 6 | import os 7 | from userbot.utils import Xa_cmd 8 | from userbot import CMD_HELP, bot 9 | 10 | 11 | @Xa_cmd(pattern="tiny(?: |$)(.*)") 12 | async def _(event): 13 | reply = await event.get_reply_message() 14 | if not (reply and (reply.media)): 15 | await event.edit("`Mohon Balas Ke Sticker`") 16 | return 17 | xx = await event.edit("`Memproses Tiny....`") 18 | ik = await bot.download_media(reply) 19 | im1 = Image.open("resources/sky_blank.png") 20 | if ik.endswith(".tgs"): 21 | await event.client.download_media(reply, "geez.tgs") 22 | os.system("lottie_convert.py geez.tgs json.json") 23 | json = open("json.json", "r") 24 | jsn = json.read() 25 | json.close() 26 | jsn = jsn.replace("512", "2000") 27 | open("json.json", "w").write(jsn) 28 | os.system("lottie_convert.py json.json geez.tgs") 29 | file = "geez.tgs" 30 | os.remove("json.json") 31 | elif ik.endswith((".gif", ".mp4")): 32 | iik = cv2.VideoCapture(ik) 33 | dani, busy = iik.read() 34 | cv2.imwrite("i.png", busy) 35 | fil = "i.png" 36 | im = Image.open(fil) 37 | z, d = im.size 38 | if z == d: 39 | xxx, yyy = 200, 200 40 | else: 41 | t = z + d 42 | a = z / t 43 | b = d / t 44 | aa = (a * 100) - 50 45 | bb = (b * 100) - 50 46 | xxx = 200 + 5 * aa 47 | yyy = 200 + 5 * bb 48 | k = im.resize((int(xxx), int(yyy))) 49 | k.save("k.png", format="PNG", optimize=True) 50 | im2 = Image.open("k.png") 51 | back_im = im1.copy() 52 | back_im.paste(im2, (150, 0)) 53 | back_im.save("o.webp", "WEBP", quality=95) 54 | file = "o.webp" 55 | os.remove(fil) 56 | os.remove("k.png") 57 | else: 58 | im = Image.open(ik) 59 | z, d = im.size 60 | if z == d: 61 | xxx, yyy = 200, 200 62 | else: 63 | t = z + d 64 | a = z / t 65 | b = d / t 66 | aa = (a * 100) - 50 67 | bb = (b * 100) - 50 68 | xxx = 200 + 5 * aa 69 | yyy = 200 + 5 * bb 70 | k = im.resize((int(xxx), int(yyy))) 71 | k.save("k.png", format="PNG", optimize=True) 72 | im2 = Image.open("k.png") 73 | back_im = im1.copy() 74 | back_im.paste(im2, (150, 0)) 75 | back_im.save("o.webp", "WEBP", quality=95) 76 | file = "o.webp" 77 | os.remove("k.png") 78 | await event.client.send_file(event.chat_id, file, reply_to=event.reply_to_msg_id) 79 | await xx.delete() 80 | os.remove(file) 81 | os.remove(ik) 82 | 83 | 84 | CMD_HELP.update({ 85 | f"tiny": "𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}tiny`\ 86 | \nUsage : Untuk Memperkecil Sticker."}) 87 | -------------------------------------------------------------------------------- /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, CMD_HANDLER as cmd 13 | from userbot.utils import Xa_cmd 14 | 15 | 16 | @Xa_cmd(pattern="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 | @Xa_cmd(pattern="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": f">`{cmd}hash`" 79 | "\nUsage: Find the md5, sha1, sha256, sha512 of the string when written into a txt file.", 80 | "base64": f">`{cmd}base64 [en or de]`" 81 | "\nUsage: Find the base64 encoding of the given string or decode it.", 82 | }) 83 | -------------------------------------------------------------------------------- /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.utils import Xa_cmd 8 | from userbot import ALIVE_NAME, CMD_HELP, bot, CMD_HANDLER as cmd 9 | 10 | # ================= CONSTANT ================= 11 | DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else uname().node 12 | # ============================================ 13 | 14 | 15 | @Xa_cmd(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"`Globall Banned!! User 𝙂𝘽𝘼𝙉𝙉𝙀𝘿 By` {DEFAULTUSER}\n" 22 | no_reason = "No Reason Given " 23 | await event.edit("**𝘎𝘓𝘖𝘉𝘈𝘓 𝘉𝘈𝘕𝘕𝘌𝘋 𝘈𝘒𝘈𝘕 𝘚𝘌𝘎𝘌𝘙𝘈 𝘈𝘒𝘛𝘐𝘍...**") 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 = ("`Globall Banned!!`" 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"Global Banned!! User 𝙂𝘽𝘼𝙉𝙉𝙀𝘿 By {DEFAULTUSER} \nReason: No Reason Given. ") 59 | await event.reply(mention) 60 | await event.delete() 61 | 62 | CMD_HELP.update({ 63 | "fakegban": f"`{cmd}fgban`\ 64 | \nUsage: Type .fgban or Reply .fgban reason and see it yourself. " 65 | }) 66 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |

xᴀ ᴜsᴇʀʙᴏᴛ

3 | 4 |

5 | 6 | 7 | 8 | PYTHON 9 |

10 | 11 | ![](https://github.com/Rexashh/Xa-Userbot/blob/Xa-Userbot/resources/ezgif-1-47328533dd.gif) 12 | 13 | ## ᴅɪsᴄʟᴀɪᴍᴇʀ : 14 | 15 | Saya tidak bertanggung jawab atas penyalahgunaan bot ini. 16 | Bot ini dimaksudkan untuk bersenang-senang sekaligus membantu anda 17 | mengelola grup secara efisien dan mengotomatiskan beberapa hal yang membosankan. 18 | Gunakan bot ini dengan risiko Anda sendiri, dan gunakan userbot ini dengan bijak. 19 | 20 | ## ᴛᴜᴛᴏʀɪᴀʟ : 21 | klik tombol dibawah ini untuk melihat tutorial deploy xa userbot : 22 | 23 | [![Full Tutorial](https://img.shields.io/badge/Tonton%20Video-green)](https://t.me/tutorialuserbottelegram/127) 24 | 25 | ## ᴅᴇᴘʟᴏʏ : 26 | 27 |

28 |

29 | 30 | 31 | ## sᴜᴘᴘᴏʀᴛ & ᴜᴘᴅᴀᴛᴇs : 32 | 33 | 34 | 35 | ## ᴀʙᴏᴜᴛ ᴍᴇ : 36 |

37 | 38 |

39 |

40 | 41 | 42 | 43 | 44 | ## ᴏʀɪɢɪɴᴀʟ ʀᴇᴘᴏ & sᴘᴇᴄɪᴀʟ ᴛʜᴀɴᴋs : 45 | 46 | * [Kyy-Userbot](https://github.com/muhammadrizky16/Kyy-Userbot) 47 | * Special Thanks To : [TONIC](https://github.com/Tonic990) 48 | * Special Thanks To : [KYY](https://github.com/muhammadrizky16) 49 | * Thank you to all Indonesian Userbot Developers 🇮🇩 50 | 51 | -------------------------------------------------------------------------------- /userbot/modules/tags.py: -------------------------------------------------------------------------------- 1 | # Port By @VckyouuBitch From Geez - Project 2 | # Copyright © Geez - Project 3 | # Credits By Ultroid 4 | 5 | from telethon.tl.types import ChannelParticipantAdmin as admin 6 | from telethon.tl.types import ChannelParticipantCreator as owner 7 | from telethon.tl.types import UserStatusOffline as off 8 | from telethon.tl.types import UserStatusOnline as onn 9 | from telethon.tl.types import UserStatusRecently as rec 10 | from telethon.utils import get_display_name 11 | 12 | from userbot.utils import Xa_cmd 13 | from userbot import CMD_HELP, CMD_HANDLER as cmd 14 | 15 | 16 | @Xa_cmd(pattern="tag(on|off|all|bots|rec|admins|owner)?(.*)") 17 | async def _(e): 18 | okk = e.text 19 | lll = e.pattern_match.group(2) 20 | users = 0 21 | o = 0 22 | nn = 0 23 | rece = 0 24 | if lll: 25 | xx = f"{lll}" 26 | else: 27 | xx = "" 28 | async for bb in e.client.iter_participants(e.chat_id, 99): 29 | users = users + 1 30 | x = bb.status 31 | y = bb.participant 32 | if isinstance(x, onn): 33 | o = o + 1 34 | if "on" in okk: 35 | xx += f"\n[{get_display_name(bb)}](tg://user?id={bb.id})" 36 | if isinstance(x, off): 37 | nn = nn + 1 38 | if "off" in okk: 39 | if not (bb.bot or bb.deleted): 40 | xx += f"\n[{get_display_name(bb)}](tg://user?id={bb.id})" 41 | if isinstance(x, rec): 42 | rece = rece + 1 43 | if "rec" in okk: 44 | if not (bb.bot or bb.deleted): 45 | xx += f"\n[{get_display_name(bb)}](tg://user?id={bb.id})" 46 | if isinstance(y, owner): 47 | if "admin" or "owner" in okk: 48 | xx += f"\n👑 [{get_display_name(bb)}](tg://user?id={bb.id}) 👑" 49 | if isinstance(y, admin): 50 | if "admin" in okk: 51 | if not bb.deleted: 52 | xx += f"\n[{get_display_name(bb)}](tg://user?id={bb.id})" 53 | if "all" in okk: 54 | if not (bb.bot or bb.deleted): 55 | xx += f"\n[{get_display_name(bb)}](tg://user?id={bb.id})" 56 | if "bot" in okk: 57 | if bb.bot: 58 | xx += f"\n[{get_display_name(bb)}](tg://user?id={bb.id})" 59 | await e.client.send_message(e.chat_id, xx) 60 | await e.delete() 61 | 62 | 63 | CMD_HELP.update({ 64 | 'tags': 65 | f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}tag all`" 66 | "\n• : Tag Top 100 Members of chat." 67 | f"\n\n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}tag admin`" 68 | "\n• : Tag Admins of that chat." 69 | f"\n\n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}tag owner`" 70 | "\n• : Tag Owner of that chat." 71 | f"\n\n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}tag bot`" 72 | "\n• : Tag Bots of that chat." 73 | f"\n\n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}tag rec`" 74 | "\n• : Tag recently Active Members." 75 | f"\n\n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}tag on`" 76 | "\n• : Tag online Members(work only if privacy off)." 77 | f"\n\n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}tag off`" 78 | "\n• : Tag Offline Members(work only if privacy off)." 79 | }) 80 | -------------------------------------------------------------------------------- /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("`Processing...`") 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"`⚠️Confirmed : {country_data['confirmed']} (+{country_data['new_cases']})`\n" 19 | output_text += f"`☢️Active : {country_data['active']}`\n" 20 | output_text += f"`🤕Critical : {country_data['critical']}`\n" 21 | output_text += f"`😟New Deaths : {country_data['new_deaths']}`\n\n" 22 | output_text += f"`⚰️Deaths : {country_data['deaths']} (+{country_data['new_deaths']})`\n" 23 | output_text += f"`😔New Cases : {country_data['new_cases']}`\n" 24 | output_text += f"`😇Recovered : {country_data['recovered']}`\n" 25 | output_text += f"`🧪Total tests : {country_data['total_tests']}`\n\n" 26 | output_text += f"Data provided by [Worldometer](https://www.worldometers.info/coronavirus/country/{country})" 27 | else: 28 | output_text = "No information yet about this country!" 29 | 30 | await event.edit(f"`Corona Virus Info in {country}:`\n\n{output_text}") 31 | 32 | 33 | @register(outgoing=True, pattern="^.covid$") 34 | async def corona(event): 35 | await event.edit("`Processing...`") 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"`⚠️Confirmed : {country_data['confirmed']} (+{country_data['new_cases']})`\n" 41 | output_text += f"`☢️Active : {country_data['active']}`\n" 42 | output_text += f"`🤕Critical : {country_data['critical']}`\n" 43 | output_text += f"`😟New Deaths : {country_data['new_deaths']}`\n\n" 44 | output_text += f"`⚰️Deaths : {country_data['deaths']} (+{country_data['new_deaths']})`\n" 45 | output_text += f"`😔New Cases : {country_data['new_cases']}`\n" 46 | output_text += f"`😇Recovered : {country_data['recovered']}`\n" 47 | output_text += "`🧪Total tests : N/A`\n\n" 48 | output_text += f"Data provided by [Worldometer](https://www.worldometers.info/coronavirus/country/{country})" 49 | else: 50 | output_text = "No information yet about this country!" 51 | 52 | await event.edit(f"`Corona Virus Info in {country}:`\n\n{output_text}") 53 | 54 | 55 | CMD_HELP.update({"covid": "`.covid `****" 56 | "\n`Usage: Get an information about covid-19 data in your country.`\n\n" 57 | "`.covid`" 58 | "\n`Usage: Get an information about covid-19 data in Worldwide.`\n"}) 59 | -------------------------------------------------------------------------------- /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 | # Default .alive logo 73 | ALIVE_LOGO = any logo 74 | 75 | # Time & Date - Country and Time Zone 76 | COUNTRY = 77 | TZ_NUMBER = 78 | 79 | # Clean Welcome 80 | CLEAN_WELCOME = True or False 81 | 82 | # Last.fm Module 83 | BIO_PREFIX = any txt 84 | DEFAULT_BIO = any txt 85 | 86 | LASTFM_API = 87 | LASTFM_SECRET = 88 | LASTFM_USERNAME = 89 | LASTFM_PASSWORD_PLAIN = 90 | LASTFM_PASS = 91 | 92 | 93 | # Google Drive Module 94 | G_DRIVE_CLIENT_ID = 95 | G_DRIVE_CLIENT_SECRET = 96 | G_DRIVE_AUTH_TOKEN_DATA = 97 | G_DRIVE_FOLDER_ID = 98 | G_DRIVE_DATA 99 | TYPE .remixhelp AND CHECK GDRIVE TUTORIAL 100 | YOU ONLY NEED TWO GDRIVE VARS AS SHOWN IN THE PICTURE https: // prnt.sc / sguzo2 101 | TEMP_DOWNLOAD_DIRECTORY = no need to change this value 102 | 103 | # Genius lyrics get this value from https://genius.com/developers both has 104 | # same values 105 | GENIUS_API_TOKEN = 106 | # Genius lyrics get this value from https://genius.com/developers both has 107 | # same values 108 | GENIUS = 109 | -------------------------------------------------------------------------------- /userbot/modules/github.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2021 Catuserbot 2 | # Ported by @mrismanaziz 3 | # FROM Man-Userbot 4 | # t.me/SharingUserbot & t.me/Lunatic0de 5 | 6 | import os 7 | 8 | import aiohttp 9 | import requests 10 | from pySmartDL import SmartDL 11 | 12 | from userbot import CMD_HANDLER as cmd 13 | from userbot import CMD_HELP 14 | from userbot.utils import edit_delete, edit_or_reply, Xa_cmd, reply_id 15 | 16 | ppath = os.path.join(os.getcwd(), "temp", "githubuser.jpg") 17 | 18 | 19 | @Xa_cmd(pattern="github( -l(\\d+))? ([\\s\\S]*)") 20 | async def _(event): 21 | reply_to = await reply_id(event) 22 | username = event.pattern_match.group(3) 23 | URL = f"https://api.github.com/users/{username}" 24 | async with aiohttp.ClientSession() as session, session.get(URL) as request: 25 | if request.status == 404: 26 | return await edit_delete(event, "`" + username + " Not Found`") 27 | catevent = await edit_or_reply(event, "`fetching github info ...`") 28 | result = await request.json() 29 | photo = result["avatar_url"] 30 | if result["bio"]: 31 | result["bio"] = result["bio"].strip() 32 | repos = [] 33 | sec_res = requests.get(result["repos_url"]) 34 | if sec_res.status_code == 200: 35 | limit = event.pattern_match.group(2) 36 | limit = 5 if not limit else int(limit) 37 | for repo in sec_res.json(): 38 | repos.append(f"[{repo['name']}]({repo['html_url']})") 39 | limit -= 1 40 | if limit == 0: 41 | break 42 | REPLY = "**GitHub Info for** `{username}`\ 43 | \n👤 **Name :** [{name}]({html_url})\ 44 | \n🔧 **Type :** `{type}`\ 45 | \n🏢 **Company :** `{company}`\ 46 | \n🔭 **Blog :** {blog}\ 47 | \n📍 **Location :** `{location}`\ 48 | \n📝 **Bio :** __{bio}__\ 49 | \n❤️ **Followers :** `{followers}`\ 50 | \n👁 **Following :** `{following}`\ 51 | \n📊 **Public Repos :** `{public_repos}`\ 52 | \n📄 **Public Gists :** `{public_gists}`\ 53 | \n🔗 **Profile Created :** `{created_at}`\ 54 | \n✏️ **Profile Updated :** `{updated_at}`".format( 55 | username=username, **result 56 | ) 57 | 58 | if repos: 59 | REPLY += "\n🔍 **Some Repos** : " + " | ".join(repos) 60 | downloader = SmartDL(photo, ppath, progress_bar=False) 61 | downloader.start(blocking=False) 62 | await event.client.send_file( 63 | event.chat_id, 64 | ppath, 65 | caption=REPLY, 66 | reply_to=reply_to, 67 | ) 68 | os.remove(ppath) 69 | await catevent.delete() 70 | 71 | 72 | CMD_HELP.update( 73 | { 74 | "github": f"**Plugin : **`github`\ 75 | \n\n ⌬ **𝙋𝙚𝙧𝙞𝙣𝙩𝙖𝙝 :** `{cmd}github` \ 76 | \n ⌬ **𝙁𝙪𝙣𝙜𝙨𝙞 : **Menampilkan informasi tentang user di GitHub dari username yang diberikan\ 77 | " 78 | } 79 | ) 80 | -------------------------------------------------------------------------------- /userbot/modules/scraper.py: -------------------------------------------------------------------------------- 1 | # Coded By Abdul 2 | # Ported By VckyAuliaZulfikar @VckyouuBitch 3 | # 4 | # Geez Projects UserBot 5 | # Copyright (C) 2021 GeezProjects 6 | # 7 | # This file is a part of 8 | # PLease read the GNU Affero General Public License in 9 | # . 10 | 11 | import asyncio 12 | import csv 13 | import random 14 | 15 | from telethon.errors.rpcerrorlist import ( 16 | UserAlreadyParticipantError, 17 | UserPrivacyRestrictedError, 18 | UserNotMutualContactError 19 | ) 20 | 21 | from userbot.utils import Xa_cmd 22 | from userbot import CMD_HELP, CMD_HANDLER as cmd 23 | from telethon.tl.functions.channels import InviteToChannelRequest 24 | from telethon.tl.types import InputPeerUser 25 | 26 | 27 | @Xa_cmd(pattern="getmemb$") 28 | async def scrapmem(event): 29 | chat = event.chat_id 30 | await event.edit("`Mohon tunggu...`") 31 | event.client 32 | members = await event.client.get_participants(chat, aggressive=True) 33 | 34 | with open("members.csv", "w", encoding="UTF-8") as f: 35 | writer = csv.writer(f, delimiter=",", lineterminator="\n") 36 | writer.writerow(["user_id", "hash"]) 37 | for member in members: 38 | writer.writerow([member.id, member.access_hash]) 39 | await event.edit("`Berhasil Mengumpulkan Member..`") 40 | 41 | 42 | @Xa_cmd(pattern="addmemb$") 43 | async def admem(event): 44 | await event.edit("`Proses Menambahkan 0 Member...`") 45 | chat = await event.get_chat() 46 | event.client 47 | users = [] 48 | with open("members.csv", encoding="UTF-8") as f: 49 | rows = csv.reader(f, delimiter=",", lineterminator="\n") 50 | next(rows, None) 51 | for row in rows: 52 | user = {'id': int(row[0]), 'hash': int(row[1])} 53 | users.append(user) 54 | n = 0 55 | for user in users: 56 | n += 1 57 | if n % 30 == 0: 58 | await event.edit(f"**Mencapai 30 anggota, tunggu selama {900/60} menit**") 59 | await asyncio.sleep(900) 60 | try: 61 | userin = InputPeerUser(user['id'], user['hash']) 62 | await event.client(InviteToChannelRequest(chat, [userin])) 63 | await asyncio.sleep(random.randrange(5, 7)) 64 | await event.edit(f"`Prosess Menambahkan {n} Member...`") 65 | except TypeError: 66 | n -= 1 67 | continue 68 | except UserAlreadyParticipantError: 69 | n -= 1 70 | continue 71 | except UserPrivacyRestrictedError: 72 | n -= 1 73 | continue 74 | except UserNotMutualContactError: 75 | n -= 1 76 | continue 77 | 78 | 79 | CMD_HELP.update({ 80 | "scraper": 81 | f"𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}getmemb`\ 82 | \nUsage : Mengumpulkan Anggota dari Obrolan\ 83 | \n\n𝘾𝙤𝙢𝙢𝙖𝙣𝙙: `{cmd}addmemb`\ 84 | \nUsage : Menambahkan Anggota ke Obrolan\ 85 | \nTata Cara Menggunakannya: Pertama, Anda harus melakukan .getmemb terlebih dahulu dari Obrolan. Lalu buka grup Anda dan ketik .addmemb untuk menambahkan mereka ke grup Anda." 86 | }) 87 | --------------------------------------------------------------------------------