Skip to content
This repository has been archived by the owner on May 15, 2021. It is now read-only.

Commit

Permalink
v2 (#138)
Browse files Browse the repository at this point in the history
* core changes
* fixed upload bugs
* fixed #17
* added new api-less google image search (.gimg)
  • Loading branch information
code-rgb authored Feb 14, 2021
1 parent 47dcde6 commit cbda56f
Show file tree
Hide file tree
Showing 62 changed files with 479 additions and 214 deletions.
26 changes: 13 additions & 13 deletions config.env.sample
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@


# Remove this line first before doing anything else

_____REMOVE_____THIS_____LINE_____=true


# >----------- REQUIRED ----------< #

# ---------------「 REQUIRED 」--------------- #


# Get them from https://my.telegram.org/
API_ID=""
API_HASH=""


# Mongodb url from https://cloud.mongodb.com/, guide: https://del.dog/mongodb_guide
# Mongodb url from https://cloud.mongodb.com/
# guide: https://del.dog/mongodb_guide
DATABASE_URL=""


# [ Private Telegram Log Channel ID ], Note: Also add your Bot to LOG CHANNEL (for BOT or DUAL)
# [ Private Telegram Log Channel ID ]
# Note: Also add your Bot to LOG CHANNEL (for BOT or DUAL)
LOG_CHANNEL_ID=""


# [------- USERGE-X MODES -------] #
# ════════════「 USERGE-X MODES 」════════════ #

# Fill Vars for the mode you want [ USER ], [ BOT ]
# or [ DUAL MODE ] (Both)


# 1. USER MODE
# get this using [ https://repl.it/@Leorio/stringsessiongen or bash genStr ]
# get this using
# [ https://repl.it/@Leorio/stringsessiongen or bash genStr ]
HU_STRING_SESSION=""


Expand All @@ -38,13 +42,11 @@ OWNER_ID="" # your user_id(s)

# 3. DUAL MODE
# Both BOT and USER Sessions are Required for DUAL MODE
# [------------------------------] #


# >------------------------------< #


# ----------- OPTIONAL ----------- #
# ----------- OPTIONAL ----------- #


# Set false if your don't like to use extra plugins
Expand Down Expand Up @@ -175,6 +177,4 @@ HEROKU_API_KEY=""


# given app name to the heroku app
HEROKU_APP_NAME=""


HEROKU_APP_NAME=""
7 changes: 4 additions & 3 deletions init/checks.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
#
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
#
# This file is part of < https://github.com/UsergeTeam/Userge > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE >
# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE >
#
# All rights reserved.

Expand Down Expand Up @@ -70,8 +70,9 @@ _checkDefaultVars() {
WORKERS=32
fi
export MOTOR_MAX_WORKERS=$WORKERS
export HEROKU_ENV=$(test $DYNO && echo 1 || echo 0)
DOWN_PATH=${DOWN_PATH%/}/
if [[ -n $HEROKU_API_KEY && -n $HEROKU_APP_NAME ]]; then
if [[ $HEROKU_ENV == 1 && -n $HEROKU_API_KEY && -n $HEROKU_APP_NAME ]]; then
local herokuErr=$(runPythonCode '
import heroku3
try:
Expand Down
8 changes: 5 additions & 3 deletions init/init.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
#
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
#
# This file is part of < https://github.com/UsergeTeam/Userge > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE >
# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE >
#
# All rights reserved.

Expand All @@ -14,6 +14,7 @@

trap handleSigTerm TERM
trap handleSigInt INT
trap 'echo hi' USR1

initUserge() {
printLogo
Expand All @@ -32,7 +33,6 @@ startUserge() {
stopUserge() {
sendMessage "Exiting USERGE-X ..."
endLogBotPolling
exit 0
}

handleSigTerm() {
Expand All @@ -50,5 +50,7 @@ handleSigInt() {
runUserge() {
initUserge
startUserge "$@"
local code=$?
stopUserge
return $code
}
4 changes: 2 additions & 2 deletions init/logbot/core/api.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
#
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
#
# This file is part of < https://github.com/UsergeTeam/Userge > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE >
# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE >
#
# All rights reserved.

Expand Down
4 changes: 2 additions & 2 deletions init/logbot/core/core.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
#
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
#
# This file is part of < https://github.com/UsergeTeam/Userge > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE >
# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE >
#
# All rights reserved.

Expand Down
4 changes: 2 additions & 2 deletions init/logbot/core/methods/apiMethods.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
#
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
#
# This file is part of < https://github.com/UsergeTeam/Userge > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE >
# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE >
#
# All rights reserved.

Expand Down
4 changes: 2 additions & 2 deletions init/logbot/core/methods/methods.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
#
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
#
# This file is part of < https://github.com/UsergeTeam/Userge > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE >
# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE >
#
# All rights reserved.

Expand Down
4 changes: 2 additions & 2 deletions init/logbot/core/methods/rawMethods.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
#
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
#
# This file is part of < https://github.com/UsergeTeam/Userge > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE >
# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE >
#
# All rights reserved.

Expand Down
4 changes: 2 additions & 2 deletions init/logbot/core/types/message.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
#
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
#
# This file is part of < https://github.com/UsergeTeam/Userge > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE >
# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE >
#
# All rights reserved.

Expand Down
4 changes: 2 additions & 2 deletions init/logbot/core/types/messageClass.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
#
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
#
# This file is part of < https://github.com/UsergeTeam/Userge > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE >
# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE >
#
# All rights reserved.

Expand Down
4 changes: 2 additions & 2 deletions init/logbot/core/types/types.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
#
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
#
# This file is part of < https://github.com/UsergeTeam/Userge > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE >
# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE >
#
# All rights reserved.

Expand Down
4 changes: 2 additions & 2 deletions init/logbot/core/utils.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
#
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
#
# This file is part of < https://github.com/UsergeTeam/Userge > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE >
# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE >
#
# All rights reserved.

Expand Down
4 changes: 2 additions & 2 deletions init/logbot/logbot.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
#
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
#
# This file is part of < https://github.com/UsergeTeam/Userge > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE >
# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE >
#
# All rights reserved.

Expand Down
4 changes: 2 additions & 2 deletions init/logbot/methods/basic.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
#
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
#
# This file is part of < https://github.com/UsergeTeam/Userge > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE >
# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE >
#
# All rights reserved.

Expand Down
4 changes: 2 additions & 2 deletions init/logbot/methods/methods.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
#
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
#
# This file is part of < https://github.com/UsergeTeam/Userge > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE >
# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE >
#
# All rights reserved.

Expand Down
5 changes: 3 additions & 2 deletions init/logbot/methods/polling.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
#
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
#
# This file is part of < https://github.com/UsergeTeam/Userge > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE >
# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE >
#
# All rights reserved.

Expand All @@ -17,6 +17,7 @@ startLogBotPolling() {

endLogBotPolling() {
test -z $BOT_TOKEN || echo quit >> $_input
wait
}

_polling() {
Expand Down
8 changes: 4 additions & 4 deletions init/utils.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
#
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
#
# This file is part of < https://github.com/UsergeTeam/Userge > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE >
# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE >
#
# All rights reserved.

Expand All @@ -20,8 +20,8 @@ getPythonVersion() {
count+=1
[[ $count -gt $maxPVer ]] && break
done
declare -gr pVer=$(sed -E 's/Python (3\.[0-9]{1,2}\.[0-9]{1,2}).*/\1/g' <<< \
"$(python3.$count -V 2> /dev/null)")
local ptn='s/Python (3\.[0-9]{1,2}\.[0-9]{1,2}).*/\1/g'
declare -gr pVer=$(sed -E "$ptn" <<< "$(python3.$count -V 2> /dev/null)")
}

log() {
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ ruamel.yaml==0.16.12
pymediainfo>=5.0.3
ujson>=4.0.1
youtube-search-python==1.4.0
git+https://github.com/code-rgb/google-images-download.git
39 changes: 35 additions & 4 deletions run
Original file line number Diff line number Diff line change
@@ -1,13 +1,44 @@
#!/bin/bash
#
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
#
# This file is part of < https://github.com/UsergeTeam/Userge > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE >
# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE >
#
# All rights reserved.

. init/init.sh
trap joinProc INT TERM

runUserge "$@"
declare -i bgProc
declare -ir usr1=138
declare -r cmd='. init/init.sh; runUserge "$@"'

setProc() {
bgProc=$1
}

waitProc() {
wait $bgProc
}

killProc() {
kill $bgProc &> /dev/null
}

joinProc() {
if test $bgProc; then
killProc
waitProc
fi
}

run() {
joinProc
bash -c "$cmd" $0 "$@" &
setProc $!
waitProc
test $? -eq $usr1 && run "$@"
}

run "$@"
2 changes: 1 addition & 1 deletion runtime.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
python-3.8.7
python-3.9.1
Loading

0 comments on commit cbda56f

Please sign in to comment.