Skip to content

Commit

Permalink
Paperplane Extended 3.0 sql-extended
Browse files Browse the repository at this point in the history
  • Loading branch information
Avinash Reddy committed Jul 21, 2019
1 parent bf56eaf commit cab9165
Show file tree
Hide file tree
Showing 56 changed files with 3,108 additions and 767 deletions.
771 changes: 771 additions & 0 deletions .apt/usr/bin/config/config.conf

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# These are supported funding model platforms

github: [baalajimaestro, raphielscape, mryacha] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
custom: # Replace with a single custom sponsorship URL
3 changes: 3 additions & 0 deletions Aptfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
neofetch
chromium-chromedriver
chromium-browser
88 changes: 52 additions & 36 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,62 +1,78 @@
# We're using Alpine Edge
# We're using Alpine stable
FROM alpine:edge

#
# We have to uncomment Community repo for some packages
#
RUN sed -e 's;^#http\(.*\)/edge/community;http\1/edge/community;g' -i /etc/apk/repositories
RUN sed -e 's;^#http\(.*\)/v3.9/community;http\1/v3.9/community;g' -i /etc/apk/repositories

# Installing Core Components
# Installing Python
RUN apk add --no-cache --update \
git \
bash \
build-base \
bzip2-dev \
chromium \
chromium-chromedriver \
curl \
figlet \
gcc \
git \
jpeg-dev \
libffi-dev \
libpq \
libwebp-dev \
libxml2 \
libxml2-dev \
libxslt-dev \
linux-headers \
musl \
neofetch \
openssl-dev \
php-pgsql \
postgresql \
postgresql-client \
postgresql-dev \
py-lxml \
py-pillow \
py-pip \
py-psycopg2 \
py-requests \
py-sqlalchemy \
py-tz \
py3-aiohttp \
python-dev \
python3 \
sudo

RUN python3 -m ensurepip \
&& pip3 install --upgrade pip setuptools \
&& rm -r /usr/lib/python*/ensurepip && \
if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi && \
if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/python3 /usr/bin/python; fi && \
rm -r /root/.cache

python3-dev \
readline-dev \
sqlite \
sqlite-dev \
sudo \
util-linux \
zlib-dev

#
# Install dependencies
#
RUN apk add --no-cache \
py-pillow py-requests \
py-sqlalchemy py-psycopg2 \
libpq curl neofetch \
musl py-tz py3-aiohttp \
py-six py-click
RUN pip3 install --upgrade pip setuptools

RUN apk add --no-cache sqlite figlet
# Copy Python Requirements to /app

#
# Make user for userbot itself
#
RUN sed -e 's;^# \(%wheel.*NOPASSWD.*\);\1;g' -i /etc/sudoers
RUN adduser userbot --disabled-password --home /home/userbot
RUN adduser userbot wheel

USER userbot
RUN mkdir /home/userbot/userbot
RUN git clone -b sql-extended https://github.com/AvinashReddy3108/PaperplaneExtended /home/userbot/userbot
WORKDIR /home/userbot/userbot
ADD ./requirements.txt /home/userbot/userbot/requirements.txt

#
# Install requirements
# Copies session and config(if it exists)
#
COPY ./requirementsDOCKER.txt /home/userbot/userbot
RUN sudo pip3 install -U pip
RUN sudo pip3 install -r requirementsDOCKER.txt

RUN git clone -b sql-backup https://github.com/baalajimaestro/Telegram-UserBot /home/userbot/userbot
COPY ./sample_config.env ./userbot.session* ./config.env* /home/userbot/userbot/

#
# Copies session and config(if it exists)
# Install requirements
#
COPY ./userbot.session ./config.env /home/userbot/userbot/

RUN sudo pip3 install -r requirements.txt
ADD . /home/userbot/userbot
RUN sudo chown -R userbot /home/userbot/userbot
RUN sudo chmod -R 777 /home/userbot/userbot
CMD ["python3","-m","userbot"]
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
worker: python3 -m userbot
65 changes: 32 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,38 @@
# Telegram-UserBot
# Project Paperplane Extended

### If the CI builds pass, but you still get syntax errors when running locally it's most probably not a problem with the source but with your version of python
### **A modular Telegram userbot running on Python 3.6+ with an sqlalchemy database.**

#### The easiest way to deploy this bad boy !!

```
#include <std/disclaimer.h>
/**
Your Telegram account may get banned.
I am not responsible for any improper use of this bot
This bot is intended for the purpose of having fun with memes,
as well as efficiently managing groups.
You ended up spamming groups, getting reported left and right,
and you ended up in a Finale Battle with Telegram and at the end
Telegram Team deleted your account?
And after that, then you pointed your fingers at us
for getting your acoount deleted?
I will rolling on the floor laughing at you.
/**
```
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/AvinashReddy3108/PaperplaneExtended/tree/sql-extended)

A modular telegram Python UserBot running on python3 with an sqlalchemy database.
#include <std/disclaimer.h>
/**
Your Telegram account may get banned.

Started up as a simple bot, which helps with deleting messages and other stuffs when I didn't possess a smartphone(selecting each message indeed difficult) with a ton of meme features kanged from [SkittBot](https://github.com/skittles9823/SkittBot), it has evolved, becoming extremely modular and simple to use.
I am not responsible for ANY improper use of this bot.

For configuring this userbot, you can checkout the [Wiki](https://wiki.raphielgang.org)
This userbot is intended for the purpose of having fun with memes,
as well as efficiently managing groups.

If you just want to stay in the loop about new features or
announcements you can join the [news channel](https://t.me/maestro_userbot_channel).

If you find any bugs or have any suggestions then don't hesitate to contact me in [my support group](https://t.me/userbot_support).

Please head to the wiki on instructions to setting it up!
You ended up spamming groups, getting reported left and right,
and you ended up in a Finale Battle with Telegram and at the end
Telegram Team deleted your account?

And after that, then you pointed your fingers at us
for getting your acoount deleted?

### Contributing to the source:
I will be rolling on the floor laughing at you.
/**

We love to see you contributing and helping us improve on our way to a perfect userbot.
This is a fork of the famous [Paperplane](https://github.com/RaphielGang/Telegram-UserBot) userbot made by the awesome [RaphielGang](https://github.com/RaphielGang) team with some extras from the Telegram userbot community.

If you need help writing a new module, you can checkout the [Wiki](https://wiki.raphielgang.org).
For setting up and configuring this userbot, you can checkout the [Wiki](https://github.com/AvinashReddy3108/PaperplaneExtended/wiki) [WIP, Coming Soon !!]

Please target your PRs to the staging branch and not master. Commits on `master` wont be done by a user.
If you just want to stay in the loop about new features or
announcements you can join the [news channel](https://t.me/PaperplaneExtended).

If you find any bugs or have any suggestions then don’t hesitate to contact me in my [support group](https://t.me/joinchat/FL1HhlObW_Q5oUrZdbDcKg).

### Credits:

Expand All @@ -52,12 +44,19 @@ I would like to thank people who assisted me throughout this project:
* [@deletescape](https://github.com/deletescape)
* [@songotenks69](https://github.com/songotenks69)
* [@Ovenoboyo](https://github.com/Ovenoboyo)
* [SphericalKat](https://github.com/ATechnoHazard)
* [@SphericalKat](https://github.com/ATechnoHazard)
* [@nitanmarcell](https://www.github.com/nitanmarcel)
* [@spechide](https://www.github.com/spechide)
* [@Jeepeo](https://github.com/Jeepeo)
* [@shxnpie](https://github.com/shxnpie)
* [@rupansh](https://github.com/rupansh)
* [@zakaryan2004](https://github.com/zakaryan2004)
* [@kandnub](https://github.com/kandnub)
* [@pqhaz](https://github.com/pqhaz)

and many more people who aren't mentioned here.
and many more people and projects who aren’t mentioned here.

All features taken from them are copyrighted to their respespective, if you are handling the features/module
by them you need to strictly comply their respective LICENSE

Found Bugs? Create an issue on the issue tracker, or post it in the [support group](https://t.me/userbot_support).
Found Bugs? Create an issue on the issue tracker, or post it in the [support group](https://t.me/joinchat/FL1HhlObW_Q5oUrZdbDcKg).
94 changes: 94 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"name": "Paperplane Extended - Telegram Userbot",
"description": "A modular Telegram userbot running on Python 3.6+ with an sqlalchemy database.",
"logo": "https://i.imgur.com/ATSG4w3.png",
"keywords": [
"telegram",
"userbot",
"plugin",
"modular",
"productivity"
],
"repository": "https://github.com/AvinashReddy3108/PaperplaneExtended",
"website": "https://github.com/RaphielGang/Telegram-UserBot/wiki",
"success_url": "https://t.me/userbot_announcements",
"stack": "container",
"env": {
"API_KEY": {
"description": "Get this value from my.telegram.org.",
"value": ""
},
"API_HASH": {
"description": "Get this value from my.telegram.org.",
"value": ""
},
"STRING_SESSION": {
"description": "[REQUIRED] Get this value by running python3 string_session.py in app console.",
"required": false
},
"CHROME_DRIVER": {
"description": "ChromeDriver location.",
"value": "/usr/bin/chromedriver"
},
"GOOGLE_CHROME_BIN": {
"description": "Google Chrome (or) Chromium binary location.",
"value": "/usr/bin/chromium-browser"
},
"OPEN_WEATHER_MAP_APPID": {
"description": "Get your own APPID (API key)from https://api.openweathermap.org/data/2.5/weather",
"required": false
},
"SCREENSHOT_LAYER_ACCESS_KEY": {
"description": "Get your own ACCESS_KEY (API key) from http://api.screenshotlayer.com/api/capture",
"required": false
},
"BOTLOG": {
"description": "Incase you want to turn off logging, put this to false",
"value": "False"
},
"BOTLOG_CHATID": {
"description": "ChatID for the Log group",
"value": "0"
},
"CONSOLE_LOGGER_VERBOSE": {
"description": "If you need Verbosity on the Logging",
"value": "False"
},
"PM_AUTO_BAN": {
"description": "PM Auto-Ban Feature Switch",
"value": "False"
},
"YOUTUBE_API_KEY": {
"description": "YouTube Data API Key for .yt command. Get from https://console.cloud.google.com",
"required": false
},
"DEFAULT_BIO": {
"description": "Set a default bio to be shown when you are not listening on Spotify..",
"required": false
},
"SPOTIFY_USERNAME": {
"description": "Put your Spotify Username (your Spotify username).",
"required": false
},
"SPOTIFY_PASS": {
"description": "Put your Spotify Password.",
"required": false
},
"SPOTIFY_BIO_PREFIX": {
"description": "Put the prefix that you want to show while you listen to music",
"required": false
},
"WELCOME_MUTE": {
"description": "Mute some known spammer bots after they join.",
"value": "False"
}
},
"addons": [
{
"plan": "heroku-postgresql",
"options": {
"version": "9.5"
}
}
]
}
5 changes: 2 additions & 3 deletions generate_session_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
#
# This script wont run your bot, it just generates a session.

import os

from dotenv import load_dotenv
from telethon import TelegramClient
from dotenv import load_dotenv
import os

load_dotenv("config.env")

Expand Down
4 changes: 2 additions & 2 deletions heroku.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
build:
docker:
docker:
worker: Dockerfile
run:
worker: dash init/start.sh
worker: python3 -m userbot
30 changes: 3 additions & 27 deletions init/CI_Test_Script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ COMMIT_POINT="$(git log --pretty=format:'%h : %s' -1)"
COMMIT_HASH="$(git rev-parse --verify HEAD)"
TELEGRAM_TOKEN=${BOT_API_KEY}
export BOT_API_KEY PARSE_BRANCH PARSE_ORIGIN COMMIT_POINT TELEGRAM_TOKEN

kickstart_pub

req_install() {
pip3 install -r requirements.txt
pip3 install pep8 autopep8
}

get_session() {
Expand All @@ -46,32 +46,8 @@ tg_senderror() {
exit 1
}

lint() {
if [ ! -z "$PULL_REQUEST_NUMBER" ]; then
exit 0
fi
num_errors_before=`find . -name \*.py -exec pycodestyle --ignore=E402 {} + | wc -l`
echo $num_errors_before
git config --global user.email "[email protected]"
git config --global user.name "baalajimaestro"
find . -name \*.py -exec autopep8 --recursive --aggressive --aggressive --in-place {} +
num_errors_after=`find . -name \*.py -exec pycodestyle --ignore=E402 {} + | wc -l`
echo $num_errors_after
if [ "$num_errors_after" -lt "$num_errors_before" ]; then
git add .
git commit -m "[MaestroCI]: Lint"
git remote rm origin
git remote add origin https://baalajimaestro:${GH_PERSONAL_TOKEN}@github.com/raphielgang/telegram-userbot.git
git push --quiet origin $PARSE_BRANCH
tg_sendinfo "<code>Code has been linted and Committed</code>"
else
tg_sendinfo "<code>Auto-Linter didn't lint anything</code>"
fi
tg_sendinfo "<code>$num_errors_after code problems detected, but couldn't be auto-linted</code>"
}
tg_yay() {
tg_sendinfo "<code>Compilation Success! Auto-Linter Starting up!</code>"
lint
tg_sendinfo "<code>Compilation Success!</code>"
}

# Fin Prober
Expand Down Expand Up @@ -104,4 +80,4 @@ execute() {
}

get_session
execute
execute
Loading

0 comments on commit cab9165

Please sign in to comment.