1
0
mirror of https://github.com/danog/mklwp.git synced 2024-11-26 20:15:26 +01:00
This commit is contained in:
Daniil Gentili 2016-01-25 13:23:06 +01:00
parent 5e9272798b
commit 534343150d
3 changed files with 12 additions and 17 deletions

View File

@ -1 +0,0 @@
26148

View File

@ -146,23 +146,21 @@ forward() {
startproc() {
mkdir -p "$copname"
mkfifo $copname/out
rm -r $copname
mkfifo $copname
tmux kill-session -t $copname
tmux new-session -d -s $copname "./run.sh bashbot ${USER[ID]} &>$copname/out"
local pid=$(ps aux | sed '/tmux/!d;/'$copname'/!d;/sed/d;s/'$USER'\s*//g;s/\s.*//g')
echo $pid>$copname/pid
while ps aux | grep -v grep | grep -q $pid;do
while tmux ls | grep -v grep | grep -q $copname;do
read -t 10 line
[ "$line" != "" ] && send_message "${USER[ID]}" "$line"
line=
done <$copname/out
done <$copname
rm -r $copname
}
inproc() {
tmux send-keys -t $copname "$MESSAGE ${URLS[*]}
"
ps aux | grep -v grep | grep -q "$copid" || { rm -r $copname; };
}
process_client() {
@ -200,10 +198,8 @@ process_client() {
# Tmux
copname="CO${USER[ID]}"
copidname="$copname/pid"
copid="$(cat $copidname 2>/dev/null)"
if [ "$copid" = "" ]; then
if ! tmux ls | grep -q $copname; then
[ ! -z "${URLS[*]}" ] && {
curl -s ${URLS[*]} -o $NAME
send_file "${USER[ID]}" "$NAME" "$CAPTION"
@ -229,7 +225,7 @@ process_client() {
startproc&
;;
'/cancel')
kill $copid
tmux kill-session -t $copname
rm -r $copname
send_message "${USER[ID]}" "Command canceled."
;;

10
run.sh
View File

@ -6,7 +6,7 @@ rm -rf out &>/dev/null
cp -a other/backup out
first=$2
[ "$1" = "bashbot" ] && {
error() { cd /tmp; rm -rf /tmp/$first; echo "I'm sorry, it seems an error occurred ($*). Please type /start to restart the process."; sleep 2;exit; }
error() { cd /tmp; rm -rf /tmp/$first; echo "I'm sorry, it seems an error occurred ($*). Please type /start to restart the process. If you want you can report this error to the creator of this bot by sending a screenshot of this chat @danogentili"; sleep 2;exit; }
mktmpdir() { rm -rf /tmp/$1 &>/dev/null; cp -a $PWD /tmp/$1; cd /tmp/$1; }
echo "Custom LWP 2.6
Thanks : andrew121 for the app this script modifies
@ -17,7 +17,7 @@ Send me the app icon (preferrably square)."
read icon
convert $icon placeimages/icon.png || error "couldn't download icon"
echo "Send me a screenshot of this chat or your device's screen size."
echo "Send me your device's screen size (can be obtained using https://play.google.com/store/apps/details?id=lt.andro.screensize)."
read size
echo "$size" | grep -q http && {
screensize=$(identify $size | awk '{print $3}')
@ -135,11 +135,11 @@ Ur device must be connected to ur pc and adb must be in ur PATH (y/n). " -n 1 -r
[[ $REPLY =~ ^[Yy]$ ]] && adb install -r $pkgname"-signed.apk"
echo
} || {
echo "Sending apk...
echo "This bot is based on https://github.com/topkecleon/telegram-bot-bash
You can also contribute to the development by sending a pull request @ https://github.com/danog/mklwp
Thanks for having used mklwp! To restart the process type /start.
Remember to set the correct resolution of your lwp by going in the lwp settings and setting the default resultion.
This bot is based on https://github.com/topkecleon/telegram-bot-bash
You can also contribute to the development by sending a pull request @ https://github.com/danog/mklwp
Sending apk...
There U go myfilelocationstartshere $PWD/$pkgname"-signed.apk
sleep 10