Skip to content

Commit

Permalink
Goodbye PPEx [4th October 2019]
Browse files Browse the repository at this point in the history
Due to some issues with the license (do read [this](https://t.me/PaperplaneExtended/102)), I am now closing the Paperplane Extended project with this final update.

Here's what's changed in this update.

- 🔥 Added back the original Paperplane like syntax for notes, filters, welcomes, snips. (Now a valid BOTLOG_CHATID is only needed when we want to save media as data for these modules.)

[NOTE: This may require you to delete your current database and lose a lot of stuff, sorry for that.]

- Added some new env vars during initial deploy time.
`LOGSPAMMER` - If set to `True`, this makes the userbot throw the error.log file into the userbot log group instead of the current chat where the commad is triggered.
`WEATHER_DEFCITY` - Set a default city for the `.weather` module.
- Bumped up the telethon library to 1.10.6 to fix some issues.
- Async'd the google search module.
- Fixed the Magisk Release fetching module.
- Fixed the bug where the upload directory to Google Drive stuff acted strange.
- Added ability to add reason to bans, kicks, mutes, gmutes.
- Added ability to add custom rank for promotes.
- Merged the error_handler into the module wrapper.
- Added the RegexNinja module to prank people with sed bots :P
- Many optimisations under the hood. (as always.)

Now the whole codebase is archived, and will not be updated until further notice.
Thank you guys for your support, but it's time for this to go.

#PeaceOut ✌️ 
~~#StayExtended~~
  • Loading branch information
Avinash Reddy authored Oct 4, 2019
1 parent 15a0644 commit 3d2b751
Show file tree
Hide file tree
Showing 58 changed files with 813 additions and 1,897 deletions.
771 changes: 0 additions & 771 deletions .apt/usr/bin/config/config.conf

This file was deleted.

8 changes: 0 additions & 8 deletions .github/FUNDING.yml

This file was deleted.

3 changes: 0 additions & 3 deletions Aptfile

This file was deleted.

11 changes: 3 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ RUN apk add --no-cache --update \
ffmpeg \
sqlite-dev \
sudo \
zlib-dev
zlib-dev \
jpeg-dev \
python-dev


RUN python3 -m ensurepip \
Expand All @@ -71,13 +73,6 @@ WORKDIR /root/userbot/
#
COPY ./sample_config.env ./userbot.session* ./config.env* /root/userbot/

#
# Clone helper scripts
#
RUN curl -s https://raw.githubusercontent.com/yshalsager/megadown/master/megadown -o /root/userbot/bin/megadown && sudo chmod a+x /root/userbot/bin/megadown
RUN curl -s https://raw.githubusercontent.com/yshalsager/cmrudl.py/master/cmrudl.py -o /root/userbot/bin/cmrudl && sudo chmod a+x /root/userbot/bin/cmrudl
ENV PATH="/root/userbot/bin:$PATH"

#
# Install requirements
#
Expand Down
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

15 changes: 14 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"value": "False"
},
"BOTLOG_CHATID": {
"description": "ChatID of the Log group. Set it to '0' if BOTLOG = False",
"description": "ChatID of the Log group. Set it to '0' if BOTLOG = False and/or if LOGSPAMMER = False.",
"value": "0"
},
"CONSOLE_LOGGER_VERBOSE": {
Expand Down Expand Up @@ -119,6 +119,7 @@
},
"DEFAULT_BIO": {
"description": "Default profile bio.",
"value": "[PM = Report Spam] I ❤ ️@PaperplaneExtended",
"required": false
},
"ALIVE_NAME": {
Expand All @@ -128,6 +129,18 @@
"G_DRIVE_CLIENT_SECRET": {
"description": "Enter Your Client Secret for Google Drive.",
"required": false
},
"G_DRIVE_AUTH_TOKEN_DATA": {
"description": "Enter the Google Drive authentication data, as a JSON structure.",
"required": false
},
"WEATHER_DEFCITY": {
"description": "Set the default city for the userbot's weather module.",
"required": false
},
"LOGSPAMMER": {
"description": "Set this to True in case you want the error logs to be stored in the userbot log group, instead of spitting out the file in the current chat, requires a valid BOTLOG_CHATID to be set.",
"value": "True"
}
},
"addons": [
Expand Down
45 changes: 0 additions & 45 deletions modules

This file was deleted.

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ requests>=2.18.4
search-engine-parser>=0.4.2
speedtest-cli>=2.0.2
sqlalchemy>=1.2
telethon>=1.10.3
telethon>=1.10.6
telethon-session-sqlalchemy>=0.2.6
urbandict>=0.5
wikipedia>=1.4.0
1 change: 0 additions & 1 deletion runtime.txt

This file was deleted.

52 changes: 12 additions & 40 deletions sample_config.env
Original file line number Diff line number Diff line change
@@ -1,99 +1,72 @@
# Remove this line first before doing anything
___________PLOX_______REMOVE_____THIS_____LINE__________=True

#
# Get from https://my.telegram.org/
#
# Get these from https://my.telegram.org/
API_KEY = "YOUR API KEY"
API_HASH = "YOUR API HASH"

#
# OpenWeather Map API Key for .weather command
# Get from https://openweathermap.org/
#
OPEN_WEATHER_MAP_APPID = ""
WEATHER_DEFCITY = ""

#
# Location of ChromeDriver for .carbon module
# Default for Heroku Slugs : "/app/.chromedriver/bin/chromedriver"
#
# Example for Linux Machines : "/usr/bin/chromedriver"
CHROME_DRIVER = ""

#
# Get this value by running python3 string_session.py locally
#
STRING_SESSION = ""

#
# Headless GoogleChrome location for .carbon module
# Default for Heroku Slugs : "/app/.apt/usr/bin/google-chrome"
#
# Example for Linux Machines : "/usr/bin/chromium-browser"
GOOGLE_CHROME_BIN = ""

#
# OCR Space API Key for .ocr command
# Get from https://ocr.space/ocrapi
#
OCR_SPACE_API_KEY = ""

#
# remove.bg API Key for .rbg command
# Get from https://www.remove.bg/api
#
REM_BG_API_KEY = ""

#
# ChatID for the Log group
# Add a Hypen or a Negative Sign before ID
# This is a integer, Please don't use Strings
#
BOTLOG_CHATID = # Chat ID should be integer.
BOTLOG_CHATID = # this is an integer, please don't use quotes.

#
# Incase you want to turn off logging, put this to false
#
BOTLOG = True

#
# Set this to True if you want the error logs to be stored in
# the userbot log, rather than spamming other chats with it.
# Note that this requires a valid BOTLOG_CHATID to be set.
LOGSPAMMER = True

# If you need Verbosity on the Logging
#
CONSOLE_LOGGER_VERBOSE = False

#
# PM Auto-Ban Feature Switch
#
PM_AUTO_BAN = False

#
# Custom Default name for .alive
#
ALIVE_NAME = None

#
# Your Database URL
# Example: 'postgres://userbot:userbot@localhost:5432/userbot'
#
DATABASE_URL = ""

#
# YouTube Data API Key for .yt command
# Get from https://console.cloud.google.com
#
YOUTUBE_API_KEY = ""

#
# Country and Time Zone setup for
# .time and .date modules
#
COUNTRY = ""
TZ_NUMBER = # this is an integer.
TZ_NUMBER = # this is an integer, please don't use quotes.

#
# Google Drive Credentials
# for .gdrive module.
#
# Get from https://console.cloud.google.com
#
G_DRIVE_CLIENT_ID = ""
G_DRIVE_CLIENT_SECRET = ""
G_DRIVE_AUTH_TOKEN_DATA = ""
Expand All @@ -109,12 +82,11 @@ LASTFM_PASSWORD = "Your last.fm password"
# Bot will add before song name. For last.fm module.
# Example: GitHub: MacTavishAO : Skillet - Feel Invincible
BIO_PREFIX = ""

# default bio message
DEFAULT_BIO = ""

#
# Report or kick some known spammer bots after
# they joins
#
ANTI_SPAMBOT = False
ANTI_SPAMBOT_SHOUT = False
38 changes: 24 additions & 14 deletions userbot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from logging import basicConfig, getLogger, INFO, DEBUG
from distutils.util import strtobool as sb

import pylast
from pylast import LastFMNetwork, md5
from pySmartDL import SmartDL
from dotenv import load_dotenv
from requests import get
Expand All @@ -35,7 +35,7 @@

if version_info[0] < 3 or version_info[1] < 6:
LOGS.info("You MUST have a python version of at least 3.6."
"Multiple features depend on this. Bot quitting.")
"Multiple features depend on this. Bot quitting.")
quit(1)

# Check if the config was edited by using the already used variable.
Expand All @@ -56,11 +56,12 @@
# Userbot Session String
STRING_SESSION = os.environ.get("STRING_SESSION", None)

# Logging channel/group configuration.
# Logging channel/group ID configuration.
BOTLOG_CHATID = int(os.environ.get("BOTLOG_CHATID", None))

# Userbot logging feature switch.
BOTLOG = sb(os.environ.get("BOTLOG", "False"))
LOGSPAMMER = sb(os.environ.get("LOGSPAMMER", "False"))

# Bleep Blop, this is a bot ;)
PM_AUTO_BAN = sb(os.environ.get("PM_AUTO_BAN", "False"))
Expand All @@ -83,10 +84,10 @@

# OpenWeatherMap API Key
OPEN_WEATHER_MAP_APPID = os.environ.get("OPEN_WEATHER_MAP_APPID", None)
WEATHER_DEFCITY = os.environ.get("WEATHER_DEFCITY", None)

# Anti Spambot Config
ANTI_SPAMBOT = sb(os.environ.get("ANTI_SPAMBOT", "False"))

ANTI_SPAMBOT_SHOUT = sb(os.environ.get("ANTI_SPAMBOT_SHOUT", "False"))

# Youtube API key
Expand All @@ -97,7 +98,6 @@

# Time & Date - Country and Time Zone
COUNTRY = str(os.environ.get("COUNTRY", ""))

TZ_NUMBER = int(os.environ.get("TZ_NUMBER", 1))

# Clean Welcome
Expand All @@ -111,12 +111,12 @@
LASTFM_SECRET = os.environ.get("LASTFM_SECRET", None)
LASTFM_USERNAME = os.environ.get("LASTFM_USERNAME", None)
LASTFM_PASSWORD_PLAIN = os.environ.get("LASTFM_PASSWORD", None)
LASTFM_PASS = pylast.md5(LASTFM_PASSWORD_PLAIN)
if not LASTFM_USERNAME == "None":
lastfm = pylast.LastFMNetwork(api_key=LASTFM_API,
api_secret=LASTFM_SECRET,
username=LASTFM_USERNAME,
password_hash=LASTFM_PASS)
LASTFM_PASS = md5(LASTFM_PASSWORD_PLAIN)
if LASTFM_API and LASTFM_SECRET and LASTFM_USERNAME and LASTFM_PASS:
lastfm = LastFMNetwork(api_key=LASTFM_API,
api_secret=LASTFM_SECRET,
username=LASTFM_USERNAME,
password_hash=LASTFM_PASS)
else:
lastfm = None

Expand Down Expand Up @@ -155,19 +155,29 @@


async def check_botlog_chatid():
if not BOTLOG_CHATID:
if not BOTLOG_CHATID and LOGSPAMMER:
LOGS.info(
"You must set up the BOTLOG_CHATID variable in the config.env or environment variables, "
"many critical features depend on it. KTHXBye.")
"You must set up the BOTLOG_CHATID variable in the config.env or environment variables, for the private error log storage to work."
)
quit(1)

elif not BOTLOG_CHATID and BOTLOG:
LOGS.info(
"You must set up the BOTLOG_CHATID variable in the config.env or environment variables, for the userbot logging feature to work."
)
quit(1)

elif not BOTLOG or not LOGSPAMMER:
return

entity = await bot.get_entity(BOTLOG_CHATID)
if entity.default_banned_rights.send_messages:
LOGS.info(
"Your account doesn't have rights to send messages to BOTLOG_CHATID "
"group. Check if you typed the Chat ID correctly.")
quit(1)


with bot:
try:
bot.loop.run_until_complete(check_botlog_chatid())
Expand Down
Loading

0 comments on commit 3d2b751

Please sign in to comment.