Spaces:
Paused
Paused
Commit
·
d7854c4
1
Parent(s):
9267d87
Ultroid v0.7 Updates
Browse filesDate: 30-8-2022
Co-Authored-By: Aditya <[email protected]>
Co-Authored-By: Amit Sharma <[email protected]>
Co-Authored-By: CyrusXD <[email protected]>
Co-Authored-By: Danish <[email protected]>
Co-Authored-By: TechiError <[email protected]>
Co-Authored-By: Arnab Paryali <[email protected]>
This view is limited to 50 files because it contains too many changes.
See raw diff
- .github/ISSUE_TEMPLATE/bug-reports.yml +7 -7
- .github/ISSUE_TEMPLATE/config.yml +2 -2
- .github/workflows/autotranslate.yml +33 -0
- .github/workflows/pylint.yaml +44 -0
- .github/workflows/stringanalysis.yml +33 -0
- .gitignore +5 -3
- README.md +4 -2
- app.json +2 -2
- assistant/__init__.py +6 -6
- assistant/callbackstuffs.py +40 -46
- assistant/games.py +13 -7
- assistant/initial.py +9 -7
- assistant/inlinestuff.py +72 -335
- assistant/localization.py +11 -3
- assistant/manager/__init__.py +1 -1
- assistant/manager/_help.py +4 -4
- assistant/manager/admins.py +2 -1
- assistant/manager/afk.py +2 -1
- assistant/manager/misc.py +3 -3
- assistant/manager/stickermanager.py +24 -10
- assistant/pmbot.py +6 -5
- assistant/start.py +5 -5
- assistant/ytdl.py +30 -20
- installer.sh +50 -7
- plugins/__init__.py +18 -14
- plugins/_chatactions.py +9 -10
- plugins/_help.py +12 -11
- plugins/_inline.py +27 -49
- plugins/_ultroid.py +3 -3
- plugins/_userlogs.py +3 -4
- plugins/_wspr.py +3 -4
- plugins/admintools.py +15 -54
- plugins/afk.py +6 -10
- plugins/antiflood.py +7 -15
- plugins/asstcmd.py +6 -13
- plugins/audiotools.py +17 -35
- plugins/autoban.py +5 -21
- plugins/autocorrect.py +0 -61
- plugins/autopic.py +5 -8
- plugins/beautify.py +7 -15
- plugins/blacklist.py +4 -16
- plugins/bot.py +30 -52
- plugins/broadcast.py +9 -22
- plugins/button.py +7 -11
- plugins/calculator.py +10 -10
- plugins/channelhacks.py +9 -35
- plugins/chatbot.py +6 -16
- plugins/chats.py +5 -31
- plugins/cleanaction.py +3 -12
- plugins/compressor.py +19 -28
.github/ISSUE_TEMPLATE/bug-reports.yml
CHANGED
@@ -30,18 +30,18 @@ body:
|
|
30 |
label: Version
|
31 |
description: What version of Ultroid are you running?
|
32 |
options:
|
33 |
-
- 0.
|
34 |
-
- 0.
|
35 |
-
- 0.
|
36 |
-
- 0.
|
37 |
-
|
38 |
validations:
|
39 |
required: true
|
40 |
- type: dropdown
|
41 |
id: hosted
|
42 |
attributes:
|
43 |
label: Hosted On
|
44 |
-
description: You
|
45 |
options:
|
46 |
- Vps
|
47 |
- Heroku
|
@@ -65,4 +65,4 @@ body:
|
|
65 |
description: By submitting this issue, you agree that you have read the [docs](https://ultroid.tech) and gone through the [deploy tutorial](https://www.youtube.com/watch?v=9wF7k9qA0Q4) at first.
|
66 |
options:
|
67 |
- label: I have followed all of the above steps.
|
68 |
-
required: true
|
|
|
30 |
label: Version
|
31 |
description: What version of Ultroid are you running?
|
32 |
options:
|
33 |
+
- "0.5"
|
34 |
+
- "0.6"
|
35 |
+
- "0.7"
|
36 |
+
- "> 0.7"
|
37 |
+
|
38 |
validations:
|
39 |
required: true
|
40 |
- type: dropdown
|
41 |
id: hosted
|
42 |
attributes:
|
43 |
label: Hosted On
|
44 |
+
description: You are hosting Ultroid on Which Platform?
|
45 |
options:
|
46 |
- Vps
|
47 |
- Heroku
|
|
|
65 |
description: By submitting this issue, you agree that you have read the [docs](https://ultroid.tech) and gone through the [deploy tutorial](https://www.youtube.com/watch?v=9wF7k9qA0Q4) at first.
|
66 |
options:
|
67 |
- label: I have followed all of the above steps.
|
68 |
+
required: true
|
.github/ISSUE_TEMPLATE/config.yml
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
blank_issues_enabled: true
|
2 |
contact_links:
|
3 |
- name: Ultroid Support
|
4 |
-
url: https://t.me/
|
5 |
about: Please drop your doubts or queries there for an immediate response.
|
6 |
- name: Documentation
|
7 |
url: https://ultroid.tech/
|
8 |
-
about: Basic documentation for setting up.
|
|
|
1 |
blank_issues_enabled: true
|
2 |
contact_links:
|
3 |
- name: Ultroid Support
|
4 |
+
url: https://t.me/UltroidSupportChat
|
5 |
about: Please drop your doubts or queries there for an immediate response.
|
6 |
- name: Documentation
|
7 |
url: https://ultroid.tech/
|
8 |
+
about: Basic documentation for setting up.
|
.github/workflows/autotranslate.yml
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Strings Translation
|
2 |
+
|
3 |
+
on:
|
4 |
+
workflow_dispatch:
|
5 |
+
push:
|
6 |
+
branches: [ dev ]
|
7 |
+
paths:
|
8 |
+
- strings/strings/en.yml
|
9 |
+
|
10 |
+
env:
|
11 |
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
12 |
+
|
13 |
+
jobs:
|
14 |
+
analyze:
|
15 |
+
name: Checkout Strings
|
16 |
+
runs-on: ubuntu-latest
|
17 |
+
steps:
|
18 |
+
- uses: actions/checkout@v2
|
19 |
+
- name: Setup Python
|
20 |
+
uses: actions/setup-python@v2
|
21 |
+
with:
|
22 |
+
python-version: 3.9.x
|
23 |
+
- name: Update Translations
|
24 |
+
run: |
|
25 |
+
git config --global user.email "[email protected]"
|
26 |
+
git config --global user.name "New-Dev0"
|
27 |
+
git branch translation && git checkout translation
|
28 |
+
pip install pyyaml requests telethon
|
29 |
+
wget -O run.py https://gist.githubusercontent.com/New-dev0/c7d0d1eb514d311e8e3b687ae5cbe5f3/raw/350cc6d451a02a4b07d0f9bbc27b0e7c9465d3d4/updater.py
|
30 |
+
python3 run.py
|
31 |
+
rm run.py
|
32 |
+
git add . && git commit -m "[Auto] Translate" && git push --set-upstream origin translation
|
33 |
+
gh pr create --title "[Auto] Translation" -B dev --body "Update Translation"
|
.github/workflows/pylint.yaml
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: PyLint
|
2 |
+
on:
|
3 |
+
push:
|
4 |
+
branches: [ dev ]
|
5 |
+
paths:
|
6 |
+
- "**.py"
|
7 |
+
jobs:
|
8 |
+
PEP8:
|
9 |
+
runs-on: ubuntu-latest
|
10 |
+
steps:
|
11 |
+
- uses: actions/checkout@v2
|
12 |
+
- name: Setup Python
|
13 |
+
uses: actions/setup-python@v1
|
14 |
+
with:
|
15 |
+
python-version: 3.8
|
16 |
+
- name: Install Python lint libraries
|
17 |
+
run: pip install autopep8 autoflake isort black
|
18 |
+
- name: Check for showstoppers
|
19 |
+
run: |
|
20 |
+
autopep8 --verbose --in-place --recursive --aggressive --aggressive assistant/*.py
|
21 |
+
autopep8 --verbose --in-place --recursive --aggressive --aggressive assistant/manager/*.py
|
22 |
+
autopep8 --verbose --in-place --recursive --aggressive --aggressive plugins/*.py
|
23 |
+
- name: Remove unused imports and variables
|
24 |
+
run: |
|
25 |
+
autoflake --in-place --recursive --remove-all-unused-imports --remove-unused-variables --ignore-init-module-imports assistant/*.py
|
26 |
+
autoflake --in-place --recursive --remove-all-unused-imports --remove-unused-variables --ignore-init-module-imports assistant/manager/*.py
|
27 |
+
autoflake --in-place --recursive --remove-all-unused-imports --remove-unused-variables --ignore-init-module-imports plugins/*.py
|
28 |
+
- name: lint with isort and black
|
29 |
+
run: |
|
30 |
+
isort assistant/*.py
|
31 |
+
isort assistant/manager/*.py
|
32 |
+
black --fast assistant/*.py
|
33 |
+
black assistant/manager/*.py
|
34 |
+
isort plugins/*.py
|
35 |
+
black --fast plugins/*.py
|
36 |
+
- uses: stefanzweifel/git-auto-commit-action@v4
|
37 |
+
with:
|
38 |
+
commit_message: 'pylint: auto fixes'
|
39 |
+
commit_options: '--no-verify'
|
40 |
+
repository: .
|
41 |
+
commit_user_name: buddhhu
|
42 |
+
commit_user_email: [email protected]
|
43 |
+
commit_author: Amit Sharma <[email protected]>
|
44 |
+
|
.github/workflows/stringanalysis.yml
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Strings Analysis
|
2 |
+
|
3 |
+
on:
|
4 |
+
pull_request:
|
5 |
+
push:
|
6 |
+
branches: dev
|
7 |
+
paths: strings/strings/*
|
8 |
+
workflow_dispatch:
|
9 |
+
|
10 |
+
jobs:
|
11 |
+
analyze:
|
12 |
+
name: Checkout Strings
|
13 |
+
runs-on: ubuntu-latest
|
14 |
+
steps:
|
15 |
+
- uses: actions/checkout@v2
|
16 |
+
- name: Setup Python
|
17 |
+
uses: actions/setup-python@v2
|
18 |
+
with:
|
19 |
+
python-version: 3.9.x
|
20 |
+
- name: Install Stuff
|
21 |
+
run: pip install pyyaml
|
22 |
+
- name: dl stuff
|
23 |
+
run: wget -O stringizer.py https://gist.githubusercontent.com/New-dev0/6dfc8a177418565a776167764b2fe0e4/raw/f515e9892a331110c1565eb109eb712eb64423bd/stringzer.py
|
24 |
+
- name: do stuff
|
25 |
+
run: python stringizer.py && rm stringizer.py
|
26 |
+
- uses: stefanzweifel/git-auto-commit-action@v4
|
27 |
+
with:
|
28 |
+
commit_message: 'Strings: Auto Count'
|
29 |
+
commit_options: '--no-verify'
|
30 |
+
repository: .
|
31 |
+
commit_user_name: TeamUltroid
|
32 |
+
commit_user_email: [email protected]
|
33 |
+
commit_author: Amit Sharma <[email protected]>
|
.gitignore
CHANGED
@@ -14,10 +14,11 @@ test*
|
|
14 |
*.log
|
15 |
target/npmlist.json
|
16 |
package-lock.json
|
|
|
17 |
|
18 |
# Directories
|
19 |
addons/
|
20 |
-
|
21 |
__pycache__/
|
22 |
venv/
|
23 |
node_modules/
|
@@ -38,5 +39,6 @@ bin-release/
|
|
38 |
|
39 |
# temporary files
|
40 |
*.raw
|
41 |
-
|
42 |
-
|
|
|
|
14 |
*.log
|
15 |
target/npmlist.json
|
16 |
package-lock.json
|
17 |
+
resources/extras/thumbnail.jpg
|
18 |
|
19 |
# Directories
|
20 |
addons/
|
21 |
+
vcbot/
|
22 |
__pycache__/
|
23 |
venv/
|
24 |
node_modules/
|
|
|
39 |
|
40 |
# temporary files
|
41 |
*.raw
|
42 |
+
|
43 |
+
# fly.io configs
|
44 |
+
fly.toml
|
README.md
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
|
8 |
<b>A stable pluggable Telegram userbot + Voice & Video Call music bot, based on Telethon.</b>
|
9 |
|
10 |
-
[](https://github.com/TeamUltroid/Ultroid/stargazers)
|
12 |
[](https://github.com/TeamUltroid/Ultroid/fork)
|
13 |
[](https://github.com/TeamUltroid/Ultroid/)
|
@@ -84,8 +84,9 @@ Get the [Necessary Variables](#Necessary-Variables) and then click the button be
|
|
84 |
`bash startup`
|
85 |
- Windows Users:
|
86 |
`python(3) -m pyUltroid`
|
|
|
|
|
87 |
|
88 |
-
### Ultroid CLI
|
89 |
[Ultroid CLI](https://github.com/BLUE-DEVIL1134/UltroidCli) is a command-line interface for deploying Ultroid.
|
90 |
|
91 |
- **Installing** -
|
@@ -96,6 +97,7 @@ Go to [UltroidCli](https://github.com/BLUE-DEVIL1134/UltroidCli) and install the
|
|
96 |
|
97 |
- **Documentation** -
|
98 |
Take a look at the [`docs`](https://blue-devil1134.github.io/UltroidCli/) for more detailed information.
|
|
|
99 |
|
100 |
---
|
101 |
## Necessary Variables
|
|
|
7 |
|
8 |
<b>A stable pluggable Telegram userbot + Voice & Video Call music bot, based on Telethon.</b>
|
9 |
|
10 |
+
[](#)
|
11 |
[](https://github.com/TeamUltroid/Ultroid/stargazers)
|
12 |
[](https://github.com/TeamUltroid/Ultroid/fork)
|
13 |
[](https://github.com/TeamUltroid/Ultroid/)
|
|
|
84 |
`bash startup`
|
85 |
- Windows Users:
|
86 |
`python(3) -m pyUltroid`
|
87 |
+
<details>
|
88 |
+
<summary><h3>[OUTDATED] Ultroid CLI</h3></summary>
|
89 |
|
|
|
90 |
[Ultroid CLI](https://github.com/BLUE-DEVIL1134/UltroidCli) is a command-line interface for deploying Ultroid.
|
91 |
|
92 |
- **Installing** -
|
|
|
97 |
|
98 |
- **Documentation** -
|
99 |
Take a look at the [`docs`](https://blue-devil1134.github.io/UltroidCli/) for more detailed information.
|
100 |
+
</details>
|
101 |
|
102 |
---
|
103 |
## Necessary Variables
|
app.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
{
|
2 |
"name": "Ultroid UserBot",
|
3 |
"description": "Pluggable telegram userbot, made in python using Telethon.",
|
4 |
-
"logo": "https://
|
5 |
"keywords": [
|
6 |
"Telethon",
|
7 |
"telegram",
|
@@ -11,7 +11,7 @@
|
|
11 |
],
|
12 |
"repository": "https://github.com/TeamUltroid/Ultroid",
|
13 |
"website": "https://ultroid.tech",
|
14 |
-
"success_url": "https://t.me/
|
15 |
"stack": "container",
|
16 |
"env": {
|
17 |
"API_ID": {
|
|
|
1 |
{
|
2 |
"name": "Ultroid UserBot",
|
3 |
"description": "Pluggable telegram userbot, made in python using Telethon.",
|
4 |
+
"logo": "https://graph.org/file/031957757a4f6a5191040.jpg",
|
5 |
"keywords": [
|
6 |
"Telethon",
|
7 |
"telegram",
|
|
|
11 |
],
|
12 |
"repository": "https://github.com/TeamUltroid/Ultroid",
|
13 |
"website": "https://ultroid.tech",
|
14 |
+
"success_url": "https://t.me/TeamUltroid",
|
15 |
"stack": "container",
|
16 |
"env": {
|
17 |
"API_ID": {
|
assistant/__init__.py
CHANGED
@@ -5,16 +5,16 @@
|
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
|
|
|
|
|
|
|
8 |
from pyUltroid import *
|
9 |
from pyUltroid import _ult_cache
|
10 |
from pyUltroid._misc import owner_and_sudos
|
11 |
from pyUltroid._misc._assistant import asst_cmd, callback, in_pattern
|
12 |
-
from pyUltroid.
|
13 |
-
from pyUltroid.
|
14 |
-
from
|
15 |
-
|
16 |
-
from plugins import ATRA_COL
|
17 |
-
from strings import get_languages, get_string, language
|
18 |
|
19 |
OWNER_NAME = ultroid_bot.full_name
|
20 |
OWNER_ID = ultroid_bot.uid
|
|
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
|
8 |
+
from telethon import Button, custom
|
9 |
+
|
10 |
+
from plugins import ATRA_COL, InlinePlugin
|
11 |
from pyUltroid import *
|
12 |
from pyUltroid import _ult_cache
|
13 |
from pyUltroid._misc import owner_and_sudos
|
14 |
from pyUltroid._misc._assistant import asst_cmd, callback, in_pattern
|
15 |
+
from pyUltroid.fns.helper import *
|
16 |
+
from pyUltroid.fns.tools import get_stored_file
|
17 |
+
from strings import get_languages, get_string
|
|
|
|
|
|
|
18 |
|
19 |
OWNER_NAME = ultroid_bot.full_name
|
20 |
OWNER_ID = ultroid_bot.uid
|
assistant/callbackstuffs.py
CHANGED
@@ -17,22 +17,18 @@ from random import choice
|
|
17 |
from bs4 import BeautifulSoup as bs
|
18 |
|
19 |
try:
|
20 |
-
from pyUltroid.
|
21 |
except ImportError:
|
22 |
GDriveManager = None
|
23 |
-
from pyUltroid.functions.helper import fast_download, progress
|
24 |
-
from pyUltroid.functions.tools import (
|
25 |
-
Carbon,
|
26 |
-
async_searcher,
|
27 |
-
get_paste,
|
28 |
-
telegraph_client,
|
29 |
-
)
|
30 |
-
from pyUltroid.startup.loader import Loader
|
31 |
from telegraph import upload_file as upl
|
32 |
from telethon import Button, events
|
33 |
from telethon.tl.types import MessageMediaWebPage
|
34 |
from telethon.utils import get_peer_id
|
35 |
|
|
|
|
|
|
|
|
|
36 |
from . import *
|
37 |
|
38 |
# --------------------------------------------------------------------#
|
@@ -54,7 +50,7 @@ def text_to_url(event):
|
|
54 |
|
55 |
_buttons = {
|
56 |
"otvars": {
|
57 |
-
"text": "Other Variables to set for @
|
58 |
"buttons": [
|
59 |
[
|
60 |
Button.inline("Tᴀɢ Lᴏɢɢᴇʀ", data="taglog"),
|
@@ -306,8 +302,9 @@ async def update(eve):
|
|
306 |
ups_rem.fetch(ac_br)
|
307 |
repo.git.reset("--hard", "FETCH_HEAD")
|
308 |
heroku_git_url = heroku_app.git_url.replace(
|
309 |
-
"https://", "https://api:
|
310 |
)
|
|
|
311 |
if "heroku" in repo.remotes:
|
312 |
remote = repo.remote("heroku")
|
313 |
remote.set_url(heroku_git_url)
|
@@ -340,7 +337,7 @@ async def changes(okk):
|
|
340 |
if not match:
|
341 |
try:
|
342 |
if len(tl_chnglog) > 700:
|
343 |
-
tl_chnglog = tl_chnglog[:700]
|
344 |
button.append([Button.inline("View Complete", "changesall")])
|
345 |
await okk.edit("• Writing Changelogs 📝 •")
|
346 |
img = await Carbon(
|
@@ -387,7 +384,7 @@ async def _(e):
|
|
387 |
ok, index = ok.split("|")
|
388 |
with open(ok, "r") as hmm:
|
389 |
_, key = await get_paste(hmm.read())
|
390 |
-
link = "https://spaceb.in/"
|
391 |
raw = f"https://spaceb.in/api/v1/documents/{key}/raw"
|
392 |
if not _:
|
393 |
return await e.answer(key[:30], alert=True)
|
@@ -512,7 +509,7 @@ async def rhwhe(e):
|
|
512 |
else:
|
513 |
udB.set_key("DUAL_MODE", "True")
|
514 |
key = "On"
|
515 |
-
Msg = "Dual Mode : "
|
516 |
await e.edit(Msg, buttons=get_back_button("cbs_otvars"))
|
517 |
|
518 |
|
@@ -603,10 +600,7 @@ async def pluginch(event):
|
|
603 |
else:
|
604 |
await setit(event, var, themssg)
|
605 |
await conv.send_message(
|
606 |
-
"{} changed to {}\n After Setting All Things Do Restart"
|
607 |
-
name,
|
608 |
-
themssg,
|
609 |
-
),
|
610 |
buttons=get_back_button("cbs_otvars"),
|
611 |
)
|
612 |
|
@@ -705,10 +699,12 @@ async def _(e):
|
|
705 |
|
706 |
@callback("eaddon", owner=True)
|
707 |
async def pmset(event):
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
|
|
|
|
712 |
await event.edit(
|
713 |
"ADDONS~ Extra Plugins:",
|
714 |
buttons=[
|
@@ -739,10 +735,12 @@ async def eddof(event):
|
|
739 |
|
740 |
@callback("sudo", owner=True)
|
741 |
async def pmset(event):
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
|
|
|
|
746 |
await event.edit(
|
747 |
f"SUDO MODE ~ Some peoples can use ur Bot which u selected. To know More use `{HNDLR}help sudo`",
|
748 |
buttons=[
|
@@ -829,7 +827,7 @@ async def media(event):
|
|
829 |
media = await event.client.download_media(response, "alvpc")
|
830 |
try:
|
831 |
x = upl(media)
|
832 |
-
url = f"https://
|
833 |
remove(media)
|
834 |
except BaseException:
|
835 |
return await conv.send_message(
|
@@ -902,10 +900,7 @@ async def name(event):
|
|
902 |
)
|
903 |
await setit(event, var, themssg)
|
904 |
await conv.send_message(
|
905 |
-
"{} changed to {}\n\nAfter Setting All Things Do restart"
|
906 |
-
name,
|
907 |
-
themssg,
|
908 |
-
),
|
909 |
buttons=get_back_button("cbs_pmcstm"),
|
910 |
)
|
911 |
|
@@ -925,8 +920,7 @@ async def name(event):
|
|
925 |
@callback(re.compile(b"wrns_(.*)"), owner=True)
|
926 |
async def set_wrns(event):
|
927 |
value = int(event.data_match.group(1).decode("UTF-8"))
|
928 |
-
dn
|
929 |
-
if dn:
|
930 |
await event.edit(
|
931 |
f"PM Warns Set to {value}.\nNew users will have {value} chances in PMs before getting banned.",
|
932 |
buttons=get_back_button("cbs_pmcstm"),
|
@@ -970,7 +964,7 @@ async def media(event):
|
|
970 |
else:
|
971 |
try:
|
972 |
x = upl(media)
|
973 |
-
url = f"https://
|
974 |
remove(media)
|
975 |
except BaseException:
|
976 |
return await conv.send_message(
|
@@ -1025,10 +1019,12 @@ async def apof(event):
|
|
1025 |
|
1026 |
@callback("pml", owner=True)
|
1027 |
async def l_vcs(event):
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
|
|
|
|
1032 |
await event.edit(
|
1033 |
"PMLOGGER This Will Forward Ur Pm to Ur Private Group -",
|
1034 |
buttons=[
|
@@ -1170,10 +1166,7 @@ async def name(event):
|
|
1170 |
)
|
1171 |
await setit(event, var, themssg)
|
1172 |
await conv.send_message(
|
1173 |
-
"{} changed to {}"
|
1174 |
-
name,
|
1175 |
-
themssg,
|
1176 |
-
),
|
1177 |
buttons=get_back_button("cbs_chatbot"),
|
1178 |
)
|
1179 |
|
@@ -1237,7 +1230,7 @@ async def media(event):
|
|
1237 |
else:
|
1238 |
try:
|
1239 |
x = upl(media)
|
1240 |
-
url = f"https://
|
1241 |
remove(media)
|
1242 |
except BaseException:
|
1243 |
return await conv.send_message(
|
@@ -1268,12 +1261,12 @@ async def fdroid_dler(event):
|
|
1268 |
title = BSC.find("h3", "package-name").text.strip()
|
1269 |
thumb = BSC.find("img", "package-icon")["src"]
|
1270 |
if thumb.startswith("/"):
|
1271 |
-
thumb = "https://f-droid.org"
|
1272 |
-
thumb, _ = await fast_download(thumb, filename=uri
|
1273 |
s_time = time.time()
|
1274 |
file, _ = await fast_download(
|
1275 |
dl_,
|
1276 |
-
filename=title
|
1277 |
progress_callback=lambda d, t: asyncio.get_event_loop().create_task(
|
1278 |
progress(
|
1279 |
d,
|
@@ -1284,6 +1277,7 @@ async def fdroid_dler(event):
|
|
1284 |
)
|
1285 |
),
|
1286 |
)
|
|
|
1287 |
time.time()
|
1288 |
n_file = await event.client.fast_uploader(
|
1289 |
file, show_progress=True, event=event, message="Uploading...", to_delete=True
|
|
|
17 |
from bs4 import BeautifulSoup as bs
|
18 |
|
19 |
try:
|
20 |
+
from pyUltroid.fns.gDrive import GDriveManager
|
21 |
except ImportError:
|
22 |
GDriveManager = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
from telegraph import upload_file as upl
|
24 |
from telethon import Button, events
|
25 |
from telethon.tl.types import MessageMediaWebPage
|
26 |
from telethon.utils import get_peer_id
|
27 |
|
28 |
+
from pyUltroid.fns.helper import fast_download, progress
|
29 |
+
from pyUltroid.fns.tools import Carbon, async_searcher, get_paste, telegraph_client
|
30 |
+
from pyUltroid.startup.loader import Loader
|
31 |
+
|
32 |
from . import *
|
33 |
|
34 |
# --------------------------------------------------------------------#
|
|
|
50 |
|
51 |
_buttons = {
|
52 |
"otvars": {
|
53 |
+
"text": "Other Variables to set for @TeamUltroid:",
|
54 |
"buttons": [
|
55 |
[
|
56 |
Button.inline("Tᴀɢ Lᴏɢɢᴇʀ", data="taglog"),
|
|
|
302 |
ups_rem.fetch(ac_br)
|
303 |
repo.git.reset("--hard", "FETCH_HEAD")
|
304 |
heroku_git_url = heroku_app.git_url.replace(
|
305 |
+
"https://", f"https://api:{heroku_api}@"
|
306 |
)
|
307 |
+
|
308 |
if "heroku" in repo.remotes:
|
309 |
remote = repo.remote("heroku")
|
310 |
remote.set_url(heroku_git_url)
|
|
|
337 |
if not match:
|
338 |
try:
|
339 |
if len(tl_chnglog) > 700:
|
340 |
+
tl_chnglog = f"{tl_chnglog[:700]}..."
|
341 |
button.append([Button.inline("View Complete", "changesall")])
|
342 |
await okk.edit("• Writing Changelogs 📝 •")
|
343 |
img = await Carbon(
|
|
|
384 |
ok, index = ok.split("|")
|
385 |
with open(ok, "r") as hmm:
|
386 |
_, key = await get_paste(hmm.read())
|
387 |
+
link = f"https://spaceb.in/{key}"
|
388 |
raw = f"https://spaceb.in/api/v1/documents/{key}/raw"
|
389 |
if not _:
|
390 |
return await e.answer(key[:30], alert=True)
|
|
|
509 |
else:
|
510 |
udB.set_key("DUAL_MODE", "True")
|
511 |
key = "On"
|
512 |
+
Msg = f"Dual Mode : {key}"
|
513 |
await e.edit(Msg, buttons=get_back_button("cbs_otvars"))
|
514 |
|
515 |
|
|
|
600 |
else:
|
601 |
await setit(event, var, themssg)
|
602 |
await conv.send_message(
|
603 |
+
f"{name} changed to {themssg}\n After Setting All Things Do Restart",
|
|
|
|
|
|
|
604 |
buttons=get_back_button("cbs_otvars"),
|
605 |
)
|
606 |
|
|
|
699 |
|
700 |
@callback("eaddon", owner=True)
|
701 |
async def pmset(event):
|
702 |
+
BT = (
|
703 |
+
[Button.inline("Aᴅᴅᴏɴs Oғғ", data="edof")]
|
704 |
+
if udB.get_key("ADDONS")
|
705 |
+
else [Button.inline("Aᴅᴅᴏɴs Oɴ", data="edon")]
|
706 |
+
)
|
707 |
+
|
708 |
await event.edit(
|
709 |
"ADDONS~ Extra Plugins:",
|
710 |
buttons=[
|
|
|
735 |
|
736 |
@callback("sudo", owner=True)
|
737 |
async def pmset(event):
|
738 |
+
BT = (
|
739 |
+
[Button.inline("Sᴜᴅᴏ Mᴏᴅᴇ Oғғ", data="ofsudo")]
|
740 |
+
if udB.get_key("SUDO")
|
741 |
+
else [Button.inline("Sᴜᴅᴏ Mᴏᴅᴇ Oɴ", data="onsudo")]
|
742 |
+
)
|
743 |
+
|
744 |
await event.edit(
|
745 |
f"SUDO MODE ~ Some peoples can use ur Bot which u selected. To know More use `{HNDLR}help sudo`",
|
746 |
buttons=[
|
|
|
827 |
media = await event.client.download_media(response, "alvpc")
|
828 |
try:
|
829 |
x = upl(media)
|
830 |
+
url = f"https://graph.org/{x[0]}"
|
831 |
remove(media)
|
832 |
except BaseException:
|
833 |
return await conv.send_message(
|
|
|
900 |
)
|
901 |
await setit(event, var, themssg)
|
902 |
await conv.send_message(
|
903 |
+
f"{name} changed to {themssg}\n\nAfter Setting All Things Do restart",
|
|
|
|
|
|
|
904 |
buttons=get_back_button("cbs_pmcstm"),
|
905 |
)
|
906 |
|
|
|
920 |
@callback(re.compile(b"wrns_(.*)"), owner=True)
|
921 |
async def set_wrns(event):
|
922 |
value = int(event.data_match.group(1).decode("UTF-8"))
|
923 |
+
if dn := udB.set_key("PMWARNS", value):
|
|
|
924 |
await event.edit(
|
925 |
f"PM Warns Set to {value}.\nNew users will have {value} chances in PMs before getting banned.",
|
926 |
buttons=get_back_button("cbs_pmcstm"),
|
|
|
964 |
else:
|
965 |
try:
|
966 |
x = upl(media)
|
967 |
+
url = f"https://graph.org/{x[0]}"
|
968 |
remove(media)
|
969 |
except BaseException:
|
970 |
return await conv.send_message(
|
|
|
1019 |
|
1020 |
@callback("pml", owner=True)
|
1021 |
async def l_vcs(event):
|
1022 |
+
BT = (
|
1023 |
+
[Button.inline("PMLOGGER OFF", data="pmlogof")]
|
1024 |
+
if udB.get_key("PMLOG")
|
1025 |
+
else [Button.inline("PMLOGGER ON", data="pmlog")]
|
1026 |
+
)
|
1027 |
+
|
1028 |
await event.edit(
|
1029 |
"PMLOGGER This Will Forward Ur Pm to Ur Private Group -",
|
1030 |
buttons=[
|
|
|
1166 |
)
|
1167 |
await setit(event, var, themssg)
|
1168 |
await conv.send_message(
|
1169 |
+
f"{name} changed to {themssg}",
|
|
|
|
|
|
|
1170 |
buttons=get_back_button("cbs_chatbot"),
|
1171 |
)
|
1172 |
|
|
|
1230 |
else:
|
1231 |
try:
|
1232 |
x = upl(media)
|
1233 |
+
url = f"https://graph.org/{x[0]}"
|
1234 |
remove(media)
|
1235 |
except BaseException:
|
1236 |
return await conv.send_message(
|
|
|
1261 |
title = BSC.find("h3", "package-name").text.strip()
|
1262 |
thumb = BSC.find("img", "package-icon")["src"]
|
1263 |
if thumb.startswith("/"):
|
1264 |
+
thumb = f"https://f-droid.org{thumb}"
|
1265 |
+
thumb, _ = await fast_download(thumb, filename=f"{uri}.png")
|
1266 |
s_time = time.time()
|
1267 |
file, _ = await fast_download(
|
1268 |
dl_,
|
1269 |
+
filename=f"{title}.apk",
|
1270 |
progress_callback=lambda d, t: asyncio.get_event_loop().create_task(
|
1271 |
progress(
|
1272 |
d,
|
|
|
1277 |
)
|
1278 |
),
|
1279 |
)
|
1280 |
+
|
1281 |
time.time()
|
1282 |
n_file = await event.client.fast_uploader(
|
1283 |
file, show_progress=True, event=event, message="Uploading...", to_delete=True
|
assistant/games.py
CHANGED
@@ -28,9 +28,6 @@ except ImportError:
|
|
28 |
akinator = None
|
29 |
LOGS.error("'akinator' not installed.")
|
30 |
|
31 |
-
from pyUltroid._misc._decorators import ultroid_cmd
|
32 |
-
from pyUltroid.functions.helper import inline_mention
|
33 |
-
from pyUltroid.functions.tools import async_searcher
|
34 |
from telethon.errors.rpcerrorlist import (
|
35 |
BotMethodInvalidError,
|
36 |
ChatSendStickersForbiddenError,
|
@@ -38,12 +35,16 @@ from telethon.errors.rpcerrorlist import (
|
|
38 |
from telethon.events import Raw
|
39 |
from telethon.tl.types import InputMediaPoll, Poll, PollAnswer, UpdateMessagePollVote
|
40 |
|
|
|
|
|
|
|
|
|
41 |
from . import *
|
42 |
|
43 |
# -------------------------- Akinator ----------------------- #
|
44 |
|
45 |
games = {}
|
46 |
-
aki_photo = "https://
|
47 |
|
48 |
|
49 |
@ultroid_cmd(pattern="akinator")
|
@@ -89,7 +90,7 @@ async def doai(e):
|
|
89 |
|
90 |
bts = [bts, cts]
|
91 |
# ignored Back Button since it makes the Pagination looks Bad
|
92 |
-
await e.edit("Q. "
|
93 |
|
94 |
|
95 |
@callback(re.compile("aka_(.*)"), owner=True)
|
@@ -138,6 +139,11 @@ async def eiagx(e):
|
|
138 |
|
139 |
# ----------------------- Main Command ------------------- #
|
140 |
|
|
|
|
|
|
|
|
|
|
|
141 |
|
142 |
@asst_cmd(pattern="startgame", owner=True)
|
143 |
async def magic(event):
|
@@ -147,7 +153,7 @@ async def magic(event):
|
|
147 |
]
|
148 |
await event.reply(
|
149 |
get_string("games_1"),
|
150 |
-
file=
|
151 |
buttons=buttons,
|
152 |
)
|
153 |
|
@@ -261,7 +267,7 @@ async def choose_cata(event):
|
|
261 |
close_period=int(in_),
|
262 |
),
|
263 |
correct_answers=[ansi],
|
264 |
-
solution="Join @
|
265 |
solution_entities=[],
|
266 |
)
|
267 |
m_ = await event.client.send_message(chat, file=poll)
|
|
|
28 |
akinator = None
|
29 |
LOGS.error("'akinator' not installed.")
|
30 |
|
|
|
|
|
|
|
31 |
from telethon.errors.rpcerrorlist import (
|
32 |
BotMethodInvalidError,
|
33 |
ChatSendStickersForbiddenError,
|
|
|
35 |
from telethon.events import Raw
|
36 |
from telethon.tl.types import InputMediaPoll, Poll, PollAnswer, UpdateMessagePollVote
|
37 |
|
38 |
+
from pyUltroid._misc._decorators import ultroid_cmd
|
39 |
+
from pyUltroid.fns.helper import inline_mention
|
40 |
+
from pyUltroid.fns.tools import async_searcher
|
41 |
+
|
42 |
from . import *
|
43 |
|
44 |
# -------------------------- Akinator ----------------------- #
|
45 |
|
46 |
games = {}
|
47 |
+
aki_photo = "https://graph.org/file/3cc8825c029fd0cab9edc.jpg"
|
48 |
|
49 |
|
50 |
@ultroid_cmd(pattern="akinator")
|
|
|
90 |
|
91 |
bts = [bts, cts]
|
92 |
# ignored Back Button since it makes the Pagination looks Bad
|
93 |
+
await e.edit(f"Q. {qu}", buttons=bts)
|
94 |
|
95 |
|
96 |
@callback(re.compile("aka_(.*)"), owner=True)
|
|
|
139 |
|
140 |
# ----------------------- Main Command ------------------- #
|
141 |
|
142 |
+
GIMAGES = [
|
143 |
+
"https://graph.org/file/1c51015bae5205a65fd69.jpg",
|
144 |
+
"https://imgwhale.xyz/3xyr322l64j9590",
|
145 |
+
]
|
146 |
+
|
147 |
|
148 |
@asst_cmd(pattern="startgame", owner=True)
|
149 |
async def magic(event):
|
|
|
153 |
]
|
154 |
await event.reply(
|
155 |
get_string("games_1"),
|
156 |
+
file=choice(GIMAGES),
|
157 |
buttons=buttons,
|
158 |
)
|
159 |
|
|
|
267 |
close_period=int(in_),
|
268 |
),
|
269 |
correct_answers=[ansi],
|
270 |
+
solution="Join @TeamUltroid",
|
271 |
solution_entities=[],
|
272 |
)
|
273 |
m_ = await event.client.send_message(chat, file=poll)
|
assistant/initial.py
CHANGED
@@ -32,7 +32,7 @@ STRINGS = {
|
|
32 |
-> [Also Check](https://t.me/UltroidUpdates/14)
|
33 |
|
34 |
**• To Know About Updates**
|
35 |
-
- Join @
|
36 |
4: f"""• `To Know All Available Commands`
|
37 |
|
38 |
- `{HNDLR}help`
|
@@ -50,14 +50,15 @@ async def init_depl(e):
|
|
50 |
if CURRENT == 5:
|
51 |
return await e.edit(
|
52 |
STRINGS[5],
|
53 |
-
buttons=Button.inline("<< Back", "
|
54 |
link_preview=False,
|
55 |
)
|
|
|
56 |
await e.edit(
|
57 |
STRINGS[CURRENT],
|
58 |
buttons=[
|
59 |
-
Button.inline("<<", "initbk_
|
60 |
-
Button.inline(">>", "initft_
|
61 |
],
|
62 |
link_preview=False,
|
63 |
)
|
@@ -69,14 +70,15 @@ async def ineiq(e):
|
|
69 |
if CURRENT == 1:
|
70 |
return await e.edit(
|
71 |
STRINGS[1],
|
72 |
-
buttons=Button.inline("Start Back >>", "
|
73 |
link_preview=False,
|
74 |
)
|
|
|
75 |
await e.edit(
|
76 |
STRINGS[CURRENT],
|
77 |
buttons=[
|
78 |
-
Button.inline("<<", "initbk_
|
79 |
-
Button.inline(">>", "initft_
|
80 |
],
|
81 |
link_preview=False,
|
82 |
)
|
|
|
32 |
-> [Also Check](https://t.me/UltroidUpdates/14)
|
33 |
|
34 |
**• To Know About Updates**
|
35 |
+
- Join @TeamUltroid.""",
|
36 |
4: f"""• `To Know All Available Commands`
|
37 |
|
38 |
- `{HNDLR}help`
|
|
|
50 |
if CURRENT == 5:
|
51 |
return await e.edit(
|
52 |
STRINGS[5],
|
53 |
+
buttons=Button.inline("<< Back", "initbk_4"),
|
54 |
link_preview=False,
|
55 |
)
|
56 |
+
|
57 |
await e.edit(
|
58 |
STRINGS[CURRENT],
|
59 |
buttons=[
|
60 |
+
Button.inline("<<", f"initbk_{str(CURRENT - 1)}"),
|
61 |
+
Button.inline(">>", f"initft_{str(CURRENT + 1)}"),
|
62 |
],
|
63 |
link_preview=False,
|
64 |
)
|
|
|
70 |
if CURRENT == 1:
|
71 |
return await e.edit(
|
72 |
STRINGS[1],
|
73 |
+
buttons=Button.inline("Start Back >>", "initft_2"),
|
74 |
link_preview=False,
|
75 |
)
|
76 |
+
|
77 |
await e.edit(
|
78 |
STRINGS[CURRENT],
|
79 |
buttons=[
|
80 |
+
Button.inline("<<", f"initbk_{str(CURRENT - 1)}"),
|
81 |
+
Button.inline(">>", f"initft_{str(CURRENT + 1)}"),
|
82 |
],
|
83 |
link_preview=False,
|
84 |
)
|
assistant/inlinestuff.py
CHANGED
@@ -8,22 +8,24 @@
|
|
8 |
import base64
|
9 |
import inspect
|
10 |
from datetime import datetime
|
|
|
11 |
from random import choice
|
12 |
from re import compile as re_compile
|
13 |
|
14 |
from bs4 import BeautifulSoup as bs
|
15 |
-
from
|
16 |
-
from
|
|
|
|
|
|
|
|
|
|
|
17 |
_webupload_cache,
|
18 |
async_searcher,
|
19 |
get_ofox,
|
20 |
saavn_search,
|
21 |
webuploader,
|
22 |
)
|
23 |
-
from telethon import Button
|
24 |
-
from telethon.tl.alltlobjects import LAYER, tlobjects
|
25 |
-
from telethon.tl.types import DocumentAttributeAudio as Audio
|
26 |
-
from telethon.tl.types import InputWebDocument as wb
|
27 |
|
28 |
from . import *
|
29 |
from . import _ult_cache
|
@@ -31,13 +33,13 @@ from . import _ult_cache
|
|
31 |
SUP_BUTTONS = [
|
32 |
[
|
33 |
Button.url("• Repo •", url="https://github.com/TeamUltroid/Ultroid"),
|
34 |
-
Button.url("• Support •", url="t.me/
|
35 |
],
|
36 |
]
|
37 |
|
38 |
-
ofox = "https://
|
39 |
-
gugirl = "https://
|
40 |
-
ultpic = "https://
|
41 |
|
42 |
apis = [
|
43 |
"QUl6YVN5QXlEQnNZM1dSdEI1WVBDNmFCX3c4SkF5NlpkWE5jNkZV",
|
@@ -229,12 +231,11 @@ async def _(e):
|
|
229 |
return await e.answer(
|
230 |
[], switch_pm="Mod Apps Search. Enter app name!", switch_pm_param="start"
|
231 |
)
|
232 |
-
|
233 |
-
start = (page - 1) * 3 + 1
|
234 |
da = base64.b64decode(choice(apis)).decode("ascii")
|
235 |
url = f"https://www.googleapis.com/customsearch/v1?key={da}&cx=25b3b50edb928435b&q={quer}&start={start}"
|
236 |
data = await async_searcher(url, re_json=True)
|
237 |
-
search_items = data.get("items")
|
238 |
modss = []
|
239 |
for a in search_items:
|
240 |
title = a.get("title")
|
@@ -268,55 +269,22 @@ async def _(e):
|
|
268 |
await e.answer(modss, switch_pm="Search Mod Applications.", switch_pm_param="start")
|
269 |
|
270 |
|
271 |
-
# Inspired by @FindXDaBot
|
272 |
-
|
273 |
-
|
274 |
-
@in_pattern("xda", owner=True)
|
275 |
-
async def xda_dev(event):
|
276 |
-
QUERY = event.text.split(maxsplit=1)
|
277 |
-
try:
|
278 |
-
query = QUERY[1]
|
279 |
-
except IndexError:
|
280 |
-
return await event.answer(
|
281 |
-
[], switch_pm=get_string("instu_3"), switch_pm_param="start"
|
282 |
-
)
|
283 |
-
le = "https://www.xda-developers.com/search/" + query.replace(" ", "+")
|
284 |
-
ct = await async_searcher(le, re_content=True)
|
285 |
-
ml = bs(ct, "html.parser", from_encoding="utf-8")
|
286 |
-
ml = ml.find_all("div", re_compile("layout_post_"), id=re_compile("post-"))
|
287 |
-
out = []
|
288 |
-
for on in ml:
|
289 |
-
data = on.find_all("img", "xda_image")[0]
|
290 |
-
title = data["alt"]
|
291 |
-
thumb = data["src"]
|
292 |
-
hre = on.find_all("div", "item_content")[0].find("h4").find("a")["href"]
|
293 |
-
desc = on.find_all("div", "item_meta clearfix")[0].text
|
294 |
-
thumb = wb(thumb, 0, "image/jpeg", [])
|
295 |
-
text = f"[{title}]({hre})"
|
296 |
-
out.append(
|
297 |
-
await event.builder.article(
|
298 |
-
title=title, description=desc, url=hre, thumb=thumb, text=text
|
299 |
-
)
|
300 |
-
)
|
301 |
-
uppar = "No Results Found :(" if not out else "|| XDA Search Results ||"
|
302 |
-
await event.answer(out, switch_pm=uppar, switch_pm_param="start")
|
303 |
-
|
304 |
-
|
305 |
APP_CACHE = {}
|
306 |
RECENTS = {}
|
|
|
307 |
|
308 |
|
309 |
@in_pattern("app", owner=True)
|
310 |
async def _(e):
|
311 |
try:
|
312 |
-
f = e.text.split(
|
313 |
except IndexError:
|
314 |
get_string("instu_1")
|
315 |
res = []
|
316 |
if APP_CACHE and RECENTS.get(e.sender_id):
|
317 |
-
|
318 |
-
if APP_CACHE.get(a)
|
319 |
-
|
320 |
return await e.answer(
|
321 |
res, switch_pm=get_string("instu_2"), switch_pm_param="start"
|
322 |
)
|
@@ -327,33 +295,21 @@ async def _(e):
|
|
327 |
except KeyError:
|
328 |
pass
|
329 |
foles = []
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
bp = bs(scra, "html.parser", from_encoding="utf-8")
|
339 |
-
name = z.find("div", "WsMG1c nnK0zc")["title"]
|
340 |
-
desc = (
|
341 |
-
str(bp.find("div", jsname="sngebd"))
|
342 |
-
.replace('<div jsname="sngebd">', "")
|
343 |
-
.replace("<br/>", "\n")
|
344 |
-
.replace("</div>", "")[:300]
|
345 |
-
+ "..."
|
346 |
-
)
|
347 |
-
dev = z.find("div", "KoLSrc").text
|
348 |
-
icon = z.find("img", "T75of QNCnCf")["data-src"]
|
349 |
-
text = f"**••Aᴘᴘ Nᴀᴍᴇ••** [{name}]({icon})\n"
|
350 |
text += f"**••Dᴇᴠᴇʟᴏᴘᴇʀ••** `{dev}`\n"
|
351 |
text += f"**••Dᴇsᴄʀɪᴘᴛɪᴏɴ••**\n`{desc}`"
|
352 |
foles.append(
|
353 |
await e.builder.article(
|
354 |
title=name,
|
355 |
description=dev,
|
356 |
-
thumb=wb(icon, 0, "image/jpeg", []),
|
357 |
text=text,
|
358 |
link_preview=True,
|
359 |
buttons=[
|
@@ -395,13 +351,13 @@ async def piston_run(event):
|
|
395 |
title="Bad Query",
|
396 |
description="Usage: [Language] [code]",
|
397 |
thumb=wb(
|
398 |
-
"https://
|
399 |
),
|
400 |
-
text=f'**Inline Usage**\n\n`@{asst.me.username} run python print("hello world")`\n\n[Language List](https://
|
401 |
)
|
402 |
return await event.answer([result])
|
403 |
if not PISTON_LANGS:
|
404 |
-
se = await async_searcher(PISTON_URI
|
405 |
PISTON_LANGS.update({lang.pop("language"): lang for lang in se})
|
406 |
if lang in PISTON_LANGS.keys():
|
407 |
version = PISTON_LANGS[lang]["version"]
|
@@ -410,26 +366,31 @@ async def piston_run(event):
|
|
410 |
title="Unsupported Language",
|
411 |
description="Usage: [Language] [code]",
|
412 |
thumb=wb(
|
413 |
-
"https://
|
414 |
),
|
415 |
-
text=f'**Inline Usage**\n\n`@{asst.me.username} run python print("hello world")`\n\n[Language List](https://
|
416 |
)
|
417 |
return await event.answer([result])
|
418 |
output = await async_searcher(
|
419 |
-
PISTON_URI
|
420 |
post=True,
|
421 |
-
json={
|
|
|
|
|
|
|
|
|
422 |
re_json=True,
|
423 |
)
|
|
|
424 |
output = output["run"]["output"] or get_string("instu_4")
|
425 |
if len(output) > 3000:
|
426 |
-
output = output[:3000]
|
427 |
result = await event.builder.article(
|
428 |
title="Result",
|
429 |
description=output,
|
430 |
text=f"• **Language:**\n`{lang}`\n\n• **Code:**\n`{code}`\n\n• **Result:**\n`{output}`",
|
431 |
thumb=wb(
|
432 |
-
"https://
|
433 |
),
|
434 |
buttons=Button.switch_inline("Fork", query=event.text, same_peer=True),
|
435 |
)
|
@@ -458,7 +419,7 @@ async def do_magic(event):
|
|
458 |
for dat in BSC.find_all("a", "package-header")[:10]:
|
459 |
image = dat.find("img", "package-icon")["src"]
|
460 |
if image.endswith("/"):
|
461 |
-
image = "https://
|
462 |
title = dat.find("h4", "package-name").text.strip()
|
463 |
desc = dat.find("span", "package-summary").text.strip()
|
464 |
text = f"• **Name :** `{title}`\n\n"
|
@@ -487,96 +448,6 @@ async def do_magic(event):
|
|
487 |
await event.answer(ress, switch_pm=msg, switch_pm_param="start")
|
488 |
|
489 |
|
490 |
-
_koo_ = {}
|
491 |
-
|
492 |
-
|
493 |
-
@in_pattern("koo", owner=True)
|
494 |
-
async def koo_search(ult):
|
495 |
-
"""Search Users on koo with API"""
|
496 |
-
try:
|
497 |
-
match = ult.text.split(maxsplit=1)[1].lower()
|
498 |
-
match_ = match
|
499 |
-
except IndexError:
|
500 |
-
return await ult.answer(
|
501 |
-
[], switch_pm="Enter Query to Search..", switch_pm_param="start"
|
502 |
-
)
|
503 |
-
if _koo_.get(match):
|
504 |
-
return await ult.answer(
|
505 |
-
_koo_[match], switch_pm="• Koo Search •", switch_pm_param="start"
|
506 |
-
)
|
507 |
-
res = []
|
508 |
-
se_ = None
|
509 |
-
key_count = None
|
510 |
-
if " | " in match:
|
511 |
-
match = match.split(" | ", maxsplit=1)
|
512 |
-
try:
|
513 |
-
key_count = int(match[1])
|
514 |
-
except ValueError:
|
515 |
-
pass
|
516 |
-
match = match[0]
|
517 |
-
match = match.replace(" ", "+")
|
518 |
-
req = await async_searcher(
|
519 |
-
f"https://www.kooapp.com/apiV1/search?query={match}&searchType=EXPLORE",
|
520 |
-
re_json=True,
|
521 |
-
)
|
522 |
-
if key_count:
|
523 |
-
try:
|
524 |
-
se_ = [req["feed"][key_count - 1]]
|
525 |
-
except KeyError:
|
526 |
-
pass
|
527 |
-
if not se_:
|
528 |
-
se_ = req["feed"]
|
529 |
-
for count, feed in enumerate(se_[:10]):
|
530 |
-
if feed["uiItemType"] == "search_profile":
|
531 |
-
count += 1
|
532 |
-
item = feed["items"][0]
|
533 |
-
profileImage = (
|
534 |
-
item["profileImageBaseUrl"]
|
535 |
-
if item.get("profileImageBaseUrl")
|
536 |
-
else "https://telegra.ph/file/dc28e69bd7ea2c0f25329.jpg"
|
537 |
-
)
|
538 |
-
extra = await async_searcher(
|
539 |
-
"https://www.kooapp.com/apiV1/users/handle/" + item["userHandle"],
|
540 |
-
re_json=True,
|
541 |
-
)
|
542 |
-
img = wb(profileImage, 0, "image/jpeg", [])
|
543 |
-
text = f"‣ **Name :** `{item['name']}`"
|
544 |
-
if extra.get("title"):
|
545 |
-
text += f"\n‣ **Title :** `{extra['title']}`"
|
546 |
-
text += f"\n‣ **Username :** `@{item['userHandle']}`"
|
547 |
-
if extra.get("description"):
|
548 |
-
text += f"\n‣ **Description :** `{extra['description']}`"
|
549 |
-
text += f"\n‣ **Followers :** `{extra['followerCount']}` ‣ **Following :** {extra['followingCount']}"
|
550 |
-
if extra.get("socialProfile") and extra["socialProfile"].get("website"):
|
551 |
-
text += f"\n‣ **Website :** {extra['socialProfile']['website']}"
|
552 |
-
res.append(
|
553 |
-
await ult.builder.article(
|
554 |
-
title=item["name"],
|
555 |
-
description=item.get("title") or f"@{item['userHandle']}",
|
556 |
-
type="photo",
|
557 |
-
content=img,
|
558 |
-
thumb=img,
|
559 |
-
include_media=True,
|
560 |
-
text=text,
|
561 |
-
buttons=[
|
562 |
-
Button.url(
|
563 |
-
"View", "https://kooapp.com/profile/" + item["userHandle"]
|
564 |
-
),
|
565 |
-
Button.switch_inline(
|
566 |
-
"• Share •",
|
567 |
-
query=ult.text if key_count else ult.text + f" | {count}",
|
568 |
-
),
|
569 |
-
],
|
570 |
-
)
|
571 |
-
)
|
572 |
-
if not res:
|
573 |
-
switch = "No Results Found :("
|
574 |
-
else:
|
575 |
-
_koo_.update({match_: res})
|
576 |
-
switch = f"Showing {len(res)} Results!"
|
577 |
-
await ult.answer(res, switch_pm=switch, switch_pm_param="start")
|
578 |
-
|
579 |
-
|
580 |
# Thanks to OpenSource
|
581 |
_bearer_collected = [
|
582 |
"AAAAAAAAAAAAAAAAAAAAALIKKgEAAAAA1DRuS%2BI7ZRKiagD6KHYmreaXomo%3DP5Vaje4UTtEkODg0fX7nCh5laSrchhtLxeyEqxXpv0w9ZKspLD",
|
@@ -601,7 +472,7 @@ async def twitter_search(event):
|
|
601 |
)
|
602 |
except KeyError:
|
603 |
pass
|
604 |
-
headers = {"Authorization": "bearer
|
605 |
res = await async_searcher(
|
606 |
f"https://api.twitter.com/1.1/users/search.json?q={match}",
|
607 |
headers=headers,
|
@@ -629,7 +500,7 @@ async def twitter_search(event):
|
|
629 |
thumb=thumb,
|
630 |
)
|
631 |
)
|
632 |
-
swi_ = "
|
633 |
await event.answer(reso, switch_pm=swi_, switch_pm_param="start")
|
634 |
if _ult_cache.get("twitter"):
|
635 |
_ult_cache["twitter"].update({match: reso})
|
@@ -655,18 +526,19 @@ async def savn_s(event):
|
|
655 |
switch_pm_param="start",
|
656 |
)
|
657 |
results = await saavn_search(query)
|
658 |
-
swi = "
|
659 |
res = []
|
660 |
for song in results:
|
661 |
thumb = wb(song["image"], 0, "image/jpeg", [])
|
662 |
-
text = f"• **Title :** {song['
|
663 |
text += f"\n• **Year :** {song['year']}"
|
664 |
text += f"\n• **Lang :** {song['language']}"
|
665 |
-
text += f"\n• **Artist :** {song['
|
666 |
text += f"\n• **Release Date :** {song['release_date']}"
|
667 |
res.append(
|
668 |
await event.builder.article(
|
669 |
-
title=song["
|
|
|
670 |
type="audio",
|
671 |
text=text,
|
672 |
include_media=True,
|
@@ -675,14 +547,14 @@ async def savn_s(event):
|
|
675 |
),
|
676 |
thumb=thumb,
|
677 |
content=wb(
|
678 |
-
song["
|
679 |
0,
|
680 |
"audio/mp4",
|
681 |
[
|
682 |
Audio(
|
683 |
-
title=song["
|
684 |
duration=int(song["duration"]),
|
685 |
-
performer=song["
|
686 |
)
|
687 |
],
|
688 |
),
|
@@ -692,58 +564,6 @@ async def savn_s(event):
|
|
692 |
_savn_cache.update({query: res})
|
693 |
|
694 |
|
695 |
-
_OMG = {}
|
696 |
-
|
697 |
-
|
698 |
-
@in_pattern("omgu", owner=True)
|
699 |
-
async def omgubuntu(ult):
|
700 |
-
try:
|
701 |
-
match = ult.text.split(maxsplit=1)[1].lower()
|
702 |
-
except IndexError:
|
703 |
-
return await ult.answer(
|
704 |
-
[], switch_pm="Enter Query to search...", switch_pm_param="start"
|
705 |
-
)
|
706 |
-
if _OMG.get(match):
|
707 |
-
return await ult.answer(
|
708 |
-
_OMG[match], switch_pm="OMG Ubuntu Search :]", switch_pm_param="start"
|
709 |
-
)
|
710 |
-
get_web = "https://www.omgubuntu.co.uk/?s=" + match.replace(" ", "+")
|
711 |
-
get_ = await async_searcher(get_web, re_content=True)
|
712 |
-
BSC = bs(get_, "html.parser", from_encoding="utf-8")
|
713 |
-
res = []
|
714 |
-
for cont in BSC.find_all("div", "sbs-layout__item"):
|
715 |
-
img = cont.find("div", "sbs-layout__image")
|
716 |
-
url = img.find("a")["href"]
|
717 |
-
src = img.find("img")["src"]
|
718 |
-
con = cont.find("div", "sbs-layout__content")
|
719 |
-
tit = con.find("a", "layout__title-link")
|
720 |
-
title = tit.text.strip()
|
721 |
-
desc = con.find("p", "layout__description").text.strip()
|
722 |
-
text = f"[{title.strip()}]({url})\n\n{desc}"
|
723 |
-
img = wb(src, 0, "image/jpeg", [])
|
724 |
-
res.append(
|
725 |
-
await ult.builder.article(
|
726 |
-
title=title,
|
727 |
-
type="photo",
|
728 |
-
description=desc,
|
729 |
-
url=url,
|
730 |
-
text=text,
|
731 |
-
buttons=Button.switch_inline(
|
732 |
-
"Search Again", query=ult.text, same_peer=True
|
733 |
-
),
|
734 |
-
include_media=True,
|
735 |
-
content=img,
|
736 |
-
thumb=img,
|
737 |
-
)
|
738 |
-
)
|
739 |
-
await ult.answer(
|
740 |
-
res,
|
741 |
-
switch_pm=f"Showing {len(res)} results!" if res else "No Results Found :[",
|
742 |
-
switch_pm_param="start",
|
743 |
-
)
|
744 |
-
_OMG[match] = res
|
745 |
-
|
746 |
-
|
747 |
@in_pattern("tl", owner=True)
|
748 |
async def inline_tl(ult):
|
749 |
try:
|
@@ -755,7 +575,7 @@ async def inline_tl(ult):
|
|
755 |
await ult.builder.article(
|
756 |
title="How to Use?",
|
757 |
description="Tl Searcher by Ultroid",
|
758 |
-
url="https://t.me/
|
759 |
text=text,
|
760 |
)
|
761 |
],
|
@@ -769,8 +589,7 @@ async def inline_tl(ult):
|
|
769 |
text = f"**Name:** `{key.__name__}`\n"
|
770 |
text += f"**Category:** `{tyyp}`\n"
|
771 |
text += f"\n`from {key.__module__} import {key.__name__}`\n\n"
|
772 |
-
args
|
773 |
-
if args:
|
774 |
text += "**Parameter:**\n"
|
775 |
for para in args.split(","):
|
776 |
text += " " * 4 + "`" + para + "`\n"
|
@@ -779,108 +598,26 @@ async def inline_tl(ult):
|
|
779 |
await ult.builder.article(
|
780 |
title=key.__name__,
|
781 |
description=tyyp,
|
782 |
-
url="https://t.me/
|
783 |
text=text[:4000],
|
784 |
)
|
785 |
)
|
786 |
-
if
|
787 |
-
mo = f"No Results for {match}!"
|
788 |
-
else:
|
789 |
-
mo = f"Showing {len(res)} results!"
|
790 |
await ult.answer(res[:50], switch_pm=mo, switch_pm_param="start")
|
791 |
|
792 |
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
data = await async_searcher(
|
809 |
-
f"https://api.github.com/users/{username}/events", re_json=True
|
810 |
-
)
|
811 |
-
if not isinstance(data, list):
|
812 |
-
msg = ""
|
813 |
-
for ak in list(data.keys()):
|
814 |
-
msg += ak + ": `" + data[ak] + "`\n"
|
815 |
-
return await ult.answer(
|
816 |
-
[
|
817 |
-
await ult.builder.article(
|
818 |
-
title=data["message"], text=msg, link_preview=False
|
819 |
-
)
|
820 |
-
],
|
821 |
-
cache_time=300,
|
822 |
-
switch_pm="Error!!!",
|
823 |
-
switch_pm_param="start",
|
824 |
-
)
|
825 |
-
res = []
|
826 |
-
res_ids = []
|
827 |
-
for cont in data[:50]:
|
828 |
-
text = f"<b><a href='https://github.com/{username}'>@{username}</a></b>"
|
829 |
-
title = f"@{username}"
|
830 |
-
extra = None
|
831 |
-
if cont["type"] == "PushEvent":
|
832 |
-
text += " pushed in"
|
833 |
-
title += " pushed in"
|
834 |
-
dt = cont["payload"]["commits"][-1]
|
835 |
-
url = "https://github.com/" + dt["url"].split("/repos/")[-1]
|
836 |
-
extra = f"\n-> <b>message:</b> <code>{dt['message']}</code>"
|
837 |
-
elif cont["type"] == "IssueCommentEvent":
|
838 |
-
title += " commented at"
|
839 |
-
text += " commented at"
|
840 |
-
url = cont["payload"]["comment"]["html_url"]
|
841 |
-
elif cont["type"] == "CreateEvent":
|
842 |
-
title += " created"
|
843 |
-
text += " created"
|
844 |
-
url = "https://github.com/" + cont["repo"]["name"]
|
845 |
-
elif cont["type"] == "PullRequestEvent":
|
846 |
-
if (
|
847 |
-
cont["payload"]["pull_request"].get("user", {}).get("login")
|
848 |
-
!= username.lower()
|
849 |
-
):
|
850 |
-
continue
|
851 |
-
url = cont["payload"]["pull_request"]["html_url"]
|
852 |
-
text += " created a pull request in"
|
853 |
-
title += " created a pull request in"
|
854 |
-
elif cont["type"] == "ForkEvent":
|
855 |
-
text += " forked"
|
856 |
-
title += " forked"
|
857 |
-
url = cont["payload"]["forkee"]["html_url"]
|
858 |
-
else:
|
859 |
-
continue
|
860 |
-
repo = cont["repo"]["name"]
|
861 |
-
repo_url = "https://github.com/" + repo
|
862 |
-
title += " " + repo
|
863 |
-
text += f" <b><a href='{repo_url}'>{repo}</a></b>"
|
864 |
-
if extra:
|
865 |
-
text += extra
|
866 |
-
thumb = wb(cont["actor"]["avatar_url"], 0, "image/jpeg", [])
|
867 |
-
article = await ult.builder.article(
|
868 |
-
title=title,
|
869 |
-
text=text,
|
870 |
-
url=repo_url,
|
871 |
-
parse_mode="html",
|
872 |
-
link_preview=False,
|
873 |
-
thumb=thumb,
|
874 |
-
buttons=[
|
875 |
-
Button.url("View", url),
|
876 |
-
Button.switch_inline("Search again", query=ult.text, same_peer=True),
|
877 |
-
],
|
878 |
-
)
|
879 |
-
if article.id not in res_ids:
|
880 |
-
res_ids.append(article.id)
|
881 |
-
res.append(article)
|
882 |
-
if res:
|
883 |
-
msg = f"Showing {len(res)} feeds!"
|
884 |
-
else:
|
885 |
-
msg = "Nothing Found"
|
886 |
-
await ult.answer(res, cache_time=5000, switch_pm=msg, switch_pm_param="start")
|
|
|
8 |
import base64
|
9 |
import inspect
|
10 |
from datetime import datetime
|
11 |
+
from html import unescape
|
12 |
from random import choice
|
13 |
from re import compile as re_compile
|
14 |
|
15 |
from bs4 import BeautifulSoup as bs
|
16 |
+
from telethon import Button
|
17 |
+
from telethon.tl.alltlobjects import LAYER, tlobjects
|
18 |
+
from telethon.tl.types import DocumentAttributeAudio as Audio
|
19 |
+
from telethon.tl.types import InputWebDocument as wb
|
20 |
+
|
21 |
+
from pyUltroid.fns.misc import google_search
|
22 |
+
from pyUltroid.fns.tools import (
|
23 |
_webupload_cache,
|
24 |
async_searcher,
|
25 |
get_ofox,
|
26 |
saavn_search,
|
27 |
webuploader,
|
28 |
)
|
|
|
|
|
|
|
|
|
29 |
|
30 |
from . import *
|
31 |
from . import _ult_cache
|
|
|
33 |
SUP_BUTTONS = [
|
34 |
[
|
35 |
Button.url("• Repo •", url="https://github.com/TeamUltroid/Ultroid"),
|
36 |
+
Button.url("• Support •", url="t.me/UltroidSupportChat"),
|
37 |
],
|
38 |
]
|
39 |
|
40 |
+
ofox = "https://graph.org/file/231f0049fcd722824f13b.jpg"
|
41 |
+
gugirl = "https://graph.org/file/0df54ae4541abca96aa11.jpg"
|
42 |
+
ultpic = "https://graph.org/file/4136aa1650bc9d4109cc5.jpg"
|
43 |
|
44 |
apis = [
|
45 |
"QUl6YVN5QXlEQnNZM1dSdEI1WVBDNmFCX3c4SkF5NlpkWE5jNkZV",
|
|
|
231 |
return await e.answer(
|
232 |
[], switch_pm="Mod Apps Search. Enter app name!", switch_pm_param="start"
|
233 |
)
|
234 |
+
start = 0 * 3 + 1
|
|
|
235 |
da = base64.b64decode(choice(apis)).decode("ascii")
|
236 |
url = f"https://www.googleapis.com/customsearch/v1?key={da}&cx=25b3b50edb928435b&q={quer}&start={start}"
|
237 |
data = await async_searcher(url, re_json=True)
|
238 |
+
search_items = data.get("items", [])
|
239 |
modss = []
|
240 |
for a in search_items:
|
241 |
title = a.get("title")
|
|
|
269 |
await e.answer(modss, switch_pm="Search Mod Applications.", switch_pm_param="start")
|
270 |
|
271 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
272 |
APP_CACHE = {}
|
273 |
RECENTS = {}
|
274 |
+
PLAY_API = "https://googleplay.onrender.com/api/apps?q="
|
275 |
|
276 |
|
277 |
@in_pattern("app", owner=True)
|
278 |
async def _(e):
|
279 |
try:
|
280 |
+
f = e.text.split(maxsplit=1)[1].lower()
|
281 |
except IndexError:
|
282 |
get_string("instu_1")
|
283 |
res = []
|
284 |
if APP_CACHE and RECENTS.get(e.sender_id):
|
285 |
+
res.extend(
|
286 |
+
APP_CACHE[a][0] for a in RECENTS[e.sender_id] if APP_CACHE.get(a)
|
287 |
+
)
|
288 |
return await e.answer(
|
289 |
res, switch_pm=get_string("instu_2"), switch_pm_param="start"
|
290 |
)
|
|
|
295 |
except KeyError:
|
296 |
pass
|
297 |
foles = []
|
298 |
+
url = PLAY_API + f.replace(" ", "+")
|
299 |
+
aap = await async_searcher(url, re_json=True)
|
300 |
+
for z in aap["results"][:50]:
|
301 |
+
url = "https://play.google.com/store/apps/details?id=" + z["appId"]
|
302 |
+
name = z["title"]
|
303 |
+
desc = unescape(z["summary"])[:300].replace("<br>", "\n") + "..."
|
304 |
+
dev = z["developer"]["devId"]
|
305 |
+
text = f"**••Aᴘᴘ Nᴀᴍᴇ••** [{name}]({url})\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
text += f"**••Dᴇᴠᴇʟᴏᴘᴇʀ••** `{dev}`\n"
|
307 |
text += f"**••Dᴇsᴄʀɪᴘᴛɪᴏɴ••**\n`{desc}`"
|
308 |
foles.append(
|
309 |
await e.builder.article(
|
310 |
title=name,
|
311 |
description=dev,
|
312 |
+
thumb=wb(z["icon"], 0, "image/jpeg", []),
|
313 |
text=text,
|
314 |
link_preview=True,
|
315 |
buttons=[
|
|
|
351 |
title="Bad Query",
|
352 |
description="Usage: [Language] [code]",
|
353 |
thumb=wb(
|
354 |
+
"https://graph.org/file/e33c57fc5f1044547e4d8.jpg", 0, "image/jpeg", []
|
355 |
),
|
356 |
+
text=f'**Inline Usage**\n\n`@{asst.me.username} run python print("hello world")`\n\n[Language List](https://graph.org/Ultroid-09-01-6)',
|
357 |
)
|
358 |
return await event.answer([result])
|
359 |
if not PISTON_LANGS:
|
360 |
+
se = await async_searcher(f"{PISTON_URI}runtimes", re_json=True)
|
361 |
PISTON_LANGS.update({lang.pop("language"): lang for lang in se})
|
362 |
if lang in PISTON_LANGS.keys():
|
363 |
version = PISTON_LANGS[lang]["version"]
|
|
|
366 |
title="Unsupported Language",
|
367 |
description="Usage: [Language] [code]",
|
368 |
thumb=wb(
|
369 |
+
"https://graph.org/file/e33c57fc5f1044547e4d8.jpg", 0, "image/jpeg", []
|
370 |
),
|
371 |
+
text=f'**Inline Usage**\n\n`@{asst.me.username} run python print("hello world")`\n\n[Language List](https://graph.org/Ultroid-09-01-6)',
|
372 |
)
|
373 |
return await event.answer([result])
|
374 |
output = await async_searcher(
|
375 |
+
f"{PISTON_URI}execute",
|
376 |
post=True,
|
377 |
+
json={
|
378 |
+
"language": lang,
|
379 |
+
"version": version,
|
380 |
+
"files": [{"content": code}],
|
381 |
+
},
|
382 |
re_json=True,
|
383 |
)
|
384 |
+
|
385 |
output = output["run"]["output"] or get_string("instu_4")
|
386 |
if len(output) > 3000:
|
387 |
+
output = f"{output[:3000]}..."
|
388 |
result = await event.builder.article(
|
389 |
title="Result",
|
390 |
description=output,
|
391 |
text=f"• **Language:**\n`{lang}`\n\n• **Code:**\n`{code}`\n\n• **Result:**\n`{output}`",
|
392 |
thumb=wb(
|
393 |
+
"https://graph.org/file/871ee4a481f58117dccc4.jpg", 0, "image/jpeg", []
|
394 |
),
|
395 |
buttons=Button.switch_inline("Fork", query=event.text, same_peer=True),
|
396 |
)
|
|
|
419 |
for dat in BSC.find_all("a", "package-header")[:10]:
|
420 |
image = dat.find("img", "package-icon")["src"]
|
421 |
if image.endswith("/"):
|
422 |
+
image = "https://graph.org/file/a8dd4a92c5a53a89d0eff.jpg"
|
423 |
title = dat.find("h4", "package-name").text.strip()
|
424 |
desc = dat.find("span", "package-summary").text.strip()
|
425 |
text = f"• **Name :** `{title}`\n\n"
|
|
|
448 |
await event.answer(ress, switch_pm=msg, switch_pm_param="start")
|
449 |
|
450 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
451 |
# Thanks to OpenSource
|
452 |
_bearer_collected = [
|
453 |
"AAAAAAAAAAAAAAAAAAAAALIKKgEAAAAA1DRuS%2BI7ZRKiagD6KHYmreaXomo%3DP5Vaje4UTtEkODg0fX7nCh5laSrchhtLxeyEqxXpv0w9ZKspLD",
|
|
|
472 |
)
|
473 |
except KeyError:
|
474 |
pass
|
475 |
+
headers = {"Authorization": f"bearer {choice(_bearer_collected)}"}
|
476 |
res = await async_searcher(
|
477 |
f"https://api.twitter.com/1.1/users/search.json?q={match}",
|
478 |
headers=headers,
|
|
|
500 |
thumb=thumb,
|
501 |
)
|
502 |
)
|
503 |
+
swi_ = f"🐦 Showing {len(reso)} Results!" if reso else "No User Found :("
|
504 |
await event.answer(reso, switch_pm=swi_, switch_pm_param="start")
|
505 |
if _ult_cache.get("twitter"):
|
506 |
_ult_cache["twitter"].update({match: reso})
|
|
|
526 |
switch_pm_param="start",
|
527 |
)
|
528 |
results = await saavn_search(query)
|
529 |
+
swi = "🎵 Saavn Search" if results else "No Results Found!"
|
530 |
res = []
|
531 |
for song in results:
|
532 |
thumb = wb(song["image"], 0, "image/jpeg", [])
|
533 |
+
text = f"• **Title :** {song['title']}"
|
534 |
text += f"\n• **Year :** {song['year']}"
|
535 |
text += f"\n• **Lang :** {song['language']}"
|
536 |
+
text += f"\n• **Artist :** {song['artists']}"
|
537 |
text += f"\n• **Release Date :** {song['release_date']}"
|
538 |
res.append(
|
539 |
await event.builder.article(
|
540 |
+
title=song["title"],
|
541 |
+
description=song["artists"],
|
542 |
type="audio",
|
543 |
text=text,
|
544 |
include_media=True,
|
|
|
547 |
),
|
548 |
thumb=thumb,
|
549 |
content=wb(
|
550 |
+
song["url"],
|
551 |
0,
|
552 |
"audio/mp4",
|
553 |
[
|
554 |
Audio(
|
555 |
+
title=song["title"],
|
556 |
duration=int(song["duration"]),
|
557 |
+
performer=song["artists"],
|
558 |
)
|
559 |
],
|
560 |
),
|
|
|
564 |
_savn_cache.update({query: res})
|
565 |
|
566 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
567 |
@in_pattern("tl", owner=True)
|
568 |
async def inline_tl(ult):
|
569 |
try:
|
|
|
575 |
await ult.builder.article(
|
576 |
title="How to Use?",
|
577 |
description="Tl Searcher by Ultroid",
|
578 |
+
url="https://t.me/TeamUltroid",
|
579 |
text=text,
|
580 |
)
|
581 |
],
|
|
|
589 |
text = f"**Name:** `{key.__name__}`\n"
|
590 |
text += f"**Category:** `{tyyp}`\n"
|
591 |
text += f"\n`from {key.__module__} import {key.__name__}`\n\n"
|
592 |
+
if args := str(inspect.signature(key))[1:][:-1]:
|
|
|
593 |
text += "**Parameter:**\n"
|
594 |
for para in args.split(","):
|
595 |
text += " " * 4 + "`" + para + "`\n"
|
|
|
598 |
await ult.builder.article(
|
599 |
title=key.__name__,
|
600 |
description=tyyp,
|
601 |
+
url="https://t.me/TeamUltroid",
|
602 |
text=text[:4000],
|
603 |
)
|
604 |
)
|
605 |
+
mo = f"Showing {len(res)} results!" if res else f"No Results for {match}!"
|
|
|
|
|
|
|
606 |
await ult.answer(res[:50], switch_pm=mo, switch_pm_param="start")
|
607 |
|
608 |
|
609 |
+
InlinePlugin.update(
|
610 |
+
{
|
611 |
+
"Pʟᴀʏ Sᴛᴏʀᴇ Aᴘᴘs": "app telegram",
|
612 |
+
"Mᴏᴅᴅᴇᴅ Aᴘᴘs": "mods minecraft",
|
613 |
+
"Sᴇᴀʀᴄʜ Oɴ Gᴏᴏɢʟᴇ": "go TeamUltroid",
|
614 |
+
"WʜɪSᴘᴇʀ": "wspr @username Hello🎉",
|
615 |
+
"YᴏᴜTᴜʙᴇ Dᴏᴡɴʟᴏᴀᴅᴇʀ": "yt Ed Sheeran Perfect",
|
616 |
+
"Piston Eval": "run javascript console.log('Hello Ultroid')",
|
617 |
+
"OʀᴀɴɢᴇFᴏx🦊": "ofox beryllium",
|
618 |
+
"Tᴡɪᴛᴛᴇʀ Usᴇʀ": "twitter theultroid",
|
619 |
+
"Fᴅʀᴏɪᴅ Sᴇᴀʀᴄʜ": "fdroid telegram",
|
620 |
+
"Sᴀᴀᴠɴ sᴇᴀʀᴄʜ": "saavn",
|
621 |
+
"Tʟ Sᴇᴀʀᴄʜ": "tl",
|
622 |
+
}
|
623 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assistant/localization.py
CHANGED
@@ -7,7 +7,15 @@
|
|
7 |
|
8 |
import re
|
9 |
|
10 |
-
from . import
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
|
13 |
@callback("lang", owner=True)
|
@@ -24,14 +32,14 @@ async def setlang(event):
|
|
24 |
if len(tultd) % 2 == 1:
|
25 |
buttons.append((tultd[-1],))
|
26 |
buttons.append([Button.inline("« Back", data="mainmenu")])
|
27 |
-
await event.edit("
|
28 |
|
29 |
|
30 |
@callback(re.compile(b"set_(.*)"), owner=True)
|
31 |
async def settt(event):
|
32 |
lang = event.data_match.group(1).decode("UTF-8")
|
33 |
languages = get_languages()
|
34 |
-
|
35 |
udB.del_key("language") if lang == "en" else udB.set_key("language", lang)
|
36 |
await event.edit(
|
37 |
f"Your language has been set to {languages[lang]['natively']} [{lang}].",
|
|
|
7 |
|
8 |
import re
|
9 |
|
10 |
+
from . import (
|
11 |
+
Button,
|
12 |
+
ULTConfig,
|
13 |
+
callback,
|
14 |
+
get_back_button,
|
15 |
+
get_languages,
|
16 |
+
get_string,
|
17 |
+
udB,
|
18 |
+
)
|
19 |
|
20 |
|
21 |
@callback("lang", owner=True)
|
|
|
32 |
if len(tultd) % 2 == 1:
|
33 |
buttons.append((tultd[-1],))
|
34 |
buttons.append([Button.inline("« Back", data="mainmenu")])
|
35 |
+
await event.edit(get_string("ast_4"), buttons=buttons)
|
36 |
|
37 |
|
38 |
@callback(re.compile(b"set_(.*)"), owner=True)
|
39 |
async def settt(event):
|
40 |
lang = event.data_match.group(1).decode("UTF-8")
|
41 |
languages = get_languages()
|
42 |
+
ULTConfig.lang = lang
|
43 |
udB.del_key("language") if lang == "en" else udB.set_key("language", lang)
|
44 |
await event.edit(
|
45 |
f"Your language has been set to {languages[lang]['natively']} [{lang}].",
|
assistant/manager/__init__.py
CHANGED
@@ -6,6 +6,6 @@
|
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
|
8 |
from pyUltroid._misc._decorators import ultroid_cmd
|
9 |
-
from pyUltroid.
|
10 |
|
11 |
from .. import *
|
|
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
|
8 |
from pyUltroid._misc._decorators import ultroid_cmd
|
9 |
+
from pyUltroid.fns.helper import inline_mention
|
10 |
|
11 |
from .. import *
|
assistant/manager/_help.py
CHANGED
@@ -14,7 +14,7 @@ START = """
|
|
14 |
✘ /help : Get This Message.
|
15 |
✘ /repo : Get Bot's Repo..
|
16 |
|
17 |
-
🧑💻 Join **@
|
18 |
"""
|
19 |
|
20 |
ADMINTOOLS = """✘ **AdminTools** ✘
|
@@ -93,11 +93,11 @@ def get_buttons():
|
|
93 |
while keys:
|
94 |
BT = []
|
95 |
for i in list(keys)[:2]:
|
96 |
-
text = MNGE
|
97 |
-
BT.append(Button.inline(text, "hlp_"
|
98 |
del keys[i]
|
99 |
BTTS.append(BT)
|
100 |
-
url = "https://t.me/
|
101 |
BTTS.append([Button.url("Add me to Group", url)])
|
102 |
return BTTS
|
103 |
|
|
|
14 |
✘ /help : Get This Message.
|
15 |
✘ /repo : Get Bot's Repo..
|
16 |
|
17 |
+
🧑💻 Join **@TeamUltroid**
|
18 |
"""
|
19 |
|
20 |
ADMINTOOLS = """✘ **AdminTools** ✘
|
|
|
93 |
while keys:
|
94 |
BT = []
|
95 |
for i in list(keys)[:2]:
|
96 |
+
text = f"{MNGE} {i} {MNGE}"
|
97 |
+
BT.append(Button.inline(text, f"hlp_{i}"))
|
98 |
del keys[i]
|
99 |
BTTS.append(BT)
|
100 |
+
url = f"https://t.me/{asst.me.username}?startgroup=true"
|
101 |
BTTS.append([Button.url("Add me to Group", url)])
|
102 |
return BTTS
|
103 |
|
assistant/manager/admins.py
CHANGED
@@ -7,9 +7,10 @@
|
|
7 |
|
8 |
import re
|
9 |
|
10 |
-
from pyUltroid import _ult_cache
|
11 |
from telethon.errors.rpcerrorlist import UserNotParticipantError
|
12 |
|
|
|
|
|
13 |
from . import *
|
14 |
|
15 |
|
|
|
7 |
|
8 |
import re
|
9 |
|
|
|
10 |
from telethon.errors.rpcerrorlist import UserNotParticipantError
|
11 |
|
12 |
+
from pyUltroid import _ult_cache
|
13 |
+
|
14 |
from . import *
|
15 |
|
16 |
|
assistant/manager/afk.py
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
|
8 |
from datetime import datetime as dt
|
9 |
|
10 |
-
from pyUltroid.functions.helper import inline_mention, time_formatter
|
11 |
from telethon.events import NewMessage
|
12 |
from telethon.tl.types import (
|
13 |
Message,
|
@@ -17,6 +16,8 @@ from telethon.tl.types import (
|
|
17 |
)
|
18 |
from telethon.utils import get_display_name
|
19 |
|
|
|
|
|
20 |
from . import asst, asst_cmd
|
21 |
|
22 |
AFK = {}
|
|
|
7 |
|
8 |
from datetime import datetime as dt
|
9 |
|
|
|
10 |
from telethon.events import NewMessage
|
11 |
from telethon.tl.types import (
|
12 |
Message,
|
|
|
16 |
)
|
17 |
from telethon.utils import get_display_name
|
18 |
|
19 |
+
from pyUltroid.fns.helper import inline_mention, time_formatter
|
20 |
+
|
21 |
from . import asst, asst_cmd
|
22 |
|
23 |
AFK = {}
|
assistant/manager/misc.py
CHANGED
@@ -9,8 +9,9 @@
|
|
9 |
import random
|
10 |
|
11 |
import aiohttp
|
|
|
12 |
from pyUltroid.dB import DEVLIST
|
13 |
-
from pyUltroid.
|
14 |
|
15 |
from . import *
|
16 |
|
@@ -27,8 +28,7 @@ async def dheh(e):
|
|
27 |
async def oqha(e):
|
28 |
if not await admin_check(e):
|
29 |
return
|
30 |
-
match
|
31 |
-
if match:
|
32 |
text = match
|
33 |
reply_to = e
|
34 |
elif e.is_reply:
|
|
|
9 |
import random
|
10 |
|
11 |
import aiohttp
|
12 |
+
|
13 |
from pyUltroid.dB import DEVLIST
|
14 |
+
from pyUltroid.fns.admins import admin_check
|
15 |
|
16 |
from . import *
|
17 |
|
|
|
28 |
async def oqha(e):
|
29 |
if not await admin_check(e):
|
30 |
return
|
31 |
+
if match := e.pattern_match.group(1).strip():
|
|
|
32 |
text = match
|
33 |
reply_to = e
|
34 |
elif e.is_reply:
|
assistant/manager/stickermanager.py
CHANGED
@@ -7,8 +7,6 @@
|
|
7 |
|
8 |
import random
|
9 |
|
10 |
-
from pyUltroid.functions.misc import Quotly
|
11 |
-
from pyUltroid.functions.tools import TgConverter
|
12 |
from telethon import errors
|
13 |
from telethon.errors.rpcerrorlist import StickersetInvalidError
|
14 |
from telethon.tl.functions.messages import GetStickerSetRequest as GetSticker
|
@@ -20,6 +18,9 @@ from telethon.tl.types import InputStickerSetItem as SetItem
|
|
20 |
from telethon.tl.types import InputStickerSetShortName, User
|
21 |
from telethon.utils import get_display_name, get_input_document
|
22 |
|
|
|
|
|
|
|
23 |
from . import LOGS, asst, asst_cmd, udB
|
24 |
|
25 |
|
@@ -37,7 +38,7 @@ async def kang_cmd(ult):
|
|
37 |
pre = sender.username[:4]
|
38 |
else:
|
39 |
pre = random.random_string(length=3)
|
40 |
-
animated, dl = None, None
|
41 |
try:
|
42 |
emoji = ult.text.split(maxsplit=1)[1]
|
43 |
except IndexError:
|
@@ -45,9 +46,13 @@ async def kang_cmd(ult):
|
|
45 |
if reply.sticker:
|
46 |
file = get_input_document(reply.sticker)
|
47 |
emoji = emoji or reply.file.emoji
|
48 |
-
|
|
|
49 |
animated = True
|
50 |
dl = await reply.download_media()
|
|
|
|
|
|
|
51 |
elif reply.photo:
|
52 |
dl = await reply.download_media()
|
53 |
name = "sticker.webp"
|
@@ -65,7 +70,7 @@ async def kang_cmd(ult):
|
|
65 |
await ult.client(UploadMediaRequest(InputPeerSelf(), upl))
|
66 |
)
|
67 |
get_ = udB.get_key("STICKERS") or {}
|
68 |
-
type_ = "
|
69 |
if not get_.get(ult.sender_id) or not get_.get(ult.sender_id, {}).get(type_):
|
70 |
sn = f"{pre}_{ult.sender_id}"
|
71 |
title = f"{get_display_name(sender)}'s Kang Pack"
|
@@ -73,6 +78,10 @@ async def kang_cmd(ult):
|
|
73 |
type_ = "anim"
|
74 |
sn += "_anim"
|
75 |
title += " (Animated)"
|
|
|
|
|
|
|
|
|
76 |
sn += f"_by_{asst.me.username}"
|
77 |
try:
|
78 |
await asst(GetSticker(InputStickerSetShortName(sn), hash=0))
|
@@ -86,7 +95,9 @@ async def kang_cmd(ult):
|
|
86 |
title=title,
|
87 |
short_name=sn,
|
88 |
stickers=[SetItem(file, emoji=emoji)],
|
|
|
89 |
animated=animated,
|
|
|
90 |
)
|
91 |
)
|
92 |
except Exception as er:
|
@@ -115,6 +126,9 @@ async def kang_cmd(ult):
|
|
115 |
if animated:
|
116 |
sn += "_anim"
|
117 |
title += " (Animated)"
|
|
|
|
|
|
|
118 |
sn += f"_by_{asst.me.username}"
|
119 |
try:
|
120 |
pack = await ult.client(
|
@@ -148,10 +162,8 @@ async def do_magic(ult):
|
|
148 |
return await ult.reply("No Sticker Pack Found!")
|
149 |
al_ = []
|
150 |
ul = ko[ult.sender_id]
|
151 |
-
|
152 |
-
al_.extend(ul[
|
153 |
-
if ul.get("anim"):
|
154 |
-
al_.extend(ul["anim"])
|
155 |
msg = "• **Stickers Owned by You!**\n\n"
|
156 |
for _ in al_:
|
157 |
try:
|
@@ -160,7 +172,9 @@ async def do_magic(ult):
|
|
160 |
except StickerSetInvalidError:
|
161 |
if ul.get("anim") and _ in ul["anim"]:
|
162 |
ul["anim"].remove(_)
|
|
|
|
|
163 |
else:
|
164 |
ul["static"].remove(_)
|
165 |
-
|
166 |
await ult.reply(msg)
|
|
|
7 |
|
8 |
import random
|
9 |
|
|
|
|
|
10 |
from telethon import errors
|
11 |
from telethon.errors.rpcerrorlist import StickersetInvalidError
|
12 |
from telethon.tl.functions.messages import GetStickerSetRequest as GetSticker
|
|
|
18 |
from telethon.tl.types import InputStickerSetShortName, User
|
19 |
from telethon.utils import get_display_name, get_input_document
|
20 |
|
21 |
+
from pyUltroid.fns.misc import Quotly
|
22 |
+
from pyUltroid.fns.tools import TgConverter
|
23 |
+
|
24 |
from . import LOGS, asst, asst_cmd, udB
|
25 |
|
26 |
|
|
|
38 |
pre = sender.username[:4]
|
39 |
else:
|
40 |
pre = random.random_string(length=3)
|
41 |
+
animated, dl, video = None, None, None
|
42 |
try:
|
43 |
emoji = ult.text.split(maxsplit=1)[1]
|
44 |
except IndexError:
|
|
|
46 |
if reply.sticker:
|
47 |
file = get_input_document(reply.sticker)
|
48 |
emoji = emoji or reply.file.emoji
|
49 |
+
name = reply.file.name
|
50 |
+
if name.endswith(".tgs"):
|
51 |
animated = True
|
52 |
dl = await reply.download_media()
|
53 |
+
elif name.endswith(".webm"):
|
54 |
+
video = True
|
55 |
+
dl = await reply.download_media()
|
56 |
elif reply.photo:
|
57 |
dl = await reply.download_media()
|
58 |
name = "sticker.webp"
|
|
|
70 |
await ult.client(UploadMediaRequest(InputPeerSelf(), upl))
|
71 |
)
|
72 |
get_ = udB.get_key("STICKERS") or {}
|
73 |
+
type_ = "anim" if animated else "static"
|
74 |
if not get_.get(ult.sender_id) or not get_.get(ult.sender_id, {}).get(type_):
|
75 |
sn = f"{pre}_{ult.sender_id}"
|
76 |
title = f"{get_display_name(sender)}'s Kang Pack"
|
|
|
78 |
type_ = "anim"
|
79 |
sn += "_anim"
|
80 |
title += " (Animated)"
|
81 |
+
elif video:
|
82 |
+
type_ = "vid"
|
83 |
+
sn += "_vid"
|
84 |
+
title += " (Video)"
|
85 |
sn += f"_by_{asst.me.username}"
|
86 |
try:
|
87 |
await asst(GetSticker(InputStickerSetShortName(sn), hash=0))
|
|
|
95 |
title=title,
|
96 |
short_name=sn,
|
97 |
stickers=[SetItem(file, emoji=emoji)],
|
98 |
+
videos=video,
|
99 |
animated=animated,
|
100 |
+
software="@TeamUltroid",
|
101 |
)
|
102 |
)
|
103 |
except Exception as er:
|
|
|
126 |
if animated:
|
127 |
sn += "_anim"
|
128 |
title += " (Animated)"
|
129 |
+
elif video:
|
130 |
+
sn += "_vid"
|
131 |
+
title += "(Video)"
|
132 |
sn += f"_by_{asst.me.username}"
|
133 |
try:
|
134 |
pack = await ult.client(
|
|
|
162 |
return await ult.reply("No Sticker Pack Found!")
|
163 |
al_ = []
|
164 |
ul = ko[ult.sender_id]
|
165 |
+
for _ in ul.keys():
|
166 |
+
al_.extend(ul[_])
|
|
|
|
|
167 |
msg = "• **Stickers Owned by You!**\n\n"
|
168 |
for _ in al_:
|
169 |
try:
|
|
|
172 |
except StickerSetInvalidError:
|
173 |
if ul.get("anim") and _ in ul["anim"]:
|
174 |
ul["anim"].remove(_)
|
175 |
+
elif ul.get("vid") and _ in ul["vid"]:
|
176 |
+
ul["vid"].remove(_)
|
177 |
else:
|
178 |
ul["static"].remove(_)
|
179 |
+
udB.set_key("STICKERS", ko)
|
180 |
await ult.reply(msg)
|
assistant/pmbot.py
CHANGED
@@ -11,9 +11,6 @@
|
|
11 |
|
12 |
import os
|
13 |
|
14 |
-
from pyUltroid.dB.asst_fns import *
|
15 |
-
from pyUltroid.dB.botchat_db import *
|
16 |
-
from pyUltroid.functions.helper import inline_mention
|
17 |
from telethon.errors.rpcerrorlist import UserNotParticipantError
|
18 |
from telethon.tl.custom import Button
|
19 |
from telethon.tl.functions.channels import GetFullChannelRequest
|
@@ -21,6 +18,10 @@ from telethon.tl.functions.messages import GetFullChatRequest
|
|
21 |
from telethon.tl.types import Channel, Chat
|
22 |
from telethon.utils import get_display_name
|
23 |
|
|
|
|
|
|
|
|
|
24 |
from . import *
|
25 |
|
26 |
FSUB = udB.get_key("PMBOT_FSUB")
|
@@ -50,7 +51,7 @@ async def on_new_mssg(event):
|
|
50 |
try:
|
51 |
TAHC_ = await event.client.get_entity(chat)
|
52 |
if hasattr(TAHC_, "username") and TAHC_.username:
|
53 |
-
uri = "t.me/
|
54 |
elif CACHE.get(chat):
|
55 |
uri = CACHE[chat]
|
56 |
else:
|
@@ -98,7 +99,7 @@ async def on_out_mssg(event):
|
|
98 |
os.remove(photu)
|
99 |
return
|
100 |
except BaseException as er:
|
101 |
-
return await event.reply("**ERROR : **
|
102 |
elif event.text.startswith("/"):
|
103 |
return
|
104 |
if to_user:
|
|
|
11 |
|
12 |
import os
|
13 |
|
|
|
|
|
|
|
14 |
from telethon.errors.rpcerrorlist import UserNotParticipantError
|
15 |
from telethon.tl.custom import Button
|
16 |
from telethon.tl.functions.channels import GetFullChannelRequest
|
|
|
18 |
from telethon.tl.types import Channel, Chat
|
19 |
from telethon.utils import get_display_name
|
20 |
|
21 |
+
from pyUltroid.dB.asst_fns import *
|
22 |
+
from pyUltroid.dB.botchat_db import *
|
23 |
+
from pyUltroid.fns.helper import inline_mention
|
24 |
+
|
25 |
from . import *
|
26 |
|
27 |
FSUB = udB.get_key("PMBOT_FSUB")
|
|
|
51 |
try:
|
52 |
TAHC_ = await event.client.get_entity(chat)
|
53 |
if hasattr(TAHC_, "username") and TAHC_.username:
|
54 |
+
uri = f"t.me/{TAHC_.username}"
|
55 |
elif CACHE.get(chat):
|
56 |
uri = CACHE[chat]
|
57 |
else:
|
|
|
99 |
os.remove(photu)
|
100 |
return
|
101 |
except BaseException as er:
|
102 |
+
return await event.reply(f"**ERROR : **{str(er)}")
|
103 |
elif event.text.startswith("/"):
|
104 |
return
|
105 |
if to_user:
|
assistant/start.py
CHANGED
@@ -8,14 +8,14 @@
|
|
8 |
from datetime import datetime
|
9 |
|
10 |
from pytz import timezone as tz
|
11 |
-
from pyUltroid._misc import SUDO_M, owner_and_sudos
|
12 |
-
from pyUltroid.dB.asst_fns import *
|
13 |
-
from pyUltroid.functions.helper import inline_mention
|
14 |
from telethon import Button, events
|
15 |
from telethon.errors.rpcerrorlist import MessageDeleteForbiddenError
|
16 |
from telethon.utils import get_display_name
|
17 |
|
18 |
-
from
|
|
|
|
|
|
|
19 |
|
20 |
from . import *
|
21 |
|
@@ -68,7 +68,7 @@ async def own(event):
|
|
68 |
mention=event.sender.mention, me=inline_mention(ultroid_bot.me)
|
69 |
)
|
70 |
if custom_info:
|
71 |
-
msg += "\n\n• Powered by **@
|
72 |
await event.edit(
|
73 |
msg,
|
74 |
buttons=[Button.inline("Close", data="closeit")],
|
|
|
8 |
from datetime import datetime
|
9 |
|
10 |
from pytz import timezone as tz
|
|
|
|
|
|
|
11 |
from telethon import Button, events
|
12 |
from telethon.errors.rpcerrorlist import MessageDeleteForbiddenError
|
13 |
from telethon.utils import get_display_name
|
14 |
|
15 |
+
from pyUltroid._misc import SUDO_M, owner_and_sudos
|
16 |
+
from pyUltroid.dB.asst_fns import *
|
17 |
+
from pyUltroid.fns.helper import inline_mention
|
18 |
+
from strings import get_string
|
19 |
|
20 |
from . import *
|
21 |
|
|
|
68 |
mention=event.sender.mention, me=inline_mention(ultroid_bot.me)
|
69 |
)
|
70 |
if custom_info:
|
71 |
+
msg += "\n\n• Powered by **@TeamUltroid**"
|
72 |
await event.edit(
|
73 |
msg,
|
74 |
buttons=[Button.inline("Close", data="closeit")],
|
assistant/ytdl.py
CHANGED
@@ -13,18 +13,19 @@ try:
|
|
13 |
from PIL import Image
|
14 |
except ImportError:
|
15 |
Image = None
|
16 |
-
from
|
|
|
|
|
|
|
|
|
|
|
17 |
bash,
|
18 |
fast_download,
|
19 |
humanbytes,
|
20 |
numerize,
|
21 |
time_formatter,
|
22 |
)
|
23 |
-
from pyUltroid.
|
24 |
-
from telethon import Button
|
25 |
-
from telethon.errors.rpcerrorlist import FilePartLengthInvalidError, MediaEmptyError
|
26 |
-
from telethon.tl.types import DocumentAttributeAudio, DocumentAttributeVideo
|
27 |
-
from telethon.tl.types import InputWebDocument as wb
|
28 |
|
29 |
from . import LOGS, asst, callback, in_pattern, udB
|
30 |
|
@@ -35,7 +36,7 @@ except ImportError:
|
|
35 |
VideosSearch = None
|
36 |
|
37 |
|
38 |
-
ytt = "https://
|
39 |
_yt_base_url = "https://www.youtube.com/watch?v="
|
40 |
BACK_BUTTON = {}
|
41 |
|
@@ -130,9 +131,12 @@ async def _(e):
|
|
130 |
_ytdl_data = await dler(e, _yt_base_url + _lets_split[1])
|
131 |
_data = get_formats(_lets_split[0], _lets_split[1], _ytdl_data)
|
132 |
_buttons = get_buttons(_data)
|
133 |
-
_text =
|
134 |
-
|
135 |
-
|
|
|
|
|
|
|
136 |
await e.edit(_text, buttons=_buttons)
|
137 |
|
138 |
|
@@ -159,7 +163,7 @@ async def _(event):
|
|
159 |
"key": "FFmpegMetadata",
|
160 |
"prefer_ffmpeg": True,
|
161 |
"geo_bypass": True,
|
162 |
-
"outtmpl": "%(id)s."
|
163 |
"logtostderr": False,
|
164 |
"postprocessors": [
|
165 |
{
|
@@ -170,6 +174,7 @@ async def _(event):
|
|
170 |
{"key": "FFmpegMetadata"},
|
171 |
],
|
172 |
}
|
|
|
173 |
ytdl_data = await dler(event, link, opts, True)
|
174 |
title = ytdl_data["title"]
|
175 |
if ytdl_data.get("artist"):
|
@@ -179,7 +184,8 @@ async def _(event):
|
|
179 |
elif ytdl_data.get("channel"):
|
180 |
artist = ytdl_data["channel"]
|
181 |
views = numerize(ytdl_data.get("view_count")) or 0
|
182 |
-
thumb, _ = await fast_download(ytdl_data["thumbnail"], filename=vid_id
|
|
|
183 |
likes = numerize(ytdl_data.get("like_count")) or 0
|
184 |
duration = ytdl_data.get("duration") or 0
|
185 |
description = (
|
@@ -188,17 +194,18 @@ async def _(event):
|
|
188 |
else ytdl_data["description"][:100]
|
189 |
)
|
190 |
description = description or "None"
|
191 |
-
filepath =
|
192 |
if not os.path.exists(filepath):
|
193 |
-
filepath =
|
194 |
size = os.path.getsize(filepath)
|
195 |
file, _ = await event.client.fast_uploader(
|
196 |
filepath,
|
197 |
-
filename=title
|
198 |
show_progress=True,
|
199 |
event=event,
|
200 |
to_delete=True,
|
201 |
)
|
|
|
202 |
attributes = [
|
203 |
DocumentAttributeAudio(
|
204 |
duration=int(duration),
|
@@ -213,10 +220,11 @@ async def _(event):
|
|
213 |
"key": "FFmpegMetadata",
|
214 |
"prefer_ffmpeg": True,
|
215 |
"geo_bypass": True,
|
216 |
-
"outtmpl": "%(id)s."
|
217 |
"logtostderr": False,
|
218 |
"postprocessors": [{"key": "FFmpegMetadata"}],
|
219 |
}
|
|
|
220 |
ytdl_data = await dler(event, link, opts, True)
|
221 |
title = ytdl_data["title"]
|
222 |
if ytdl_data.get("artist"):
|
@@ -226,7 +234,8 @@ async def _(event):
|
|
226 |
elif ytdl_data.get("channel"):
|
227 |
artist = ytdl_data["channel"]
|
228 |
views = numerize(ytdl_data.get("view_count")) or 0
|
229 |
-
thumb, _ = await fast_download(ytdl_data["thumbnail"], filename=vid_id
|
|
|
230 |
try:
|
231 |
Image.open(thumb).save(thumb, "JPEG")
|
232 |
except Exception as er:
|
@@ -240,17 +249,18 @@ async def _(event):
|
|
240 |
likes = numerize(ytdl_data.get("like_count")) or 0
|
241 |
hi, wi = ytdl_data.get("height") or 720, ytdl_data.get("width") or 1280
|
242 |
duration = ytdl_data.get("duration") or 0
|
243 |
-
filepath = vid_id
|
244 |
if not os.path.exists(filepath):
|
245 |
-
filepath = filepath
|
246 |
size = os.path.getsize(filepath)
|
247 |
file, _ = await event.client.fast_uploader(
|
248 |
filepath,
|
249 |
-
filename=title
|
250 |
show_progress=True,
|
251 |
event=event,
|
252 |
to_delete=True,
|
253 |
)
|
|
|
254 |
attributes = [
|
255 |
DocumentAttributeVideo(
|
256 |
duration=int(duration),
|
|
|
13 |
from PIL import Image
|
14 |
except ImportError:
|
15 |
Image = None
|
16 |
+
from telethon import Button
|
17 |
+
from telethon.errors.rpcerrorlist import FilePartLengthInvalidError, MediaEmptyError
|
18 |
+
from telethon.tl.types import DocumentAttributeAudio, DocumentAttributeVideo
|
19 |
+
from telethon.tl.types import InputWebDocument as wb
|
20 |
+
|
21 |
+
from pyUltroid.fns.helper import (
|
22 |
bash,
|
23 |
fast_download,
|
24 |
humanbytes,
|
25 |
numerize,
|
26 |
time_formatter,
|
27 |
)
|
28 |
+
from pyUltroid.fns.ytdl import dler, get_buttons, get_formats
|
|
|
|
|
|
|
|
|
29 |
|
30 |
from . import LOGS, asst, callback, in_pattern, udB
|
31 |
|
|
|
36 |
VideosSearch = None
|
37 |
|
38 |
|
39 |
+
ytt = "https://graph.org/file/afd04510c13914a06dd03.jpg"
|
40 |
_yt_base_url = "https://www.youtube.com/watch?v="
|
41 |
BACK_BUTTON = {}
|
42 |
|
|
|
131 |
_ytdl_data = await dler(e, _yt_base_url + _lets_split[1])
|
132 |
_data = get_formats(_lets_split[0], _lets_split[1], _ytdl_data)
|
133 |
_buttons = get_buttons(_data)
|
134 |
+
_text = (
|
135 |
+
"`Select Your Format.`"
|
136 |
+
if _buttons
|
137 |
+
else "`Error downloading from YouTube.\nTry Restarting your bot.`"
|
138 |
+
)
|
139 |
+
|
140 |
await e.edit(_text, buttons=_buttons)
|
141 |
|
142 |
|
|
|
163 |
"key": "FFmpegMetadata",
|
164 |
"prefer_ffmpeg": True,
|
165 |
"geo_bypass": True,
|
166 |
+
"outtmpl": f"%(id)s.{ext}",
|
167 |
"logtostderr": False,
|
168 |
"postprocessors": [
|
169 |
{
|
|
|
174 |
{"key": "FFmpegMetadata"},
|
175 |
],
|
176 |
}
|
177 |
+
|
178 |
ytdl_data = await dler(event, link, opts, True)
|
179 |
title = ytdl_data["title"]
|
180 |
if ytdl_data.get("artist"):
|
|
|
184 |
elif ytdl_data.get("channel"):
|
185 |
artist = ytdl_data["channel"]
|
186 |
views = numerize(ytdl_data.get("view_count")) or 0
|
187 |
+
thumb, _ = await fast_download(ytdl_data["thumbnail"], filename=f"{vid_id}.jpg")
|
188 |
+
|
189 |
likes = numerize(ytdl_data.get("like_count")) or 0
|
190 |
duration = ytdl_data.get("duration") or 0
|
191 |
description = (
|
|
|
194 |
else ytdl_data["description"][:100]
|
195 |
)
|
196 |
description = description or "None"
|
197 |
+
filepath = f"{vid_id}.{ext}"
|
198 |
if not os.path.exists(filepath):
|
199 |
+
filepath = f"{filepath}.{ext}"
|
200 |
size = os.path.getsize(filepath)
|
201 |
file, _ = await event.client.fast_uploader(
|
202 |
filepath,
|
203 |
+
filename=f"{title}.{ext}",
|
204 |
show_progress=True,
|
205 |
event=event,
|
206 |
to_delete=True,
|
207 |
)
|
208 |
+
|
209 |
attributes = [
|
210 |
DocumentAttributeAudio(
|
211 |
duration=int(duration),
|
|
|
220 |
"key": "FFmpegMetadata",
|
221 |
"prefer_ffmpeg": True,
|
222 |
"geo_bypass": True,
|
223 |
+
"outtmpl": f"%(id)s.{ext}",
|
224 |
"logtostderr": False,
|
225 |
"postprocessors": [{"key": "FFmpegMetadata"}],
|
226 |
}
|
227 |
+
|
228 |
ytdl_data = await dler(event, link, opts, True)
|
229 |
title = ytdl_data["title"]
|
230 |
if ytdl_data.get("artist"):
|
|
|
234 |
elif ytdl_data.get("channel"):
|
235 |
artist = ytdl_data["channel"]
|
236 |
views = numerize(ytdl_data.get("view_count")) or 0
|
237 |
+
thumb, _ = await fast_download(ytdl_data["thumbnail"], filename=f"{vid_id}.jpg")
|
238 |
+
|
239 |
try:
|
240 |
Image.open(thumb).save(thumb, "JPEG")
|
241 |
except Exception as er:
|
|
|
249 |
likes = numerize(ytdl_data.get("like_count")) or 0
|
250 |
hi, wi = ytdl_data.get("height") or 720, ytdl_data.get("width") or 1280
|
251 |
duration = ytdl_data.get("duration") or 0
|
252 |
+
filepath = f"{vid_id}.mkv"
|
253 |
if not os.path.exists(filepath):
|
254 |
+
filepath = f"{filepath}.webm"
|
255 |
size = os.path.getsize(filepath)
|
256 |
file, _ = await event.client.fast_uploader(
|
257 |
filepath,
|
258 |
+
filename=f"{title}.mkv",
|
259 |
show_progress=True,
|
260 |
event=event,
|
261 |
to_delete=True,
|
262 |
)
|
263 |
+
|
264 |
attributes = [
|
265 |
DocumentAttributeVideo(
|
266 |
duration=int(duration),
|
installer.sh
CHANGED
@@ -19,29 +19,71 @@ clone_repo(){
|
|
19 |
if [ ! $BRANCH ]
|
20 |
then export BRANCH="main"
|
21 |
fi
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
git clone -b $BRANCH $REPO $DIR
|
24 |
}
|
25 |
|
26 |
install_requirements(){
|
27 |
echo -e "\n\nInstalling requirements... "
|
28 |
-
pip3 install -q --no-cache-dir -r $DIR/requirements.txt
|
29 |
pip3 install -q -r $DIR/resources/startup/optional-requirements.txt
|
30 |
}
|
31 |
|
32 |
railways_dep(){
|
33 |
if [ $RAILWAY_STATIC_URL ]
|
34 |
then
|
35 |
-
echo -e "
|
36 |
-
pip3 install -q
|
37 |
fi
|
38 |
}
|
39 |
|
40 |
-
|
41 |
if [ $OKTETO_TOKEN ]
|
42 |
then
|
43 |
-
echo -e "
|
44 |
curl https://get.okteto.com -sSfL | sh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
fi
|
46 |
}
|
47 |
|
@@ -49,7 +91,8 @@ main(){
|
|
49 |
(clone_repo)
|
50 |
(install_requirements)
|
51 |
(railways_dep)
|
52 |
-
(
|
|
|
53 |
}
|
54 |
|
55 |
main
|
|
|
19 |
if [ ! $BRANCH ]
|
20 |
then export BRANCH="main"
|
21 |
fi
|
22 |
+
if [ -d $DIR ]
|
23 |
+
then
|
24 |
+
echo -e $DIR "Already exists.."
|
25 |
+
cd $DIR
|
26 |
+
git pull
|
27 |
+
currentbranch="$(git rev-parse --abbrev-ref HEAD)"
|
28 |
+
if [ currentbranch != $BRANCH ]
|
29 |
+
then
|
30 |
+
git checkout $BRANCH
|
31 |
+
fi
|
32 |
+
if [ -d "addons" ]
|
33 |
+
then
|
34 |
+
cd addons
|
35 |
+
git pull
|
36 |
+
fi
|
37 |
+
return
|
38 |
+
fi
|
39 |
+
echo -e "Cloning Ultroid ${BRANCH}... "
|
40 |
git clone -b $BRANCH $REPO $DIR
|
41 |
}
|
42 |
|
43 |
install_requirements(){
|
44 |
echo -e "\n\nInstalling requirements... "
|
45 |
+
pip3 install -q --no-cache-dir -r $DIR/requirements.txt
|
46 |
pip3 install -q -r $DIR/resources/startup/optional-requirements.txt
|
47 |
}
|
48 |
|
49 |
railways_dep(){
|
50 |
if [ $RAILWAY_STATIC_URL ]
|
51 |
then
|
52 |
+
echo -e "Installing YouTube dependency... "
|
53 |
+
pip3 install -q yt-dlp
|
54 |
fi
|
55 |
}
|
56 |
|
57 |
+
misc_install(){
|
58 |
if [ $OKTETO_TOKEN ]
|
59 |
then
|
60 |
+
echo -e "Installing Okteto-CLI... "
|
61 |
curl https://get.okteto.com -sSfL | sh
|
62 |
+
elif [ $VCBOT ]
|
63 |
+
then
|
64 |
+
if [ -d $DIR/vcbot ]
|
65 |
+
then
|
66 |
+
cd $DIR/vcbot
|
67 |
+
git pull
|
68 |
+
else
|
69 |
+
echo -e "Cloning VCBOT.."
|
70 |
+
git clone https://github.com/TeamUltroid/VcBot $DIR/vcbot
|
71 |
+
fi
|
72 |
+
pip3 install pytgcalls>=3.0.0.dev21 && pip3 install av -q --no-binary av
|
73 |
+
fi
|
74 |
+
}
|
75 |
+
|
76 |
+
dep_install(){
|
77 |
+
echo -e "\n\nInstalling DB Requirement..."
|
78 |
+
if [ $MONGO_URI ]
|
79 |
+
then
|
80 |
+
pip3 install -q pymongo[srv]
|
81 |
+
elif [ $DATABASE_URL ]
|
82 |
+
then
|
83 |
+
pip3 install -q psycopg2-binary
|
84 |
+
elif [ $REDIS_URI ]
|
85 |
+
then
|
86 |
+
pip3 install -q redis hiredis
|
87 |
fi
|
88 |
}
|
89 |
|
|
|
91 |
(clone_repo)
|
92 |
(install_requirements)
|
93 |
(railways_dep)
|
94 |
+
(dep_install)
|
95 |
+
(misc_install)
|
96 |
}
|
97 |
|
98 |
main
|
plugins/__init__.py
CHANGED
@@ -11,20 +11,20 @@ import time
|
|
11 |
from random import choice
|
12 |
|
13 |
import requests
|
|
|
|
|
|
|
14 |
from pyUltroid import *
|
15 |
from pyUltroid._misc._assistant import asst_cmd, callback, in_pattern
|
16 |
from pyUltroid._misc._decorators import ultroid_cmd
|
17 |
from pyUltroid._misc._wrappers import eod, eor
|
18 |
from pyUltroid.dB import DEVLIST, ULTROID_IMAGES
|
19 |
-
from pyUltroid.
|
20 |
-
from pyUltroid.
|
21 |
-
from pyUltroid.
|
22 |
-
from pyUltroid.
|
23 |
from pyUltroid.version import __version__, ultroid_version
|
24 |
-
from
|
25 |
-
from telethon.tl import functions, types
|
26 |
-
|
27 |
-
from strings import get_string
|
28 |
|
29 |
Redis = udB.get_key
|
30 |
con = TgConverter
|
@@ -34,19 +34,23 @@ OWNER_ID = ultroid_bot.uid
|
|
34 |
|
35 |
LOG_CHANNEL = udB.get_key("LOG_CHANNEL")
|
36 |
|
37 |
-
INLINE_PIC = udB.get_key("INLINE_PIC")
|
38 |
|
39 |
-
|
40 |
-
INLINE_PIC =
|
41 |
-
|
42 |
-
|
|
|
|
|
|
|
|
|
43 |
|
44 |
Telegraph = telegraph_client()
|
45 |
|
46 |
List = []
|
47 |
Dict = {}
|
|
|
48 |
N = 0
|
49 |
-
|
50 |
STUFF = {}
|
51 |
|
52 |
# Chats, which needs to be ignore for some cases
|
|
|
11 |
from random import choice
|
12 |
|
13 |
import requests
|
14 |
+
from telethon import Button, events
|
15 |
+
from telethon.tl import functions, types # pylint:ignore
|
16 |
+
|
17 |
from pyUltroid import *
|
18 |
from pyUltroid._misc._assistant import asst_cmd, callback, in_pattern
|
19 |
from pyUltroid._misc._decorators import ultroid_cmd
|
20 |
from pyUltroid._misc._wrappers import eod, eor
|
21 |
from pyUltroid.dB import DEVLIST, ULTROID_IMAGES
|
22 |
+
from pyUltroid.fns.helper import *
|
23 |
+
from pyUltroid.fns.info import *
|
24 |
+
from pyUltroid.fns.misc import *
|
25 |
+
from pyUltroid.fns.tools import *
|
26 |
from pyUltroid.version import __version__, ultroid_version
|
27 |
+
from strings import get_help, get_string
|
|
|
|
|
|
|
28 |
|
29 |
Redis = udB.get_key
|
30 |
con = TgConverter
|
|
|
34 |
|
35 |
LOG_CHANNEL = udB.get_key("LOG_CHANNEL")
|
36 |
|
|
|
37 |
|
38 |
+
def inline_pic():
|
39 |
+
INLINE_PIC = udB.get_key("INLINE_PIC")
|
40 |
+
if INLINE_PIC is None:
|
41 |
+
INLINE_PIC = choice(ULTROID_IMAGES)
|
42 |
+
elif INLINE_PIC == False:
|
43 |
+
INLINE_PIC = None
|
44 |
+
return INLINE_PIC
|
45 |
+
|
46 |
|
47 |
Telegraph = telegraph_client()
|
48 |
|
49 |
List = []
|
50 |
Dict = {}
|
51 |
+
InlinePlugin = {}
|
52 |
N = 0
|
53 |
+
cmd = ultroid_cmd
|
54 |
STUFF = {}
|
55 |
|
56 |
# Chats, which needs to be ignore for some cases
|
plugins/_chatactions.py
CHANGED
@@ -7,17 +7,18 @@
|
|
7 |
|
8 |
import asyncio
|
9 |
|
|
|
|
|
|
|
|
|
|
|
10 |
from pyUltroid.dB import stickers
|
11 |
from pyUltroid.dB.forcesub_db import get_forcesetting
|
12 |
from pyUltroid.dB.gban_mute_db import is_gbanned
|
13 |
from pyUltroid.dB.greetings_db import get_goodbye, get_welcome, must_thank
|
14 |
from pyUltroid.dB.nsfw_db import is_profan
|
15 |
-
from pyUltroid.
|
16 |
-
from pyUltroid.
|
17 |
-
from telethon import events
|
18 |
-
from telethon.errors.rpcerrorlist import UserNotParticipantError
|
19 |
-
from telethon.tl.functions.channels import GetParticipantRequest
|
20 |
-
from telethon.utils import get_display_name
|
21 |
|
22 |
try:
|
23 |
from ProfanityDetector import detector
|
@@ -91,11 +92,9 @@ async def DummyHandler(ult):
|
|
91 |
)
|
92 |
await ult.client.send_message(
|
93 |
chat.id,
|
94 |
-
|
95 |
-
str(is_banned),
|
96 |
-
is_banned["reason"],
|
97 |
-
),
|
98 |
)
|
|
|
99 |
except BaseException:
|
100 |
pass
|
101 |
reason = is_gbanned(user.id)
|
|
|
7 |
|
8 |
import asyncio
|
9 |
|
10 |
+
from telethon import events
|
11 |
+
from telethon.errors.rpcerrorlist import UserNotParticipantError
|
12 |
+
from telethon.tl.functions.channels import GetParticipantRequest
|
13 |
+
from telethon.utils import get_display_name
|
14 |
+
|
15 |
from pyUltroid.dB import stickers
|
16 |
from pyUltroid.dB.forcesub_db import get_forcesetting
|
17 |
from pyUltroid.dB.gban_mute_db import is_gbanned
|
18 |
from pyUltroid.dB.greetings_db import get_goodbye, get_welcome, must_thank
|
19 |
from pyUltroid.dB.nsfw_db import is_profan
|
20 |
+
from pyUltroid.fns.helper import inline_mention
|
21 |
+
from pyUltroid.fns.tools import async_searcher, create_tl_btn, get_chatbot_reply
|
|
|
|
|
|
|
|
|
22 |
|
23 |
try:
|
24 |
from ProfanityDetector import detector
|
|
|
92 |
)
|
93 |
await ult.client.send_message(
|
94 |
chat.id,
|
95 |
+
f'**@UltroidBans:** Banned user detected and banned!\n`{str(is_banned)}`.\nBan reason: {is_banned["reason"]}',
|
|
|
|
|
|
|
96 |
)
|
97 |
+
|
98 |
except BaseException:
|
99 |
pass
|
100 |
reason = is_gbanned(user.id)
|
plugins/_help.py
CHANGED
@@ -5,12 +5,6 @@
|
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
|
8 |
-
try:
|
9 |
-
from fuzzywuzzy.process import extractOne
|
10 |
-
except ImportError:
|
11 |
-
extractOne = None
|
12 |
-
from pyUltroid.dB._core import HELP, LIST
|
13 |
-
from pyUltroid.functions.tools import cmd_regex_replace
|
14 |
from telethon.errors.rpcerrorlist import (
|
15 |
BotInlineDisabledError,
|
16 |
BotMethodInvalidError,
|
@@ -18,7 +12,10 @@ from telethon.errors.rpcerrorlist import (
|
|
18 |
)
|
19 |
from telethon.tl.custom import Button
|
20 |
|
21 |
-
from . import
|
|
|
|
|
|
|
22 |
|
23 |
_main_help_menu = [
|
24 |
[
|
@@ -86,9 +83,13 @@ async def _help(ult):
|
|
86 |
if not file:
|
87 |
# the enter command/plugin name is not found
|
88 |
text = f"`{plug}` is not a valid plugin!"
|
89 |
-
|
90 |
-
|
91 |
-
|
|
|
|
|
|
|
|
|
92 |
return await ult.eor(text)
|
93 |
output = f"**Command** `{plug}` **found in plugin** - `{file}`\n"
|
94 |
if file in HELP["Official"]:
|
@@ -122,7 +123,7 @@ async def _help(ult):
|
|
122 |
len(HELP["Addons"] if "Addons" in HELP else []),
|
123 |
cmd,
|
124 |
),
|
125 |
-
file=
|
126 |
buttons=_main_help_menu,
|
127 |
)
|
128 |
except BotResponseTimeoutError:
|
|
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
from telethon.errors.rpcerrorlist import (
|
9 |
BotInlineDisabledError,
|
10 |
BotMethodInvalidError,
|
|
|
12 |
)
|
13 |
from telethon.tl.custom import Button
|
14 |
|
15 |
+
from pyUltroid.dB._core import HELP, LIST
|
16 |
+
from pyUltroid.fns.tools import cmd_regex_replace
|
17 |
+
|
18 |
+
from . import HNDLR, LOGS, OWNER_NAME, asst, get_string, inline_pic, udB, ultroid_cmd
|
19 |
|
20 |
_main_help_menu = [
|
21 |
[
|
|
|
83 |
if not file:
|
84 |
# the enter command/plugin name is not found
|
85 |
text = f"`{plug}` is not a valid plugin!"
|
86 |
+
best_match = None
|
87 |
+
for _ in compare_strings:
|
88 |
+
if plug in _ and not _.startswith("_"):
|
89 |
+
best_match = _
|
90 |
+
break
|
91 |
+
if best_match:
|
92 |
+
text += f"\nDid you mean `{best_match}`?"
|
93 |
return await ult.eor(text)
|
94 |
output = f"**Command** `{plug}` **found in plugin** - `{file}`\n"
|
95 |
if file in HELP["Official"]:
|
|
|
123 |
len(HELP["Addons"] if "Addons" in HELP else []),
|
124 |
cmd,
|
125 |
),
|
126 |
+
file=inline_pic(),
|
127 |
buttons=_main_help_menu,
|
128 |
)
|
129 |
except BotResponseTimeoutError:
|
plugins/_inline.py
CHANGED
@@ -11,21 +11,23 @@ from datetime import datetime
|
|
11 |
from os import remove
|
12 |
|
13 |
from git import Repo
|
14 |
-
from pyUltroid._misc._assistant import callback, in_pattern
|
15 |
-
from pyUltroid.dB._core import HELP, LIST
|
16 |
-
from pyUltroid.functions.helper import gen_chlog, time_formatter, updater
|
17 |
-
from pyUltroid.functions.misc import split_list
|
18 |
from telethon import Button
|
19 |
from telethon.tl.types import InputWebDocument, Message
|
20 |
from telethon.utils import resolve_bot_file_id
|
21 |
|
|
|
|
|
|
|
|
|
|
|
22 |
from . import (
|
23 |
HNDLR,
|
24 |
-
INLINE_PIC,
|
25 |
LOGS,
|
26 |
OWNER_NAME,
|
|
|
27 |
asst,
|
28 |
get_string,
|
|
|
29 |
split_list,
|
30 |
start_time,
|
31 |
udB,
|
@@ -34,16 +36,11 @@ from ._help import _main_help_menu
|
|
34 |
|
35 |
# ================================================#
|
36 |
|
37 |
-
TLINK = INLINE_PIC or "https://telegra.ph/file/74d6259983e0642923fdb.jpg"
|
38 |
helps = get_string("inline_1")
|
39 |
|
40 |
add_ons = udB.get_key("ADDONS")
|
41 |
|
42 |
-
if add_ons is
|
43 |
-
zhelps = get_string("inline_2")
|
44 |
-
else:
|
45 |
-
zhelps = get_string("inline_3")
|
46 |
-
|
47 |
PLUGINS = HELP.get("Official", [])
|
48 |
ADDONS = HELP.get("Addons", [])
|
49 |
upage = 0
|
@@ -54,7 +51,7 @@ upage = 0
|
|
54 |
SUP_BUTTONS = [
|
55 |
[
|
56 |
Button.url("• Repo •", url="https://github.com/TeamUltroid/Ultroid"),
|
57 |
-
Button.url("• Support •", url="t.me/
|
58 |
],
|
59 |
]
|
60 |
|
@@ -63,9 +60,10 @@ SUP_BUTTONS = [
|
|
63 |
|
64 |
@in_pattern(owner=True, func=lambda x: not x.text)
|
65 |
async def inline_alive(o):
|
|
|
66 |
MSG = "• **Ultroid Userbot •**"
|
67 |
WEB0 = InputWebDocument(
|
68 |
-
"https://
|
69 |
)
|
70 |
RES = [
|
71 |
await o.builder.article(
|
@@ -100,9 +98,9 @@ async def inline_handler(event):
|
|
100 |
len(HELP.get("Addons", [])),
|
101 |
len(z),
|
102 |
)
|
103 |
-
if
|
104 |
result = await event.builder.photo(
|
105 |
-
file=
|
106 |
link_preview=False,
|
107 |
text=text,
|
108 |
buttons=_main_help_menu,
|
@@ -117,7 +115,7 @@ async def inline_handler(event):
|
|
117 |
@in_pattern("pasta", owner=True)
|
118 |
async def _(event):
|
119 |
ok = event.text.split("-")[1]
|
120 |
-
link = "https://spaceb.in/"
|
121 |
raw = f"https://spaceb.in/api/v1/documents/{ok}/raw"
|
122 |
result = await event.builder.article(
|
123 |
title="Paste",
|
@@ -144,7 +142,7 @@ async def setting(event):
|
|
144 |
len(HELP.get("Addons", [])),
|
145 |
len(z),
|
146 |
),
|
147 |
-
file=
|
148 |
link_preview=False,
|
149 |
buttons=[
|
150 |
[
|
@@ -172,11 +170,9 @@ async def help_func(ult):
|
|
172 |
return await ult.answer(get_string("help_13").format(HNDLR), alert=True)
|
173 |
if "|" in count:
|
174 |
_, count = count.split("|")
|
175 |
-
count =
|
176 |
text = _strings.get(key, "").format(OWNER_NAME, len(HELP.get(key)))
|
177 |
-
await ult.edit(
|
178 |
-
text, file=INLINE_PIC, buttons=page_num(count, key), link_preview=False
|
179 |
-
)
|
180 |
|
181 |
|
182 |
@callback(re.compile("uplugin_(.*)"), owner=True)
|
@@ -201,7 +197,7 @@ async def uptd_plugin(event):
|
|
201 |
help_ = f"{file} has no Detailed Help!"
|
202 |
help_ += "\n© @TeamUltroid"
|
203 |
buttons = []
|
204 |
-
if
|
205 |
data = f"sndplug_{key}_{file}"
|
206 |
if index is not None:
|
207 |
data += f"|{index}"
|
@@ -233,7 +229,7 @@ async def uptd_plugin(event):
|
|
233 |
async def _(event):
|
234 |
if not await updater():
|
235 |
return await event.answer(get_string("inline_9"), cache_time=0, alert=True)
|
236 |
-
if not
|
237 |
return await event.answer(f"Do '{HNDLR}update' to update..")
|
238 |
repo = Repo.init()
|
239 |
changelog, tl_chnglog = await gen_chlog(
|
@@ -280,36 +276,18 @@ async def _(event):
|
|
280 |
await event.answer(pin, cache_time=0, alert=True)
|
281 |
|
282 |
|
283 |
-
InPlugin = {
|
284 |
-
"Pʟᴀʏ Sᴛᴏʀᴇ Aᴘᴘs": "app telegram",
|
285 |
-
"Mᴏᴅᴅᴇᴅ Aᴘᴘs": "mods minecraft",
|
286 |
-
"Sᴇᴀʀᴄʜ Oɴ Gᴏᴏɢʟᴇ": "go TeamUltroid",
|
287 |
-
"Search on XDA": "xda telegram",
|
288 |
-
"WʜɪSᴘᴇʀ": "wspr @username Hello🎉",
|
289 |
-
"YᴏᴜTᴜʙᴇ Dᴏᴡɴʟᴏᴀᴅᴇʀ": "yt Ed Sheeran Perfect",
|
290 |
-
"Piston Eval": "run javascript console.log('Hello Ultroid')",
|
291 |
-
"OʀᴀɴɢᴇFᴏx🦊": "ofox beryllium",
|
292 |
-
"Tᴡɪᴛᴛᴇʀ Usᴇʀ": "twitter theultroid",
|
293 |
-
"Kᴏᴏ Sᴇᴀʀᴄʜ": "koo @__kumar__amit",
|
294 |
-
"Fᴅʀᴏɪᴅ Sᴇᴀʀᴄʜ": "fdroid telegram",
|
295 |
-
"Sᴀᴀᴠɴ sᴇᴀʀᴄʜ": "saavn",
|
296 |
-
"Tʟ Sᴇᴀʀᴄʜ": "tl",
|
297 |
-
"GɪᴛHᴜʙ ғᴇᴇᴅs": "gh",
|
298 |
-
"OᴍɢUʙᴜɴᴛᴜ": "omgu cutefish",
|
299 |
-
}
|
300 |
-
_InButtons = [Button.switch_inline(_, query=InPlugin[_]) for _ in list(InPlugin.keys())]
|
301 |
-
InButtons = split_list(_InButtons, 2)
|
302 |
-
|
303 |
-
|
304 |
@callback(data="inlone", owner=True)
|
305 |
async def _(e):
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
button = InButtons.copy()
|
307 |
button.append(
|
308 |
[
|
309 |
-
Button.inline(
|
310 |
-
"« Bᴀᴄᴋ",
|
311 |
-
data="open",
|
312 |
-
),
|
313 |
],
|
314 |
)
|
315 |
await e.edit(buttons=button, link_preview=False)
|
@@ -422,7 +400,7 @@ async def ibuild(e):
|
|
422 |
_pic,
|
423 |
title="Ultroid Op",
|
424 |
text=txt,
|
425 |
-
description="@
|
426 |
buttons=btn,
|
427 |
link_preview=False,
|
428 |
)
|
|
|
11 |
from os import remove
|
12 |
|
13 |
from git import Repo
|
|
|
|
|
|
|
|
|
14 |
from telethon import Button
|
15 |
from telethon.tl.types import InputWebDocument, Message
|
16 |
from telethon.utils import resolve_bot_file_id
|
17 |
|
18 |
+
from pyUltroid._misc._assistant import callback, in_pattern
|
19 |
+
from pyUltroid.dB._core import HELP, LIST
|
20 |
+
from pyUltroid.fns.helper import gen_chlog, time_formatter, updater
|
21 |
+
from pyUltroid.fns.misc import split_list
|
22 |
+
|
23 |
from . import (
|
24 |
HNDLR,
|
|
|
25 |
LOGS,
|
26 |
OWNER_NAME,
|
27 |
+
InlinePlugin,
|
28 |
asst,
|
29 |
get_string,
|
30 |
+
inline_pic,
|
31 |
split_list,
|
32 |
start_time,
|
33 |
udB,
|
|
|
36 |
|
37 |
# ================================================#
|
38 |
|
|
|
39 |
helps = get_string("inline_1")
|
40 |
|
41 |
add_ons = udB.get_key("ADDONS")
|
42 |
|
43 |
+
zhelps = get_string("inline_3") if add_ons is False else get_string("inline_2")
|
|
|
|
|
|
|
|
|
44 |
PLUGINS = HELP.get("Official", [])
|
45 |
ADDONS = HELP.get("Addons", [])
|
46 |
upage = 0
|
|
|
51 |
SUP_BUTTONS = [
|
52 |
[
|
53 |
Button.url("• Repo •", url="https://github.com/TeamUltroid/Ultroid"),
|
54 |
+
Button.url("• Support •", url="t.me/UltroidSupportChat"),
|
55 |
],
|
56 |
]
|
57 |
|
|
|
60 |
|
61 |
@in_pattern(owner=True, func=lambda x: not x.text)
|
62 |
async def inline_alive(o):
|
63 |
+
TLINK = inline_pic() or "https://graph.org/file/74d6259983e0642923fdb.jpg"
|
64 |
MSG = "• **Ultroid Userbot •**"
|
65 |
WEB0 = InputWebDocument(
|
66 |
+
"https://graph.org/file/acd4f5d61369f74c5e7a7.jpg", 0, "image/jpg", []
|
67 |
)
|
68 |
RES = [
|
69 |
await o.builder.article(
|
|
|
98 |
len(HELP.get("Addons", [])),
|
99 |
len(z),
|
100 |
)
|
101 |
+
if inline_pic():
|
102 |
result = await event.builder.photo(
|
103 |
+
file=inline_pic(),
|
104 |
link_preview=False,
|
105 |
text=text,
|
106 |
buttons=_main_help_menu,
|
|
|
115 |
@in_pattern("pasta", owner=True)
|
116 |
async def _(event):
|
117 |
ok = event.text.split("-")[1]
|
118 |
+
link = f"https://spaceb.in/{ok}"
|
119 |
raw = f"https://spaceb.in/api/v1/documents/{ok}/raw"
|
120 |
result = await event.builder.article(
|
121 |
title="Paste",
|
|
|
142 |
len(HELP.get("Addons", [])),
|
143 |
len(z),
|
144 |
),
|
145 |
+
file=inline_pic(),
|
146 |
link_preview=False,
|
147 |
buttons=[
|
148 |
[
|
|
|
170 |
return await ult.answer(get_string("help_13").format(HNDLR), alert=True)
|
171 |
if "|" in count:
|
172 |
_, count = count.split("|")
|
173 |
+
count = int(count) if count else 0
|
174 |
text = _strings.get(key, "").format(OWNER_NAME, len(HELP.get(key)))
|
175 |
+
await ult.edit(text, buttons=page_num(count, key), link_preview=False)
|
|
|
|
|
176 |
|
177 |
|
178 |
@callback(re.compile("uplugin_(.*)"), owner=True)
|
|
|
197 |
help_ = f"{file} has no Detailed Help!"
|
198 |
help_ += "\n© @TeamUltroid"
|
199 |
buttons = []
|
200 |
+
if inline_pic():
|
201 |
data = f"sndplug_{key}_{file}"
|
202 |
if index is not None:
|
203 |
data += f"|{index}"
|
|
|
229 |
async def _(event):
|
230 |
if not await updater():
|
231 |
return await event.answer(get_string("inline_9"), cache_time=0, alert=True)
|
232 |
+
if not inline_pic():
|
233 |
return await event.answer(f"Do '{HNDLR}update' to update..")
|
234 |
repo = Repo.init()
|
235 |
changelog, tl_chnglog = await gen_chlog(
|
|
|
276 |
await event.answer(pin, cache_time=0, alert=True)
|
277 |
|
278 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
@callback(data="inlone", owner=True)
|
280 |
async def _(e):
|
281 |
+
_InButtons = [
|
282 |
+
Button.switch_inline(_, query=InlinePlugin[_], same_peer=True)
|
283 |
+
for _ in list(InlinePlugin.keys())
|
284 |
+
]
|
285 |
+
InButtons = split_list(_InButtons, 2)
|
286 |
+
|
287 |
button = InButtons.copy()
|
288 |
button.append(
|
289 |
[
|
290 |
+
Button.inline("« Bᴀᴄᴋ", data="open"),
|
|
|
|
|
|
|
291 |
],
|
292 |
)
|
293 |
await e.edit(buttons=button, link_preview=False)
|
|
|
400 |
_pic,
|
401 |
title="Ultroid Op",
|
402 |
text=txt,
|
403 |
+
description="@TeamUltroid",
|
404 |
buttons=btn,
|
405 |
link_preview=False,
|
406 |
)
|
plugins/_ultroid.py
CHANGED
@@ -25,7 +25,7 @@ RP_BUTTONS = [
|
|
25 |
Button.url(get_string("bot_3"), "https://github.com/TeamUltroid/Ultroid"),
|
26 |
Button.url("Addons", "https://github.com/TeamUltroid/UltroidAddons"),
|
27 |
],
|
28 |
-
[Button.url("Support Group", "t.me/
|
29 |
]
|
30 |
|
31 |
ULTSTRING = """🎇 **Thanks for Deploying Ultroid Userbot!**
|
@@ -49,7 +49,7 @@ async def repify(e):
|
|
49 |
):
|
50 |
pass
|
51 |
except Exception as er:
|
52 |
-
LOGS.info("Error while repo command :
|
53 |
await e.eor(REPOMSG)
|
54 |
|
55 |
|
@@ -59,7 +59,7 @@ async def useUltroid(rs):
|
|
59 |
msg = await asst.send_message(
|
60 |
LOG_CHANNEL,
|
61 |
ULTSTRING,
|
62 |
-
file="https://
|
63 |
buttons=button,
|
64 |
)
|
65 |
if not (rs.chat_id == LOG_CHANNEL and rs.client._bot):
|
|
|
25 |
Button.url(get_string("bot_3"), "https://github.com/TeamUltroid/Ultroid"),
|
26 |
Button.url("Addons", "https://github.com/TeamUltroid/UltroidAddons"),
|
27 |
],
|
28 |
+
[Button.url("Support Group", "t.me/UltroidSupportChat")],
|
29 |
]
|
30 |
|
31 |
ULTSTRING = """🎇 **Thanks for Deploying Ultroid Userbot!**
|
|
|
49 |
):
|
50 |
pass
|
51 |
except Exception as er:
|
52 |
+
LOGS.info(f"Error while repo command : {str(er)}")
|
53 |
await e.eor(REPOMSG)
|
54 |
|
55 |
|
|
|
59 |
msg = await asst.send_message(
|
60 |
LOG_CHANNEL,
|
61 |
ULTSTRING,
|
62 |
+
file="https://graph.org/file/54a917cc9dbb94733ea5f.jpg",
|
63 |
buttons=button,
|
64 |
)
|
65 |
if not (rs.chat_id == LOG_CHANNEL and rs.client._bot):
|
plugins/_userlogs.py
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
import os
|
9 |
import re
|
10 |
|
11 |
-
from pyUltroid.dB.botchat_db import tag_add, who_tag
|
12 |
from telethon.errors.rpcerrorlist import (
|
13 |
ChannelPrivateError,
|
14 |
ChatWriteForbiddenError,
|
@@ -21,6 +20,8 @@ from telethon.errors.rpcerrorlist import (
|
|
21 |
from telethon.tl.types import MessageEntityMention, MessageEntityMentionName, User
|
22 |
from telethon.utils import get_display_name
|
23 |
|
|
|
|
|
24 |
from . import (
|
25 |
LOG_CHANNEL,
|
26 |
LOGS,
|
@@ -123,8 +124,7 @@ if udB.get_key("TAG_LOG"):
|
|
123 |
return
|
124 |
if event.is_private:
|
125 |
return
|
126 |
-
entities
|
127 |
-
if entities:
|
128 |
is_self = False
|
129 |
username = event.client.me.username
|
130 |
if username:
|
@@ -235,7 +235,6 @@ ultroid_bot.add_event_handler(
|
|
235 |
when_added_or_joined,
|
236 |
events.ChatAction(func=lambda x: x.user_added or x.user_joined),
|
237 |
)
|
238 |
-
|
239 |
_client = {"bot": asst, "user": ultroid_bot}
|
240 |
|
241 |
|
|
|
8 |
import os
|
9 |
import re
|
10 |
|
|
|
11 |
from telethon.errors.rpcerrorlist import (
|
12 |
ChannelPrivateError,
|
13 |
ChatWriteForbiddenError,
|
|
|
20 |
from telethon.tl.types import MessageEntityMention, MessageEntityMentionName, User
|
21 |
from telethon.utils import get_display_name
|
22 |
|
23 |
+
from pyUltroid.dB.botchat_db import tag_add, who_tag
|
24 |
+
|
25 |
from . import (
|
26 |
LOG_CHANNEL,
|
27 |
LOGS,
|
|
|
124 |
return
|
125 |
if event.is_private:
|
126 |
return
|
127 |
+
if entities := event.get_entities_text():
|
|
|
128 |
is_self = False
|
129 |
username = event.client.me.username
|
130 |
if username:
|
|
|
235 |
when_added_or_joined,
|
236 |
events.ChatAction(func=lambda x: x.user_added or x.user_joined),
|
237 |
)
|
|
|
238 |
_client = {"bot": asst, "user": ultroid_bot}
|
239 |
|
240 |
|
plugins/_wspr.py
CHANGED
@@ -37,10 +37,7 @@ buddhhu = {}
|
|
37 |
async def _(e):
|
38 |
if e.reply_to_msg_id:
|
39 |
okk = await e.get_reply_message()
|
40 |
-
if okk.sender.username
|
41 |
-
put = f"@{okk.sender.username}"
|
42 |
-
else:
|
43 |
-
put = okk.sender_id
|
44 |
else:
|
45 |
put = e.pattern_match.group(1).strip()
|
46 |
if put:
|
@@ -66,6 +63,8 @@ async def _(e):
|
|
66 |
if query.isdigit():
|
67 |
query = int(query)
|
68 |
logi = await ultroid_bot.get_entity(query)
|
|
|
|
|
69 |
except IndexError:
|
70 |
sur = e.builder.article(
|
71 |
title="Give Username",
|
|
|
37 |
async def _(e):
|
38 |
if e.reply_to_msg_id:
|
39 |
okk = await e.get_reply_message()
|
40 |
+
put = f"@{okk.sender.username}" if okk.sender.username else okk.sender_id
|
|
|
|
|
|
|
41 |
else:
|
42 |
put = e.pattern_match.group(1).strip()
|
43 |
if put:
|
|
|
63 |
if query.isdigit():
|
64 |
query = int(query)
|
65 |
logi = await ultroid_bot.get_entity(query)
|
66 |
+
if not isinstance(logi, types.User):
|
67 |
+
raise ValueError("Invalid Username.")
|
68 |
except IndexError:
|
69 |
sur = e.builder.article(
|
70 |
title="Give Username",
|
plugins/admintools.py
CHANGED
@@ -4,48 +4,13 @@
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
-
"""
|
8 |
-
✘ Commands Available -
|
9 |
|
10 |
-
|
11 |
-
• `{i}demote`
|
12 |
-
Promote/Demote the user in the chat.
|
13 |
|
14 |
-
|
15 |
-
• `{i}unban`
|
16 |
-
Ban/Unban the user from the chat.
|
17 |
-
|
18 |
-
• `{i}kick <reply to user/userid/username> <reason>`
|
19 |
-
Kick the user from the chat.
|
20 |
-
|
21 |
-
• `{i}pin <reply to message>`
|
22 |
-
Pin the message in the chat
|
23 |
-
• `{i}tpin <time> <temp pin message>`
|
24 |
-
• `{i}unpin (all) <reply to message>`
|
25 |
-
Unpin the messages in the chat.
|
26 |
-
|
27 |
-
• `{i}pinned`
|
28 |
-
Get pinned message in the current chat.
|
29 |
-
• `{i}listpinned`
|
30 |
-
Get all pinned messages in current chat
|
31 |
-
|
32 |
-
• `{i}autodelete <24h/7d/1m/off>`
|
33 |
-
Enable Auto Delete Messages in Chat.
|
34 |
-
|
35 |
-
• `{i}purge <reply to message>`
|
36 |
-
Purge all messages from the replied message.
|
37 |
-
|
38 |
-
• `{i}purgeme <reply to message>`
|
39 |
-
Purge Only your messages from the replied message.
|
40 |
-
|
41 |
-
• `{i}purgeall`
|
42 |
-
Delete all msgs of replied user.
|
43 |
-
"""
|
44 |
|
45 |
import asyncio
|
46 |
|
47 |
-
from pyUltroid.dB import DEVLIST
|
48 |
-
from pyUltroid.functions.admins import ban_time
|
49 |
from telethon.errors import BadRequestError
|
50 |
from telethon.errors.rpcerrorlist import ChatNotModifiedError, UserIdInvalidError
|
51 |
from telethon.tl.functions.channels import EditAdminRequest, GetFullChannelRequest
|
@@ -53,6 +18,9 @@ from telethon.tl.functions.messages import GetFullChatRequest, SetHistoryTTLRequ
|
|
53 |
from telethon.tl.types import InputMessagesFilterPinned
|
54 |
from telethon.utils import get_display_name
|
55 |
|
|
|
|
|
|
|
56 |
from . import (
|
57 |
HNDLR,
|
58 |
LOGS,
|
@@ -267,7 +235,7 @@ async def tkicki(e):
|
|
267 |
except Exception as ex:
|
268 |
return await eor(e, f"`{ex}`")
|
269 |
try:
|
270 |
-
bun = ban_time(
|
271 |
await e.client.edit_permissions(
|
272 |
e.chat_id, user.id, until_date=bun, view_messages=False
|
273 |
)
|
@@ -335,11 +303,9 @@ async def pin_message(ult):
|
|
335 |
if not match:
|
336 |
return await ult.eor("`Please provide time..`", time=8)
|
337 |
msg = await ult.eor(get_string("com_1"))
|
338 |
-
time = ban_time(msg, match)
|
339 |
-
if not time:
|
340 |
-
return
|
341 |
msg_id = ult.reply_to_msg_id
|
342 |
try:
|
|
|
343 |
await ult.client.pin_message(ult.chat_id, msg_id)
|
344 |
await msg.eor(f"`pinned for time` `{time}`", time=8)
|
345 |
except Exception as er:
|
@@ -377,22 +343,19 @@ async def fastpurger(purg):
|
|
377 |
return await eor(purg, get_string("purge_1"), time=10)
|
378 |
try:
|
379 |
await purg.client.delete_messages(
|
380 |
-
purg.chat_id, list(range(purg.reply_to_msg_id, purg.id
|
381 |
)
|
382 |
|
383 |
except Exception as er:
|
384 |
LOGS.info(er)
|
385 |
-
await purg.
|
386 |
-
"__Fast purge complete!__",
|
387 |
-
)
|
388 |
|
389 |
|
390 |
@ultroid_cmd(
|
391 |
pattern="purgeme( (.*)|$)",
|
392 |
)
|
393 |
async def fastpurgerme(purg):
|
394 |
-
num
|
395 |
-
if num:
|
396 |
try:
|
397 |
nnt = int(num)
|
398 |
except BaseException:
|
@@ -406,9 +369,7 @@ async def fastpurgerme(purg):
|
|
406 |
mp += 1
|
407 |
await eor(purg, f"Purged {mp} Messages!", time=5)
|
408 |
return
|
409 |
-
elif purg.reply_to_msg_id:
|
410 |
-
pass
|
411 |
-
else:
|
412 |
return await eod(
|
413 |
purg,
|
414 |
"`Reply to a message to purge from or use it like ``purgeme <num>`",
|
@@ -424,9 +385,9 @@ async def fastpurgerme(purg):
|
|
424 |
msgs.append(msg)
|
425 |
if msgs:
|
426 |
await purg.client.delete_messages(chat, msgs)
|
427 |
-
await
|
428 |
-
purg,
|
429 |
"__Fast purge complete!__\n**Purged** `" + str(len(msgs)) + "` **messages.**",
|
|
|
430 |
)
|
431 |
|
432 |
|
@@ -480,7 +441,7 @@ async def get_all_pinned(event):
|
|
480 |
):
|
481 |
if i.message:
|
482 |
t = " ".join(i.message.split()[:4])
|
483 |
-
txt = "{}...."
|
484 |
else:
|
485 |
txt = "Go to message."
|
486 |
a += f"{c}. <a href=https://t.me/c/{chat_id}/{i.id}>{txt}</a>\n"
|
@@ -491,7 +452,7 @@ async def get_all_pinned(event):
|
|
491 |
else:
|
492 |
m = f"<b>List of pinned message(s) in {chat_name}:</b>\n\n"
|
493 |
|
494 |
-
if a
|
495 |
return await eor(x, get_string("listpin_1"), time=5)
|
496 |
|
497 |
await x.edit(m + a, parse_mode="html")
|
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
|
|
|
|
7 |
|
8 |
+
from . import get_help
|
|
|
|
|
9 |
|
10 |
+
__doc__ = get_help("help_admintools")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
import asyncio
|
13 |
|
|
|
|
|
14 |
from telethon.errors import BadRequestError
|
15 |
from telethon.errors.rpcerrorlist import ChatNotModifiedError, UserIdInvalidError
|
16 |
from telethon.tl.functions.channels import EditAdminRequest, GetFullChannelRequest
|
|
|
18 |
from telethon.tl.types import InputMessagesFilterPinned
|
19 |
from telethon.utils import get_display_name
|
20 |
|
21 |
+
from pyUltroid.dB import DEVLIST
|
22 |
+
from pyUltroid.fns.admins import ban_time
|
23 |
+
|
24 |
from . import (
|
25 |
HNDLR,
|
26 |
LOGS,
|
|
|
235 |
except Exception as ex:
|
236 |
return await eor(e, f"`{ex}`")
|
237 |
try:
|
238 |
+
bun = ban_time(tme)
|
239 |
await e.client.edit_permissions(
|
240 |
e.chat_id, user.id, until_date=bun, view_messages=False
|
241 |
)
|
|
|
303 |
if not match:
|
304 |
return await ult.eor("`Please provide time..`", time=8)
|
305 |
msg = await ult.eor(get_string("com_1"))
|
|
|
|
|
|
|
306 |
msg_id = ult.reply_to_msg_id
|
307 |
try:
|
308 |
+
time = ban_time(match)
|
309 |
await ult.client.pin_message(ult.chat_id, msg_id)
|
310 |
await msg.eor(f"`pinned for time` `{time}`", time=8)
|
311 |
except Exception as er:
|
|
|
343 |
return await eor(purg, get_string("purge_1"), time=10)
|
344 |
try:
|
345 |
await purg.client.delete_messages(
|
346 |
+
purg.chat_id, list(range(purg.reply_to_msg_id, purg.id))
|
347 |
)
|
348 |
|
349 |
except Exception as er:
|
350 |
LOGS.info(er)
|
351 |
+
await purg.eor("__Fast purge complete!__", time=5)
|
|
|
|
|
352 |
|
353 |
|
354 |
@ultroid_cmd(
|
355 |
pattern="purgeme( (.*)|$)",
|
356 |
)
|
357 |
async def fastpurgerme(purg):
|
358 |
+
if num := purg.pattern_match.group(1).strip():
|
|
|
359 |
try:
|
360 |
nnt = int(num)
|
361 |
except BaseException:
|
|
|
369 |
mp += 1
|
370 |
await eor(purg, f"Purged {mp} Messages!", time=5)
|
371 |
return
|
372 |
+
elif not purg.reply_to_msg_id:
|
|
|
|
|
373 |
return await eod(
|
374 |
purg,
|
375 |
"`Reply to a message to purge from or use it like ``purgeme <num>`",
|
|
|
385 |
msgs.append(msg)
|
386 |
if msgs:
|
387 |
await purg.client.delete_messages(chat, msgs)
|
388 |
+
await purg.eor(
|
|
|
389 |
"__Fast purge complete!__\n**Purged** `" + str(len(msgs)) + "` **messages.**",
|
390 |
+
time=5,
|
391 |
)
|
392 |
|
393 |
|
|
|
441 |
):
|
442 |
if i.message:
|
443 |
t = " ".join(i.message.split()[:4])
|
444 |
+
txt = f"{t}...."
|
445 |
else:
|
446 |
txt = "Go to message."
|
447 |
a += f"{c}. <a href=https://t.me/c/{chat_id}/{i.id}>{txt}</a>\n"
|
|
|
452 |
else:
|
453 |
m = f"<b>List of pinned message(s) in {chat_name}:</b>\n\n"
|
454 |
|
455 |
+
if not a:
|
456 |
return await eor(x, get_string("listpin_1"), time=5)
|
457 |
|
458 |
await x.edit(m + a, parse_mode="html")
|
plugins/afk.py
CHANGED
@@ -4,24 +4,20 @@
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
-
"""
|
8 |
-
✘ Commands Available -
|
9 |
|
10 |
-
|
11 |
-
AFK means away from keyboard,
|
12 |
-
After this is activated, if someone tags or messages you, he/she would get an automated reply from the bot.
|
13 |
|
14 |
-
|
15 |
|
16 |
-
"""
|
17 |
|
18 |
import asyncio
|
19 |
|
20 |
-
from pyUltroid.dB.afk_db import add_afk, del_afk, is_afk
|
21 |
-
from pyUltroid.dB.pmpermit_db import is_approved
|
22 |
from telegraph import upload_file as uf
|
23 |
from telethon import events
|
24 |
|
|
|
|
|
|
|
25 |
from . import (
|
26 |
LOG_CHANNEL,
|
27 |
NOSPAM_CHAT,
|
@@ -53,7 +49,7 @@ async def set_afk(event):
|
|
53 |
if media_type.startswith(("pic", "gif")):
|
54 |
file = await event.client.download_media(reply.media)
|
55 |
iurl = uf(file)
|
56 |
-
media = f"https://
|
57 |
else:
|
58 |
media = reply.file.id
|
59 |
await event.eor("`Done`", time=2)
|
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
|
|
|
|
7 |
|
8 |
+
from . import get_help
|
|
|
|
|
9 |
|
10 |
+
__doc__ = get_help("help_afk")
|
11 |
|
|
|
12 |
|
13 |
import asyncio
|
14 |
|
|
|
|
|
15 |
from telegraph import upload_file as uf
|
16 |
from telethon import events
|
17 |
|
18 |
+
from pyUltroid.dB.afk_db import add_afk, del_afk, is_afk
|
19 |
+
from pyUltroid.dB.pmpermit_db import is_approved
|
20 |
+
|
21 |
from . import (
|
22 |
LOG_CHANNEL,
|
23 |
NOSPAM_CHAT,
|
|
|
49 |
if media_type.startswith(("pic", "gif")):
|
50 |
file = await event.client.download_media(reply.media)
|
51 |
iurl = uf(file)
|
52 |
+
media = f"https://graph.org{iurl[0]}"
|
53 |
else:
|
54 |
media = reply.file.id
|
55 |
await event.eor("`Done`", time=2)
|
plugins/antiflood.py
CHANGED
@@ -4,25 +4,19 @@
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
-
"""
|
8 |
-
✘ Commands Available -
|
9 |
|
10 |
-
|
11 |
-
Set flood limit in a chat.
|
12 |
|
13 |
-
|
14 |
-
Remove flood limit from a chat.
|
15 |
|
16 |
-
• `{i}getflood`
|
17 |
-
Get flood limit of a chat.
|
18 |
-
"""
|
19 |
|
20 |
import re
|
21 |
|
|
|
|
|
22 |
from pyUltroid.dB import DEVLIST
|
23 |
from pyUltroid.dB.antiflood_db import get_flood, get_flood_limit, rem_flood, set_flood
|
24 |
-
from pyUltroid.
|
25 |
-
from telethon.events import NewMessage as NewMsg
|
26 |
|
27 |
from . import Button, Redis, asst, callback, eod, get_string, ultroid_bot, ultroid_cmd
|
28 |
|
@@ -98,8 +92,7 @@ async def setflood(e):
|
|
98 |
return await e.eor("`What?`", time=5)
|
99 |
if not input_.isdigit():
|
100 |
return await e.eor(get_string("com_3"), time=5)
|
101 |
-
m
|
102 |
-
if m:
|
103 |
return await eod(e, get_string("antiflood_4").format(input_))
|
104 |
|
105 |
|
@@ -123,7 +116,6 @@ async def remove_flood(e):
|
|
123 |
admins_only=True,
|
124 |
)
|
125 |
async def getflood(e):
|
126 |
-
ok
|
127 |
-
if ok:
|
128 |
return await e.eor(get_string("antiflood_5").format(ok), time=5)
|
129 |
await e.eor(get_string("antiflood_2"), time=5)
|
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
|
|
|
|
7 |
|
8 |
+
from . import get_help
|
|
|
9 |
|
10 |
+
__doc__ = get_help("help_antiflood")
|
|
|
11 |
|
|
|
|
|
|
|
12 |
|
13 |
import re
|
14 |
|
15 |
+
from telethon.events import NewMessage as NewMsg
|
16 |
+
|
17 |
from pyUltroid.dB import DEVLIST
|
18 |
from pyUltroid.dB.antiflood_db import get_flood, get_flood_limit, rem_flood, set_flood
|
19 |
+
from pyUltroid.fns.admins import admin_check
|
|
|
20 |
|
21 |
from . import Button, Redis, asst, callback, eod, get_string, ultroid_bot, ultroid_cmd
|
22 |
|
|
|
92 |
return await e.eor("`What?`", time=5)
|
93 |
if not input_.isdigit():
|
94 |
return await e.eor(get_string("com_3"), time=5)
|
95 |
+
if m := set_flood(e.chat_id, input_):
|
|
|
96 |
return await eod(e, get_string("antiflood_4").format(input_))
|
97 |
|
98 |
|
|
|
116 |
admins_only=True,
|
117 |
)
|
118 |
async def getflood(e):
|
119 |
+
if ok := get_flood_limit(e.chat_id):
|
|
|
120 |
return await e.eor(get_string("antiflood_5").format(ok), time=5)
|
121 |
await e.eor(get_string("antiflood_2"), time=5)
|
plugins/asstcmd.py
CHANGED
@@ -4,22 +4,15 @@
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
-
"""
|
8 |
-
✘ Commands Available -
|
9 |
|
10 |
-
|
11 |
-
It will set new cmd for your assistant bot with that reply message.
|
12 |
|
13 |
-
|
14 |
-
It will remove your cmd.
|
15 |
|
16 |
-
•`{i}listcmd`
|
17 |
-
To Get list of all your custom cmd.
|
18 |
-
"""
|
19 |
import os
|
20 |
|
21 |
from pyUltroid.dB.asstcmd_db import add_cmd, cmd_reply, list_cmds, rem_cmd
|
22 |
-
from pyUltroid.
|
23 |
|
24 |
try:
|
25 |
from telegraph import upload_file as uf
|
@@ -45,14 +38,14 @@ async def ac(e):
|
|
45 |
dl = await e.client.download_media(wt.media)
|
46 |
variable = uf(dl)
|
47 |
os.remove(dl)
|
48 |
-
m = "https://
|
49 |
elif wut == "video":
|
50 |
if wt.media.document.size > 8 * 1000 * 1000:
|
51 |
return await e.eor(get_string("com_4"), time=5)
|
52 |
dl = await e.client.download_media(wt.media)
|
53 |
variable = uf(dl)
|
54 |
os.remove(dl)
|
55 |
-
m = "https://
|
56 |
else:
|
57 |
m = utils.pack_bot_file_id(wt.media)
|
58 |
if wt.text:
|
@@ -91,7 +84,7 @@ async def lscmd(e):
|
|
91 |
if list_cmds():
|
92 |
ok = get_string("asstcmd_6")
|
93 |
for x in list_cmds():
|
94 |
-
ok += "/" +
|
95 |
return await e.eor(ok)
|
96 |
return await e.eor(get_string("asstcmd_5"))
|
97 |
|
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
|
|
|
|
7 |
|
8 |
+
from . import get_help
|
|
|
9 |
|
10 |
+
__doc__ = get_help("help_asstcmd")
|
|
|
11 |
|
|
|
|
|
|
|
12 |
import os
|
13 |
|
14 |
from pyUltroid.dB.asstcmd_db import add_cmd, cmd_reply, list_cmds, rem_cmd
|
15 |
+
from pyUltroid.fns.tools import create_tl_btn, format_btn, get_msg_button
|
16 |
|
17 |
try:
|
18 |
from telegraph import upload_file as uf
|
|
|
38 |
dl = await e.client.download_media(wt.media)
|
39 |
variable = uf(dl)
|
40 |
os.remove(dl)
|
41 |
+
m = f"https://graph.org{variable[0]}"
|
42 |
elif wut == "video":
|
43 |
if wt.media.document.size > 8 * 1000 * 1000:
|
44 |
return await e.eor(get_string("com_4"), time=5)
|
45 |
dl = await e.client.download_media(wt.media)
|
46 |
variable = uf(dl)
|
47 |
os.remove(dl)
|
48 |
+
m = f"https://graph.org{variable[0]}"
|
49 |
else:
|
50 |
m = utils.pack_bot_file_id(wt.media)
|
51 |
if wt.text:
|
|
|
84 |
if list_cmds():
|
85 |
ok = get_string("asstcmd_6")
|
86 |
for x in list_cmds():
|
87 |
+
ok += f"/{x}" + "\n"
|
88 |
return await e.eor(ok)
|
89 |
return await e.eor(get_string("asstcmd_5"))
|
90 |
|
plugins/audiotools.py
CHANGED
@@ -4,34 +4,23 @@
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
-
"""
|
8 |
-
✘ Commands Available -
|
9 |
|
10 |
-
`{i}makevoice <reply to audio>`
|
11 |
-
creates a voice note from Audio.
|
12 |
-
|
13 |
-
`{i}atrim <from time> - <to time>`
|
14 |
-
trim audio as per given time.
|
15 |
-
time must be in seconds. `{i}atrim 50-70`
|
16 |
-
|
17 |
-
`{i}extractaudio <reply to media>`
|
18 |
-
To extract the audio from it.
|
19 |
-
|
20 |
-
"""
|
21 |
|
22 |
import os
|
23 |
import time
|
24 |
from datetime import datetime as dt
|
25 |
|
26 |
-
from pyUltroid.
|
27 |
|
28 |
from . import (
|
29 |
LOGS,
|
|
|
30 |
bash,
|
31 |
downloader,
|
32 |
eod,
|
33 |
eor,
|
34 |
genss,
|
|
|
35 |
get_string,
|
36 |
humanbytes,
|
37 |
mediainfo,
|
@@ -41,6 +30,8 @@ from . import (
|
|
41 |
uploader,
|
42 |
)
|
43 |
|
|
|
|
|
44 |
|
45 |
@ultroid_cmd(pattern="makevoice$")
|
46 |
async def vnc(e):
|
@@ -90,12 +81,13 @@ async def trim_aud(e):
|
|
90 |
xxx = await e.eor(get_string("audiotools_5"))
|
91 |
c_time = time.time()
|
92 |
file = await downloader(
|
93 |
-
"resources/downloads/"
|
94 |
vfile,
|
95 |
xxx,
|
96 |
c_time,
|
97 |
-
"Downloading
|
98 |
)
|
|
|
99 |
o_size = os.path.getsize(file.name)
|
100 |
d_time = time.time()
|
101 |
diff = time_formatter((d_time - c_time) * 1000)
|
@@ -112,20 +104,14 @@ async def trim_aud(e):
|
|
112 |
await bash(cmd)
|
113 |
os.remove(file.name)
|
114 |
f_time = time.time()
|
115 |
-
mmmm = await uploader(
|
116 |
-
out,
|
117 |
-
out,
|
118 |
-
f_time,
|
119 |
-
xxx,
|
120 |
-
"Uploading " + out + "...",
|
121 |
-
)
|
122 |
attributes = await set_attributes(out)
|
123 |
|
124 |
caption = get_string("audiotools_7").format(ss, dd)
|
125 |
await e.client.send_file(
|
126 |
e.chat_id,
|
127 |
mmmm,
|
128 |
-
thumb=
|
129 |
caption=caption,
|
130 |
attributes=attributes,
|
131 |
force_document=False,
|
@@ -146,13 +132,14 @@ async def ex_aud(e):
|
|
146 |
msg = await e.eor(get_string("com_1"))
|
147 |
c_time = time.time()
|
148 |
file = await downloader(
|
149 |
-
"resources/downloads/"
|
150 |
vfile,
|
151 |
msg,
|
152 |
c_time,
|
153 |
-
"Downloading
|
154 |
)
|
155 |
-
|
|
|
156 |
cmd = f"ffmpeg -i {file.name} -vn -acodec copy {out_file}"
|
157 |
o, err = await bash(cmd)
|
158 |
os.remove(file.name)
|
@@ -160,20 +147,15 @@ async def ex_aud(e):
|
|
160 |
|
161 |
f_time = time.time()
|
162 |
try:
|
163 |
-
fo = await uploader(
|
164 |
-
|
165 |
-
out_file,
|
166 |
-
f_time,
|
167 |
-
msg,
|
168 |
-
"Uploading " + out_file + "...",
|
169 |
-
)
|
170 |
except FileNotFoundError:
|
171 |
return await eor(msg, get_string("audiotools_9"))
|
172 |
await e.client.send_file(
|
173 |
e.chat_id,
|
174 |
fo,
|
175 |
caption=get_string("audiotools_10"),
|
176 |
-
thumb=
|
177 |
attributes=attributes,
|
178 |
reply_to=e.reply_to_msg_id,
|
179 |
)
|
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
|
|
|
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
import os
|
10 |
import time
|
11 |
from datetime import datetime as dt
|
12 |
|
13 |
+
from pyUltroid.fns.tools import set_attributes
|
14 |
|
15 |
from . import (
|
16 |
LOGS,
|
17 |
+
ULTConfig,
|
18 |
bash,
|
19 |
downloader,
|
20 |
eod,
|
21 |
eor,
|
22 |
genss,
|
23 |
+
get_help,
|
24 |
get_string,
|
25 |
humanbytes,
|
26 |
mediainfo,
|
|
|
30 |
uploader,
|
31 |
)
|
32 |
|
33 |
+
__doc__ = get_help("help_audiotools")
|
34 |
+
|
35 |
|
36 |
@ultroid_cmd(pattern="makevoice$")
|
37 |
async def vnc(e):
|
|
|
81 |
xxx = await e.eor(get_string("audiotools_5"))
|
82 |
c_time = time.time()
|
83 |
file = await downloader(
|
84 |
+
f"resources/downloads/{name}",
|
85 |
vfile,
|
86 |
xxx,
|
87 |
c_time,
|
88 |
+
f"Downloading {name}...",
|
89 |
)
|
90 |
+
|
91 |
o_size = os.path.getsize(file.name)
|
92 |
d_time = time.time()
|
93 |
diff = time_formatter((d_time - c_time) * 1000)
|
|
|
104 |
await bash(cmd)
|
105 |
os.remove(file.name)
|
106 |
f_time = time.time()
|
107 |
+
mmmm = await uploader(out, out, f_time, xxx, f"Uploading {out}...")
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
attributes = await set_attributes(out)
|
109 |
|
110 |
caption = get_string("audiotools_7").format(ss, dd)
|
111 |
await e.client.send_file(
|
112 |
e.chat_id,
|
113 |
mmmm,
|
114 |
+
thumb=ULTConfig.thumb,
|
115 |
caption=caption,
|
116 |
attributes=attributes,
|
117 |
force_document=False,
|
|
|
132 |
msg = await e.eor(get_string("com_1"))
|
133 |
c_time = time.time()
|
134 |
file = await downloader(
|
135 |
+
f"resources/downloads/{name}",
|
136 |
vfile,
|
137 |
msg,
|
138 |
c_time,
|
139 |
+
f"Downloading {name}...",
|
140 |
)
|
141 |
+
|
142 |
+
out_file = f"{file.name}.aac"
|
143 |
cmd = f"ffmpeg -i {file.name} -vn -acodec copy {out_file}"
|
144 |
o, err = await bash(cmd)
|
145 |
os.remove(file.name)
|
|
|
147 |
|
148 |
f_time = time.time()
|
149 |
try:
|
150 |
+
fo = await uploader(out_file, out_file, f_time, msg, f"Uploading {out_file}...")
|
151 |
+
|
|
|
|
|
|
|
|
|
|
|
152 |
except FileNotFoundError:
|
153 |
return await eor(msg, get_string("audiotools_9"))
|
154 |
await e.client.send_file(
|
155 |
e.chat_id,
|
156 |
fo,
|
157 |
caption=get_string("audiotools_10"),
|
158 |
+
thumb=ULTConfig.thumb,
|
159 |
attributes=attributes,
|
160 |
reply_to=e.reply_to_msg_id,
|
161 |
)
|
plugins/autoban.py
CHANGED
@@ -5,32 +5,16 @@
|
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
|
8 |
-
|
9 |
-
✘ Commands Available
|
10 |
|
11 |
-
|
12 |
-
on - To enable.
|
13 |
-
off - To disable.
|
14 |
-
Automatically kick new joined users from the group.
|
15 |
|
16 |
-
• `{i}cban`
|
17 |
-
Enable/Disable autobanning send as channel in used chat.
|
18 |
-
|
19 |
-
• `{i}addwl <Username>`
|
20 |
-
Add Channel to channelban whitelist.
|
21 |
-
|
22 |
-
• `{i}remwl <Username>`
|
23 |
-
Remove Channel from channelban whitelist.
|
24 |
-
|
25 |
-
• `{i}listwl` : List all whitelist channels.
|
26 |
-
"""
|
27 |
-
|
28 |
-
|
29 |
-
from pyUltroid.dB import autoban_db, dnd_db
|
30 |
-
from pyUltroid.functions.admins import get_update_linked_chat
|
31 |
from telethon import events
|
32 |
from telethon.tl.types import Channel
|
33 |
|
|
|
|
|
|
|
34 |
from . import LOGS, asst, get_string, inline_mention, ultroid_bot, ultroid_cmd
|
35 |
|
36 |
|
|
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
|
8 |
+
from . import get_help
|
|
|
9 |
|
10 |
+
__doc__ = get_help("help_autoban")
|
|
|
|
|
|
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
from telethon import events
|
13 |
from telethon.tl.types import Channel
|
14 |
|
15 |
+
from pyUltroid.dB import autoban_db, dnd_db
|
16 |
+
from pyUltroid.fns.admins import get_update_linked_chat
|
17 |
+
|
18 |
from . import LOGS, asst, get_string, inline_mention, ultroid_bot, ultroid_cmd
|
19 |
|
20 |
|
plugins/autocorrect.py
DELETED
@@ -1,61 +0,0 @@
|
|
1 |
-
# Ultroid - UserBot
|
2 |
-
# Copyright (C) 2021-2022 TeamUltroid
|
3 |
-
#
|
4 |
-
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
-
# PLease read the GNU Affero General Public License in
|
6 |
-
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
-
"""
|
8 |
-
✘ Commands Available
|
9 |
-
|
10 |
-
• `{i}autocorrect`
|
11 |
-
To on/off Autocorrect Feature.
|
12 |
-
"""
|
13 |
-
|
14 |
-
import string
|
15 |
-
|
16 |
-
from . import HNDLR, LOGS, get_string, udB, ultroid_bot, ultroid_cmd # ignore: pylint
|
17 |
-
|
18 |
-
try:
|
19 |
-
from gingerit.gingerit import GingerIt
|
20 |
-
except ImportError:
|
21 |
-
LOGS.info("GingerIt not found")
|
22 |
-
GingerIt = None
|
23 |
-
|
24 |
-
from google_trans_new import google_translator
|
25 |
-
from telethon import events
|
26 |
-
|
27 |
-
|
28 |
-
@ultroid_cmd(pattern="autocorrect", fullsudo=True)
|
29 |
-
async def acc(e):
|
30 |
-
if not udB.get_key("AUTOCORRECT"):
|
31 |
-
udB.set_key("AUTOCORRECT", "True")
|
32 |
-
ultroid_bot.add_handler(
|
33 |
-
gramme, events.NewMessage(outgoing=True, func=lambda x: x.text)
|
34 |
-
)
|
35 |
-
return await e.eor(get_string("act_1"), time=5)
|
36 |
-
udB.del_key("AUTOCORRECT")
|
37 |
-
await e.eor(get_string("act_2"), time=5)
|
38 |
-
|
39 |
-
|
40 |
-
async def gramme(event):
|
41 |
-
if not udB.get_key("AUTOCORRECT"):
|
42 |
-
return
|
43 |
-
t = event.text
|
44 |
-
if t[0] == HNDLR or t[0].lower() not in string.ascii_lowercase or t.endswith(".."):
|
45 |
-
return
|
46 |
-
tt = google_translator().detect(t)
|
47 |
-
if tt[0] != "en":
|
48 |
-
return
|
49 |
-
xx = GingerIt()
|
50 |
-
x = xx.parse(t)
|
51 |
-
res = x["result"]
|
52 |
-
try:
|
53 |
-
await event.edit(res)
|
54 |
-
except BaseException:
|
55 |
-
pass
|
56 |
-
|
57 |
-
|
58 |
-
if GingerIt and udB.get_key("AUTOCORRECT"):
|
59 |
-
ultroid_bot.add_handler(
|
60 |
-
gramme, events.NewMessage(outgoing=True, func=lambda x: x.text)
|
61 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugins/autopic.py
CHANGED
@@ -4,24 +4,21 @@
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
-
"""
|
8 |
-
✘ Commands Available -
|
9 |
|
10 |
-
• `{i}autopic <search query>`
|
11 |
-
Will change your profile pic at defined intervals with pics related to the given topic.
|
12 |
|
13 |
-
• `{i}autopic` : stop autopic if active.
|
14 |
-
"""
|
15 |
import asyncio
|
16 |
import os
|
17 |
import random
|
18 |
from glob import glob
|
19 |
from random import shuffle
|
20 |
|
21 |
-
from pyUltroid.functions.google_image import googleimagesdownload
|
22 |
from telethon.tl.functions.photos import UploadProfilePhotoRequest
|
23 |
|
24 |
-
from . import
|
|
|
|
|
|
|
|
|
25 |
|
26 |
|
27 |
@ultroid_cmd(pattern="autopic( (.*)|$)")
|
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
|
|
|
|
7 |
|
|
|
|
|
8 |
|
|
|
|
|
9 |
import asyncio
|
10 |
import os
|
11 |
import random
|
12 |
from glob import glob
|
13 |
from random import shuffle
|
14 |
|
|
|
15 |
from telethon.tl.functions.photos import UploadProfilePhotoRequest
|
16 |
|
17 |
+
from pyUltroid.fns.google_image import googleimagesdownload
|
18 |
+
|
19 |
+
from . import LOGS, get_help, get_string, udB, ultroid_bot, ultroid_cmd
|
20 |
+
|
21 |
+
__doc__ = get_help("help_autopic")
|
22 |
|
23 |
|
24 |
@ultroid_cmd(pattern="autopic( (.*)|$)")
|
plugins/beautify.py
CHANGED
@@ -4,21 +4,11 @@
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
-
"""
|
8 |
-
✘ Commands Available -
|
9 |
|
10 |
-
|
11 |
-
Carbonise the text with default settings.
|
12 |
|
13 |
-
|
14 |
-
Carbonise the text, with random bg colours.
|
15 |
|
16 |
-
• `{i}ccarbon <color ><text/reply to msg/reply to document>`
|
17 |
-
Carbonise the text, with custom bg colours.
|
18 |
-
|
19 |
-
• `{i}rayso <opt-theme> <text>/<reply to message>`
|
20 |
-
`{i}rayso list` - `Get list of themes.`
|
21 |
-
"""
|
22 |
|
23 |
import random
|
24 |
|
@@ -115,13 +105,15 @@ async def pass_on(ult):
|
|
115 |
if len(spli) > 2:
|
116 |
if spli[1] in RaySoTheme:
|
117 |
theme = spli[1]
|
118 |
-
dark =
|
119 |
elif len(spli) > 1:
|
120 |
if spli[1] in RaySoTheme:
|
121 |
theme = spli[1]
|
122 |
elif spli[1] == "list":
|
123 |
-
text = "**List of Rayso Themes:**\n"
|
124 |
-
|
|
|
|
|
125 |
await ult.eor(text)
|
126 |
return
|
127 |
else:
|
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
|
|
|
|
7 |
|
8 |
+
from . import get_help
|
|
|
9 |
|
10 |
+
__doc__ = get_help("help_beautify")
|
|
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
import random
|
14 |
|
|
|
105 |
if len(spli) > 2:
|
106 |
if spli[1] in RaySoTheme:
|
107 |
theme = spli[1]
|
108 |
+
dark = spli[2].lower().strip() in ["true", "t"]
|
109 |
elif len(spli) > 1:
|
110 |
if spli[1] in RaySoTheme:
|
111 |
theme = spli[1]
|
112 |
elif spli[1] == "list":
|
113 |
+
text = "**List of Rayso Themes:**\n" + "\n".join(
|
114 |
+
[f"- `{th_}`" for th_ in RaySoTheme]
|
115 |
+
)
|
116 |
+
|
117 |
await ult.eor(text)
|
118 |
return
|
119 |
else:
|
plugins/blacklist.py
CHANGED
@@ -4,21 +4,11 @@
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
-
"""
|
8 |
-
✘ Commands Available -
|
9 |
|
10 |
-
|
11 |
-
blacklist the choosen word in that chat.
|
12 |
|
13 |
-
|
14 |
-
Remove the word from blacklist..
|
15 |
|
16 |
-
• `{i}listblacklist`
|
17 |
-
list all blacklisted words.
|
18 |
-
|
19 |
-
'if a person uses blacklist Word his/her msg will be deleted'
|
20 |
-
'And u Must be Admin in that Chat'
|
21 |
-
"""
|
22 |
|
23 |
from pyUltroid.dB.blacklist_db import (
|
24 |
add_blacklist,
|
@@ -59,16 +49,14 @@ async def rf(e):
|
|
59 |
|
60 |
@ultroid_cmd(pattern="listblacklist$", admins_only=True)
|
61 |
async def lsnote(e):
|
62 |
-
x
|
63 |
-
if x:
|
64 |
sd = get_string("blk_5")
|
65 |
return await e.eor(sd + x)
|
66 |
await e.eor(get_string("blk_6"))
|
67 |
|
68 |
|
69 |
async def blacklist(e):
|
70 |
-
x
|
71 |
-
if x:
|
72 |
for z in e.text.lower().split():
|
73 |
for zz in x:
|
74 |
if z == zz:
|
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
|
|
|
|
7 |
|
8 |
+
from . import get_help
|
|
|
9 |
|
10 |
+
__doc__ = get_help("help_blacklist")
|
|
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
from pyUltroid.dB.blacklist_db import (
|
14 |
add_blacklist,
|
|
|
49 |
|
50 |
@ultroid_cmd(pattern="listblacklist$", admins_only=True)
|
51 |
async def lsnote(e):
|
52 |
+
if x := list_blacklist(e.chat_id):
|
|
|
53 |
sd = get_string("blk_5")
|
54 |
return await e.eor(sd + x)
|
55 |
await e.eor(get_string("blk_6"))
|
56 |
|
57 |
|
58 |
async def blacklist(e):
|
59 |
+
if x := get_blacklist(e.chat_id):
|
|
|
60 |
for z in e.text.lower().split():
|
61 |
for zz in x:
|
62 |
if z == zz:
|
plugins/bot.py
CHANGED
@@ -4,47 +4,25 @@
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
-
"""
|
8 |
-
✘ Commands Available
|
9 |
-
|
10 |
-
• `{i}alive` | `{i}alive inline`
|
11 |
-
Check if your bot is working.
|
12 |
-
|
13 |
-
• `{i}ping`
|
14 |
-
Check Ultroid's response time.
|
15 |
-
|
16 |
-
• `{i}update`
|
17 |
-
See changelogs if any update is available.
|
18 |
|
19 |
-
|
20 |
-
View all plugin names.
|
21 |
|
22 |
-
|
23 |
-
To restart your bot.
|
24 |
|
25 |
-
• `{i}logs (sys)`
|
26 |
-
Get the full terminal logs.
|
27 |
-
• `{i}logs carbon`
|
28 |
-
Get the carbonized sys logs.
|
29 |
-
• `{i}logs heroku`
|
30 |
-
Get the latest 100 lines of heroku logs.
|
31 |
-
|
32 |
-
• `{i}shutdown`
|
33 |
-
Turn off your bot.
|
34 |
-
"""
|
35 |
import os
|
36 |
import sys
|
37 |
import time
|
38 |
from platform import python_version as pyver
|
39 |
from random import choice
|
40 |
|
41 |
-
from pyUltroid.version import __version__ as UltVer
|
42 |
from telethon import __version__
|
43 |
from telethon.errors.rpcerrorlist import (
|
44 |
BotMethodInvalidError,
|
45 |
ChatSendMediaForbiddenError,
|
46 |
)
|
47 |
|
|
|
|
|
48 |
from . import HOSTED_ON, LOGS
|
49 |
|
50 |
try:
|
@@ -57,7 +35,6 @@ from telethon.utils import resolve_bot_file_id
|
|
57 |
|
58 |
from . import (
|
59 |
ATRA_COL,
|
60 |
-
INLINE_PIC,
|
61 |
LOGS,
|
62 |
OWNER_NAME,
|
63 |
ULTROID_IMAGES,
|
@@ -75,6 +52,7 @@ from . import (
|
|
75 |
get_string,
|
76 |
heroku_logs,
|
77 |
in_pattern,
|
|
|
78 |
restart,
|
79 |
shutdown,
|
80 |
start_time,
|
@@ -85,11 +63,15 @@ from . import (
|
|
85 |
updater,
|
86 |
)
|
87 |
|
88 |
-
|
|
|
|
|
|
|
|
|
89 |
buttons = [
|
90 |
[
|
91 |
Button.url(get_string("bot_3"), "https://github.com/TeamUltroid/Ultroid"),
|
92 |
-
Button.url(get_string("bot_4"), "t.me/
|
93 |
]
|
94 |
]
|
95 |
|
@@ -102,7 +84,7 @@ The Ultroid Userbot
|
|
102 |
◍ Telethon - {}
|
103 |
"""
|
104 |
|
105 |
-
in_alive = "{}\n\n🌀 <b>Ultroid Version -><b> <code>{}</code>\n🌀 <b>PyUltroid -></b> <code>{}</code>\n🌀 <b>Python -></b> <code>{}</code>\n🌀 <b>Uptime -></b> <code>{}</code>\n🌀 <b>Branch -></b> [ {} ]\n\n• <b>Join @
|
106 |
|
107 |
|
108 |
@callback("alive")
|
@@ -140,12 +122,13 @@ async def lol(ult):
|
|
140 |
parse = "html"
|
141 |
als = in_alive.format(
|
142 |
header,
|
143 |
-
|
144 |
UltVer,
|
145 |
pyver(),
|
146 |
uptime,
|
147 |
kk,
|
148 |
)
|
|
|
149 |
if _e := udB.get_key("ALIVE_EMOJI"):
|
150 |
als = als.replace("🌀", _e)
|
151 |
else:
|
@@ -153,13 +136,14 @@ async def lol(ult):
|
|
153 |
als = (get_string("alive_1")).format(
|
154 |
header,
|
155 |
OWNER_NAME,
|
156 |
-
|
157 |
UltVer,
|
158 |
uptime,
|
159 |
pyver(),
|
160 |
__version__,
|
161 |
kk,
|
162 |
)
|
|
|
163 |
if a := udB.get_key("ALIVE_EMOJI"):
|
164 |
als = als.replace("✵", a)
|
165 |
if pic:
|
@@ -252,7 +236,8 @@ async def _(event):
|
|
252 |
await heroku_logs(event)
|
253 |
elif opt == "carbon" and Carbon:
|
254 |
event = await event.eor(get_string("com_1"))
|
255 |
-
|
|
|
256 |
file = await Carbon(
|
257 |
file_name="ultroid-logs",
|
258 |
code=code,
|
@@ -260,7 +245,8 @@ async def _(event):
|
|
260 |
)
|
261 |
await event.reply("**Ultroid Logs.**", file=file)
|
262 |
elif opt == "open":
|
263 |
-
|
|
|
264 |
return await event.eor(f"`{file}`")
|
265 |
else:
|
266 |
await def_logs(event, file)
|
@@ -279,13 +265,9 @@ async def inline_alive(ult):
|
|
279 |
rep = xx.replace(".git", f"/tree/{y}")
|
280 |
kk = f"<a href={rep}>{y}</a>"
|
281 |
als = in_alive.format(
|
282 |
-
header,
|
283 |
-
ultroid_version + f" [{HOSTED_ON}]",
|
284 |
-
UltVer,
|
285 |
-
pyver(),
|
286 |
-
uptime,
|
287 |
-
kk,
|
288 |
)
|
|
|
289 |
if _e := udB.get_key("ALIVE_EMOJI"):
|
290 |
als = als.replace("🌀", _e)
|
291 |
builder = ult.builder
|
@@ -298,8 +280,7 @@ async def inline_alive(ult):
|
|
298 |
)
|
299 |
]
|
300 |
else:
|
301 |
-
_pic
|
302 |
-
if _pic:
|
303 |
pic = _pic
|
304 |
buttons.insert(
|
305 |
0, [Button.inline(get_string("bot_2"), data="alive")]
|
@@ -308,7 +289,7 @@ async def inline_alive(ult):
|
|
308 |
await builder.document(
|
309 |
pic,
|
310 |
title="Inline Alive",
|
311 |
-
description="@
|
312 |
parse_mode="html",
|
313 |
buttons=buttons,
|
314 |
)
|
@@ -327,24 +308,21 @@ async def inline_alive(ult):
|
|
327 |
@ultroid_cmd(pattern="update( (.*)|$)")
|
328 |
async def _(e):
|
329 |
xx = await e.eor(get_string("upd_1"))
|
330 |
-
if
|
331 |
-
e.pattern_match.group(1).strip()
|
332 |
-
|
333 |
-
"fast" in e.pattern_match.group(1).strip()
|
334 |
-
or "soft" in e.pattern_match.group(1).strip()
|
335 |
-
)
|
336 |
):
|
337 |
await bash("git pull -f && pip3 install -r requirements.txt")
|
338 |
call_back()
|
339 |
await xx.edit(get_string("upd_7"))
|
340 |
os.execl(sys.executable, "python3", "-m", "pyUltroid")
|
341 |
-
return
|
342 |
m = await updater()
|
343 |
branch = (Repo.init()).active_branch
|
344 |
if m:
|
345 |
x = await asst.send_file(
|
346 |
udB.get_key("LOG_CHANNEL"),
|
347 |
-
ULTPIC,
|
348 |
caption="• **Update Available** •",
|
349 |
force_document=False,
|
350 |
buttons=Button.inline("Changelogs", data="changes"),
|
@@ -368,7 +346,7 @@ async def updava(event):
|
|
368 |
await event.delete()
|
369 |
await asst.send_file(
|
370 |
udB.get_key("LOG_CHANNEL"),
|
371 |
-
ULTPIC,
|
372 |
caption="• **Update Available** •",
|
373 |
force_document=False,
|
374 |
buttons=Button.inline("Changelogs", data="changes"),
|
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
+
from . import get_help
|
|
|
9 |
|
10 |
+
__doc__ = get_help("help_bot")
|
|
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
import os
|
13 |
import sys
|
14 |
import time
|
15 |
from platform import python_version as pyver
|
16 |
from random import choice
|
17 |
|
|
|
18 |
from telethon import __version__
|
19 |
from telethon.errors.rpcerrorlist import (
|
20 |
BotMethodInvalidError,
|
21 |
ChatSendMediaForbiddenError,
|
22 |
)
|
23 |
|
24 |
+
from pyUltroid.version import __version__ as UltVer
|
25 |
+
|
26 |
from . import HOSTED_ON, LOGS
|
27 |
|
28 |
try:
|
|
|
35 |
|
36 |
from . import (
|
37 |
ATRA_COL,
|
|
|
38 |
LOGS,
|
39 |
OWNER_NAME,
|
40 |
ULTROID_IMAGES,
|
|
|
52 |
get_string,
|
53 |
heroku_logs,
|
54 |
in_pattern,
|
55 |
+
inline_pic,
|
56 |
restart,
|
57 |
shutdown,
|
58 |
start_time,
|
|
|
63 |
updater,
|
64 |
)
|
65 |
|
66 |
+
|
67 |
+
def ULTPIC():
|
68 |
+
return inline_pic() or choice(ULTROID_IMAGES)
|
69 |
+
|
70 |
+
|
71 |
buttons = [
|
72 |
[
|
73 |
Button.url(get_string("bot_3"), "https://github.com/TeamUltroid/Ultroid"),
|
74 |
+
Button.url(get_string("bot_4"), "t.me/UltroidSupportChat"),
|
75 |
]
|
76 |
]
|
77 |
|
|
|
84 |
◍ Telethon - {}
|
85 |
"""
|
86 |
|
87 |
+
in_alive = "{}\n\n🌀 <b>Ultroid Version -><b> <code>{}</code>\n🌀 <b>PyUltroid -></b> <code>{}</code>\n🌀 <b>Python -></b> <code>{}</code>\n🌀 <b>Uptime -></b> <code>{}</code>\n🌀 <b>Branch -></b> [ {} ]\n\n• <b>Join @TeamUltroid</b>"
|
88 |
|
89 |
|
90 |
@callback("alive")
|
|
|
122 |
parse = "html"
|
123 |
als = in_alive.format(
|
124 |
header,
|
125 |
+
f"{ultroid_version} [{HOSTED_ON}]",
|
126 |
UltVer,
|
127 |
pyver(),
|
128 |
uptime,
|
129 |
kk,
|
130 |
)
|
131 |
+
|
132 |
if _e := udB.get_key("ALIVE_EMOJI"):
|
133 |
als = als.replace("🌀", _e)
|
134 |
else:
|
|
|
136 |
als = (get_string("alive_1")).format(
|
137 |
header,
|
138 |
OWNER_NAME,
|
139 |
+
f"{ultroid_version} [{HOSTED_ON}]",
|
140 |
UltVer,
|
141 |
uptime,
|
142 |
pyver(),
|
143 |
__version__,
|
144 |
kk,
|
145 |
)
|
146 |
+
|
147 |
if a := udB.get_key("ALIVE_EMOJI"):
|
148 |
als = als.replace("✵", a)
|
149 |
if pic:
|
|
|
236 |
await heroku_logs(event)
|
237 |
elif opt == "carbon" and Carbon:
|
238 |
event = await event.eor(get_string("com_1"))
|
239 |
+
with open(file, "r") as f:
|
240 |
+
code = f.read()[-2500:]
|
241 |
file = await Carbon(
|
242 |
file_name="ultroid-logs",
|
243 |
code=code,
|
|
|
245 |
)
|
246 |
await event.reply("**Ultroid Logs.**", file=file)
|
247 |
elif opt == "open":
|
248 |
+
with open("ultroid.log", "r") as f:
|
249 |
+
file = f.read()[-4000:]
|
250 |
return await event.eor(f"`{file}`")
|
251 |
else:
|
252 |
await def_logs(event, file)
|
|
|
265 |
rep = xx.replace(".git", f"/tree/{y}")
|
266 |
kk = f"<a href={rep}>{y}</a>"
|
267 |
als = in_alive.format(
|
268 |
+
header, f"{ultroid_version} [{HOSTED_ON}]", UltVer, pyver(), uptime, kk
|
|
|
|
|
|
|
|
|
|
|
269 |
)
|
270 |
+
|
271 |
if _e := udB.get_key("ALIVE_EMOJI"):
|
272 |
als = als.replace("🌀", _e)
|
273 |
builder = ult.builder
|
|
|
280 |
)
|
281 |
]
|
282 |
else:
|
283 |
+
if _pic := resolve_bot_file_id(pic):
|
|
|
284 |
pic = _pic
|
285 |
buttons.insert(
|
286 |
0, [Button.inline(get_string("bot_2"), data="alive")]
|
|
|
289 |
await builder.document(
|
290 |
pic,
|
291 |
title="Inline Alive",
|
292 |
+
description="@TeamUltroid",
|
293 |
parse_mode="html",
|
294 |
buttons=buttons,
|
295 |
)
|
|
|
308 |
@ultroid_cmd(pattern="update( (.*)|$)")
|
309 |
async def _(e):
|
310 |
xx = await e.eor(get_string("upd_1"))
|
311 |
+
if e.pattern_match.group(1).strip() and (
|
312 |
+
"fast" in e.pattern_match.group(1).strip()
|
313 |
+
or "soft" in e.pattern_match.group(1).strip()
|
|
|
|
|
|
|
314 |
):
|
315 |
await bash("git pull -f && pip3 install -r requirements.txt")
|
316 |
call_back()
|
317 |
await xx.edit(get_string("upd_7"))
|
318 |
os.execl(sys.executable, "python3", "-m", "pyUltroid")
|
319 |
+
# return
|
320 |
m = await updater()
|
321 |
branch = (Repo.init()).active_branch
|
322 |
if m:
|
323 |
x = await asst.send_file(
|
324 |
udB.get_key("LOG_CHANNEL"),
|
325 |
+
ULTPIC(),
|
326 |
caption="• **Update Available** •",
|
327 |
force_document=False,
|
328 |
buttons=Button.inline("Changelogs", data="changes"),
|
|
|
346 |
await event.delete()
|
347 |
await asst.send_file(
|
348 |
udB.get_key("LOG_CHANNEL"),
|
349 |
+
ULTPIC(),
|
350 |
caption="• **Update Available** •",
|
351 |
force_document=False,
|
352 |
buttons=Button.inline("Changelogs", data="changes"),
|
plugins/broadcast.py
CHANGED
@@ -4,30 +4,19 @@
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
-
"""
|
8 |
-
✘ Commands Available
|
9 |
|
10 |
-
• `{i}addch <id/reply to list/none>`
|
11 |
-
Add chat to database. Adds current chat if no id specified.
|
12 |
|
13 |
-
|
14 |
-
Removes the specified chat (current chat if none specified), or all chats.
|
15 |
|
16 |
-
|
17 |
-
Send the replied message to all chats in database.
|
18 |
|
19 |
-
• `{i}forward <reply to msg>`
|
20 |
-
Forward the message to all chats in database.
|
21 |
-
|
22 |
-
• `{i}listchannels`
|
23 |
-
To get list of all added chats.
|
24 |
-
"""
|
25 |
import asyncio
|
26 |
import io
|
27 |
|
28 |
-
from pyUltroid.dB.broadcast_db import *
|
29 |
from telethon.utils import get_display_name
|
30 |
|
|
|
|
|
31 |
from . import HNDLR, LOGS, eor, get_string, udB, ultroid_bot, ultroid_cmd
|
32 |
|
33 |
|
@@ -76,14 +65,12 @@ async def broadcast_adder(event):
|
|
76 |
chat_id = event.chat_id
|
77 |
if chat_id == udB.get_key("LOG_CHANNEL"):
|
78 |
return
|
79 |
-
if
|
80 |
-
xx = add_channel(chat_id)
|
81 |
-
if xx:
|
82 |
-
await x.edit(get_string("bd_5"))
|
83 |
-
else:
|
84 |
-
await x.edit(get_string("sf_8"))
|
85 |
-
else:
|
86 |
await x.edit(get_string("bd_6"))
|
|
|
|
|
|
|
|
|
87 |
await asyncio.sleep(3)
|
88 |
await x.delete()
|
89 |
|
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
|
|
|
|
7 |
|
|
|
|
|
8 |
|
9 |
+
from . import get_help
|
|
|
10 |
|
11 |
+
__doc__ = get_help("help_broadcast")
|
|
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
import asyncio
|
14 |
import io
|
15 |
|
|
|
16 |
from telethon.utils import get_display_name
|
17 |
|
18 |
+
from pyUltroid.dB.broadcast_db import *
|
19 |
+
|
20 |
from . import HNDLR, LOGS, eor, get_string, udB, ultroid_bot, ultroid_cmd
|
21 |
|
22 |
|
|
|
65 |
chat_id = event.chat_id
|
66 |
if chat_id == udB.get_key("LOG_CHANNEL"):
|
67 |
return
|
68 |
+
if is_channel_added(chat_id):
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
await x.edit(get_string("bd_6"))
|
70 |
+
elif xx := add_channel(chat_id):
|
71 |
+
await x.edit(get_string("bd_5"))
|
72 |
+
else:
|
73 |
+
await x.edit(get_string("sf_8"))
|
74 |
await asyncio.sleep(3)
|
75 |
await x.delete()
|
76 |
|
plugins/button.py
CHANGED
@@ -4,22 +4,18 @@
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
-
"""
|
8 |
-
✘ Commands Available -
|
9 |
|
10 |
-
|
11 |
-
|
|
|
12 |
|
13 |
-
Format:- `{i}button Hey There! @UseUltroid 😎.
|
14 |
-
[Ultroid | t.me/theUltroid][Support | t.me/ultroidsupportchat | same]
|
15 |
-
[TeamUltroid | t.me/TeamUltroid]`
|
16 |
-
"""
|
17 |
import os
|
18 |
|
19 |
-
from pyUltroid.functions.tools import create_tl_btn, get_msg_button
|
20 |
from telegraph import upload_file as uf
|
21 |
from telethon.utils import pack_bot_file_id
|
22 |
|
|
|
|
|
23 |
from . import HNDLR, get_string, mediainfo, ultroid_cmd
|
24 |
from ._inline import something
|
25 |
|
@@ -36,14 +32,14 @@ async def butt(event):
|
|
36 |
if wut and wut.startswith(("pic", "gif")):
|
37 |
dl = await wt.download_media()
|
38 |
variable = uf(dl)
|
39 |
-
media = "https://
|
40 |
elif wut == "video":
|
41 |
if wt.media.document.size > 8 * 1000 * 1000:
|
42 |
return await event.eor(get_string("com_4"), time=5)
|
43 |
dl = await wt.download_media()
|
44 |
variable = uf(dl)
|
45 |
os.remove(dl)
|
46 |
-
media = "https://
|
47 |
else:
|
48 |
media = pack_bot_file_id(wt.media)
|
49 |
try:
|
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
|
|
|
|
7 |
|
8 |
+
from . import get_help
|
9 |
+
|
10 |
+
__doc__ = get_help("help_button")
|
11 |
|
|
|
|
|
|
|
|
|
12 |
import os
|
13 |
|
|
|
14 |
from telegraph import upload_file as uf
|
15 |
from telethon.utils import pack_bot_file_id
|
16 |
|
17 |
+
from pyUltroid.fns.tools import create_tl_btn, get_msg_button
|
18 |
+
|
19 |
from . import HNDLR, get_string, mediainfo, ultroid_cmd
|
20 |
from ._inline import something
|
21 |
|
|
|
32 |
if wut and wut.startswith(("pic", "gif")):
|
33 |
dl = await wt.download_media()
|
34 |
variable = uf(dl)
|
35 |
+
media = f"https://graph.org{variable[0]}"
|
36 |
elif wut == "video":
|
37 |
if wt.media.document.size > 8 * 1000 * 1000:
|
38 |
return await event.eor(get_string("com_4"), time=5)
|
39 |
dl = await wt.download_media()
|
40 |
variable = uf(dl)
|
41 |
os.remove(dl)
|
42 |
+
media = f"https://graph.org{variable[0]}"
|
43 |
else:
|
44 |
media = pack_bot_file_id(wt.media)
|
45 |
try:
|
plugins/calculator.py
CHANGED
@@ -4,12 +4,12 @@
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
-
"""
|
8 |
-
✘ Commands Available -
|
9 |
|
10 |
-
•`{i}calc` - Inline Calculator
|
11 |
|
12 |
-
|
|
|
|
|
|
|
13 |
import re
|
14 |
|
15 |
from . import Button, asst, callback, get_string, in_pattern, udB, ultroid_cmd
|
@@ -85,20 +85,20 @@ async def _(e):
|
|
85 |
if CALC.get(user):
|
86 |
get = CALC[user]
|
87 |
if get:
|
88 |
-
CALC.update({user: get
|
89 |
-
await e.answer(str(get
|
90 |
elif x == "÷":
|
91 |
if CALC.get(user):
|
92 |
get = CALC[user]
|
93 |
if get:
|
94 |
-
CALC.update({user: get
|
95 |
-
await e.answer(str(get
|
96 |
elif x == "x":
|
97 |
if CALC.get(user):
|
98 |
get = CALC[user]
|
99 |
if get:
|
100 |
-
CALC.update({user: get
|
101 |
-
await e.answer(str(get
|
102 |
elif x == "=":
|
103 |
if CALC.get(user):
|
104 |
get = CALC[user]
|
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
|
|
|
|
7 |
|
|
|
8 |
|
9 |
+
from . import get_help
|
10 |
+
|
11 |
+
__doc__ = get_help("help_calculator")
|
12 |
+
|
13 |
import re
|
14 |
|
15 |
from . import Button, asst, callback, get_string, in_pattern, udB, ultroid_cmd
|
|
|
85 |
if CALC.get(user):
|
86 |
get = CALC[user]
|
87 |
if get:
|
88 |
+
CALC.update({user: f"{get}/100"})
|
89 |
+
await e.answer(str(f"{get}/100"))
|
90 |
elif x == "÷":
|
91 |
if CALC.get(user):
|
92 |
get = CALC[user]
|
93 |
if get:
|
94 |
+
CALC.update({user: f"{get}/"})
|
95 |
+
await e.answer(str(f"{get}/"))
|
96 |
elif x == "x":
|
97 |
if CALC.get(user):
|
98 |
get = CALC[user]
|
99 |
if get:
|
100 |
+
CALC.update({user: f"{get}*"})
|
101 |
+
await e.answer(str(f"{get}*"))
|
102 |
elif x == "=":
|
103 |
if CALC.get(user):
|
104 |
get = CALC[user]
|
plugins/channelhacks.py
CHANGED
@@ -4,39 +4,17 @@
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
-
|
8 |
-
✘ Commands Available
|
9 |
|
10 |
-
|
11 |
-
This will transfer all old post from channel A to channel B.
|
12 |
-
(u can use username or id of channel too)
|
13 |
-
example : `{i}shift @abc | @xyz`
|
14 |
-
[note - this (" | ") sign is nessesary]
|
15 |
|
16 |
-
🔹 For auto-posting/forwarding all new message from any source channel to any destination channel.
|
17 |
-
|
18 |
-
`{i}asource <channel username or id>`
|
19 |
-
This add source channel to database
|
20 |
-
`{i}dsource <channel username or id>`
|
21 |
-
This remove source channels from database
|
22 |
-
`{i}listsource <channel username or id>`
|
23 |
-
Show list of source channels
|
24 |
-
|
25 |
-
|
26 |
-
`{i}adest <channel username or id>`
|
27 |
-
This add Ur channels to database
|
28 |
-
`{i}ddest <channel username or id>`
|
29 |
-
This Remove Ur channels from database
|
30 |
-
`{i}listdest <channel username or id>`
|
31 |
-
Show List of Ur channels
|
32 |
-
|
33 |
-
'you can set many channels in database'
|
34 |
-
'For activating auto-post use `{i}setdb AUTOPOST True` '
|
35 |
-
"""
|
36 |
|
37 |
import asyncio
|
38 |
import io
|
39 |
|
|
|
|
|
|
|
40 |
from pyUltroid.dB.ch_db import (
|
41 |
add_destination,
|
42 |
add_source_channel,
|
@@ -49,8 +27,6 @@ from pyUltroid.dB.ch_db import (
|
|
49 |
rem_destination,
|
50 |
rem_source_channel,
|
51 |
)
|
52 |
-
from telethon.errors.rpcerrorlist import FloodWaitError
|
53 |
-
from telethon.utils import get_display_name, get_peer_id
|
54 |
|
55 |
from . import LOGS, asst, eor, events, get_string, udB, ultroid_bot, ultroid_cmd
|
56 |
|
@@ -107,15 +83,14 @@ async def _(e):
|
|
107 |
|
108 |
@ultroid_cmd(pattern="asource (.*)")
|
109 |
async def source(e):
|
110 |
-
x
|
111 |
-
if not x:
|
112 |
-
y = e.chat_id
|
113 |
-
else:
|
114 |
try:
|
115 |
y = await e.client.parse_id(x)
|
116 |
except Exception as er:
|
117 |
LOGS.exception(er)
|
118 |
return
|
|
|
|
|
119 |
if not is_source_channel_added(y):
|
120 |
add_source_channel(y)
|
121 |
await e.eor(get_string("cha_2"))
|
@@ -186,8 +161,7 @@ async def list_all(event):
|
|
186 |
|
187 |
@ultroid_cmd(pattern="adest (.*)")
|
188 |
async def destination(e):
|
189 |
-
x
|
190 |
-
if x:
|
191 |
try:
|
192 |
y = await e.client.parse_id(x)
|
193 |
except Exception as er:
|
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
+
from . import get_help
|
|
|
8 |
|
9 |
+
__doc__ = get_help("help_channelhacks")
|
|
|
|
|
|
|
|
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
import asyncio
|
13 |
import io
|
14 |
|
15 |
+
from telethon.errors.rpcerrorlist import FloodWaitError
|
16 |
+
from telethon.utils import get_display_name, get_peer_id
|
17 |
+
|
18 |
from pyUltroid.dB.ch_db import (
|
19 |
add_destination,
|
20 |
add_source_channel,
|
|
|
27 |
rem_destination,
|
28 |
rem_source_channel,
|
29 |
)
|
|
|
|
|
30 |
|
31 |
from . import LOGS, asst, eor, events, get_string, udB, ultroid_bot, ultroid_cmd
|
32 |
|
|
|
83 |
|
84 |
@ultroid_cmd(pattern="asource (.*)")
|
85 |
async def source(e):
|
86 |
+
if x := e.pattern_match.group(1).strip():
|
|
|
|
|
|
|
87 |
try:
|
88 |
y = await e.client.parse_id(x)
|
89 |
except Exception as er:
|
90 |
LOGS.exception(er)
|
91 |
return
|
92 |
+
else:
|
93 |
+
y = e.chat_id
|
94 |
if not is_source_channel_added(y):
|
95 |
add_source_channel(y)
|
96 |
await e.eor(get_string("cha_2"))
|
|
|
161 |
|
162 |
@ultroid_cmd(pattern="adest (.*)")
|
163 |
async def destination(e):
|
164 |
+
if x := e.pattern_match.group(1).strip():
|
|
|
165 |
try:
|
166 |
y = await e.client.parse_id(x)
|
167 |
except Exception as er:
|
plugins/chatbot.py
CHANGED
@@ -4,23 +4,13 @@
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
-
"""
|
8 |
-
✘ Commands Available -
|
9 |
|
10 |
-
|
11 |
-
Add a AI ChatBot to reply to that user.
|
12 |
|
13 |
-
|
14 |
-
Remove the AI ChatBot.
|
15 |
|
16 |
-
• `{i}repai <reply to user/give a message>`
|
17 |
-
Reply to the user with a message by an AI.
|
18 |
|
19 |
-
|
20 |
-
List the currently AI added users.
|
21 |
-
"""
|
22 |
-
|
23 |
-
from pyUltroid.functions.tools import get_chatbot_reply
|
24 |
|
25 |
from . import eod, get_string, inline_mention, udB, ultroid_cmd
|
26 |
|
@@ -61,7 +51,7 @@ async def lister(event):
|
|
61 |
user = inline_mention(user)
|
62 |
except BaseException:
|
63 |
user = f"`{i}`"
|
64 |
-
msg += "• {}\n"
|
65 |
await event.eor(msg, link_preview=False)
|
66 |
|
67 |
|
@@ -71,11 +61,11 @@ async def chat_bot_fn(event, type_):
|
|
71 |
else:
|
72 |
temp = event.text.split(maxsplit=1)
|
73 |
try:
|
74 |
-
user_ = await event.client.get_entity(temp[1])
|
75 |
except BaseException:
|
76 |
if event.is_private:
|
77 |
user_ = event.chat
|
78 |
-
|
79 |
return await eod(
|
80 |
event,
|
81 |
get_string("chab_1"),
|
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
|
|
|
|
7 |
|
8 |
+
from . import get_help
|
|
|
9 |
|
10 |
+
__doc__ = get_help("help_chatbot")
|
|
|
11 |
|
|
|
|
|
12 |
|
13 |
+
from pyUltroid.fns.tools import get_chatbot_reply
|
|
|
|
|
|
|
|
|
14 |
|
15 |
from . import eod, get_string, inline_mention, udB, ultroid_cmd
|
16 |
|
|
|
51 |
user = inline_mention(user)
|
52 |
except BaseException:
|
53 |
user = f"`{i}`"
|
54 |
+
msg += f"• {user}\n"
|
55 |
await event.eor(msg, link_preview=False)
|
56 |
|
57 |
|
|
|
61 |
else:
|
62 |
temp = event.text.split(maxsplit=1)
|
63 |
try:
|
64 |
+
user_ = await event.client.get_entity(await event.client.parse_id(temp[1]))
|
65 |
except BaseException:
|
66 |
if event.is_private:
|
67 |
user_ = event.chat
|
68 |
+
if not user_:
|
69 |
return await eod(
|
70 |
event,
|
71 |
get_string("chab_1"),
|
plugins/chats.py
CHANGED
@@ -4,36 +4,10 @@
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
-
|
8 |
-
✘ Commands Available -
|
9 |
|
10 |
-
|
11 |
-
Delete the group this cmd is used in.
|
12 |
|
13 |
-
• `{i}getlink`
|
14 |
-
• `{i}getlink r` - `create link with admin approval`
|
15 |
-
• `{i}getlink r title_here` - `admin approval with link title`
|
16 |
-
• `{i}getlink 10` - `usage limit in new link`
|
17 |
-
Get link of group this cmd is used in.
|
18 |
-
|
19 |
-
• `{i}create (g|b|c) <group_name> ; <optional-username>`
|
20 |
-
Create group woth a specific name.
|
21 |
-
g - megagroup/supergroup
|
22 |
-
b - small group
|
23 |
-
c - channel
|
24 |
-
|
25 |
-
• `{i}setgpic <reply to Photo><chat username>`
|
26 |
-
Set Profile photo of Group.
|
27 |
-
|
28 |
-
• `{i}delgpic <chat username -optional>`
|
29 |
-
Delete Profile photo of Group.
|
30 |
-
|
31 |
-
• `{i}unbanall`
|
32 |
-
Unban all Members of a group.
|
33 |
-
|
34 |
-
• `{i}rmusers`
|
35 |
-
Remove users specifically.
|
36 |
-
"""
|
37 |
|
38 |
from telethon.errors import ChatAdminRequiredError as no_admin
|
39 |
from telethon.tl.functions.channels import (
|
@@ -101,7 +75,7 @@ async def _(e):
|
|
101 |
request, usage, title, link = None, None, None, None
|
102 |
if match:
|
103 |
split = match.split(maxsplit=1)
|
104 |
-
request =
|
105 |
title = "Created by Ultroid"
|
106 |
if len(split) > 1:
|
107 |
match = split[1]
|
@@ -190,7 +164,7 @@ async def _(e):
|
|
190 |
created_chat_id = r.chats[0].id
|
191 |
if username:
|
192 |
await e.client(UpdateUsernameRequest(created_chat_id, username))
|
193 |
-
result = "https://t.me/"
|
194 |
else:
|
195 |
result = (
|
196 |
await e.client(
|
@@ -245,7 +219,7 @@ async def _(ult):
|
|
245 |
await ult.client(EditPhotoRequest(chat, file))
|
246 |
await ult.eor("`Group Photo has Successfully Changed !`", time=5)
|
247 |
except Exception as ex:
|
248 |
-
await ult.eor("Error occured.\n`{
|
249 |
os.remove(replfile)
|
250 |
|
251 |
|
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
+
from . import get_help
|
|
|
8 |
|
9 |
+
__doc__ = get_help("help_chats")
|
|
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
from telethon.errors import ChatAdminRequiredError as no_admin
|
13 |
from telethon.tl.functions.channels import (
|
|
|
75 |
request, usage, title, link = None, None, None, None
|
76 |
if match:
|
77 |
split = match.split(maxsplit=1)
|
78 |
+
request = split[0] in ["r", "request"]
|
79 |
title = "Created by Ultroid"
|
80 |
if len(split) > 1:
|
81 |
match = split[1]
|
|
|
164 |
created_chat_id = r.chats[0].id
|
165 |
if username:
|
166 |
await e.client(UpdateUsernameRequest(created_chat_id, username))
|
167 |
+
result = f"https://t.me/{username}"
|
168 |
else:
|
169 |
result = (
|
170 |
await e.client(
|
|
|
219 |
await ult.client(EditPhotoRequest(chat, file))
|
220 |
await ult.eor("`Group Photo has Successfully Changed !`", time=5)
|
221 |
except Exception as ex:
|
222 |
+
await ult.eor(f"Error occured.\n`{str(ex)}`", time=5)
|
223 |
os.remove(replfile)
|
224 |
|
225 |
|
plugins/cleanaction.py
CHANGED
@@ -4,19 +4,11 @@
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
-
"""
|
8 |
-
✘ Commands Available -
|
9 |
|
10 |
-
|
11 |
-
Clean all Upcoming action msg in added chat like someone joined/left/pin etc.
|
12 |
|
13 |
-
|
14 |
-
Remove chat from database.
|
15 |
|
16 |
-
•`{i}listclean`
|
17 |
-
To get list of all chats where its activated.
|
18 |
-
|
19 |
-
"""
|
20 |
|
21 |
from telethon.utils import get_display_name
|
22 |
|
@@ -44,8 +36,7 @@ async def _(e):
|
|
44 |
|
45 |
@ultroid_cmd(pattern="listclean$")
|
46 |
async def _(e):
|
47 |
-
k
|
48 |
-
if k:
|
49 |
o = ""
|
50 |
for x in k:
|
51 |
try:
|
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
|
|
|
|
7 |
|
8 |
+
from . import get_help
|
|
|
9 |
|
10 |
+
__doc__ = get_help("help_cleanaction")
|
|
|
11 |
|
|
|
|
|
|
|
|
|
12 |
|
13 |
from telethon.utils import get_display_name
|
14 |
|
|
|
36 |
|
37 |
@ultroid_cmd(pattern="listclean$")
|
38 |
async def _(e):
|
39 |
+
if k := udB.get_key("CLEANCHAT"):
|
|
|
40 |
o = ""
|
41 |
for x in k:
|
42 |
try:
|
plugins/compressor.py
CHANGED
@@ -4,19 +4,11 @@
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
-
"""
|
8 |
-
✘ Commands Available -
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
Encode the replied video according to CRF value.
|
14 |
-
Less CRF == High Quality, More Size
|
15 |
-
More CRF == Low Quality, Less Size
|
16 |
-
CRF Range = 20-51
|
17 |
-
Default = 27
|
18 |
|
19 |
-
"""
|
20 |
|
21 |
import asyncio
|
22 |
import os
|
@@ -24,11 +16,13 @@ import re
|
|
24 |
import time
|
25 |
from datetime import datetime as dt
|
26 |
|
27 |
-
from pyUltroid.functions.tools import metadata
|
28 |
from telethon.errors.rpcerrorlist import MessageNotModifiedError
|
29 |
from telethon.tl.types import DocumentAttributeVideo
|
30 |
|
|
|
|
|
31 |
from . import (
|
|
|
32 |
bash,
|
33 |
downloader,
|
34 |
get_string,
|
@@ -66,12 +60,13 @@ async def _(e):
|
|
66 |
xxx = await e.eor(get_string("audiotools_5"))
|
67 |
c_time = time.time()
|
68 |
file = await downloader(
|
69 |
-
"resources/downloads/"
|
70 |
vfile,
|
71 |
xxx,
|
72 |
c_time,
|
73 |
-
"Downloading
|
74 |
)
|
|
|
75 |
o_size = os.path.getsize(file.name)
|
76 |
d_time = time.time()
|
77 |
diff = time_formatter((d_time - c_time) * 1000)
|
@@ -83,9 +78,11 @@ async def _(e):
|
|
83 |
x, y = await bash(
|
84 |
f'mediainfo --fullscan """{file.name}""" | grep "Frame count"'
|
85 |
)
|
|
|
|
|
86 |
total_frames = x.split(":")[1].split("\n")[0]
|
87 |
progress = f"progress-{c_time}.txt"
|
88 |
-
with open(progress, "w")
|
89 |
pass
|
90 |
proce = await asyncio.create_subprocess_shell(
|
91 |
f'ffmpeg -hide_banner -loglevel quiet -progress {progress} -i """{file.name}""" -preset ultrafast -vcodec libx265 -crf {crf} -c:a copy """{out}""" -y',
|
@@ -110,13 +107,13 @@ async def _(e):
|
|
110 |
some_eta = ((int(total_frames) - elapse) / speed) * 1000
|
111 |
text = f"`Compressing {file_name} at {crf} CRF.\n`"
|
112 |
progress_str = "`[{0}{1}] {2}%\n\n`".format(
|
113 |
-
"".join("●" for
|
114 |
-
"".join("" for
|
115 |
round(per, 2),
|
116 |
)
|
117 |
|
118 |
-
e_size = humanbytes(size)
|
119 |
-
eta = "~
|
120 |
try:
|
121 |
await xxx.edit(
|
122 |
text
|
@@ -142,13 +139,7 @@ async def _(e):
|
|
142 |
caption += f"**Compressed Size: **`{humanbytes(c_size)}`\n"
|
143 |
caption += f"**Compression Ratio: **`{differ:.2f}%`\n"
|
144 |
caption += f"\n**Time Taken To Compress: **`{difff}`"
|
145 |
-
mmmm = await uploader(
|
146 |
-
out,
|
147 |
-
out,
|
148 |
-
f_time,
|
149 |
-
xxx,
|
150 |
-
"Uploading " + out + "...",
|
151 |
-
)
|
152 |
if to_stream:
|
153 |
data = await metadata(out)
|
154 |
width = data["width"]
|
@@ -162,7 +153,7 @@ async def _(e):
|
|
162 |
await e.client.send_file(
|
163 |
e.chat_id,
|
164 |
mmmm,
|
165 |
-
thumb=
|
166 |
caption=caption,
|
167 |
attributes=attributes,
|
168 |
force_document=False,
|
@@ -172,7 +163,7 @@ async def _(e):
|
|
172 |
await e.client.send_file(
|
173 |
e.chat_id,
|
174 |
mmmm,
|
175 |
-
thumb=
|
176 |
caption=caption,
|
177 |
force_document=True,
|
178 |
reply_to=e.reply_to_msg_id,
|
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
|
|
|
|
7 |
|
8 |
+
from . import get_help
|
9 |
+
|
10 |
+
__doc__ = get_help("help_compressor")
|
|
|
|
|
|
|
|
|
|
|
11 |
|
|
|
12 |
|
13 |
import asyncio
|
14 |
import os
|
|
|
16 |
import time
|
17 |
from datetime import datetime as dt
|
18 |
|
|
|
19 |
from telethon.errors.rpcerrorlist import MessageNotModifiedError
|
20 |
from telethon.tl.types import DocumentAttributeVideo
|
21 |
|
22 |
+
from pyUltroid.fns.tools import metadata
|
23 |
+
|
24 |
from . import (
|
25 |
+
ULTConfig,
|
26 |
bash,
|
27 |
downloader,
|
28 |
get_string,
|
|
|
60 |
xxx = await e.eor(get_string("audiotools_5"))
|
61 |
c_time = time.time()
|
62 |
file = await downloader(
|
63 |
+
f"resources/downloads/{name}",
|
64 |
vfile,
|
65 |
xxx,
|
66 |
c_time,
|
67 |
+
f"Downloading {name}...",
|
68 |
)
|
69 |
+
|
70 |
o_size = os.path.getsize(file.name)
|
71 |
d_time = time.time()
|
72 |
diff = time_formatter((d_time - c_time) * 1000)
|
|
|
78 |
x, y = await bash(
|
79 |
f'mediainfo --fullscan """{file.name}""" | grep "Frame count"'
|
80 |
)
|
81 |
+
if y and y.endswith("NOT_FOUND"):
|
82 |
+
return await xxx.edit(f"ERROR: `{y}`")
|
83 |
total_frames = x.split(":")[1].split("\n")[0]
|
84 |
progress = f"progress-{c_time}.txt"
|
85 |
+
with open(progress, "w"):
|
86 |
pass
|
87 |
proce = await asyncio.create_subprocess_shell(
|
88 |
f'ffmpeg -hide_banner -loglevel quiet -progress {progress} -i """{file.name}""" -preset ultrafast -vcodec libx265 -crf {crf} -c:a copy """{out}""" -y',
|
|
|
107 |
some_eta = ((int(total_frames) - elapse) / speed) * 1000
|
108 |
text = f"`Compressing {file_name} at {crf} CRF.\n`"
|
109 |
progress_str = "`[{0}{1}] {2}%\n\n`".format(
|
110 |
+
"".join("●" for _ in range(math.floor(per / 5))),
|
111 |
+
"".join("" for _ in range(20 - math.floor(per / 5))),
|
112 |
round(per, 2),
|
113 |
)
|
114 |
|
115 |
+
e_size = f"{humanbytes(size)} of ~{humanbytes((size / per) * 100)}"
|
116 |
+
eta = f"~{time_formatter(some_eta)}"
|
117 |
try:
|
118 |
await xxx.edit(
|
119 |
text
|
|
|
139 |
caption += f"**Compressed Size: **`{humanbytes(c_size)}`\n"
|
140 |
caption += f"**Compression Ratio: **`{differ:.2f}%`\n"
|
141 |
caption += f"\n**Time Taken To Compress: **`{difff}`"
|
142 |
+
mmmm = await uploader(out, out, f_time, xxx, f"Uploading {out}...")
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
if to_stream:
|
144 |
data = await metadata(out)
|
145 |
width = data["width"]
|
|
|
153 |
await e.client.send_file(
|
154 |
e.chat_id,
|
155 |
mmmm,
|
156 |
+
thumb=ULTConfig.thumb,
|
157 |
caption=caption,
|
158 |
attributes=attributes,
|
159 |
force_document=False,
|
|
|
163 |
await e.client.send_file(
|
164 |
e.chat_id,
|
165 |
mmmm,
|
166 |
+
thumb=ULTConfig.thumb,
|
167 |
caption=caption,
|
168 |
force_document=True,
|
169 |
reply_to=e.reply_to_msg_id,
|