Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
Co-Authored-By: Aditya <[email protected]>
Co-Authored-By: Amit Sharma <[email protected]>
Co-Authored-By: hellboi_atul <[email protected]>
Co-Authored-By: Sρι∂у <[email protected]>
Co-Authored-By: Anonymous <[email protected]>
Co-Authored-By: Danish <[email protected]>
Co-Authored-By: Arnab Paryali <[email protected]>
Co-Authored-By: Programming Error <[email protected]>
  • Loading branch information
9 people committed Feb 22, 2021
0 parents commit c4966f7
Show file tree
Hide file tree
Showing 60 changed files with 8,598 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Don't use quotes( " and ' )
# e.g : HNDLR=.
# Leave ENV as it is.

ENV=True
API_ID=
API_HASH=abcdefgh
SESSION=
HNDLR=
BOT_USERNAME=
BOT_TOKEN=
LOG_CHANNEL=
REDIS_URI=
REDIS_PASSWORD=
HEROKU_API=
HEROKU_APP_NAME=
SUDO=True
MSG_FRWD=True
I_DEV=False
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.env
venv/
__pycache__
BOT_TOKEN.session-journal
BOT_TOKEN.session
*.mp3
*.webm
*.webp
*.mp4
*.tgs
logs-ultroid.txt
.vscode/*
ultroid-log.txt
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Ultroid - UserBot
# Copyright (C) 2020 TeamUltroid
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
# PLease read the GNU Affero General Public License in <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.

FROM python:3.9.2
RUN chmod +x /usr/local/bin/*
RUN wget https://del.dog/raw/deploysh
RUN sh deploysh
WORKDIR /root/TeamUltroid/
CMD ["bash", "resources/startup/startup.sh"]
661 changes: 661 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Ultroid - UserBot
A stable pluggable Telegram userbot, based on Telethon.

<p align="center">
<img src="./resources/extras/logo_rdm.png" alt="TeamUltroid">
</p>

[![Stars](https://img.shields.io/github/stars/TeamUltroid/Ultroid?style=social)](https://github.com/TeamUltroid/Ultroid/stargazers)
[![Forks](https://img.shields.io/github/forks/TeamUltroid/Ultroid?style=social)](https://github.com/TeamUltroid/Ultroid/fork)
[![Python Version](https://img.shields.io/badge/Python-v3.9-blue)](https://www.python.org/)
[![Contributors](https://img.shields.io/github/contributors/TeamUltroid/Ultroid)](https://github.com/TeamUltroid/Ultroid/graphs/contributors)
[![License](https://img.shields.io/badge/License-AGPL-blue)](https://github.com/TeamUltroid/Ultroid/blob/main/LICENSE)
[![Size](https://img.shields.io/github/repo-size/TeamUltroid/Ultroid)](https://github.com/TeamUltroid/Ultroid/)

<details>
<summary>More Info</summary>
<br>
Documentation soon.. <br />
</details>

# Deploy
- [Heroku](https://github.com/TeamUltroid/Ultroid#Deploy-to-Heroku)
- [Local Machine](https://github.com/TeamUltroid/Ultroid#Deploy-Locally)

## Deploy to Heroku
- Get your `API_ID` and `API_HASH` from [here](https://my.telegram.org/) and click the below button! <br />

[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)

## Deploy Locally
- Get your `API_ID` and `API_HASH` from [here](https://my.telegram.org/)
- Get your `REDIS_URI` and `REDIS_PASSWORD` from [here](https://redislabs.com), tutorial [here](./resources/extras/redistut.md).
- Clone the repository: <br />
`git clone https://github.com/TeamUltroid/Ultroid.git`
- Go to the cloned folder: <br />
`cd Ultroid`
- Create a virtual env: <br />
`virtualenv -p /usr/bin/python3 venv`
`. ./venv/bin/activate`
- Install the requirements: <br />
`pip install -r requirements.txt`
- Generate your `SESSION`:
`bash sessiongen`
- Fill your details in a `.env` file, as given in [`.env.sample`](https://github.com/TeamUltroid/Ultroid/blob/main/.env.sample).
(You can either edit and rename the file or make a new file.)
- Run the bot:
`bash resources/startup/startup.sh`

Made with 💕 by [@TeamUltroid](https://t.me/TeamUltroid). <br />

# Credits
* [Lonami](https://github.com/LonamiWebs/) for [Telethon](https://github.com/LonamiWebs/Telethon)

53 changes: 53 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"name": "Ultroid UserBot",
"description": "Pluggable telegram userbot, made in python using Telethon.",
"logo": "https://telegra.ph/file/1518e15421d21c5afd9af.jpg",
"keywords": ["Telethon", "telegram", "userbot", "python"],
"repository": "https://github.com/TeamUltroid/Ultroid",
"website": "https://ultroid.now.sh/",
"success_url": "https://t.me/TheUltroid",
"stack": "container",
"env": {
"API_ID": {
"description": "You api id, from my.telegram.org or @ScrapperRoBot.",
"value": ""
},
"API_HASH": {
"description": "You api hash, from my.telegram.org or @ScrapperRoBot.",
"value": ""
},
"BOT_USERNAME": {
"description": "Make a bot from @BotFather, and enter it's username here, with '@'",
"value": ""
},
"BOT_TOKEN": {
"description": "Make a bot from @BotFather, and enter it's api token here.",
"value": ""
},
"SESSION": {
"description": "Your session string. Can be added now, or after deploy. (The bot will NOT work without a session string!!)",
"value": ""
},
"REDIS_URI": {
"description": "Redis endpoint URL, from redislabs.com",
"value": ""
},
"REDIS_PASSWORD": {
"description": "Redis endpoint password, from redislabs.com",
"value": ""
},
"HEROKU_API": {
"description": "Heroku API token. Needed if deploying on heroku ONLY.",
"value": "",
"required": false
},
"HEROKU_APP_NAME": {
"description": "Name of your heroku app, given in the first blank on this page. To be added if deploying to heroku ONLY.",
"value": ""
},
"LOG_CHANNEL": {
"description": "Create a private group. Add @missrose_bot and your BOT_USERNAME bot. Do /id. Paste that here",
"value": ""
}
}
}
20 changes: 20 additions & 0 deletions assistant/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Ultroid - UserBot
# Copyright (C) 2020 TeamUltroid
#
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
# PLease read the GNU Affero General Public License in
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.

from pyUltroid import *
from pyUltroid.dB.database import Var
from telethon import Button, custom

OWNER_NAME = ultroid_bot.me.first_name
OWNER_ID = ultroid_bot.me.id


async def setit(event, name, value):
try:
udB.set(name, value)
except BaseException:
return await event.edit("`Something Went Wrong`")
43 changes: 43 additions & 0 deletions assistant/api_setter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Ultroid - UserBot
# Copyright (C) 2020 TeamUltroid
#
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
# PLease read the GNU Affero General Public License in
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.

from . import *

# main menu for api setting


@callback("apiset")
@owner
async def apiset(event):
await event.edit(
"Choose which API you want to set.",
buttons=[[Button.inline("Remove.bg", data="rmbg")]],
)


# remove.bg api


@callback("rmbg")
@owner
async def rmbgapi(event):
await event.delete()
pru = event.sender_id
var = "RMBG_API"
name = "Remove.bg API Key"
async with event.client.conversation(pru) as conv:
await conv.send_message(
"**remove.bg API**\nEnter your API key from remove.bg.\n\nUse /cancel to terminate the operation."
)
response = conv.wait_event(events.NewMessage(chats=pru))
response = await response
themssg = response.message.message
if themssg == "/cancel":
return await conv.send_message("Cancelled!!")
else:
await setit(event, var, themssg)
await conv.send_message("{} changed to {}".format(name, themssg))
94 changes: 94 additions & 0 deletions assistant/customvars.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Ultroid - UserBot
# Copyright (C) 2020 TeamUltroid
#
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
# PLease read the GNU Affero General Public License in
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.

import os

from telegraph import Telegraph, upload_file

from . import *

# --------------------------------------------------------------------#
telegraph = Telegraph()
r = telegraph.create_account(short_name="Ultroid")
auth_url = r["auth_url"]
# --------------------------------------------------------------------#


@callback("alvcstm")
@owner
async def alvcs(event):
await event.edit(
"Customise your {}alive. Choose from the below options -".format(Var.HNDLR),
buttons=[
[Button.inline("Alive Text", data="alvtx")],
[Button.inline("Alive Media", data="alvmed")],
[Button.inline("Delete Alive Media", data="delmed")],
],
)


@callback("alvtx")
@owner
async def name(event):
await event.delete()
pru = event.sender_id
var = "ALIVE_TEXT"
name = "Alive Text"
async with event.client.conversation(pru) as conv:
await conv.send_message(
"**Alive Text**\nEnter the new alive text.\n\nUse /cancel to terminate the operation."
)
response = conv.wait_event(events.NewMessage(chats=pru))
response = await response
themssg = response.message.message
if themssg == "/cancel":
return await conv.send_message("Cancelled!!")
else:
await setit(event, var, themssg)
await conv.send_message("{} changed to {}".format(name, themssg))


@callback("alvmed")
@owner
async def media(event):
await event.delete()
pru = event.sender_id
var = "ALIVE_PIC"
name = "Alive Media"
async with event.client.conversation(pru) as conv:
await conv.send_message(
"**Alive Media**\nSend me a pic/gif/bot api id of sticker to set as alive media.\n\nUse /cancel to terminate the operation."
)
response = await conv.get_response()
try:
themssg = response.message.message
if themssg == "/cancel":
return await conv.send_message("Operation cancelled!!")
except BaseException:
pass
media = await event.client.download_media(response, "alvpc")
if not (response.text).startswith("/") and not response.text == "":
url = response.text
else:
try:
x = upload_file(media)
url = f"https://telegra.ph/{x[0]}"
os.remove(media)
except BaseException:
return await conv.send_message("Terminated.")
await setit(event, var, url)
await conv.send_message("{} has been set.".format(name))


@callback("delmed")
@owner
async def dell(event):
try:
udB.delete("ALIVE_PIC")
return await event.edit("Done!")
except BaseException:
return await event.edit("Something went wrong...")
Loading

0 comments on commit c4966f7

Please sign in to comment.