Skip to content

Commit

Permalink
add new var CUSTOM_PIP_PACKAGES
Browse files Browse the repository at this point in the history
  • Loading branch information
rking32 committed Jan 22, 2022
1 parent d5369ce commit a23aefb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions config.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ LOAD_UNOFFICIAL_PLUGINS=false
ASSERT_SINGLE_INSTANCE=false


# Custom pip packages which are seperated by spaces to install while starting the bot.
CUSTOM_PIP_PACKAGES=""


# This is best if you wanna add your own plugins
# Set this to fork of https://github.com/UsergeTeam/Custom-Plugins and add your plugins
CUSTOM_PLUGINS_REPO=""
Expand Down
11 changes: 11 additions & 0 deletions init/checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ _checkDefaultVars() {
[UPSTREAM_REPO]="https://github.com/UsergeTeam/Userge"
[LOAD_UNOFFICIAL_PLUGINS]=false
[ASSERT_SINGLE_INSTANCE]=false
[CUSTOM_PIP_PACKAGES]=""
[CUSTOM_PLUGINS_REPO]=""
[G_DRIVE_IS_TD]=true
[CMD_TRIGGER]="."
Expand Down Expand Up @@ -172,6 +173,15 @@ _checkCustomPlugins() {
_setupPlugins Custom "https://(ghp_[0-9A-z]{36}@)?github.com/.+/.+" $CUSTOM_PLUGINS_REPO
}

_checkPipPackages() {
editLastMessage "Checking Custom Pip Packages ..."
if [[ $CUSTOM_PIP_PACKAGES ]]; then
log "\tFound and Installing ..."
upgradePip
installCustomReq "$CUSTOM_PIP_PACKAGES"
fi
}

_flushMessages() {
deleteLastMessage
}
Expand All @@ -192,5 +202,6 @@ assertEnvironment() {
_checkUpstreamRepo
_checkUnoffPlugins
_checkCustomPlugins
_checkPipPackages
_flushMessages
}
4 changes: 4 additions & 0 deletions init/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ installReq() {
pip3 install -r $1/requirements.txt &> /dev/null
}

installCustomReq() {
pip3 install $(tr ' ' '\n' <<< "$1") &> /dev/null
}

printLine() {
echo '->- ->- ->- ->- ->- ->- ->- --- -<- -<- -<- -<- -<- -<- -<-'
}
Expand Down

0 comments on commit a23aefb

Please sign in to comment.