update
This commit is contained in:
parent
797a912adb
commit
a32c7649fa
330
maple
330
maple
@ -41,24 +41,14 @@
|
|||||||
# echo -e '\033[0;34m'"/MMMMMMm. -hMMMMMN: /NMMMM. dMMMMMMMMMMMMMh- :hmNy. .NMMMMM-"
|
# echo -e '\033[0;34m'"/MMMMMMm. -hMMMMMN: /NMMMM. dMMMMMMMMMMMMMh- :hmNy. .NMMMMM-"
|
||||||
# echo -e '\033[0;34m'"/MMMMMMMm- -yNMMMm. .yMMM. dMMMMMMMMMMMMMMNh:. .... yMMMMM-"
|
# echo -e '\033[0;34m'"/MMMMMMMm- -yNMMMm. .yMMM. dMMMMMMMMMMMMMMNh:. .... yMMMMM-"
|
||||||
# echo -e '\033[0;34m'"/MMMMMMMMN+ .+hNMd. :hM: dMMMMMMMMMMMMMMMMNmo- .NMMMM-"
|
# echo -e '\033[0;34m'"/MMMMMMMMN+ .+hNMd. :hM: dMMMMMMMMMMMMMMMMNmo- .NMMMM-"
|
||||||
# echo -e '\033[0;34m'"/MMMMMMMMMMh- ./ss. .:: sMMMMMMMMMMMMMMMMMMMNms/. /MMMM-"
|
# echo -e '\033[0;34m'"/MMMMMMM
|
||||||
# echo -e '\033[0;34m'"/MMMMMMMMMMMNo. . :MMMMMMMMMMMMMMMMMMMMMMMNdo:.. oMMM-"
|
|
||||||
# echo -e '\033[0;34m'"/MMMMMMMMMMMMMmo. .mMMMMMMMMMMMMMMMMMMMMMMMMMMNmh: .dMM-"
|
|
||||||
# echo -e '\033[0;34m'"/MMMMMMMMMMMMMMMNy:. +MMMMMMMMMMMMMMMMMMMMMMMMMMNh+::/+sdNMMM-"
|
|
||||||
# echo -e '\033[0;34m'"/MMMMMMMMMMMMMMMMMNdo- .dMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNMMMMMMMM-"
|
|
||||||
# echo -e '\033[0;34m'"/MMMMMMMMMMMMMMMMMMMMNd+-. -NMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM-"
|
|
||||||
# echo -e '\033[0;34m'"-NMMMMMMMMMMMMMMMMMMMMMMNdo:. /NMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMd."
|
|
||||||
# echo -e '\033[0;34m'" -ymNNNNNNNNNNNNNNNNNNNNNNNNdo-. +NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNmy."
|
|
||||||
# echo -e '\033[0;34m'" ............................ .-................................"
|
|
||||||
# echo -e '\033[0;34m'" ...... ......... .............. .......... saiset ......\n"
|
|
||||||
|
|
||||||
#####################################################################################################################
|
|
||||||
|
|
||||||
i=`cat maple|grep -n MARKER|cut -f1 -d":"`;i=$(echo $i|xargs|cut -f2 -d" ");ii=`wc -l maple|cut -f1 -d" "`;
|
i=`cat maple|grep -n MARKER|cut -f1 -d":"`;i=$(echo $i|xargs|cut -f2 -d" ");ii=`wc -l maple|cut -f1 -d" "`;
|
||||||
iii=$((ii-i));tail -n $iii $0>mpl;MD5=$(md5sum mpl|cut -f1 -d ' ');rm mpl;DM5="5bf899243b45e9609fcb4386087692fd";
|
iii=$((ii-i));tail -n $iii $0>mpl;MD5=$(md5sum mpl|cut -f1 -d ' ');rm mpl;DM5="53ecf9877ffa225517aa34e52dab232c";
|
||||||
[ "$MD5" = "$DM5" ] || exit;
|
[ "$MD5" = "$DM5" ] || exit;
|
||||||
|
|
||||||
# MARKER ############################################################################################################
|
# MARKER ############################################################################################################
|
||||||
|
#####################################################################################################################
|
||||||
|
|
||||||
R="\x1b[5;31m";G="\x1b[5;32m";Y="\x1b[5;33m";B="\x1b[5;34m";M="\x1b[5;35m";C="\x1b[5;36m";W="\x1b[5;37m";
|
R="\x1b[5;31m";G="\x1b[5;32m";Y="\x1b[5;33m";B="\x1b[5;34m";M="\x1b[5;35m";C="\x1b[5;36m";W="\x1b[5;37m";
|
||||||
CMD=$1;
|
CMD=$1;
|
||||||
@ -69,6 +59,8 @@ DISCORD__SERVICING=-1
|
|||||||
TELEGRAM_SERVICING=-1
|
TELEGRAM_SERVICING=-1
|
||||||
MATRIX___SERVICING=-1
|
MATRIX___SERVICING=-1
|
||||||
OPENAI___SERVICING=-1
|
OPENAI___SERVICING=-1
|
||||||
|
HYDRA____SERVICING=-1
|
||||||
|
CRYPTO___SERVICING=-1
|
||||||
YOUTUBE__SERVICING=-1
|
YOUTUBE__SERVICING=-1
|
||||||
TWITTER__SERVICING=-1
|
TWITTER__SERVICING=-1
|
||||||
|
|
||||||
@ -76,19 +68,19 @@ PREREQUISITES_PROGS=(jq nc)
|
|||||||
FOUND_PROGS=()
|
FOUND_PROGS=()
|
||||||
|
|
||||||
for p in ${PREREQUISITES_PROGS[@]}; do
|
for p in ${PREREQUISITES_PROGS[@]}; do
|
||||||
which $p >> /dev/null 2>&1
|
which $p >> /dev/null 2>&1
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo -e "\033[0;32mlocated $p\033[0m"
|
echo -e "\033[0;32mlocated $p\033[0m"
|
||||||
else
|
else
|
||||||
FOUND_PROGS+=("$p")
|
FOUND_PROGS+=("$p")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
for p in ${FOUND_PROGS[@]}; do
|
for p in ${FOUND_PROGS[@]}; do
|
||||||
MESSAGE="\033[0;91minstallation required\033[0;0m"
|
MESSAGE="\033[0;91minstallation required\033[0;0m"
|
||||||
##################################################
|
##################################################
|
||||||
[ "jq" == $p ] && echo -e "\033[0;31mmissing $p -\033[0;34m $MESSAGE"
|
[ "jq" == $p ] && echo -e "\033[0;31mmissing $p -\033[0;34m $MESSAGE"
|
||||||
[ "nc" == $p ] && echo -e "\033[0;31mmissing $p -\033[0;34m $MESSAGE"
|
[ "nc" == $p ] && echo -e "\033[0;31mmissing $p -\033[0;34m $MESSAGE"
|
||||||
done
|
done
|
||||||
|
|
||||||
[ 0 -ne "${#FOUND_PROGS[@]}" ] && echo -e "\n\033[0;33m[ PREREQUISITES CHECK - \033[0;33mFAILED \033[0;33m]\033[0m\n"
|
[ 0 -ne "${#FOUND_PROGS[@]}" ] && echo -e "\n\033[0;33m[ PREREQUISITES CHECK - \033[0;33mFAILED \033[0;33m]\033[0m\n"
|
||||||
@ -108,36 +100,39 @@ if [ -e preset ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#####################################################################################################################
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
|
||||||
function rgb () {
|
function rgb () {
|
||||||
R=$((RANDOM%256))
|
R=$((RANDOM%256))
|
||||||
G=$((RANDOM%256))
|
G=$((RANDOM%256))
|
||||||
B=$((RANDOM%256))
|
B=$((RANDOM%256))
|
||||||
echo -e "\e[38;2;"$R";"$G";"$B"m"
|
echo -e "\e[38;2;"$R";"$G";"$B"m"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#####################################################################################################################
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
|
||||||
function analyze () {
|
function analyze () {
|
||||||
R="$(rgb)"
|
R="$(rgb)"
|
||||||
G="$(rgb)"
|
G="$(rgb)"
|
||||||
B="$(rgb)"
|
B="$(rgb)"
|
||||||
W="$(rgb)"
|
W="$(rgb)"
|
||||||
CYCLE=$((CYCLE+1))
|
CYCLE=$((CYCLE+1))
|
||||||
echo -e "######################################################### SOF"
|
echo -e "######################################################### SOF"
|
||||||
echo -e $W" stage: $CYCLE - ( CONTENT BELOW )"
|
echo -e $W" stage: $CYCLE - ( CONTENT BELOW )"
|
||||||
echo -e $B"filename: $1"
|
echo -e $B"filename: $1"
|
||||||
echo -e $B"filesize: `cat $1|wc -c`"
|
echo -e $B"filesize: `cat $1|wc -c`"
|
||||||
echo -e $G" md5sum: `md5sum $1|cut -c-32`"
|
echo -e $G" md5sum: `md5sum $1|cut -c-32`"
|
||||||
echo -e $G"fileinfo: `file $1`"
|
echo -e $G"fileinfo: `file $1`"
|
||||||
echo -e $R"`cat $1|hexdump -C`"|head -n 4
|
echo -e $R"`cat $1|hexdump -C`"|head -n 4
|
||||||
echo -e $R"`cat $1|hexdump -C`"|tail -n 4
|
echo -e $R"`cat $1|hexdump -C`"|tail -n 4
|
||||||
echo -e $B"filename: $1"
|
echo -e $B"filename: $1"
|
||||||
echo -e $W"stage $CYCLE: ( CONTENT ABOVE )"
|
echo -e $W"stage $CYCLE: ( CONTENT ABOVE )"
|
||||||
echo -e "EOF #########################################################"
|
echo -e "EOF #########################################################"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#####################################################################################################################
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
|
||||||
function pin_ops () {
|
function pin_ops () {
|
||||||
@ -268,6 +263,7 @@ function pin_ops () {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#####################################################################################################################
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
|
||||||
kset() {
|
kset() {
|
||||||
@ -275,6 +271,7 @@ kset() {
|
|||||||
echo "$1 = $2" >> $CONFIG
|
echo "$1 = $2" >> $CONFIG
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#####################################################################################################################
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
|
||||||
kwrite() {
|
kwrite() {
|
||||||
@ -282,12 +279,14 @@ kwrite() {
|
|||||||
echo "$1" >> $CONFIG
|
echo "$1" >> $CONFIG
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#####################################################################################################################
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
|
||||||
kblank() {
|
kblank() {
|
||||||
echo "" >> $CONFIG
|
echo "" >> $CONFIG
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#####################################################################################################################
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
|
||||||
kmodesetup() {
|
kmodesetup() {
|
||||||
@ -321,7 +320,6 @@ kmodesetup() {
|
|||||||
[ "$MODE" = "2" ] && (cp storage/bot/variants/dupe/bot_maple__services.py bot_maple.py;pip install -r storage/bot/requirements/requirements_services.txt)
|
[ "$MODE" = "2" ] && (cp storage/bot/variants/dupe/bot_maple__services.py bot_maple.py;pip install -r storage/bot/requirements/requirements_services.txt)
|
||||||
[ "$MODE" = "3" ] && (cp storage/bot/variants/dupe/bot_maple__devops.py bot_maple.py;pip install -r storage/bot/requirements/requirements_devops.txt)
|
[ "$MODE" = "3" ] && (cp storage/bot/variants/dupe/bot_maple__devops.py bot_maple.py;pip install -r storage/bot/requirements/requirements_devops.txt)
|
||||||
|
|
||||||
|
|
||||||
echo -e "\n[ $HYDRA setup complete ]"
|
echo -e "\n[ $HYDRA setup complete ]"
|
||||||
deactivate
|
deactivate
|
||||||
echo -e "[ setting up $HYDRA activation ]"
|
echo -e "[ setting up $HYDRA activation ]"
|
||||||
@ -330,9 +328,9 @@ kmodesetup() {
|
|||||||
echo -e "[ fetching $HYDRA credentials ]"
|
echo -e "[ fetching $HYDRA credentials ]"
|
||||||
cmd_hydra_undak
|
cmd_hydra_undak
|
||||||
if [ ! $? -eq 13 ]; then
|
if [ ! $? -eq 13 ]; then
|
||||||
cp data_dack/hydra.key storage/user/config/
|
cp data_dack/hydra.key storage/user/config/
|
||||||
cp data_dack/maplenet.pub storage/user/config/
|
cp data_dack/maplenet.pub storage/user/config/
|
||||||
cp data_dack/maple.pin.asc storage/user/config/
|
cp data_dack/maple.pin.asc storage/user/config/
|
||||||
[ "$MODE" = "1" ] && ( cat data_dack/activate__hydra_core__standalone >> env/bin/activate )
|
[ "$MODE" = "1" ] && ( cat data_dack/activate__hydra_core__standalone >> env/bin/activate )
|
||||||
[ "$MODE" = "2" ] && ( cat data_dack/activate__hydra_dupe__services >> env/bin/activate )
|
[ "$MODE" = "2" ] && ( cat data_dack/activate__hydra_dupe__services >> env/bin/activate )
|
||||||
[ "$MODE" = "3" ] && ( cat data_dack/activate__hydra_dupe__devops >> env/bin/activate )
|
[ "$MODE" = "3" ] && ( cat data_dack/activate__hydra_dupe__devops >> env/bin/activate )
|
||||||
@ -350,6 +348,7 @@ kmodesetup() {
|
|||||||
#############################################################################################################
|
#############################################################################################################
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#####################################################################################################################
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
|
||||||
kmode () {
|
kmode () {
|
||||||
@ -369,6 +368,7 @@ kmode () {
|
|||||||
kmodesetup "$HYDRA" "$MODE"
|
kmodesetup "$HYDRA" "$MODE"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#####################################################################################################################
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
|
||||||
kprompt() {
|
kprompt() {
|
||||||
@ -459,6 +459,8 @@ kprompt() {
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#####################################################################################################################
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
|
||||||
cmd_hydra_dak () {
|
cmd_hydra_dak () {
|
||||||
@ -558,6 +560,7 @@ cmd_hydra_dak () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#####################################################################################################################
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
|
||||||
cmd_hydra_undak () {
|
cmd_hydra_undak () {
|
||||||
@ -615,6 +618,7 @@ cmd_hydra_undak () {
|
|||||||
rm dr1p_*; rm dak_*; rm undak.py; rm unkey.py;
|
rm dr1p_*; rm dak_*; rm undak.py; rm unkey.py;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#####################################################################################################################
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
|
||||||
cmd_hydra () {
|
cmd_hydra () {
|
||||||
@ -637,15 +641,19 @@ cmd_hydra () {
|
|||||||
cmd_hydra_dak;
|
cmd_hydra_dak;
|
||||||
fi;
|
fi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#####################################################################################################################
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
|
||||||
cmd_default () {
|
cmd_default () {
|
||||||
(kmode 0);
|
(kmode 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#####################################################################################################################
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
|
||||||
cmd_services_hydra () {
|
cmd_services_hydra () {
|
||||||
|
HYDRA____SERVICING=1
|
||||||
L="\x1b[0;94m"; D="\x1b[0;34m"; G="\x1b[0;90m"
|
L="\x1b[0;94m"; D="\x1b[0;34m"; G="\x1b[0;90m"
|
||||||
echo -e "\n"$G"[ "$L"setting up services "$G"]\n"
|
echo -e "\n"$G"[ "$L"setting up services "$G"]\n"
|
||||||
[ -e storage/user/credentials ] || (mkdir -p storage/user/credentials)
|
[ -e storage/user/credentials ] || (mkdir -p storage/user/credentials)
|
||||||
@ -735,7 +743,7 @@ cmd_services_hydra () {
|
|||||||
else
|
else
|
||||||
DISCORD__SERVICING=0
|
DISCORD__SERVICING=0
|
||||||
fi
|
fi
|
||||||
kprompt "MODE" "will this bot use telegram services? " "discord" 1 0 0; RESULT=$?
|
kprompt "MODE" "will this bot use telegram services? " "telegram" 1 0 0; RESULT=$?
|
||||||
if [ $RESULT = "0" ]; then
|
if [ $RESULT = "0" ]; then
|
||||||
kprompt "MODE" "telegram_token" "[ telegram token ] example: 5405833579:AAHvEUc1hms29JBoJDhoGBUE8Ept8dBrZr5" 1 3 0; RESULT=$?
|
kprompt "MODE" "telegram_token" "[ telegram token ] example: 5405833579:AAHvEUc1hms29JBoJDhoGBUE8Ept8dBrZr5" 1 3 0; RESULT=$?
|
||||||
echo -e "export TELEGRAM_TOKEN=$REPLY" >> storage/user/credentials/activate__hydra_dupe__services
|
echo -e "export TELEGRAM_TOKEN=$REPLY" >> storage/user/credentials/activate__hydra_dupe__services
|
||||||
@ -743,11 +751,18 @@ cmd_services_hydra () {
|
|||||||
else
|
else
|
||||||
TELEGRAM_SERVICING=0
|
TELEGRAM_SERVICING=0
|
||||||
fi
|
fi
|
||||||
|
kprompt "MODE" "will this bot use cryptocompare services? " "cryptocompare" 1 0 0; RESULT=$?
|
||||||
# [ -e storage/user/credentials/activate__hydra_dupe__services ] && ( cat storage/user/credentials/activate__hydra_dupe__services >> env/bin/activate )
|
if [ $RESULT = "0" ]; then
|
||||||
|
kprompt "MODE" "cryptocompare_token" "[ cryptocompare token ] example: 8wXfZYl4cN4iSmKsRVOhXDCVxF9wZ8c7Qy4o4bKgTVpcplq9Q8oId0mY" 1 3 0; RESULT=$?
|
||||||
|
echo -e "export CRYPTOCOMPARE_TOKEN=$REPLY" >> storage/user/credentials/activate__hydra_dupe__services
|
||||||
|
CRYPTO___SERVICING=1
|
||||||
|
else
|
||||||
|
CRYPTO___SERVICING=0
|
||||||
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#####################################################################################################################
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
|
||||||
cmd_services () {
|
cmd_services () {
|
||||||
@ -804,10 +819,9 @@ cmd_services () {
|
|||||||
echo -e "export TELEGRAM_TOKEN=$REPLY" >> activation
|
echo -e "export TELEGRAM_TOKEN=$REPLY" >> activation
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# [ -e storage/user/credentials/activate__hydra_dupe__services ] && ( cat storage/user/credentials/activate__hydra_dupe__services >> env/bin/activate )
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#####################################################################################################################
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
|
||||||
cmd_setup () {
|
cmd_setup () {
|
||||||
@ -822,63 +836,81 @@ cmd_setup () {
|
|||||||
mkdir plugins
|
mkdir plugins
|
||||||
cat storage/bot/variants/default/bot_maple__default__initial_plugins.txt|grep -v "#"|grep -v irc3|sed s/plugins.//|xargs -I{} cp storage/bot/plugins/{}.py plugins/
|
cat storage/bot/variants/default/bot_maple__default__initial_plugins.txt|grep -v "#"|grep -v irc3|sed s/plugins.//|xargs -I{} cp storage/bot/plugins/{}.py plugins/
|
||||||
|
|
||||||
# ideally i would simply use sed -i s/this/that/g file; however osx/unix and gnused are not exactly posix compliant(idc) specifically with (inplace) file updating, ppl getting gsed on osx vs using ased, ill skip past.
|
|
||||||
if [ $DISCORD__SERVICING -eq 0 ]; then
|
if [ $DISCORD__SERVICING -eq 0 ]; then
|
||||||
cat plugins/tool_bus_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py
|
cat plugins/tool_bus_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py
|
||||||
cat plugins/cmd_irc_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py
|
cat plugins/cmd_irc_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py
|
||||||
cat plugins/net_discord_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > plugins/net_discord_plugin.tmp;mv plugins/net_discord_plugin.tmp plugins/net_discord_plugin.py
|
cat plugins/net_discord_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > plugins/net_discord_plugin.tmp;mv plugins/net_discord_plugin.tmp plugins/net_discord_plugin.py
|
||||||
cat plugins/tool_dims_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py
|
cat plugins/tool_dims_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py
|
||||||
else
|
else
|
||||||
cat plugins/tool_bus_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=True"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py
|
cat plugins/tool_bus_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=True"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py
|
||||||
cat plugins/cmd_irc_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=True"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py
|
cat plugins/cmd_irc_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=True"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py
|
||||||
cat plugins/net_discord_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=True"/g > plugins/net_discord_plugin.tmp;mv plugins/net_discord_plugin.tmp plugins/net_discord_plugin.py
|
cat plugins/net_discord_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=True"/g > plugins/net_discord_plugin.tmp;mv plugins/net_discord_plugin.tmp plugins/net_discord_plugin.py
|
||||||
cat plugins/tool_dims_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=True"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py
|
cat plugins/tool_dims_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=True"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $TELEGRAM__SERVICING -eq 0 ]; then
|
if [ $TELEGRAM__SERVICING -eq 0 ]; then
|
||||||
cat plugins/tool_bus_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py
|
cat plugins/tool_bus_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py
|
||||||
cat plugins/cmd_irc_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py
|
cat plugins/cmd_irc_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py
|
||||||
cat plugins/tool_dims_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py
|
cat plugins/tool_dims_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py
|
||||||
cat plugins/net_telegram_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > plugins/net_telegram_plugin.tmp;mv plugins/net_telegram_plugin.tmp plugins/net_telegram_plugin.py
|
cat plugins/net_telegram_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > plugins/net_telegram_plugin.tmp;mv plugins/net_telegram_plugin.tmp plugins/net_telegram_plugin.py
|
||||||
else
|
else
|
||||||
cat plugins/tool_bus_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=True"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py
|
cat plugins/tool_bus_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=True"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py
|
||||||
cat plugins/cmd_irc_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=True"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py
|
cat plugins/cmd_irc_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=True"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py
|
||||||
cat plugins/tool_dims_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=True"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py
|
cat plugins/tool_dims_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=True"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py
|
||||||
cat plugins/net_telegram_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=True"/g > plugins/net_telegram_plugin.tmp;mv plugins/net_telegram_plugin.tmp plugins/net_telegram_plugin.py
|
cat plugins/net_telegram_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=True"/g > plugins/net_telegram_plugin.tmp;mv plugins/net_telegram_plugin.tmp plugins/net_telegram_plugin.py
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $MATRIX__SERVICING -eq 0 ]; then
|
if [ $MATRIX__SERVICING -eq 0 ]; then
|
||||||
cat plugins/tool_bus_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py
|
cat plugins/tool_bus_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py
|
||||||
cat plugins/cmd_irc_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py
|
cat plugins/cmd_irc_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py
|
||||||
cat plugins/net_irc_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py
|
cat plugins/net_irc_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py
|
||||||
cat plugins/tool_dims_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py
|
cat plugins/tool_dims_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py
|
||||||
cat plugins/net_matrix_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/net_matrix_plugin.tmp;mv plugins/net_matrix_plugin.tmp plugins/net_matrix_plugin.py
|
cat plugins/net_matrix_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/net_matrix_plugin.tmp;mv plugins/net_matrix_plugin.tmp plugins/net_matrix_plugin.py
|
||||||
else
|
else
|
||||||
cat plugins/tool_bus_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py
|
cat plugins/tool_bus_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py
|
||||||
cat plugins/cmd_irc_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py
|
cat plugins/cmd_irc_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py
|
||||||
cat plugins/net_irc_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py
|
cat plugins/net_irc_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py
|
||||||
cat plugins/tool_dims_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py
|
cat plugins/tool_dims_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py
|
||||||
cat plugins/net_matrix_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > plugins/net_matrix_plugin.tmp;mv plugins/net_matrix_plugin.tmp plugins/net_matrix_plugin.py
|
cat plugins/net_matrix_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > plugins/net_matrix_plugin.tmp;mv plugins/net_matrix_plugin.tmp plugins/net_matrix_plugin.py
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $TWITTER__SERVICING -eq 0 ]; then
|
if [ $TWITTER__SERVICING -eq 0 ]; then
|
||||||
cat plugins/url_grabber_plugin.py|sed s/"???TWITTER???"/"SERVICES_TWITTER=False"/g > plugins/url_grabber_plugin.tmp;mv plugins/url_grabber_plugin.tmp plugins/url_grabber_plugin.py
|
cat plugins/url_grabber_plugin.py|sed s/"???TWITTER???"/"SERVICES_TWITTER=False"/g > plugins/url_grabber_plugin.tmp;mv plugins/url_grabber_plugin.tmp plugins/url_grabber_plugin.py
|
||||||
|
cat plugins/twitter_plugin.py|sed s/"???TWITTER???"/"SERVICES_TWITTER=False"/g > plugins/twitter_plugin.tmp;mv plugins/twitter_plugin.tmp plugins/twitter_plugin.py
|
||||||
else
|
else
|
||||||
cat plugins/url_grabber_plugin.py|sed s/"???TWITTER???"/"SERVICES_TWITTER=True"/g > plugins/url_grabber_plugin.tmp;mv plugins/url_grabber_plugin.tmp plugins/url_grabber_plugin.py
|
cat plugins/url_grabber_plugin.py|sed s/"???TWITTER???"/"SERVICES_TWITTER=True"/g > plugins/url_grabber_plugin.tmp;mv plugins/url_grabber_plugin.tmp plugins/url_grabber_plugin.py
|
||||||
|
cat plugins/twitter_plugin.py|sed s/"???TWITTER???"/"SERVICES_TWITTER=True"/g > plugins/twitter_plugin.tmp;mv plugins/twitter_plugin.tmp plugins/twitter_plugin.py
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $YOUTUBE__SERVICING -eq 0 ]; then
|
if [ $YOUTUBE__SERVICING -eq 0 ]; then
|
||||||
cat plugins/url_grabber_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=False"/g > plugins/url_grabber_plugin.tmp;mv plugins/url_grabber_plugin.tmp plugins/url_grabber_plugin.py
|
cat plugins/url_grabber_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=False"/g > plugins/url_grabber_plugin.tmp;mv plugins/url_grabber_plugin.tmp plugins/url_grabber_plugin.py
|
||||||
cat plugins/twitter_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=False"/g > plugins/twitter_plugin.tmp;mv plugins/twitter_plugin.tmp plugins/twitter_plugin.py
|
cat plugins/twitter_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=False"/g > plugins/twitter_plugin.tmp;mv plugins/twitter_plugin.tmp plugins/twitter_plugin.py
|
||||||
cat plugins/boombox_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=False"/g > plugins/boombox_plugin.tmp;mv plugins/boombox_plugin.tmp plugins/boombox_plugin.py
|
cat plugins/boombox_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=False"/g > plugins/boombox_plugin.tmp;mv plugins/boombox_plugin.tmp plugins/boombox_plugin.py
|
||||||
cat plugins/youtube_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=False"/g > plugins/youtube_plugin.tmp;mv plugins/youtube_plugin.tmp plugins/youtube_plugin.py
|
cat plugins/youtube_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=False"/g > plugins/youtube_plugin.tmp;mv plugins/youtube_plugin.tmp plugins/youtube_plugin.py
|
||||||
else
|
else
|
||||||
cat plugins/url_grabber_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=True"/g > plugins/url_grabber_plugin.tmp;mv plugins/url_grabber_plugin.tmp plugins/url_grabber_plugin.py
|
cat plugins/url_grabber_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=True"/g > plugins/url_grabber_plugin.tmp;mv plugins/url_grabber_plugin.tmp plugins/url_grabber_plugin.py
|
||||||
cat plugins/twitter_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=True"/g > plugins/twitter_plugin.tmp;mv plugins/twitter_plugin.tmp plugins/twitter_plugin.py
|
cat plugins/twitter_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=True"/g > plugins/twitter_plugin.tmp;mv plugins/twitter_plugin.tmp plugins/twitter_plugin.py
|
||||||
cat plugins/boombox_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=True"/g > plugins/boombox_plugin.tmp;mv plugins/boombox_plugin.tmp plugins/boombox_plugin.py
|
cat plugins/boombox_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=True"/g > plugins/boombox_plugin.tmp;mv plugins/boombox_plugin.tmp plugins/boombox_plugin.py
|
||||||
cat plugins/youtube_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=True"/g > plugins/youtube_plugin.tmp;mv plugins/youtube_plugin.tmp plugins/youtube_plugin.py
|
cat plugins/youtube_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=True"/g > plugins/youtube_plugin.tmp;mv plugins/youtube_plugin.tmp plugins/youtube_plugin.py
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $HYDRA____SERVICING -eq 0 ]; then
|
||||||
|
cat plugins/net_hydra_plugin.py|sed s/"???HYDRA???"/"SERVICES_HYDRA=False"/g > plugins/net_hydra_plugin.tmp;mv plugins/net_hydra_plugin.tmp plugins/net_hydra_plugin.py
|
||||||
|
else
|
||||||
|
cat plugins/net_hydra_plugin.py|sed s/"???HYDRA???"/"SERVICES_HYDRA=True"/g > plugins/net_hydra_plugin.tmp;mv plugins/net_hydra_plugin.tmp plugins/net_hydra_plugin.py
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $OPENAI___SERVICING -eq 0 ]; then
|
||||||
|
cat plugins/openai_plugin.py|sed s/"???OPENAI???"/"SERVICES_OPENAI=False"/g > plugins/openai_plugin.tmp;mv plugins/openai_plugin.tmp plugins/openai_plugin.py
|
||||||
|
else
|
||||||
|
cat plugins/openai_plugin.py|sed s/"???OPENAI???"/"SERVICES_OPENAI=True"/g > plugins/openai_plugin.tmp;mv plugins/openai_plugin.tmp plugins/openai_plugin.py
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $CRYPTO___SERVICING -eq 0 ]; then
|
||||||
|
cat plugins/crypto_plugin.py|sed s/"???CRYPTOCOMPARE???"/"SERVICES_CRYPTOCOMPARE=False"/g > plugins/crypto_plugin.tmp;mv plugins/crypto_plugin.tmp plugins/crypto_plugin.py
|
||||||
|
else
|
||||||
|
cat plugins/crypto_plugin.py|sed s/"???CRYPTOCOMPARE???"/"SERVICES_CRYPTOCOMPARE=True"/g > plugins/crypto_plugin.tmp;mv plugins/crypto_plugin.tmp plugins/crypto_plugin.py
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $DISCORD__SERVICING -eq 0 ]; then
|
if [ $DISCORD__SERVICING -eq 0 ]; then
|
||||||
cat bot_maple.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > bot_maple.tmp;mv bot_maple.tmp bot_maple.py
|
cat bot_maple.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > bot_maple.tmp;mv bot_maple.tmp bot_maple.py
|
||||||
@ -898,21 +930,17 @@ cmd_setup () {
|
|||||||
cat bot_maple.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > bot_maple.tmp;mv bot_maple.tmp bot_maple.py
|
cat bot_maple.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > bot_maple.tmp;mv bot_maple.tmp bot_maple.py
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
fi;
|
fi;
|
||||||
fi;
|
fi;
|
||||||
if [ $RESULT -eq 2 ]; then
|
if [ $RESULT -eq 2 ]; then
|
||||||
#kprompt "MODE" "$L""\nalready have an online credential pak? " "credential pak" 1 0 0; RESULT=$?
|
cmd_services_hydra
|
||||||
#echo $RESULT
|
[ -e storage/user/config/hydra.key ] || cmd_hydra;
|
||||||
#if [ $RESULT = "0" ]; then
|
|
||||||
cmd_services_hydra
|
|
||||||
[ -e storage/user/config/hydra.key ] || cmd_hydra;
|
|
||||||
#fi;
|
|
||||||
cmd_setup_bot
|
cmd_setup_bot
|
||||||
fi;
|
fi;
|
||||||
fi;
|
fi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#####################################################################################################################
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
|
||||||
cmd_setup_bot () {
|
cmd_setup_bot () {
|
||||||
@ -936,78 +964,78 @@ cmd_setup_bot () {
|
|||||||
# ideally i would simply use sed -i s/this/that/g file; however osx/unix and gnused are not exactly posix compliant(idc) specifically with (inplace) file updating, ppl getting gsed on osx vs using ased, ill skip past.
|
# ideally i would simply use sed -i s/this/that/g file; however osx/unix and gnused are not exactly posix compliant(idc) specifically with (inplace) file updating, ppl getting gsed on osx vs using ased, ill skip past.
|
||||||
if [ $DISCORD__SERVICING -eq 0 ]; then
|
if [ $DISCORD__SERVICING -eq 0 ]; then
|
||||||
cat plugins/tool_bus_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py
|
cat plugins/tool_bus_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py
|
||||||
cat plugins/cmd_irc_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py
|
cat plugins/cmd_irc_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py
|
||||||
cat plugins/net_discord_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > plugins/net_discord_plugin.tmp;mv plugins/net_discord_plugin.tmp plugins/net_discord_plugin.py
|
cat plugins/net_discord_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > plugins/net_discord_plugin.tmp;mv plugins/net_discord_plugin.tmp plugins/net_discord_plugin.py
|
||||||
cat plugins/tool_dims_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py
|
cat plugins/tool_dims_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py
|
||||||
cat bot_maple.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > bot_maple.tmp;mv bot_maple.tmp bot_maple.py
|
cat bot_maple.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > bot_maple.tmp;mv bot_maple.tmp bot_maple.py
|
||||||
else
|
else
|
||||||
cat plugins/tool_bus_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=True"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py
|
cat plugins/tool_bus_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=True"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py
|
||||||
cat plugins/cmd_irc_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=True"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py
|
cat plugins/cmd_irc_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=True"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py
|
||||||
cat plugins/net_discord_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=True"/g > plugins/net_discord_plugin.tmp;mv plugins/net_discord_plugin.tmp plugins/net_discord_plugin.py
|
cat plugins/net_discord_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=True"/g > plugins/net_discord_plugin.tmp;mv plugins/net_discord_plugin.tmp plugins/net_discord_plugin.py
|
||||||
cat plugins/tool_dims_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=True"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py
|
cat plugins/tool_dims_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=True"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py
|
||||||
cat bot_maple.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=True"/g > bot_maple.tmp;mv bot_maple.tmp bot_maple.py
|
cat bot_maple.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=True"/g > bot_maple.tmp;mv bot_maple.tmp bot_maple.py
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $TELEGRAM_SERVICING -eq 0 ]; then
|
if [ $TELEGRAM_SERVICING -eq 0 ]; then
|
||||||
cat plugins/tool_bus_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py
|
cat plugins/tool_bus_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py
|
||||||
cat plugins/cmd_irc_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py
|
cat plugins/cmd_irc_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py
|
||||||
cat plugins/tool_dims_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py
|
cat plugins/tool_dims_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py
|
||||||
cat plugins/net_telegram_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > plugins/net_telegram_plugin.tmp;mv plugins/net_telegram_plugin.tmp plugins/net_telegram_plugin.py
|
cat plugins/net_telegram_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > plugins/net_telegram_plugin.tmp;mv plugins/net_telegram_plugin.tmp plugins/net_telegram_plugin.py
|
||||||
cat bot_maple.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > bot_maple.tmp;mv bot_maple.tmp bot_maple.py
|
cat bot_maple.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > bot_maple.tmp;mv bot_maple.tmp bot_maple.py
|
||||||
else
|
else
|
||||||
cat plugins/tool_bus_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=True"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py
|
cat plugins/tool_bus_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=True"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py
|
||||||
cat plugins/cmd_irc_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=True"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py
|
cat plugins/cmd_irc_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=True"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py
|
||||||
cat plugins/tool_dims_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=True"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py
|
cat plugins/tool_dims_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=True"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py
|
||||||
cat plugins/net_telegram_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=True"/g > plugins/net_telegram_plugin.tmp;mv plugins/net_telegram_plugin.tmp plugins/net_telegram_plugin.py
|
cat plugins/net_telegram_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=True"/g > plugins/net_telegram_plugin.tmp;mv plugins/net_telegram_plugin.tmp plugins/net_telegram_plugin.py
|
||||||
cat bot_maple.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=True"/g > bot_maple.tmp;mv bot_maple.tmp bot_maple.py
|
cat bot_maple.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=True"/g > bot_maple.tmp;mv bot_maple.tmp bot_maple.py
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $MATRIX___SERVICING -eq 0 ]; then
|
if [ $MATRIX___SERVICING -eq 0 ]; then
|
||||||
cat plugins/tool_bus_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py
|
cat plugins/tool_bus_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py
|
||||||
cat plugins/cmd_irc_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py
|
cat plugins/cmd_irc_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py
|
||||||
cat plugins/net_irc_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py
|
cat plugins/net_irc_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py
|
||||||
cat plugins/tool_dims_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py
|
cat plugins/tool_dims_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py
|
||||||
cat plugins/net_matrix_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/net_matrix_plugin.tmp;mv plugins/net_matrix_plugin.tmp plugins/net_matrix_plugin.py
|
cat plugins/net_matrix_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/net_matrix_plugin.tmp;mv plugins/net_matrix_plugin.tmp plugins/net_matrix_plugin.py
|
||||||
cat bot_maple.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > bot_maple.tmp;mv bot_maple.tmp bot_maple.py
|
cat bot_maple.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > bot_maple.tmp;mv bot_maple.tmp bot_maple.py
|
||||||
else
|
else
|
||||||
cat plugins/tool_bus_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py
|
cat plugins/tool_bus_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py
|
||||||
cat plugins/cmd_irc_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py
|
cat plugins/cmd_irc_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py
|
||||||
cat plugins/net_irc_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py
|
cat plugins/net_irc_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py
|
||||||
cat plugins/tool_dims_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py
|
cat plugins/tool_dims_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py
|
||||||
cat plugins/net_matrix_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > plugins/net_matrix_plugin.tmp;mv plugins/net_matrix_plugin.tmp plugins/net_matrix_plugin.py
|
cat plugins/net_matrix_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > plugins/net_matrix_plugin.tmp;mv plugins/net_matrix_plugin.tmp plugins/net_matrix_plugin.py
|
||||||
cat bot_maple.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > bot_maple.tmp;mv bot_maple.tmp bot_maple.py
|
cat bot_maple.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > bot_maple.tmp;mv bot_maple.tmp bot_maple.py
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $TWITTER__SERVICING -eq 0 ]; then
|
if [ $TWITTER__SERVICING -eq 0 ]; then
|
||||||
cat plugins/url_grabber_plugin.py|sed s/"???TWITTER???"/"SERVICES_TWITTER=False"/g > plugins/url_grabber_plugin.tmp;mv plugins/url_grabber_plugin.tmp plugins/url_grabber_plugin.py
|
cat plugins/url_grabber_plugin.py|sed s/"???TWITTER???"/"SERVICES_TWITTER=False"/g > plugins/url_grabber_plugin.tmp;mv plugins/url_grabber_plugin.tmp plugins/url_grabber_plugin.py
|
||||||
else
|
else
|
||||||
cat plugins/url_grabber_plugin.py|sed s/"???TWITTER???"/"SERVICES_TWITTER=True"/g > plugins/url_grabber_plugin.tmp;mv plugins/url_grabber_plugin.tmp plugins/url_grabber_plugin.py
|
cat plugins/url_grabber_plugin.py|sed s/"???TWITTER???"/"SERVICES_TWITTER=True"/g > plugins/url_grabber_plugin.tmp;mv plugins/url_grabber_plugin.tmp plugins/url_grabber_plugin.py
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $YOUTUBE__SERVICING -eq 0 ]; then
|
if [ $YOUTUBE__SERVICING -eq 0 ]; then
|
||||||
cat plugins/url_grabber_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=False"/g > plugins/url_grabber_plugin.tmp;mv plugins/url_grabber_plugin.tmp plugins/url_grabber_plugin.py
|
cat plugins/url_grabber_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=False"/g > plugins/url_grabber_plugin.tmp;mv plugins/url_grabber_plugin.tmp plugins/url_grabber_plugin.py
|
||||||
cat plugins/twitter_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=False"/g > plugins/twitter_plugin.tmp;mv plugins/twitter_plugin.tmp plugins/twitter_plugin.py
|
cat plugins/twitter_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=False"/g > plugins/twitter_plugin.tmp;mv plugins/twitter_plugin.tmp plugins/twitter_plugin.py
|
||||||
cat plugins/boombox_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=False"/g > plugins/boombox_plugin.tmp;mv plugins/boombox_plugin.tmp plugins/boombox_plugin.py
|
cat plugins/boombox_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=False"/g > plugins/boombox_plugin.tmp;mv plugins/boombox_plugin.tmp plugins/boombox_plugin.py
|
||||||
cat plugins/youtube_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=False"/g > plugins/youtube_plugin.tmp;mv plugins/youtube_plugin.tmp plugins/youtube_plugin.py
|
cat plugins/youtube_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=False"/g > plugins/youtube_plugin.tmp;mv plugins/youtube_plugin.tmp plugins/youtube_plugin.py
|
||||||
else
|
else
|
||||||
cat plugins/url_grabber_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=True"/g > plugins/url_grabber_plugin.tmp;mv plugins/url_grabber_plugin.tmp plugins/url_grabber_plugin.py
|
cat plugins/url_grabber_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=True"/g > plugins/url_grabber_plugin.tmp;mv plugins/url_grabber_plugin.tmp plugins/url_grabber_plugin.py
|
||||||
cat plugins/twitter_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=True"/g > plugins/twitter_plugin.tmp;mv plugins/twitter_plugin.tmp plugins/twitter_plugin.py
|
cat plugins/twitter_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=True"/g > plugins/twitter_plugin.tmp;mv plugins/twitter_plugin.tmp plugins/twitter_plugin.py
|
||||||
cat plugins/boombox_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=True"/g > plugins/boombox_plugin.tmp;mv plugins/boombox_plugin.tmp plugins/boombox_plugin.py
|
cat plugins/boombox_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=True"/g > plugins/boombox_plugin.tmp;mv plugins/boombox_plugin.tmp plugins/boombox_plugin.py
|
||||||
cat plugins/youtube_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=True"/g > plugins/youtube_plugin.tmp;mv plugins/youtube_plugin.tmp plugins/youtube_plugin.py
|
cat plugins/youtube_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=True"/g > plugins/youtube_plugin.tmp;mv plugins/youtube_plugin.tmp plugins/youtube_plugin.py
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# injects a myriad of plugins depending on variant
|
# injects a myriad of plugins depending on variant
|
||||||
cat plugins/net_irc_plugin.py|sed '/includes/r storage/bot/variants/dupe/bot_maple__services__initial_plugins.txt' > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py
|
cat plugins/net_irc_plugin.py|sed '/includes/r storage/bot/variants/dupe/bot_maple__services__initial_plugins.txt' > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py
|
||||||
|
|
||||||
fi;
|
fi;
|
||||||
elif [ $RESULT -eq 3 ]; then
|
elif [ $RESULT -eq 3 ]; then
|
||||||
(kmode 3);
|
(kmode 3);
|
||||||
if [ ! -e plugins ]; then
|
if [ ! -e plugins ]; then
|
||||||
mkdir plugins
|
mkdir plugins
|
||||||
cat storage/bot/variants/dupe/bot_maple__devops__initial_plugins.txt|grep -v "#"|grep -v irc3|sed s/plugins.//|xargs -I{} cp storage/bot/plugins/{}.py plugins/
|
cat storage/bot/variants/dupe/bot_maple__devops__initial_plugins.txt|grep -v "#"|grep -v irc3|sed s/plugins.//|xargs -I{} cp storage/bot/plugins/{}.py plugins/
|
||||||
cat plugins/net_irc_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py
|
cat plugins/net_irc_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py
|
||||||
cat plugins/net_irc_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py
|
cat plugins/net_irc_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py
|
||||||
cat plugins/net_irc_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py
|
cat plugins/net_irc_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py
|
||||||
cat plugins/net_irc_plugin.py|sed '/includes/r storage/bot/variants/dupe/bot_maple__devops__initial_plugins.txt' > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py
|
cat plugins/net_irc_plugin.py|sed '/includes/r storage/bot/variants/dupe/bot_maple__devops__initial_plugins.txt' > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py
|
||||||
fi;
|
fi;
|
||||||
fi;
|
fi;
|
||||||
@ -1023,6 +1051,7 @@ cmd_setup_bot () {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#####################################################################################################################
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
|
||||||
cmd_start () {
|
cmd_start () {
|
||||||
@ -1057,14 +1086,16 @@ cmd_start () {
|
|||||||
|
|
||||||
}; # eof cmd_start
|
}; # eof cmd_start
|
||||||
|
|
||||||
################
|
#####################################################################################################################
|
||||||
|
#####################################################################################################################
|
||||||
|
|
||||||
cmd_stop () {
|
cmd_stop () {
|
||||||
echo -e "[ stopping `cat r3kt.pid` ]"
|
echo -e "[ stopping `cat r3kt.pid` ]"
|
||||||
pid=`cat r3kt.pid` && kill -9 $pid;rm r3kt.pid
|
pid=`cat r3kt.pid` && kill -9 $pid;rm r3kt.pid
|
||||||
}
|
}
|
||||||
|
|
||||||
################
|
#####################################################################################################################
|
||||||
|
#####################################################################################################################
|
||||||
|
|
||||||
cmd_cleanup () {
|
cmd_cleanup () {
|
||||||
L="\x1b[0;94m"; D="\x1b[0;34m"; G="\x1b[0;90m"
|
L="\x1b[0;94m"; D="\x1b[0;34m"; G="\x1b[0;90m"
|
||||||
@ -1093,7 +1124,9 @@ cmd_cleanup () {
|
|||||||
[ -e r3kt.pid ] && (PID=`cat r3kt.pid`;rm r3kt.pid;kill -9 $PID > /dev/null 2>&1)
|
[ -e r3kt.pid ] && (PID=`cat r3kt.pid`;rm r3kt.pid;kill -9 $PID > /dev/null 2>&1)
|
||||||
}
|
}
|
||||||
|
|
||||||
################
|
#####################################################################################################################
|
||||||
|
#####################################################################################################################
|
||||||
|
|
||||||
|
|
||||||
cmd_autosync () {
|
cmd_autosync () {
|
||||||
########################################################################################################################## SOF
|
########################################################################################################################## SOF
|
||||||
@ -1122,6 +1155,7 @@ cmd_autosync () {
|
|||||||
########################################################################################################################## EOF
|
########################################################################################################################## EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#####################################################################################################################
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
|
||||||
error () {
|
error () {
|
||||||
@ -1129,11 +1163,14 @@ error () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
#####################################################################################################################
|
||||||
|
|
||||||
|
|
||||||
help () {
|
help () {
|
||||||
[ $1 -eq 1 ] && echo -e $W"commands: ${COMMANDS[*]}"
|
[ $1 -eq 1 ] && echo -e $W"commands: ${COMMANDS[*]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#####################################################################################################################
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
@ -1142,11 +1179,10 @@ help () {
|
|||||||
# ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY #
|
# ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY #
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
|
||||||
|
#####################################################################################################################
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
|
||||||
#[ -z $1 ] && error "no command issued" && help 1 && exit
|
|
||||||
if [ -z $1 ]; then
|
if [ -z $1 ]; then
|
||||||
# detect bot setup, if none start setup
|
|
||||||
if [ ! -e bot_maple.ini ] || [ ! -e bot_maple.py ]; then
|
if [ ! -e bot_maple.ini ] || [ ! -e bot_maple.py ]; then
|
||||||
cmd_setup;
|
cmd_setup;
|
||||||
|
|
||||||
@ -1175,7 +1211,7 @@ if [ -z $1 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
# detect bot pid, if no pid then start bot, if pid then stop bot
|
|
||||||
if [ ! -e r3kt.pid ]; then
|
if [ ! -e r3kt.pid ]; then
|
||||||
cmd_start;
|
cmd_start;
|
||||||
elif [ -e r3kt.pid ]; then
|
elif [ -e r3kt.pid ]; then
|
||||||
@ -1184,9 +1220,7 @@ if [ -z $1 ]; then
|
|||||||
fi;
|
fi;
|
||||||
|
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
#####################################################################################################################
|
||||||
# if grep -q "$CMD" <<< "${commands[@]}"; then
|
|
||||||
# echo -e "$CMD command found"
|
|
||||||
|
|
||||||
if [ "$CMD" = "setup" ]; then
|
if [ "$CMD" = "setup" ]; then
|
||||||
cmd_setup;
|
cmd_setup;
|
||||||
@ -1200,10 +1234,7 @@ fi;
|
|||||||
cmd_autosync;
|
cmd_autosync;
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
# else
|
#####################################################################################################################
|
||||||
# error "$1 isn't an available command" && help 1 && exit 1
|
|
||||||
# fi
|
|
||||||
|
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
@ -1213,5 +1244,4 @@ fi;
|
|||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
|
||||||
#####################################################################################################################
|
#####################################################################################################################
|
||||||
|
|
||||||
################################################################################################################# EOF
|
################################################################################################################# EOF
|
||||||
|
@ -1,149 +1,158 @@
|
|||||||
# -*- coding: utf-8 -*- ############################################################### SOF
|
# -*- coding: utf-8 -*- ############################################################### SOF
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
|
|
||||||
import sys
|
???CRYPTOCOMPARE???
|
||||||
from irc3.plugins.command import command
|
|
||||||
import irc3,os,aiohttp, asyncio, async_timeout
|
|
||||||
from plugins.tool_log_plugin import FOG
|
|
||||||
|
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
|
|
||||||
def getenv(s):
|
##########################
|
||||||
try:
|
if SERVICES_CRYPTOCOMPARE:
|
||||||
s = os.environ[s]
|
##########################
|
||||||
return s
|
|
||||||
except:
|
|
||||||
fog=FOG().fog
|
|
||||||
error_type="environmental variable error"
|
|
||||||
error_reason=f"exported {s} not found"
|
|
||||||
fog(f"{error_type}: {error_reason}")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
###########################################################################################
|
import sys
|
||||||
###########################################################################################
|
from irc3.plugins.command import command
|
||||||
|
import irc3,os,aiohttp, asyncio, async_timeout
|
||||||
CRYPTOCOMPARE_KEY=getenv('CRYPTOCOMPARE_KEY')
|
from plugins.tool_log_plugin import FOG
|
||||||
|
|
||||||
###########################################################################################
|
|
||||||
###########################################################################################
|
|
||||||
|
|
||||||
headers = { 'authorization': f'Apikey {CRYPTOCOMPARE_KEY}' }
|
|
||||||
|
|
||||||
###########################################################################################
|
|
||||||
###########################################################################################
|
|
||||||
|
|
||||||
dir_path = os.path.dirname(os.path.realpath(__file__))
|
|
||||||
|
|
||||||
###########################################################################################
|
|
||||||
###########################################################################################
|
|
||||||
|
|
||||||
@irc3.plugin
|
|
||||||
class Plugin:
|
|
||||||
|
|
||||||
#######################################################################################
|
|
||||||
#######################################################################################
|
|
||||||
|
|
||||||
def __init__(self, bot):
|
|
||||||
self.bot = bot
|
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
|
||||||
@command(permission='view')
|
def getenv(s):
|
||||||
def cc(self, mask, target, args):
|
try:
|
||||||
"""Show Crypto Value
|
s = os.environ[s]
|
||||||
%%cc <coin>
|
return s
|
||||||
"""
|
except:
|
||||||
coin = args['<coin>'].upper()
|
fog=FOG().fog
|
||||||
async def fetch(session, url):
|
error_type="environmental variable error"
|
||||||
async with async_timeout.timeout(10):
|
error_reason=f"exported {s} not found"
|
||||||
async with session.get(url) as response:
|
fog(f"{error_type}: {error_reason}")
|
||||||
return await response.json()
|
sys.exit(1)
|
||||||
|
|
||||||
###################################################################################
|
#######################################################################################
|
||||||
###################################################################################
|
#######################################################################################
|
||||||
|
|
||||||
async def grab_url(url):
|
CRYPTOCOMPARE_KEY=getenv('CRYPTOCOMPARE_KEY')
|
||||||
async with aiohttp.ClientSession(headers=headers) as session:
|
|
||||||
json_response = await fetch(session, url)
|
|
||||||
return json_response
|
|
||||||
|
|
||||||
###################################################################################
|
#######################################################################################
|
||||||
###################################################################################
|
#######################################################################################
|
||||||
|
|
||||||
def parse_coin(response):
|
headers = { 'authorization': f'Apikey {CRYPTOCOMPARE_KEY}' }
|
||||||
try:
|
|
||||||
task_result, _ = response.result()
|
|
||||||
task1, task2, task3 = task_result
|
|
||||||
rlist = sorted([task1.result(), task2.result(), task3.result()], key=lambda item: len(item.keys()))
|
|
||||||
if rlist[1].get("USD"):
|
|
||||||
price = rlist[1].get("USD")
|
|
||||||
price_multi = rlist[2].get("DISPLAY")[coin].get("USD", {})
|
|
||||||
daily_avg = rlist[0].get("USD")
|
|
||||||
elif rlist[2].get("USD"):
|
|
||||||
price_multi = rlist[1].get("DISPLAY")[coin].get("USD", {})
|
|
||||||
price = rlist[2].get("USD")
|
|
||||||
daily_avg = rlist[0].get("USD")
|
|
||||||
data_dict = {}
|
|
||||||
for k, v in price_multi.items():
|
|
||||||
if isinstance(v, str):
|
|
||||||
v = v.replace("$","").replace(" ","").replace(",","")
|
|
||||||
data_dict[k] = v
|
|
||||||
price_multi = data_dict
|
|
||||||
X = float(daily_avg) # AVERAGE OF THE DAY
|
|
||||||
P = float(price_multi.get('PRICE')) # PRICE CURRENTLY
|
|
||||||
H = float(price_multi.get('HIGHDAY')) # HIGH OF THE DAY
|
|
||||||
L = float(price_multi.get('LOWDAY')) # LOW OF THE DAY
|
|
||||||
A = float(price) # AGGREGATED EXCHANGE
|
|
||||||
Y = float(price_multi.get('CHANGE24HOUR')) # PRICE PERCENT DIFFERENTIAL 24 HOURS AGO
|
|
||||||
C = float(price_multi.get('CHANGEPCT24HOUR'))
|
|
||||||
if C <= 0:
|
|
||||||
C = "\x0304{}\x0F".format(C)
|
|
||||||
else:
|
|
||||||
C = "\x0303{}\x0F".format(C)
|
|
||||||
if Y <= 0:
|
|
||||||
Y = "\x0304{}\x0F".format(Y)
|
|
||||||
else:
|
|
||||||
Y = "\x0303{}\x0F".format(Y)
|
|
||||||
symbol = price_multi.get('FROMSYMBOL')
|
|
||||||
msg = "\x02\x0302[ {coin:}/{symbol:} ]\x0F @\x0303${p:,}\x0F ::: H\x0303${h:,}\x0F L\x0303${l:,}\x0F ::: Y${y:} @ %{c:} ::: X\x0303${x:,}\x0F A\x0303${a:,}\x0F".format(coin=coin, symbol=symbol, p=P, h=H, l=L, y=Y,c=C, x=X, a=A)
|
|
||||||
msg = self.bot.emo(msg)
|
|
||||||
self.bot.privmsg(target, msg)
|
|
||||||
except Exception as e:
|
|
||||||
msg = self.bot.emo('their api is glitching: check back later')
|
|
||||||
self.bot.privmsg(target, msg)
|
|
||||||
|
|
||||||
###################################################################################
|
#######################################################################################
|
||||||
###################################################################################
|
#######################################################################################
|
||||||
|
|
||||||
def process_lookups(response):
|
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||||
try:
|
|
||||||
html = response.result()
|
|
||||||
except Exception as e:
|
|
||||||
msg = self.bot.emo('site error: {}'.format(e.message))
|
|
||||||
self.bot.privmsg(target, msg)
|
|
||||||
return
|
|
||||||
coin_result = html.get("Data",{}).get(coin, None)
|
|
||||||
if not coin_result:
|
|
||||||
msg = self.bot.emo('Invalid coin - see https://min-api.cryptocompare.com/data/all/coinlist data keys')
|
|
||||||
self.bot.privmsg(target, msg)
|
|
||||||
return
|
|
||||||
day_avg_url = "https://min-api.cryptocompare.com/data/dayAvg?fsym={}&tsym=USD&api_key=94e50805f19646893ee16424918998caad5ec6accff539a23ffee8e546eda4e3".format(coin)
|
|
||||||
price_multi_url = "https://min-api.cryptocompare.com/data/pricemultifull?fsyms={}&tsyms=USD&api_key=94e50805f19646893ee16424918998caad5ec6accff539a23ffee8e546eda4e3".format(coin)
|
|
||||||
price_url = "https://min-api.cryptocompare.com/data/price?fsym={}&tsyms=USD&api_key=94e50805f19646893ee16424918998caad5ec6accff539a23ffee8e546eda4e3".format(coin)
|
|
||||||
tasks = [asyncio.ensure_future(grab_url(day_avg_url)),
|
|
||||||
asyncio.ensure_future(grab_url(price_multi_url)),
|
|
||||||
asyncio.ensure_future(grab_url(price_url))]
|
|
||||||
task = self.bot.create_task(asyncio.wait(tasks))
|
|
||||||
task.add_done_callback(parse_coin)
|
|
||||||
|
|
||||||
###################################################################################
|
#######################################################################################
|
||||||
###################################################################################
|
#######################################################################################
|
||||||
|
|
||||||
url = "https://min-api.cryptocompare.com/data/all/coinlist"
|
@irc3.plugin
|
||||||
asyncio.ensure_future(grab_url(url), \
|
class Plugin:
|
||||||
loop=self.bot.loop).add_done_callback(process_lookups)
|
|
||||||
|
#######################################################################################
|
||||||
|
#######################################################################################
|
||||||
|
|
||||||
|
def __init__(self, bot):
|
||||||
|
self.bot = bot
|
||||||
|
|
||||||
|
#######################################################################################
|
||||||
|
#######################################################################################
|
||||||
|
|
||||||
|
@command(permission='view')
|
||||||
|
def cc(self, mask, target, args):
|
||||||
|
"""Show Crypto Value
|
||||||
|
%%cc <coin>
|
||||||
|
"""
|
||||||
|
coin = args['<coin>'].upper()
|
||||||
|
async def fetch(session, url):
|
||||||
|
async with async_timeout.timeout(10):
|
||||||
|
async with session.get(url) as response:
|
||||||
|
return await response.json()
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
async def grab_url(url):
|
||||||
|
async with aiohttp.ClientSession(headers=headers) as session:
|
||||||
|
json_response = await fetch(session, url)
|
||||||
|
return json_response
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
def parse_coin(response):
|
||||||
|
try:
|
||||||
|
task_result, _ = response.result()
|
||||||
|
task1, task2, task3 = task_result
|
||||||
|
rlist = sorted([task1.result(), task2.result(), task3.result()], key=lambda item: len(item.keys()))
|
||||||
|
if rlist[1].get("USD"):
|
||||||
|
price = rlist[1].get("USD")
|
||||||
|
price_multi = rlist[2].get("DISPLAY")[coin].get("USD", {})
|
||||||
|
daily_avg = rlist[0].get("USD")
|
||||||
|
elif rlist[2].get("USD"):
|
||||||
|
price_multi = rlist[1].get("DISPLAY")[coin].get("USD", {})
|
||||||
|
price = rlist[2].get("USD")
|
||||||
|
daily_avg = rlist[0].get("USD")
|
||||||
|
data_dict = {}
|
||||||
|
for k, v in price_multi.items():
|
||||||
|
if isinstance(v, str):
|
||||||
|
v = v.replace("$","").replace(" ","").replace(",","")
|
||||||
|
data_dict[k] = v
|
||||||
|
price_multi = data_dict
|
||||||
|
X = float(daily_avg) # AVERAGE OF THE DAY
|
||||||
|
P = float(price_multi.get('PRICE')) # PRICE CURRENTLY
|
||||||
|
H = float(price_multi.get('HIGHDAY')) # HIGH OF THE DAY
|
||||||
|
L = float(price_multi.get('LOWDAY')) # LOW OF THE DAY
|
||||||
|
A = float(price) # AGGREGATED EXCHANGE
|
||||||
|
Y = float(price_multi.get('CHANGE24HOUR')) # PRICE PERCENT DIFFERENTIAL 24 HOURS AGO
|
||||||
|
C = float(price_multi.get('CHANGEPCT24HOUR'))
|
||||||
|
if C <= 0:
|
||||||
|
C = "\x0304{}\x0F".format(C)
|
||||||
|
else:
|
||||||
|
C = "\x0303{}\x0F".format(C)
|
||||||
|
if Y <= 0:
|
||||||
|
Y = "\x0304{}\x0F".format(Y)
|
||||||
|
else:
|
||||||
|
Y = "\x0303{}\x0F".format(Y)
|
||||||
|
symbol = price_multi.get('FROMSYMBOL')
|
||||||
|
msg = "\x02\x0302[ {coin:}/{symbol:} ]\x0F @\x0303${p:,}\x0F ::: H\x0303${h:,}\x0F L\x0303${l:,}\x0F ::: Y${y:} @ %{c:} ::: X\x0303${x:,}\x0F A\x0303${a:,}\x0F".format(coin=coin, symbol=symbol, p=P, h=H, l=L, y=Y,c=C, x=X, a=A)
|
||||||
|
msg = self.bot.emo(msg)
|
||||||
|
self.bot.privmsg(target, msg)
|
||||||
|
except Exception as e:
|
||||||
|
msg = self.bot.emo('their api is glitching: check back later')
|
||||||
|
self.bot.privmsg(target, msg)
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
def process_lookups(response):
|
||||||
|
try:
|
||||||
|
html = response.result()
|
||||||
|
except Exception as e:
|
||||||
|
msg = self.bot.emo('site error: {}'.format(e.message))
|
||||||
|
self.bot.privmsg(target, msg)
|
||||||
|
return
|
||||||
|
coin_result = html.get("Data",{}).get(coin, None)
|
||||||
|
if not coin_result:
|
||||||
|
msg = self.bot.emo('Invalid coin - see https://min-api.cryptocompare.com/data/all/coinlist data keys')
|
||||||
|
self.bot.privmsg(target, msg)
|
||||||
|
return
|
||||||
|
day_avg_url = "https://min-api.cryptocompare.com/data/dayAvg?fsym={}&tsym=USD&api_key=94e50805f19646893ee16424918998caad5ec6accff539a23ffee8e546eda4e3".format(coin)
|
||||||
|
price_multi_url = "https://min-api.cryptocompare.com/data/pricemultifull?fsyms={}&tsyms=USD&api_key=94e50805f19646893ee16424918998caad5ec6accff539a23ffee8e546eda4e3".format(coin)
|
||||||
|
price_url = "https://min-api.cryptocompare.com/data/price?fsym={}&tsyms=USD&api_key=94e50805f19646893ee16424918998caad5ec6accff539a23ffee8e546eda4e3".format(coin)
|
||||||
|
tasks = [asyncio.ensure_future(grab_url(day_avg_url)),
|
||||||
|
asyncio.ensure_future(grab_url(price_multi_url)),
|
||||||
|
asyncio.ensure_future(grab_url(price_url))]
|
||||||
|
task = self.bot.create_task(asyncio.wait(tasks))
|
||||||
|
task.add_done_callback(parse_coin)
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
url = "https://min-api.cryptocompare.com/data/all/coinlist"
|
||||||
|
asyncio.ensure_future(grab_url(url), \
|
||||||
|
loop=self.bot.loop).add_done_callback(process_lookups)
|
||||||
|
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
####################################################################################### EOF
|
####################################################################################### EOF
|
||||||
|
@ -1,215 +1,224 @@
|
|||||||
# -*- coding: utf-8 -*- ############################################################### SOF
|
# -*- coding: utf-8 -*- ############################################################### SOF
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
|
|
||||||
from irc3.plugins.command import command
|
???HYDRA???
|
||||||
from irc3.plugins.cron import cron
|
|
||||||
from irc3.plugins import core
|
|
||||||
import irc3
|
|
||||||
import os
|
|
||||||
from random import randint as rint
|
|
||||||
from random import shuffle
|
|
||||||
from datetime import datetime
|
|
||||||
import socket
|
|
||||||
|
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
|
|
||||||
class dr1p:
|
##################
|
||||||
def __init__():
|
if SERVICES_HYDRA:
|
||||||
dr1p.designation=""
|
##################
|
||||||
dr1p.enforcing=False
|
|
||||||
dr1p.purpose=""
|
|
||||||
dr1p.color=""
|
|
||||||
dr1p.keyid=""
|
|
||||||
dr1p.home=""
|
|
||||||
|
|
||||||
###########################################################################################
|
from irc3.plugins.command import command
|
||||||
###########################################################################################
|
from irc3.plugins.cron import cron
|
||||||
|
from irc3.plugins import core
|
||||||
@irc3.plugin
|
import irc3
|
||||||
class Plugin:
|
import os
|
||||||
def generate_keyid_token(self,mode=1):
|
from random import randint as rint
|
||||||
if mode:
|
from random import shuffle
|
||||||
token=""
|
from datetime import datetime
|
||||||
for i in range(3): token+=hex(rint(0,255))[2:].zfill(2).upper()
|
import socket
|
||||||
token+=hex(int(datetime.now().timestamp()))[-4:].upper()
|
|
||||||
token=list(token)
|
|
||||||
shuffle(token)
|
|
||||||
token=''.join(token)
|
|
||||||
return token
|
|
||||||
elif not mode:
|
|
||||||
keyid=""
|
|
||||||
for i in range(7): keyid+=hex(rint(0,255))[2:].zfill(2).upper()
|
|
||||||
keyid+=hex(int(datetime.now().timestamp()))[-4:].upper()
|
|
||||||
keyid=list(keyid)
|
|
||||||
shuffle(keyid)
|
|
||||||
keyid=''.join(keyid)
|
|
||||||
return keyid
|
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
|
||||||
def __init__(self,bot):
|
class dr1p:
|
||||||
self.bot=bot
|
def __init__():
|
||||||
|
dr1p.designation=""
|
||||||
|
dr1p.enforcing=False
|
||||||
|
dr1p.purpose=""
|
||||||
dr1p.color=""
|
dr1p.color=""
|
||||||
try:
|
dr1p.keyid=""
|
||||||
dr1p.purpose=os.environ['HYDRA_PURPOSE']
|
dr1p.home=""
|
||||||
dr1p.designation=os.environ['HYDRA_DESIGNATION']
|
|
||||||
dr1p.home=os.environ['HYDRA_HOME']
|
|
||||||
dr1p.enforcing=False
|
|
||||||
except:
|
|
||||||
dr1p.designation="dupe"
|
|
||||||
dr1p.enforcing=False
|
|
||||||
return
|
|
||||||
if dr1p.designation=="core":
|
|
||||||
dr1p.color="\x0304"
|
|
||||||
dr1p.keyid=self.generate_keyid_token(0)
|
|
||||||
dr1p.token=self.generate_keyid_token(1)
|
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
|
||||||
def server_ready(self):
|
@irc3.plugin
|
||||||
if not dr1p.designation=='core':
|
class Plugin:
|
||||||
dr1p.token=self.generate_keyid_token()
|
def generate_keyid_token(self,mode=1):
|
||||||
self.bot.privmsg("maple",f"[{dr1p.keyid}] - [{dr1p.token}] - purpose: {dr1p.purpose} - dupe - connected")
|
if mode:
|
||||||
else:
|
token=""
|
||||||
dr1p.keyid=self.generate_keyid_token(0)
|
for i in range(3): token+=hex(rint(0,255))[2:].zfill(2).upper()
|
||||||
dr1p.token=self.generate_keyid_token(1)
|
token+=hex(int(datetime.now().timestamp()))[-4:].upper()
|
||||||
self.bot.privmsg("maple",f"[{dr1p.keyid}] - [{dr1p.token}] - purpose: {dr1p.purpose} - core - connected")
|
token=list(token)
|
||||||
|
shuffle(token)
|
||||||
|
token=''.join(token)
|
||||||
|
return token
|
||||||
|
elif not mode:
|
||||||
|
keyid=""
|
||||||
|
for i in range(7): keyid+=hex(rint(0,255))[2:].zfill(2).upper()
|
||||||
|
keyid+=hex(int(datetime.now().timestamp()))[-4:].upper()
|
||||||
|
keyid=list(keyid)
|
||||||
|
shuffle(keyid)
|
||||||
|
keyid=''.join(keyid)
|
||||||
|
return keyid
|
||||||
|
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
|
|
||||||
@irc3.event(irc3.rfc.ERR_NICK)
|
def __init__(self,bot):
|
||||||
def on_errnick(self,srv=None,retcode=None,me=None,nick=None,data=None):
|
self.bot=bot
|
||||||
if not dr1p.designation=='core': return
|
dr1p.color=""
|
||||||
msg=f'err_nick - srv:{srv} - retcode:{retcode} - me:{me} - nick:{nick} - data:{data}'
|
try:
|
||||||
self.bot.privmsg("maple",msg.lower())
|
dr1p.purpose=os.environ['HYDRA_PURPOSE']
|
||||||
|
dr1p.designation=os.environ['HYDRA_DESIGNATION']
|
||||||
|
dr1p.home=os.environ['HYDRA_HOME']
|
||||||
|
dr1p.enforcing=False
|
||||||
|
except:
|
||||||
|
dr1p.designation="dupe"
|
||||||
|
dr1p.enforcing=False
|
||||||
|
return
|
||||||
|
if dr1p.designation=="core":
|
||||||
|
dr1p.color="\x0304"
|
||||||
|
dr1p.keyid=self.generate_keyid_token(0)
|
||||||
|
dr1p.token=self.generate_keyid_token(1)
|
||||||
|
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
|
|
||||||
@irc3.event(irc3.rfc.NEW_NICK)
|
def server_ready(self):
|
||||||
def on_newnick(self,nick=None,new_nick=None):
|
if not dr1p.designation=='core':
|
||||||
if not dr1p.designation=='core': return
|
dr1p.token=self.generate_keyid_token()
|
||||||
if nick==self.bot.config['nick'] or new_nick==self.bot.config['nick']:
|
self.bot.privmsg("maple",f"[{dr1p.keyid}] - [{dr1p.token}] - purpose: {dr1p.purpose} - dupe - connected")
|
||||||
msg=f'new_nick - nick:{nick} - new_nick:{new_nick}'
|
else:
|
||||||
|
dr1p.keyid=self.generate_keyid_token(0)
|
||||||
|
dr1p.token=self.generate_keyid_token(1)
|
||||||
|
self.bot.privmsg("maple",f"[{dr1p.keyid}] - [{dr1p.token}] - purpose: {dr1p.purpose} - core - connected")
|
||||||
|
|
||||||
|
###################################################################################
|
||||||
|
###################################################################################
|
||||||
|
|
||||||
|
@irc3.event(irc3.rfc.ERR_NICK)
|
||||||
|
def on_errnick(self,srv=None,retcode=None,me=None,nick=None,data=None):
|
||||||
|
if not dr1p.designation=='core': return
|
||||||
|
msg=f'err_nick - srv:{srv} - retcode:{retcode} - me:{me} - nick:{nick} - data:{data}'
|
||||||
self.bot.privmsg("maple",msg.lower())
|
self.bot.privmsg("maple",msg.lower())
|
||||||
|
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
|
|
||||||
@irc3.event(irc3.rfc.CTCP)
|
@irc3.event(irc3.rfc.NEW_NICK)
|
||||||
def on_ctcp(self,mask=None,event=None,target=None,ctcp=None):
|
def on_newnick(self,nick=None,new_nick=None):
|
||||||
if not dr1p.designation=='core': return
|
if not dr1p.designation=='core': return
|
||||||
msg=f'ctcpd - mask:{mask} - event:{event} - target:{target} - ctcp:{ctcp}'
|
if nick==self.bot.config['nick'] or new_nick==self.bot.config['nick']:
|
||||||
self.bot.privmsg("maple",msg.lower())
|
msg=f'new_nick - nick:{nick} - new_nick:{new_nick}'
|
||||||
|
self.bot.privmsg("maple",msg.lower())
|
||||||
|
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
|
|
||||||
@irc3.event(irc3.rfc.INVITE)
|
@irc3.event(irc3.rfc.CTCP)
|
||||||
def on_invite(self,mask=None,channel=None):
|
def on_ctcp(self,mask=None,event=None,target=None,ctcp=None):
|
||||||
if not dr1p.designation=='core': return
|
if not dr1p.designation=='core': return
|
||||||
msg=f'invited - mask:{mask} - channel:{channel}'
|
msg=f'ctcpd - mask:{mask} - event:{event} - target:{target} - ctcp:{ctcp}'
|
||||||
self.bot.privmsg("maple",msg.lower())
|
self.bot.privmsg("maple",msg.lower())
|
||||||
|
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
|
|
||||||
@irc3.event(irc3.rfc.KICK)
|
@irc3.event(irc3.rfc.INVITE)
|
||||||
def on_kick(self,mask=None,event=None,channel=None,target=None,data=None):
|
def on_invite(self,mask=None,channel=None):
|
||||||
msg=f'kicked - mask:{mask} - event:{event} - target:{target} - data:{data}'
|
if not dr1p.designation=='core': return
|
||||||
self.bot.privmsg(dr1p.home,msg)
|
msg=f'invited - mask:{mask} - channel:{channel}'
|
||||||
|
self.bot.privmsg("maple",msg.lower())
|
||||||
|
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
|
|
||||||
@irc3.event(irc3.rfc.PRIVMSG)
|
@irc3.event(irc3.rfc.KICK)
|
||||||
def on_privmsg(self,mask=None,event=None,target=None,data=None,**kw):
|
def on_kick(self,mask=None,event=None,channel=None,target=None,data=None):
|
||||||
if mask.nick=='d' and 'maple' in data and 'list' in data and 'hydra' in data:
|
msg=f'kicked - mask:{mask} - event:{event} - target:{target} - data:{data}'
|
||||||
msg=f"{dr1p.color}[hydra:{dr1p.keyid}] - purpose: {dr1p.purpose}"
|
self.bot.privmsg(dr1p.home,msg)
|
||||||
self.bot.privmsg(target,msg)
|
|
||||||
msg=f"{dr1p.color}[hydra:{dr1p.keyid}] - hostname: {socket.gethostname()}"
|
###################################################################################
|
||||||
self.bot.privmsg(target,msg)
|
###################################################################################
|
||||||
for _ in self.bot.config['includes']:
|
|
||||||
msg=f"{dr1p.color}[hydra:{dr1p.keyid}] - hostname: {socket.gethostname()} - plugin: {_}"
|
@irc3.event(irc3.rfc.PRIVMSG)
|
||||||
|
def on_privmsg(self,mask=None,event=None,target=None,data=None,**kw):
|
||||||
|
if mask.nick=='d' and 'maple' in data and 'list' in data and 'hydra' in data:
|
||||||
|
msg=f"{dr1p.color}[hydra:{dr1p.keyid}] - purpose: {dr1p.purpose}"
|
||||||
self.bot.privmsg(target,msg)
|
self.bot.privmsg(target,msg)
|
||||||
return
|
msg=f"{dr1p.color}[hydra:{dr1p.keyid}] - hostname: {socket.gethostname()}"
|
||||||
if target!=self.bot.config['nick'] and mask.nick==self.bot.nick:
|
self.bot.privmsg(target,msg)
|
||||||
data=""
|
for _ in self.bot.config['includes']:
|
||||||
return
|
msg=f"{dr1p.color}[hydra:{dr1p.keyid}] - hostname: {socket.gethostname()} - plugin: {_}"
|
||||||
if mask.nick==self.bot.nick and target==self.bot.config['nick'] and dr1p.designation=='core':
|
self.bot.privmsg(target,msg)
|
||||||
if data.endswith('dupe - connected'):
|
return
|
||||||
_keyid=data.split("[")[1].split("]")[0]
|
if target!=self.bot.config['nick'] and mask.nick==self.bot.nick:
|
||||||
_diyek=_keyid[::-1]
|
data=""
|
||||||
msg=f'[KEYID:{_keyid}] - [DIYEK:{_diyek}] - COLOR:{rint(16,87)}'
|
return
|
||||||
self.bot.privmsg(self.bot.config['nick'],msg)
|
if mask.nick==self.bot.nick and target==self.bot.config['nick'] and dr1p.designation=='core':
|
||||||
if mask.nick==self.bot.nick and target==self.bot.config['nick'] and dr1p.designation=='dupe':
|
if data.endswith('dupe - connected'):
|
||||||
if not data.find('DIYEK')==-1:
|
_keyid=data.split("[")[1].split("]")[0]
|
||||||
_keyid=data.split(":")[1].split("]")[0]
|
_diyek=_keyid[::-1]
|
||||||
if _keyid.lower()==dr1p.keyid.lower():
|
msg=f'[KEYID:{_keyid}] - [DIYEK:{_diyek}] - COLOR:{rint(16,87)}'
|
||||||
if not data.find("] - [DIYEK:")==-1:
|
self.bot.privmsg(self.bot.config['nick'],msg)
|
||||||
_diyek=data.split("] - [DIYEK:")[1].split("]")[0]
|
if mask.nick==self.bot.nick and target==self.bot.config['nick'] and dr1p.designation=='dupe':
|
||||||
if _keyid.lower()==_diyek[::-1].lower():
|
if not data.find('DIYEK')==-1:
|
||||||
_color=int(data.split(" - COLOR:")[1].strip())
|
_keyid=data.split(":")[1].split("]")[0]
|
||||||
if not dr1p.color:
|
if _keyid.lower()==dr1p.keyid.lower():
|
||||||
dr1p.color=f"\x03{str(_color)}"
|
if not data.find("] - [DIYEK:")==-1:
|
||||||
if dr1p.designation=='core':
|
_diyek=data.split("] - [DIYEK:")[1].split("]")[0]
|
||||||
msg=f"{dr1p.color}[maple:{dr1p.keyid}] - "
|
if _keyid.lower()==_diyek[::-1].lower():
|
||||||
else:
|
_color=int(data.split(" - COLOR:")[1].strip())
|
||||||
|
if not dr1p.color:
|
||||||
|
dr1p.color=f"\x03{str(_color)}"
|
||||||
|
if dr1p.designation=='core':
|
||||||
|
msg=f"{dr1p.color}[maple:{dr1p.keyid}] - "
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
msg=f"{dr1p.color}[hydra:{dr1p.keyid}] - "
|
||||||
|
except:
|
||||||
|
dr1p.color="\x0303"
|
||||||
|
msg=f"{dr1p.color}[hydra:{dr1p.keyid}] - "
|
||||||
|
if mask.nick!=self.bot.config['nick']:
|
||||||
|
if target!=dr1p.home: return
|
||||||
|
if target==dr1p.home: return
|
||||||
|
msg+=f'event:{event} - mask:{mask} - target:{target} - data:'
|
||||||
|
msg+=f'{data}'
|
||||||
|
if kw: msg+=f" - kw:{kw}"
|
||||||
try:
|
try:
|
||||||
msg=f"{dr1p.color}[hydra:{dr1p.keyid}] - "
|
keyid1=msg.split(":")[1].split(']')[0].lower()
|
||||||
|
keyid2=msg.split("] - [")[1].lower()
|
||||||
|
if keyid1==keyid2: self.bot.privmsg(dr1p.home,msg.lower())
|
||||||
except:
|
except:
|
||||||
dr1p.color="\x0303"
|
self.bot.privmsg(dr1p.home,"exception - "+msg.lower())
|
||||||
msg=f"{dr1p.color}[hydra:{dr1p.keyid}] - "
|
|
||||||
if mask.nick!=self.bot.config['nick']:
|
|
||||||
if target!=dr1p.home: return
|
|
||||||
if target==dr1p.home: return
|
|
||||||
msg+=f'event:{event} - mask:{mask} - target:{target} - data:'
|
|
||||||
msg+=f'{data}'
|
|
||||||
if kw: msg+=f" - kw:{kw}"
|
|
||||||
try:
|
|
||||||
keyid1=msg.split(":")[1].split(']')[0].lower()
|
|
||||||
keyid2=msg.split("] - [")[1].lower()
|
|
||||||
if keyid1==keyid2: self.bot.privmsg(dr1p.home,msg.lower())
|
|
||||||
except:
|
|
||||||
self.bot.privmsg(dr1p.home,"exception - "+msg.lower())
|
|
||||||
|
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
|
|
||||||
@irc3.event(irc3.rfc.MY_PRIVMSG)
|
@irc3.event(irc3.rfc.MY_PRIVMSG)
|
||||||
def on_my_privmsg(self,mask=None,event=None,target=None,data=None,**kw):
|
def on_my_privmsg(self,mask=None,event=None,target=None,data=None,**kw):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
|
|
||||||
@irc3.event(irc3.rfc.JOIN_PART_QUIT)
|
@irc3.event(irc3.rfc.JOIN_PART_QUIT)
|
||||||
def on_join_part_quit(self,mask=None,target=None,data=None,**kw):
|
def on_join_part_quit(self,mask=None,target=None,data=None,**kw):
|
||||||
target=kw['channel']
|
target=kw['channel']
|
||||||
if mask.nick==self.bot.config['nick']:
|
if mask.nick==self.bot.config['nick']:
|
||||||
if kw['event']=='JOIN':
|
if kw['event']=='JOIN':
|
||||||
self.bot.privmsg("maple",f"[{dr1p.keyid}] - [{dr1p.token}] - joined {target}".lower())
|
self.bot.privmsg("maple",f"[{dr1p.keyid}] - [{dr1p.token}] - joined {target}".lower())
|
||||||
if target!=dr1p.home:
|
if target!=dr1p.home:
|
||||||
if dr1p.enforcing:
|
if dr1p.enforcing:
|
||||||
reason=".[d]."
|
reason=".[d]."
|
||||||
self.bot.part(target,reason)
|
self.bot.part(target,reason)
|
||||||
self.bot.privmsg("maple",f"parted {target} - {reason}".lower())
|
self.bot.privmsg("maple",f"parted {target} - {reason}".lower())
|
||||||
if kw['event']=='PART':
|
if kw['event']=='PART':
|
||||||
if dr1p.designation=="core":
|
if dr1p.designation=="core":
|
||||||
msg=f"[maple:{dr1p.keyid}] -"
|
msg=f"[maple:{dr1p.keyid}] -"
|
||||||
else:
|
else:
|
||||||
msg=f"[hydra:{dr1p.keyid}] -"
|
msg=f"[hydra:{dr1p.keyid}] -"
|
||||||
self.bot.privmsg(dr1p.home,msg+f"parted {target} - {data}")
|
self.bot.privmsg(dr1p.home,msg+f"parted {target} - {data}")
|
||||||
if kw['event']=='QUIT':
|
if kw['event']=='QUIT':
|
||||||
if dr1p.designation=="core":
|
if dr1p.designation=="core":
|
||||||
msg=f"[maple:{dr1p.keyid}] -"
|
msg=f"[maple:{dr1p.keyid}] -"
|
||||||
else:
|
else:
|
||||||
msg=f"[hydra:{dr1p.keyid}] -"
|
msg=f"[hydra:{dr1p.keyid}] -"
|
||||||
self.bot.privmsg("maple",msg+f"quit {target} - {data}")
|
self.bot.privmsg("maple",msg+f"quit {target} - {data}")
|
||||||
|
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
####################################################################################### EOF
|
####################################################################################### EOF
|
||||||
|
@ -1,503 +1,512 @@
|
|||||||
# -*- coding: utf-8 -*- ############################################################### SOF
|
# -*- coding: utf-8 -*- ############################################################### SOF
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
|
|
||||||
import os
|
???OPENAI???
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from difflib import SequenceMatcher
|
|
||||||
import urllib.parse
|
|
||||||
import irc3
|
|
||||||
import openai
|
|
||||||
import requests
|
|
||||||
from irc3.plugins.command import command
|
|
||||||
from random import randint as rint
|
|
||||||
from random import choices
|
|
||||||
from glob import glob
|
|
||||||
from plugins.tool_log_plugin import FOG
|
|
||||||
|
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
|
|
||||||
dir_path = os.path.dirname(os.path.realpath(__file__))
|
###################
|
||||||
|
if SERVICES_OPENAI:
|
||||||
|
###################
|
||||||
|
|
||||||
###########################################################################################
|
import os
|
||||||
###########################################################################################
|
import re
|
||||||
|
import sys
|
||||||
def getenv(s):
|
from difflib import SequenceMatcher
|
||||||
try:
|
import urllib.parse
|
||||||
s = os.environ[s]
|
import irc3
|
||||||
return s
|
import openai
|
||||||
except:
|
import requests
|
||||||
fog=FOG().fog
|
from irc3.plugins.command import command
|
||||||
error_type="environmental variable error"
|
from random import randint as rint
|
||||||
error_reason=f"exported {s} not found"
|
from random import choices
|
||||||
fog(f"{error_type}: {error_reason}")
|
from glob import glob
|
||||||
sys.exit(1)
|
from plugins.tool_log_plugin import FOG
|
||||||
|
|
||||||
###########################################################################################
|
|
||||||
###########################################################################################
|
|
||||||
|
|
||||||
OPENAI_KEY = getenv('OPENAI_KEY')
|
|
||||||
|
|
||||||
###########################################################################################
|
|
||||||
###########################################################################################
|
|
||||||
|
|
||||||
DREY="\x02\x0315"
|
|
||||||
GREY="\x02\x0314"
|
|
||||||
DRED="\x02\x0302"
|
|
||||||
LRED="\x02\x0312"
|
|
||||||
|
|
||||||
###########################################################################################
|
|
||||||
###########################################################################################
|
|
||||||
|
|
||||||
class OPENAI_MESSAGE_HISTORY():
|
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
|
||||||
openai_messages = []
|
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||||
user_messages = []
|
|
||||||
user_users = []
|
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
|
||||||
def __init__(self):
|
def getenv(s):
|
||||||
self.processing=0
|
try:
|
||||||
|
s = os.environ[s]
|
||||||
|
return s
|
||||||
|
except:
|
||||||
|
fog=FOG().fog
|
||||||
|
error_type="environmental variable error"
|
||||||
|
error_reason=f"exported {s} not found"
|
||||||
|
fog(f"{error_type}: {error_reason}")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
|
||||||
def push_openai_messages(self,data):
|
OPENAI_KEY = getenv('OPENAI_KEY')
|
||||||
self.openai_messages = self.openai_messages[-1:] + self.openai_messages[:-1]
|
|
||||||
self.openai_messages[0] = data
|
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
|
||||||
def push_user_messages(self,user,data):
|
DREY="\x02\x0315"
|
||||||
self.user_users.append(user)
|
GREY="\x02\x0314"
|
||||||
self.user_messages.append(data)
|
DRED="\x02\x0302"
|
||||||
|
LRED="\x02\x0312"
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
|
||||||
def similar(self,a,b):
|
class OPENAI_MESSAGE_HISTORY():
|
||||||
return SequenceMatcher(None,a,b).ratio()
|
|
||||||
|
|
||||||
###########################################################################################
|
###################################################################################
|
||||||
###########################################################################################
|
###################################################################################
|
||||||
|
|
||||||
@irc3.plugin
|
openai_messages = []
|
||||||
class Plugin:
|
user_messages = []
|
||||||
|
user_users = []
|
||||||
|
|
||||||
def __init__(self, bot):
|
###################################################################################
|
||||||
self.bot = bot
|
###################################################################################
|
||||||
self.bot.openai_history=OPENAI_MESSAGE_HISTORY()
|
|
||||||
for _ in range(5):
|
def __init__(self):
|
||||||
self.bot.openai_history.openai_messages.append("")
|
self.processing=0
|
||||||
self.openai_io=[]
|
|
||||||
self.start_chat_log=""
|
###################################################################################
|
||||||
self.lastterm=""
|
###################################################################################
|
||||||
self.lastresponse=""
|
|
||||||
self.default_model="text-davinci-002"
|
def push_openai_messages(self,data):
|
||||||
self.temperature=1.1
|
self.openai_messages = self.openai_messages[-1:] + self.openai_messages[:-1]
|
||||||
self.max_tokens=2000
|
self.openai_messages[0] = data
|
||||||
self.top_p=1.0
|
|
||||||
self.frequency_penalty=0.0
|
###################################################################################
|
||||||
self.presence_penalty=0.0
|
###################################################################################
|
||||||
self.flipcolor=False
|
|
||||||
self.default_load()
|
def push_user_messages(self,user,data):
|
||||||
|
self.user_users.append(user)
|
||||||
|
self.user_messages.append(data)
|
||||||
|
|
||||||
|
###################################################################################
|
||||||
|
###################################################################################
|
||||||
|
|
||||||
|
def similar(self,a,b):
|
||||||
|
return SequenceMatcher(None,a,b).ratio()
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
|
||||||
@command(permission='view')
|
@irc3.plugin
|
||||||
def ai(self, mask, target, args):
|
class Plugin:
|
||||||
"""OpenAi Question A Term
|
|
||||||
%%ai <term>...
|
def __init__(self, bot):
|
||||||
"""
|
self.bot = bot
|
||||||
term=' '.join(args['<term>'])
|
self.bot.openai_history=OPENAI_MESSAGE_HISTORY()
|
||||||
if not term[-1] == ".": term+="."
|
for _ in range(5):
|
||||||
openai.api_key = OPENAI_KEY
|
self.bot.openai_history.openai_messages.append("")
|
||||||
print(f"<<< openai: processing {target} {mask.nick.lower()} message: {term.lower()}")
|
self.openai_io=[]
|
||||||
MESSAGE_OK=True
|
self.start_chat_log=""
|
||||||
TRAP_OK=True
|
self.lastterm=""
|
||||||
LOOP_COUNT_LIMIT=5
|
self.lastresponse=""
|
||||||
LOOP_COUNT=0
|
self.default_model="text-davinci-002"
|
||||||
while MESSAGE_OK:
|
self.temperature=1.1
|
||||||
LOOP_COUNT+=1
|
self.max_tokens=2000
|
||||||
print(f'<<< loop: {LOOP_COUNT} >>>')
|
self.top_p=1.0
|
||||||
prompt_text=f'{term}'
|
self.frequency_penalty=0.0
|
||||||
self.lastterm=f'{term}'
|
self.presence_penalty=0.0
|
||||||
response=openai.Completion.create(
|
self.flipcolor=False
|
||||||
model=self.default_model,
|
self.default_load()
|
||||||
prompt=prompt_text,
|
|
||||||
temperature=self.temperature,
|
###################################################################################
|
||||||
max_tokens=self.max_tokens,
|
###################################################################################
|
||||||
top_p=self.top_p,
|
|
||||||
frequency_penalty=self.frequency_penalty,
|
@command(permission='view')
|
||||||
presence_penalty=self.presence_penalty
|
def ai(self, mask, target, args):
|
||||||
)
|
"""OpenAi Question A Term
|
||||||
self.lastresponse=response
|
%%ai <term>...
|
||||||
openai_message=response.choices[0].text
|
"""
|
||||||
USER=mask.nick
|
term=' '.join(args['<term>'])
|
||||||
MESSAGE=term
|
if not term[-1] == ".": term+="."
|
||||||
if MESSAGE_OK and TRAP_OK:
|
openai.api_key = OPENAI_KEY
|
||||||
self.bot.openai_history.push_openai_messages(openai_message)
|
print(f"<<< openai: processing {target} {mask.nick.lower()} message: {term.lower()}")
|
||||||
_msg = re.findall(r'.{1,400}(?:\s+|$)', openai_message)
|
MESSAGE_OK=True
|
||||||
COLOR=""
|
TRAP_OK=True
|
||||||
self.flipcolor = not self.flipcolor
|
LOOP_COUNT_LIMIT=5
|
||||||
if self.flipcolor:
|
LOOP_COUNT=0
|
||||||
COLOR=DREY
|
while MESSAGE_OK:
|
||||||
else:
|
LOOP_COUNT+=1
|
||||||
COLOR=GREY
|
print(f'<<< loop: {LOOP_COUNT} >>>')
|
||||||
for i,_ in enumerate(_msg):
|
prompt_text=f'{term}'
|
||||||
if i==0:
|
self.lastterm=f'{term}'
|
||||||
self.bot.privmsg(target, f"\x02\x0302{USER:}\x0F\x02\x0309 ▶ {COLOR}{_.strip()}\x0F")
|
response=openai.Completion.create(
|
||||||
|
model=self.default_model,
|
||||||
|
prompt=prompt_text,
|
||||||
|
temperature=self.temperature,
|
||||||
|
max_tokens=self.max_tokens,
|
||||||
|
top_p=self.top_p,
|
||||||
|
frequency_penalty=self.frequency_penalty,
|
||||||
|
presence_penalty=self.presence_penalty
|
||||||
|
)
|
||||||
|
self.lastresponse=response
|
||||||
|
openai_message=response.choices[0].text
|
||||||
|
USER=mask.nick
|
||||||
|
MESSAGE=term
|
||||||
|
if MESSAGE_OK and TRAP_OK:
|
||||||
|
self.bot.openai_history.push_openai_messages(openai_message)
|
||||||
|
_msg = re.findall(r'.{1,400}(?:\s+|$)', openai_message)
|
||||||
|
COLOR=""
|
||||||
|
self.flipcolor = not self.flipcolor
|
||||||
|
if self.flipcolor:
|
||||||
|
COLOR=DREY
|
||||||
else:
|
else:
|
||||||
self.bot.privmsg(target, f"{COLOR}{_.strip()}\x0F")
|
COLOR=GREY
|
||||||
MESSAGE_OK=False
|
for i,_ in enumerate(_msg):
|
||||||
print('<<< openai finished >>>')
|
if i==0:
|
||||||
if LOOP_COUNT > LOOP_COUNT_LIMIT:
|
self.bot.privmsg(target, f"\x02\x0302{USER:}\x0F\x02\x0309 ▶ {COLOR}{_.strip()}\x0F")
|
||||||
print(f"<<< openai failed: bouncing to mapleai >>>")
|
else:
|
||||||
self.bot.history.bounce={'user':USER,'message':term,'target':target}
|
self.bot.privmsg(target, f"{COLOR}{_.strip()}\x0F")
|
||||||
break
|
MESSAGE_OK=False
|
||||||
|
print('<<< openai finished >>>')
|
||||||
|
if LOOP_COUNT > LOOP_COUNT_LIMIT:
|
||||||
|
print(f"<<< openai failed: bouncing to mapleai >>>")
|
||||||
|
self.bot.history.bounce={'user':USER,'message':term,'target':target}
|
||||||
|
break
|
||||||
|
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
|
|
||||||
def random_float(self,n):
|
def random_float(self,n):
|
||||||
i=float(rint(0,n))
|
i=float(rint(0,n))
|
||||||
i/=10
|
i/=10
|
||||||
return i
|
return i
|
||||||
|
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
|
|
||||||
def print_response_properties(self,target):
|
def print_response_properties(self,target):
|
||||||
self.bot.privmsg(target, f"{DRED} model{GREY}: {LRED}{self.default_model}")
|
self.bot.privmsg(target, f"{DRED} model{GREY}: {LRED}{self.default_model}")
|
||||||
self.bot.privmsg(target, f"{DRED} temperature{GREY}: {LRED}{self.temperature}")
|
self.bot.privmsg(target, f"{DRED} temperature{GREY}: {LRED}{self.temperature}")
|
||||||
self.bot.privmsg(target, f"{DRED} max_tokens{GREY}: {LRED}{self.max_tokens}")
|
self.bot.privmsg(target, f"{DRED} max_tokens{GREY}: {LRED}{self.max_tokens}")
|
||||||
self.bot.privmsg(target, f"{DRED} top_p{GREY}: {LRED}{self.top_p}")
|
self.bot.privmsg(target, f"{DRED} top_p{GREY}: {LRED}{self.top_p}")
|
||||||
self.bot.privmsg(target, f"{DRED}frequency_penalty{GREY}: {LRED}{self.frequency_penalty}")
|
self.bot.privmsg(target, f"{DRED}frequency_penalty{GREY}: {LRED}{self.frequency_penalty}")
|
||||||
self.bot.privmsg(target, f"{DRED} presence_penalty{GREY}: {LRED}{self.presence_penalty}")
|
self.bot.privmsg(target, f"{DRED} presence_penalty{GREY}: {LRED}{self.presence_penalty}")
|
||||||
|
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
|
|
||||||
@command(permission='admin')
|
@command(permission='admin')
|
||||||
def airand(self, mask, target, args):
|
def airand(self, mask, target, args):
|
||||||
"""OpenAi Randomize Response Properties
|
"""OpenAi Randomize Response Properties
|
||||||
%%airand
|
%%airand
|
||||||
"""
|
"""
|
||||||
MODELS=["text-davinci-002","text-curie-001","text-babbage-001","text-ada-001"]
|
MODELS=["text-davinci-002","text-curie-001","text-babbage-001","text-ada-001"]
|
||||||
MODEL=choices(MODELS)[0]
|
MODEL=choices(MODELS)[0]
|
||||||
TOKEN_CEILING=1000
|
TOKEN_CEILING=1000
|
||||||
if MODEL==MODELS[0]:
|
if MODEL==MODELS[0]:
|
||||||
TOKEN_CEILING=2000
|
TOKEN_CEILING=2000
|
||||||
self.default_model=MODEL
|
self.default_model=MODEL
|
||||||
self.temperature=self.random_float(20)
|
self.temperature=self.random_float(20)
|
||||||
self.max_tokens=rint(1,TOKEN_CEILING)
|
self.max_tokens=rint(1,TOKEN_CEILING)
|
||||||
self.top_p=self.random_float(10)
|
self.top_p=self.random_float(10)
|
||||||
self.frequency_penalty=self.random_float(10000)
|
self.frequency_penalty=self.random_float(10000)
|
||||||
self.presence_penalty=self.random_float(20)
|
self.presence_penalty=self.random_float(20)
|
||||||
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}randomizing personality properties {GREY}>>>"))
|
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}randomizing personality properties {GREY}>>>"))
|
||||||
self.print_response_properties(target)
|
self.print_response_properties(target)
|
||||||
|
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
|
|
||||||
def default_load(self):
|
def default_load(self):
|
||||||
FILE='%s/../personalities/default.db' % dir_path
|
FILE='%s/../personalities/default.db' % dir_path
|
||||||
f=open(FILE,'r')
|
f=open(FILE,'r')
|
||||||
self.start_chat_log=f.read()
|
self.start_chat_log=f.read()
|
||||||
if self.start_chat_log.find('\n')==0:
|
if self.start_chat_log.find('\n')==0:
|
||||||
self.start_chat_log=self.start_chat_log[1:]
|
self.start_chat_log=self.start_chat_log[1:]
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
|
|
||||||
@command(permission='admin')
|
@command(permission='admin')
|
||||||
def airead(self, mask, target, args):
|
def airead(self, mask, target, args):
|
||||||
"""OpenAi Read Current Personality
|
"""OpenAi Read Current Personality
|
||||||
%%airead
|
%%airead
|
||||||
"""
|
"""
|
||||||
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}reading current personality profile {GREY}>>>"))
|
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}reading current personality profile {GREY}>>>"))
|
||||||
if self.start_chat_log==None:
|
if self.start_chat_log==None:
|
||||||
self.bot.privmsg(target,"<NULL>")
|
self.bot.privmsg(target,"<NULL>")
|
||||||
else:
|
else:
|
||||||
for _ in self.start_chat_log.splitlines():
|
for _ in self.start_chat_log.splitlines():
|
||||||
|
msg = re.findall(r'.{1,400}(?:\s+|$)', _)
|
||||||
|
for __ in msg:
|
||||||
|
self.bot.privmsg(target, f'{__.strip()}')
|
||||||
|
|
||||||
|
###################################################################################
|
||||||
|
###################################################################################
|
||||||
|
|
||||||
|
@command(permission='admin')
|
||||||
|
def aishow(self, mask, target, args):
|
||||||
|
"""OpenAi Show Current Personality Properties and Values.
|
||||||
|
%%aishow
|
||||||
|
"""
|
||||||
|
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}showing current personality properties {GREY}>>>"))
|
||||||
|
self.print_response_properties(target)
|
||||||
|
|
||||||
|
###################################################################################
|
||||||
|
###################################################################################
|
||||||
|
|
||||||
|
@command(permission='admin')
|
||||||
|
def aiterm(self, mask, target, args):
|
||||||
|
"""OpenAi Show Last Term.
|
||||||
|
%%aiterm
|
||||||
|
"""
|
||||||
|
self.bot.privmsg(target, self.bot.emo(f'{GREY}<<< {DRED}showing last term query {GREY}>>>'))
|
||||||
|
for _ in self.lastterm.splitlines():
|
||||||
msg = re.findall(r'.{1,400}(?:\s+|$)', _)
|
msg = re.findall(r'.{1,400}(?:\s+|$)', _)
|
||||||
for __ in msg:
|
for __ in msg:
|
||||||
self.bot.privmsg(target, f'{__.strip()}')
|
self.bot.privmsg(target, f'{__.strip()}')
|
||||||
|
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
|
|
||||||
@command(permission='admin')
|
@command(permission='admin')
|
||||||
def aishow(self, mask, target, args):
|
def airesponse(self, mask, target, args):
|
||||||
"""OpenAi Show Current Personality Properties and Values.
|
"""OpenAi Show Last Server Response.
|
||||||
%%aishow
|
%%airesponse
|
||||||
"""
|
"""
|
||||||
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}showing current personality properties {GREY}>>>"))
|
self.bot.privmsg(target, self.bot.emo(f'{GREY}<<< {DRED}showing last openai server response {GREY}>>>'))
|
||||||
self.print_response_properties(target)
|
msg=[]
|
||||||
|
FINISH_REASON=self.lastresponse['choices'][0]['finish_reason']
|
||||||
|
INDEX=self.lastresponse['choices'][0]['index']
|
||||||
|
LOGPROBS=self.lastresponse['choices'][0]['logprobs']
|
||||||
|
TEXT=self.lastresponse['choices'][0]['text'].strip()
|
||||||
|
MODEL=self.lastresponse['model']
|
||||||
|
OBJECT=MODEL=self.lastresponse['object']
|
||||||
|
COMPLETION_TOKENS=MODEL=self.lastresponse['usage']['completion_tokens']
|
||||||
|
PROMPT_TOKENS=MODEL=self.lastresponse['usage']['prompt_tokens']
|
||||||
|
TOTAL_TOKENS=MODEL=self.lastresponse['usage']['total_tokens']
|
||||||
|
_TEXT=re.findall(r'.{1,400}(?:\s+|$)', TEXT)
|
||||||
|
msg.append(f'{DRED}completion_tokens{GREY}: {LRED}{COMPLETION_TOKENS}')
|
||||||
|
msg.append(f' {DRED}prompt_tokens{GREY}: {LRED}{PROMPT_TOKENS}')
|
||||||
|
msg.append(f' {DRED}total_tokens{GREY}: {LRED}{TOTAL_TOKENS}')
|
||||||
|
msg.append(f' {DRED}index{GREY}: {LRED}{INDEX}')
|
||||||
|
msg.append(f' {DRED}logprobs{GREY}: {LRED}{LOGPROBS}')
|
||||||
|
if len(_TEXT) > 1:
|
||||||
|
if len(_TEXT[0]) < len(_TEXT[1])//2:
|
||||||
|
print(f'discovered and removed a preface glitch: {_TEXT[0].strip()}')
|
||||||
|
_TEXT.reverse()
|
||||||
|
_TEXT.pop()
|
||||||
|
_TEXT.reverse()
|
||||||
|
for i,_ in enumerate(_TEXT):
|
||||||
|
if i == 0:
|
||||||
|
msg.append(f' {DRED}text{GREY}: {LRED}{_.strip()}')
|
||||||
|
else:
|
||||||
|
msg.append(f'{LRED}{_.strip()}')
|
||||||
|
for _ in msg:
|
||||||
|
self.bot.privmsg(target, _)
|
||||||
|
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
|
|
||||||
@command(permission='admin')
|
@command(permission='admin')
|
||||||
def aiterm(self, mask, target, args):
|
def ailist(self, mask, target, args):
|
||||||
"""OpenAi Show Last Term.
|
"""OpenAi List Personalities
|
||||||
%%aiterm
|
%%ailist
|
||||||
"""
|
"""
|
||||||
self.bot.privmsg(target, self.bot.emo(f'{GREY}<<< {DRED}showing last term query {GREY}>>>'))
|
PATH='%s/../personalities' % dir_path
|
||||||
for _ in self.lastterm.splitlines():
|
FILES=glob(f'{PATH}/*.db')
|
||||||
msg = re.findall(r'.{1,400}(?:\s+|$)', _)
|
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}listing personality databases {GREY}>>>"))
|
||||||
for __ in msg:
|
for i,_ in enumerate(FILES):
|
||||||
self.bot.privmsg(target, f'{__.strip()}')
|
FILE=_.split('/')[-1].replace('.db','')
|
||||||
|
self.bot.privmsg(target, f'{DRED}{i}{GREY}: {LRED}{FILE}')
|
||||||
|
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
|
|
||||||
@command(permission='admin')
|
@command(permission='admin')
|
||||||
def airesponse(self, mask, target, args):
|
def aiload(self, mask, target, args):
|
||||||
"""OpenAi Show Last Server Response.
|
"""OpenAi Load Personalities
|
||||||
%%airesponse
|
%%aiload <msg>...
|
||||||
"""
|
"""
|
||||||
self.bot.privmsg(target, self.bot.emo(f'{GREY}<<< {DRED}showing last openai server response {GREY}>>>'))
|
msg = ''.join(args['<msg>'])
|
||||||
msg=[]
|
try:
|
||||||
FINISH_REASON=self.lastresponse['choices'][0]['finish_reason']
|
i=int(msg)
|
||||||
INDEX=self.lastresponse['choices'][0]['index']
|
except:
|
||||||
LOGPROBS=self.lastresponse['choices'][0]['logprobs']
|
self.bot.privmsg(target, self.bot.emo(f'{GREY}<<< {DRED}error{GREY}: {LRED}not an integer, use only numbers of the personality databases {GREY}>>>'))
|
||||||
TEXT=self.lastresponse['choices'][0]['text'].strip()
|
return
|
||||||
MODEL=self.lastresponse['model']
|
PATH='%s/../personalities' % dir_path
|
||||||
OBJECT=MODEL=self.lastresponse['object']
|
FILES=glob(f'{PATH}/*.db')
|
||||||
COMPLETION_TOKENS=MODEL=self.lastresponse['usage']['completion_tokens']
|
try:
|
||||||
PROMPT_TOKENS=MODEL=self.lastresponse['usage']['prompt_tokens']
|
f=open(FILES[i],'r')
|
||||||
TOTAL_TOKENS=MODEL=self.lastresponse['usage']['total_tokens']
|
buffer=f.read().splitlines()
|
||||||
_TEXT=re.findall(r'.{1,400}(?:\s+|$)', TEXT)
|
f.close()
|
||||||
msg.append(f'{DRED}completion_tokens{GREY}: {LRED}{COMPLETION_TOKENS}')
|
self.start_chat_log='\n'.join(buffer)
|
||||||
msg.append(f' {DRED}prompt_tokens{GREY}: {LRED}{PROMPT_TOKENS}')
|
if self.start_chat_log.find('\n')==0:
|
||||||
msg.append(f' {DRED}total_tokens{GREY}: {LRED}{TOTAL_TOKENS}')
|
self.start_chat_log=self.start_chat_log[1:]
|
||||||
msg.append(f' {DRED}index{GREY}: {LRED}{INDEX}')
|
FILE=FILES[i].split('/')[-1].replace('.db', '')
|
||||||
msg.append(f' {DRED}logprobs{GREY}: {LRED}{LOGPROBS}')
|
self.bot.privmsg(target, self.bot.emo(f'{GREY}<<< {DRED}loaded {FILE} personality database {GREY}>>>'))
|
||||||
if len(_TEXT) > 1:
|
except:
|
||||||
if len(_TEXT[0]) < len(_TEXT[1])//2:
|
self.bot.privmsg(target, self.bot.emo(f'{GREY}<<< {DRED}error{GREY}: {LRED}could not load this personality database, maybe invalid index number {GREY}>>>'))
|
||||||
print(f'discovered and removed a preface glitch: {_TEXT[0].strip()}')
|
return
|
||||||
_TEXT.reverse()
|
|
||||||
_TEXT.pop()
|
|
||||||
_TEXT.reverse()
|
|
||||||
for i,_ in enumerate(_TEXT):
|
|
||||||
if i == 0:
|
|
||||||
msg.append(f' {DRED}text{GREY}: {LRED}{_.strip()}')
|
|
||||||
else:
|
|
||||||
msg.append(f'{LRED}{_.strip()}')
|
|
||||||
for _ in msg:
|
|
||||||
self.bot.privmsg(target, _)
|
|
||||||
|
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
|
|
||||||
@command(permission='admin')
|
@command(permission='admin')
|
||||||
def ailist(self, mask, target, args):
|
def aiwrite(self, mask, target, args):
|
||||||
"""OpenAi List Personalities
|
"""OpenAi List Personalities
|
||||||
%%ailist
|
%%aiwrite <msg>...
|
||||||
"""
|
"""
|
||||||
PATH='%s/../personalities' % dir_path
|
msg = ''.join(args['<msg>'])
|
||||||
FILES=glob(f'{PATH}/*.db')
|
if self.start_chat_log.find('None\n')==0:
|
||||||
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}listing personality databases {GREY}>>>"))
|
self.start_chat_log=self.start_chat_log.replace('None\n','')
|
||||||
for i,_ in enumerate(FILES):
|
msg=msg.replace('.','').replace('/','')
|
||||||
FILE=_.split('/')[-1].replace('.db','')
|
PATH='%s/../personalities' % dir_path
|
||||||
self.bot.privmsg(target, f'{DRED}{i}{GREY}: {LRED}{FILE}')
|
FILE=f'{PATH}/{msg}.db'
|
||||||
|
if os.path.exists(FILE):
|
||||||
#######################################################################################
|
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}personality database already exists, choose a different filename {GREY}>>>"))
|
||||||
#######################################################################################
|
return
|
||||||
|
f=open(FILE, "a")
|
||||||
@command(permission='admin')
|
f.write(f'{self.start_chat_log}\n')
|
||||||
def aiload(self, mask, target, args):
|
|
||||||
"""OpenAi Load Personalities
|
|
||||||
%%aiload <msg>...
|
|
||||||
"""
|
|
||||||
msg = ''.join(args['<msg>'])
|
|
||||||
try:
|
|
||||||
i=int(msg)
|
|
||||||
except:
|
|
||||||
self.bot.privmsg(target, self.bot.emo(f'{GREY}<<< {DRED}error{GREY}: {LRED}not an integer, use only numbers of the personality databases {GREY}>>>'))
|
|
||||||
return
|
|
||||||
PATH='%s/../personalities' % dir_path
|
|
||||||
FILES=glob(f'{PATH}/*.db')
|
|
||||||
try:
|
|
||||||
f=open(FILES[i],'r')
|
|
||||||
buffer=f.read().splitlines()
|
|
||||||
f.close()
|
f.close()
|
||||||
self.start_chat_log='\n'.join(buffer)
|
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}created {msg} personality database {GREY}>>>"))
|
||||||
if self.start_chat_log.find('\n')==0:
|
|
||||||
self.start_chat_log=self.start_chat_log[1:]
|
|
||||||
FILE=FILES[i].split('/')[-1].replace('.db', '')
|
|
||||||
self.bot.privmsg(target, self.bot.emo(f'{GREY}<<< {DRED}loaded {FILE} personality database {GREY}>>>'))
|
|
||||||
except:
|
|
||||||
self.bot.privmsg(target, self.bot.emo(f'{GREY}<<< {DRED}error{GREY}: {LRED}could not load this personality database, maybe invalid index number {GREY}>>>'))
|
|
||||||
return
|
|
||||||
|
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
|
|
||||||
@command(permission='admin')
|
@command(permission='admin')
|
||||||
def aiwrite(self, mask, target, args):
|
def aitrain(self, mask, target, args):
|
||||||
"""OpenAi List Personalities
|
"""OpenAi Question A Term
|
||||||
%%aiwrite <msg>...
|
%%aitrain <term>...
|
||||||
"""
|
"""
|
||||||
msg = ''.join(args['<msg>'])
|
term = ' '.join(args['<term>'])
|
||||||
if self.start_chat_log.find('None\n')==0:
|
if term[-1]==',': term=term[::-1].replace(',','')[::-1]
|
||||||
self.start_chat_log=self.start_chat_log.replace('None\n','')
|
if not term[-1] == ".": term+="."
|
||||||
msg=msg.replace('.','').replace('/','')
|
FILE='%s/../personalities/trained.db' % dir_path
|
||||||
PATH='%s/../personalities' % dir_path
|
f=open(FILE, "a")
|
||||||
FILE=f'{PATH}/{msg}.db'
|
f.write(f'{term}\n')
|
||||||
if os.path.exists(FILE):
|
f.close()
|
||||||
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}personality database already exists, choose a different filename {GREY}>>>"))
|
self.start_chat_log=f'{self.start_chat_log}\n{term}'
|
||||||
return
|
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}trained {GREY}>>>"))
|
||||||
f=open(FILE, "a")
|
|
||||||
f.write(f'{self.start_chat_log}\n')
|
|
||||||
f.close()
|
|
||||||
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}created {msg} personality database {GREY}>>>"))
|
|
||||||
|
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
|
|
||||||
@command(permission='admin')
|
@command(permission='admin')
|
||||||
def aitrain(self, mask, target, args):
|
def aidefault(self, mask, target, args):
|
||||||
"""OpenAi Question A Term
|
"""OpenAi Return to Defaults
|
||||||
%%aitrain <term>...
|
%%aidefault
|
||||||
"""
|
"""
|
||||||
term = ' '.join(args['<term>'])
|
self.default_model="text-davinci-002"
|
||||||
if term[-1]==',': term=term[::-1].replace(',','')[::-1]
|
self.temperature=1.1
|
||||||
if not term[-1] == ".": term+="."
|
self.max_tokens=2000
|
||||||
FILE='%s/../personalities/trained.db' % dir_path
|
self.top_p=1.0
|
||||||
f=open(FILE, "a")
|
self.frequency_penalty=0.0
|
||||||
f.write(f'{term}\n')
|
self.presence_penalty=0.0
|
||||||
f.close()
|
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}setting personality and properties to defaults {GREY}>>>"))
|
||||||
self.start_chat_log=f'{self.start_chat_log}\n{term}'
|
self.print_response_properties(target)
|
||||||
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}trained {GREY}>>>"))
|
|
||||||
|
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
|
|
||||||
@command(permission='admin')
|
@command(permission='admin')
|
||||||
def aidefault(self, mask, target, args):
|
def aiset(self, mask, target, args):
|
||||||
"""OpenAi Return to Defaults
|
"""OpenAi Set Response Properties. Properties are default_model, temperature, max_tokens, top_p, frequency_penalty, presence_penalty. Example Usage: ?aiset top_p 1.0
|
||||||
%%aidefault
|
%%aiset <msg>...
|
||||||
"""
|
"""
|
||||||
self.default_model="text-davinci-002"
|
msg= ' '.join(args['<msg>'])
|
||||||
self.temperature=1.1
|
PROPERTIES=['model','temperature','max_tokens','top_p','frequency_penalty','presence_penalty']
|
||||||
self.max_tokens=2000
|
MODELS=["text-davinci-002","text-curie-001","text-babbage-001","text-ada-001"]
|
||||||
self.top_p=1.0
|
prop=""
|
||||||
self.frequency_penalty=0.0
|
val=""
|
||||||
self.presence_penalty=0.0
|
try:
|
||||||
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}setting personality and properties to defaults {GREY}>>>"))
|
prop=msg.split()[0].lower()
|
||||||
self.print_response_properties(target)
|
val=msg.split()[1].lower()
|
||||||
|
except:
|
||||||
#######################################################################################
|
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}not enough parameters {GREY}- {DRED}property choices{GREY}: {LRED}{PROPERTIES} {GREY}- {DRED}model choices{GREY}: {LRED}{MODELS} {GREY}- {DRED}usage examples{GREY}: {LRED}?aiset model text-davinci-002, ?aiset max_tokens 2000, ?aiset model text-davinci-002, ?aiset temperature 0.7, ?aiset top_p 1.0, ?aiset frequency_penalty 0.0, ?aiset presence_penalty 0.0 {GREY}>>>"))
|
||||||
#######################################################################################
|
return
|
||||||
|
if prop in PROPERTIES:
|
||||||
@command(permission='admin')
|
if prop == "model":
|
||||||
def aiset(self, mask, target, args):
|
try:
|
||||||
"""OpenAi Set Response Properties. Properties are default_model, temperature, max_tokens, top_p, frequency_penalty, presence_penalty. Example Usage: ?aiset top_p 1.0
|
if val in MODELS:
|
||||||
%%aiset <msg>...
|
self.default_model=val
|
||||||
"""
|
if str(val)==MODELS[0]:
|
||||||
msg= ' '.join(args['<msg>'])
|
self.max_tokens = 2000
|
||||||
PROPERTIES=['model','temperature','max_tokens','top_p','frequency_penalty','presence_penalty']
|
else:
|
||||||
MODELS=["text-davinci-002","text-curie-001","text-babbage-001","text-ada-001"]
|
self.max_tokens = 1000
|
||||||
prop=""
|
|
||||||
val=""
|
|
||||||
try:
|
|
||||||
prop=msg.split()[0].lower()
|
|
||||||
val=msg.split()[1].lower()
|
|
||||||
except:
|
|
||||||
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}not enough parameters {GREY}- {DRED}property choices{GREY}: {LRED}{PROPERTIES} {GREY}- {DRED}model choices{GREY}: {LRED}{MODELS} {GREY}- {DRED}usage examples{GREY}: {LRED}?aiset model text-davinci-002, ?aiset max_tokens 2000, ?aiset model text-davinci-002, ?aiset temperature 0.7, ?aiset top_p 1.0, ?aiset frequency_penalty 0.0, ?aiset presence_penalty 0.0 {GREY}>>>"))
|
|
||||||
return
|
|
||||||
if prop in PROPERTIES:
|
|
||||||
if prop == "model":
|
|
||||||
try:
|
|
||||||
if val in MODELS:
|
|
||||||
self.default_model=val
|
|
||||||
if str(val)==MODELS[0]:
|
|
||||||
self.max_tokens = 2000
|
|
||||||
else:
|
else:
|
||||||
self.max_tokens = 1000
|
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}property model value should be a string {GREY}- {DRED}choice of models{GREY}: {LRED}{MODELS} {GREY}- {DRED}example{GREY}: {LRED}?aiset model text-davinci-002 {GREY}>>>"))
|
||||||
else:
|
except:
|
||||||
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}property model value should be a string {GREY}- {DRED}choice of models{GREY}: {LRED}{MODELS} {GREY}- {DRED}example{GREY}: {LRED}?aiset model text-davinci-002 {GREY}>>>"))
|
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}property model value should be a string {GREY}- {DRED}choice of models{GREY}: {LRED}{MODELS} {GREY}- {DRED}example{GREY}: {LRED}?aiset model text-davinci-002 {GREY}>>>"))
|
||||||
except:
|
return
|
||||||
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}property model value should be a string {GREY}- {DRED}choice of models{GREY}: {LRED}{MODELS} {GREY}- {DRED}example{GREY}: {LRED}?aiset model text-davinci-002 {GREY}>>>"))
|
elif prop == "temperature":
|
||||||
return
|
try:
|
||||||
elif prop == "temperature":
|
if float(val) <= 2 and float(val) >= 0:
|
||||||
try:
|
self.temperature=float(val)
|
||||||
if float(val) <= 2 and float(val) >= 0:
|
except:
|
||||||
self.temperature=float(val)
|
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}property temperature value should be a float {GREY}- {DRED}example{GREY}: {LRED}?aiset temperature 0.7 {GREY}>>>"))
|
||||||
except:
|
return
|
||||||
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}property temperature value should be a float {GREY}- {DRED}example{GREY}: {LRED}?aiset temperature 0.7 {GREY}>>>"))
|
elif prop == "max_tokens":
|
||||||
return
|
try:
|
||||||
elif prop == "max_tokens":
|
if int(val) <= 2000 and int(val) >= 100:
|
||||||
try:
|
self.max_tokens=int(val)
|
||||||
if int(val) <= 2000 and int(val) >= 100:
|
except:
|
||||||
self.max_tokens=int(val)
|
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}property max_tokens value should be an integer not greater than 2000 {GREY}- {DRED}example{GREY}: {LRED}?aiset max_tokens 2000 {GREY}>>>"))
|
||||||
except:
|
return
|
||||||
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}property max_tokens value should be an integer not greater than 2000 {GREY}- {DRED}example{GREY}: {LRED}?aiset max_tokens 2000 {GREY}>>>"))
|
elif prop == "top_p":
|
||||||
return
|
try:
|
||||||
elif prop == "top_p":
|
if float(val) <= 1.0 and float(val) >= 0.0:
|
||||||
try:
|
self.top_p=float(val)
|
||||||
if float(val) <= 1.0 and float(val) >= 0.0:
|
else:
|
||||||
self.top_p=float(val)
|
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: property model should be a float no greater than 1.0 {GREY}- {DRED}example{GREY}: {LRED}?aiset top_p 0.7 {GREY}>>>"))
|
||||||
else:
|
return
|
||||||
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: property model should be a float no greater than 1.0 {GREY}- {DRED}example{GREY}: {LRED}?aiset top_p 0.7 {GREY}>>>"))
|
except:
|
||||||
return
|
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: property model should be a float no greater than 1.0 {GREY}- {DRED}example{GREY}: {LRED}?aiset top_p 0.7 {GREY}>>>"))
|
||||||
except:
|
return
|
||||||
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: property model should be a float no greater than 1.0 {GREY}- {DRED}example{GREY}: {LRED}?aiset top_p 0.7 {GREY}>>>"))
|
elif prop == "frequency_penalty":
|
||||||
return
|
try:
|
||||||
elif prop == "frequency_penalty":
|
if float(val):
|
||||||
try:
|
self.frequency_penalty=float(val)
|
||||||
if float(val):
|
except:
|
||||||
self.frequency_penalty=float(val)
|
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}property frequency_penalty should be a float {GREY}- {DRED}example{GREY}: {LRED}?aiset frequency_penalty 0.0 {GREY}>>>"))
|
||||||
except:
|
return
|
||||||
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}property frequency_penalty should be a float {GREY}- {DRED}example{GREY}: {LRED}?aiset frequency_penalty 0.0 {GREY}>>>"))
|
elif prop == "presence_penalty":
|
||||||
return
|
try:
|
||||||
elif prop == "presence_penalty":
|
if float(val) <= 2.0 and float(val) >= 0.0:
|
||||||
try:
|
self.presence_penalty=float(val)
|
||||||
if float(val) <= 2.0 and float(val) >= 0.0:
|
else:
|
||||||
self.presence_penalty=float(val)
|
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}property presence_penalty should be a float no greater than 2.0 {GREY}- {DRED}example{GREY}: {LRED}?aiset presence_penalty 0.0 {GREY}>>>"))
|
||||||
else:
|
return
|
||||||
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}property presence_penalty should be a float no greater than 2.0 {GREY}- {DRED}example{GREY}: {LRED}?aiset presence_penalty 0.0 {GREY}>>>"))
|
except:
|
||||||
return
|
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}property presence_penalty should be a float no greater than 2.0 {GREY}- {DRED}example{GREY}: {LRED}?aiset presence_penalty 0.0 {GREY}>>>"))
|
||||||
except:
|
return
|
||||||
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}property presence_penalty should be a float no greater than 2.0 {GREY}- {DRED}example{GREY}: {LRED}?aiset presence_penalty 0.0 {GREY}>>>"))
|
else:
|
||||||
return
|
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}no properties were set, they remain the same {GREY}>>>"))
|
||||||
|
self.print_response_properties(target)
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
|
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}used an invalid property identifier {GREY}- {DRED}property identifiers are {LRED}{PROPERTIES} {GREY}>>>"))
|
||||||
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}no properties were set, they remain the same {GREY}>>>"))
|
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}no properties were set, they remain the same {GREY}>>>"))
|
||||||
self.print_response_properties(target)
|
self.print_response_properties(target)
|
||||||
return
|
return
|
||||||
else:
|
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}{prop} property set to the value {val} {GREY}>>>"))
|
||||||
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}used an invalid property identifier {GREY}- {DRED}property identifiers are {LRED}{PROPERTIES} {GREY}>>>"))
|
|
||||||
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}no properties were set, they remain the same {GREY}>>>"))
|
|
||||||
self.print_response_properties(target)
|
self.print_response_properties(target)
|
||||||
return
|
|
||||||
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}{prop} property set to the value {val} {GREY}>>>"))
|
|
||||||
self.print_response_properties(target)
|
|
||||||
|
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
#######################################################################################
|
###################################################################################
|
||||||
|
|
||||||
@command(permission='admin')
|
@command(permission='admin')
|
||||||
def aiclear(self, mask, target, args):
|
def aiclear(self, mask, target, args):
|
||||||
"""OpenAi Clear Term
|
"""OpenAi Clear Term
|
||||||
%%aiclear
|
%%aiclear
|
||||||
"""
|
"""
|
||||||
FILE='%s/../personalities/trained.db' % dir_path
|
FILE='%s/../personalities/trained.db' % dir_path
|
||||||
f=open(FILE, "w")
|
f=open(FILE, "w")
|
||||||
f.write("")
|
f.write("")
|
||||||
f.close()
|
f.close()
|
||||||
self.start_chat_log = ""
|
self.start_chat_log = ""
|
||||||
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}cleared {GREY}>>>"))
|
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}cleared {GREY}>>>"))
|
||||||
|
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
####################################################################################### EOF
|
####################################################################################### EOF
|
||||||
|
@ -1,255 +1,260 @@
|
|||||||
# -*- coding: utf-8 -*- ############################################################### SOF
|
# -*- coding: utf-8 -*- ############################################################### SOF
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
|
|
||||||
|
???TWITTER???
|
||||||
???YOUTUBE???
|
???YOUTUBE???
|
||||||
|
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
|
|
||||||
import irc3
|
|
||||||
from datetime import datetime
|
|
||||||
import twitter
|
|
||||||
import re
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import time
|
|
||||||
import timeago
|
|
||||||
import os
|
|
||||||
import requests
|
|
||||||
from lxml.html import fromstring
|
|
||||||
from difflib import SequenceMatcher
|
|
||||||
from plugins.tool_log_plugin import FOG
|
|
||||||
|
|
||||||
###########################################################################################
|
|
||||||
###########################################################################################
|
|
||||||
|
|
||||||
####################
|
####################
|
||||||
if SERVICES_YOUTUBE:
|
if SERVICES_TWITTER:
|
||||||
####################
|
####################
|
||||||
|
|
||||||
YOUTUBE_REGEX = re.compile('http(?:s?):\/\/(?:www\.)?youtu(?:be\.com\/watch\?v=|\.be\/)([\w\-\_]*)(&(amp;)?[\w\?=]*)?', re.IGNORECASE)
|
import irc3
|
||||||
|
from datetime import datetime
|
||||||
###########################################################################################
|
import twitter
|
||||||
###########################################################################################
|
import re
|
||||||
|
import os
|
||||||
def getenv(s):
|
import sys
|
||||||
try:
|
import time
|
||||||
s = os.environ[s]
|
import timeago
|
||||||
return s
|
import os
|
||||||
except:
|
import requests
|
||||||
fog=FOG().fog
|
from lxml.html import fromstring
|
||||||
error_type="environmental variable error"
|
from difflib import SequenceMatcher
|
||||||
error_reason=f"exported {s} not found"
|
from plugins.tool_log_plugin import FOG
|
||||||
fog(f"{error_type}: {error_reason}")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
###########################################################################################
|
|
||||||
###########################################################################################
|
|
||||||
|
|
||||||
TWITTER_CONSUMER_KEY = getenv('TWITTER_CONSUMER_KEY')
|
|
||||||
TWITTER_CONSUMER_SECRET = getenv('TWITTER_CONSUMER_SECRET')
|
|
||||||
TWITTER_ACCESS_TOKEN_KEY = getenv('TWITTER_ACCESS_TOKEN_KEY')
|
|
||||||
TWITTER_ACCESS_TOKEN_SECRET = getenv('TWITTER_ACCESS_TOKEN_SECRET')
|
|
||||||
|
|
||||||
###########################################################################################
|
|
||||||
###########################################################################################
|
|
||||||
|
|
||||||
twitter = twitter.Api(consumer_key=TWITTER_CONSUMER_KEY, consumer_secret=TWITTER_CONSUMER_SECRET,
|
|
||||||
access_token_key=TWITTER_ACCESS_TOKEN_KEY, access_token_secret=TWITTER_ACCESS_TOKEN_SECRET)
|
|
||||||
|
|
||||||
###########################################################################################
|
|
||||||
###########################################################################################
|
|
||||||
|
|
||||||
TWITTER_REGEX = re.compile('https?:\/\/twitter\.com\/(?:#!\/)?(\w+)\/status(es)?\/(\d+)$', re.IGNORECASE)
|
|
||||||
URL_REGEX = re.compile('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', re.IGNORECASE)
|
|
||||||
|
|
||||||
###########################################################################################
|
|
||||||
###########################################################################################
|
|
||||||
|
|
||||||
TOO_LONG = 2000
|
|
||||||
|
|
||||||
###########################################################################################
|
|
||||||
###########################################################################################
|
|
||||||
|
|
||||||
@irc3.plugin
|
|
||||||
class Plugin:
|
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
|
||||||
def __init__(self, bot):
|
####################
|
||||||
self.bot = bot
|
if SERVICES_YOUTUBE:
|
||||||
|
####################
|
||||||
|
|
||||||
|
YOUTUBE_REGEX = re.compile('http(?:s?):\/\/(?:www\.)?youtu(?:be\.com\/watch\?v=|\.be\/)([\w\-\_]*)(&(amp;)?[\w\?=]*)?', re.IGNORECASE)
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
|
||||||
@irc3.extend
|
def getenv(s):
|
||||||
def _similar(self, a, b):
|
try:
|
||||||
return SequenceMatcher(None, a, b).ratio()
|
s = os.environ[s]
|
||||||
|
return s
|
||||||
|
except:
|
||||||
|
fog=FOG().fog
|
||||||
|
error_type="environmental variable error"
|
||||||
|
error_reason=f"exported {s} not found"
|
||||||
|
fog(f"{error_type}: {error_reason}")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
|
||||||
@irc3.extend
|
TWITTER_CONSUMER_KEY = getenv('TWITTER_CONSUMER_KEY')
|
||||||
def _check_for_url(self, og_tweet, d_nick, d_url, d_unrolled, d_text, d_target):
|
TWITTER_CONSUMER_SECRET = getenv('TWITTER_CONSUMER_SECRET')
|
||||||
match_list = URL_REGEX.findall(d_unrolled)
|
TWITTER_ACCESS_TOKEN_KEY = getenv('TWITTER_ACCESS_TOKEN_KEY')
|
||||||
read_size = 0
|
TWITTER_ACCESS_TOKEN_SECRET = getenv('TWITTER_ACCESS_TOKEN_SECRET')
|
||||||
if match_list:
|
|
||||||
url = match_list.pop()
|
|
||||||
try:
|
|
||||||
if not d_unrolled.find('https://twitter.com/') == -1:
|
|
||||||
if not d_unrolled.find('status') == -1:
|
|
||||||
try:
|
|
||||||
e_status = d_unrolled.split('/')[-1]
|
|
||||||
e_tweet = twitter.GetStatus(e_status)
|
|
||||||
e_text = e_tweet.text
|
|
||||||
if self._similar(og_tweet.text,e_text) > 0.7: return
|
|
||||||
msg = "\x02\x0302{nick1:}:{nick2:}\x0F\x02\x0303 >> {e_text:} \x0F".format(nick1=d_nick,nick2='UNROLLED',e_text=e_text)
|
|
||||||
if e_tweet.media:
|
|
||||||
for y in range(len(e_tweet.media)):
|
|
||||||
m_turl = e_tweet.media[y].url
|
|
||||||
m_murl = e_tweet.media[y].media_url
|
|
||||||
m_eurl = e_tweet.media[y].expanded_url
|
|
||||||
msg = msg + " >> [media] \x0F\x02\x0312{media_url:}".format(media_url=m_murl)
|
|
||||||
if e_tweet.urls:
|
|
||||||
for y in range(len(e_tweet.urls)):
|
|
||||||
e_turl = e_tweet.urls[y].url
|
|
||||||
e_eurl = e_tweet.urls[y].expanded_url
|
|
||||||
msg = msg + " >> [url] \x0F\x02\x0312{e_url:}".format(e_url=e_eurl)
|
|
||||||
msg = self.bot.emo(msg)
|
|
||||||
self.bot.privmsg(d_target, msg)
|
|
||||||
return
|
|
||||||
except Exception as e:
|
|
||||||
msg = "wu/tang >>>>>>>>>>> sub-unrolling: {}".format(e)
|
|
||||||
msg = self.bot.emo(msg)
|
|
||||||
self.bot.privmsg(d_target, msg)
|
|
||||||
return
|
|
||||||
r = requests.get(d_unrolled, timeout=3, stream=True)
|
|
||||||
content_type = r.headers.get("Content-Type")
|
|
||||||
content_length = r.headers.get('Content-Length')
|
|
||||||
if not content_length:
|
|
||||||
content_length = 0
|
|
||||||
if content_type.startswith('image'):
|
|
||||||
msg = "\x02\x0302{nick1:}:{nick2:}\x0F\x02\x0303 >> [media] {media:} \x0F".format(nick1=d_nick,nick2='UNROLLED',media=d_unrolled)
|
|
||||||
msg = self.bot.emo(msg)
|
|
||||||
self.bot.privmsg(d_target, msg)
|
|
||||||
return
|
|
||||||
if not content_type.startswith("text/html"):
|
|
||||||
return
|
|
||||||
if int(content_length) > 200000:
|
|
||||||
self.bot.privmsg(d_target, "pre-fetch aborted -> fuck your large ass content -> {} -> {}".format(d_url,d_unrolled))
|
|
||||||
while read_size <= (2000 * 10):
|
|
||||||
for content in r.iter_content(chunk_size=2000):
|
|
||||||
tree = fromstring(content)
|
|
||||||
title = tree.find(".//title")
|
|
||||||
if title is not None:
|
|
||||||
title = title.text.strip()[:100]
|
|
||||||
print('title: {}'.format(title))
|
|
||||||
similarity = self.bot._similar(title,d_text)
|
|
||||||
if similarity > 0.4:
|
|
||||||
print('wu/tang: similarity')
|
|
||||||
return
|
|
||||||
msg = "\x02\x0302{nick1:}:{nick2:}\x0F\x02\x0304 >> \x0F\x1D\x0314{url:}\x0F\x0304 >> \x0F\x0303{unrolled:} \x0F\x0304>> \x0F\x1D\x0314{title:}\x0F".format(nick1=d_nick,nick2='UNROLLED',url=d_url,unrolled=d_unrolled,title=title)
|
|
||||||
msg = self.bot.emo(msg)
|
|
||||||
self.bot.privmsg(d_target, msg)
|
|
||||||
return
|
|
||||||
read_size = read_size + 2000
|
|
||||||
except Exception as e:
|
|
||||||
self.bot.privmsg("_debug_check_for_url_error: {}".format(e))
|
|
||||||
print("original: {} nick: {} url: {} unrolled: {} text: {} error: {}".format(og_tweet,d_nick,d_url,d_unrolled,d_text,e))
|
|
||||||
pass
|
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
|
||||||
def _check_for_twitter(self, mask=None, data=None, target=None, **kw):
|
twitter = twitter.Api(consumer_key=TWITTER_CONSUMER_KEY, consumer_secret=TWITTER_CONSUMER_SECRET,
|
||||||
match_list = TWITTER_REGEX.findall(data)
|
access_token_key=TWITTER_ACCESS_TOKEN_KEY, access_token_secret=TWITTER_ACCESS_TOKEN_SECRET)
|
||||||
if match_list:
|
|
||||||
status_id = match_list[0][2]
|
#######################################################################################
|
||||||
try:
|
#######################################################################################
|
||||||
tweet = twitter.GetStatus(status_id=status_id)
|
|
||||||
tweet_text = tweet.text
|
TWITTER_REGEX = re.compile('https?:\/\/twitter\.com\/(?:#!\/)?(\w+)\/status(es)?\/(\d+)$', re.IGNORECASE)
|
||||||
user = tweet.user.screen_name
|
URL_REGEX = re.compile('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', re.IGNORECASE)
|
||||||
fav_count = tweet.favorite_count
|
|
||||||
retweet_count = tweet.retweet_count
|
#######################################################################################
|
||||||
if tweet.coordinates:
|
#######################################################################################
|
||||||
location = tweet.coordinates
|
|
||||||
else:
|
TOO_LONG = 2000
|
||||||
location = ""
|
|
||||||
tweet_time = time.strptime(tweet.created_at, '%a %b %d %H:%M:%S +0000 %Y')
|
#######################################################################################
|
||||||
time_since = timeago.format(time.strftime('%Y-%m-%d %H:%M:%S', tweet_time), datetime.now())
|
#######################################################################################
|
||||||
msg = "\x02\x0302{} \x0F\x0303>\x0F \x02\x0301{}\x0F\x0314 | Retweets:\x0F \x1D\x0306{}\x0F\x0314 Favorites:\x0F\x1D\x0306 {} \x0F⑆\x1D\x0314\x1D {} {}".format(user, tweet_text, retweet_count, fav_count, time_since, location)
|
|
||||||
msg = self.bot.emo(msg)
|
@irc3.plugin
|
||||||
self.bot.privmsg(target, msg)
|
class Plugin:
|
||||||
match_list = URL_REGEX.findall(msg)
|
|
||||||
|
###################################################################################
|
||||||
|
###################################################################################
|
||||||
|
|
||||||
|
def __init__(self, bot):
|
||||||
|
self.bot = bot
|
||||||
|
|
||||||
|
###################################################################################
|
||||||
|
###################################################################################
|
||||||
|
|
||||||
|
@irc3.extend
|
||||||
|
def _similar(self, a, b):
|
||||||
|
return SequenceMatcher(None, a, b).ratio()
|
||||||
|
|
||||||
|
###################################################################################
|
||||||
|
###################################################################################
|
||||||
|
|
||||||
|
@irc3.extend
|
||||||
|
def _check_for_url(self, og_tweet, d_nick, d_url, d_unrolled, d_text, d_target):
|
||||||
|
match_list = URL_REGEX.findall(d_unrolled)
|
||||||
|
read_size = 0
|
||||||
|
if match_list:
|
||||||
|
url = match_list.pop()
|
||||||
try:
|
try:
|
||||||
if(match_list):
|
if not d_unrolled.find('https://twitter.com/') == -1:
|
||||||
try:
|
if not d_unrolled.find('status') == -1:
|
||||||
if len(tweet.urls) == 0:
|
|
||||||
if tweet.media:
|
|
||||||
for y in range(len(tweet.media)):
|
|
||||||
m_turl = tweet.media[y].url
|
|
||||||
m_murl = tweet.media[y].media_url
|
|
||||||
m_eurl = tweet.media[y].expanded_url
|
|
||||||
msg = "\x02\x0302{nick1:}:{nick2:}\x0F\x02\x0304 >> [media] \x0F\x02\x0312{m_turl:}\x0F\x0304 >> \x0F\x0303{m_murl:} \x0F\x0304>> \x0F\x1D\x0314{m_eurl:}\x0F".format(nick1=user,nick2='UNROLLED',m_turl=m_turl,m_murl=m_murl,m_eurl=m_eurl)
|
|
||||||
msg = self.bot.emo(msg)
|
|
||||||
self.bot.privmsg(target, msg)
|
|
||||||
else:
|
|
||||||
for y in range(len(tweet.urls)):
|
|
||||||
t_turl = tweet.urls[y].url
|
|
||||||
try:
|
|
||||||
match_list.remove(t_turl)
|
|
||||||
except:
|
|
||||||
print('cant remove from matchlist, does not exist')
|
|
||||||
t_eurl = tweet.urls[y].expanded_url
|
|
||||||
|
|
||||||
####################
|
|
||||||
if SERVICES_YOUTUBE:
|
|
||||||
####################
|
|
||||||
|
|
||||||
yt_match_list = YOUTUBE_REGEX.findall(t_eurl)
|
|
||||||
if yt_match_list:
|
|
||||||
d_video_id = t_eurl.split('=')[1]
|
|
||||||
self.bot.madjust = "{}:UNROLLED".format(user)
|
|
||||||
self.bot.yt(mask,target,{'<keyword>': [d_video_id],'yt': True})
|
|
||||||
self.bot.madjust = ""
|
|
||||||
|
|
||||||
else:
|
|
||||||
if not str(tweet.id) == t_eurl.split('/')[-1]:
|
|
||||||
self.bot._check_for_url(tweet,user,t_turl,t_eurl,tweet_text,target)
|
|
||||||
else:
|
|
||||||
print('bypassing original tweet')
|
|
||||||
try:
|
try:
|
||||||
if len(match_list) > 0:
|
e_status = d_unrolled.split('/')[-1]
|
||||||
print('items in matchlist remain')
|
e_tweet = twitter.GetStatus(e_status)
|
||||||
print(match_list)
|
e_text = e_tweet.text
|
||||||
except:
|
if self._similar(og_tweet.text,e_text) > 0.7: return
|
||||||
print('errrororororororo: cant remove from matchlist, does not exist')
|
msg = "\x02\x0302{nick1:}:{nick2:}\x0F\x02\x0303 >> {e_text:} \x0F".format(nick1=d_nick,nick2='UNROLLED',e_text=e_text)
|
||||||
except Exception as e:
|
if e_tweet.media:
|
||||||
self.bot.privmsg(target,'twitter_plugin <> _debug_unrolling -> wu/tang: {}'.format(e))
|
for y in range(len(e_tweet.media)):
|
||||||
|
m_turl = e_tweet.media[y].url
|
||||||
|
m_murl = e_tweet.media[y].media_url
|
||||||
|
m_eurl = e_tweet.media[y].expanded_url
|
||||||
|
msg = msg + " >> [media] \x0F\x02\x0312{media_url:}".format(media_url=m_murl)
|
||||||
|
if e_tweet.urls:
|
||||||
|
for y in range(len(e_tweet.urls)):
|
||||||
|
e_turl = e_tweet.urls[y].url
|
||||||
|
e_eurl = e_tweet.urls[y].expanded_url
|
||||||
|
msg = msg + " >> [url] \x0F\x02\x0312{e_url:}".format(e_url=e_eurl)
|
||||||
|
msg = self.bot.emo(msg)
|
||||||
|
self.bot.privmsg(d_target, msg)
|
||||||
|
return
|
||||||
|
except Exception as e:
|
||||||
|
msg = "wu/tang >>>>>>>>>>> sub-unrolling: {}".format(e)
|
||||||
|
msg = self.bot.emo(msg)
|
||||||
|
self.bot.privmsg(d_target, msg)
|
||||||
|
return
|
||||||
|
r = requests.get(d_unrolled, timeout=3, stream=True)
|
||||||
|
content_type = r.headers.get("Content-Type")
|
||||||
|
content_length = r.headers.get('Content-Length')
|
||||||
|
if not content_length:
|
||||||
|
content_length = 0
|
||||||
|
if content_type.startswith('image'):
|
||||||
|
msg = "\x02\x0302{nick1:}:{nick2:}\x0F\x02\x0303 >> [media] {media:} \x0F".format(nick1=d_nick,nick2='UNROLLED',media=d_unrolled)
|
||||||
|
msg = self.bot.emo(msg)
|
||||||
|
self.bot.privmsg(d_target, msg)
|
||||||
|
return
|
||||||
|
if not content_type.startswith("text/html"):
|
||||||
|
return
|
||||||
|
if int(content_length) > 200000:
|
||||||
|
self.bot.privmsg(d_target, "pre-fetch aborted -> fuck your large ass content -> {} -> {}".format(d_url,d_unrolled))
|
||||||
|
while read_size <= (2000 * 10):
|
||||||
|
for content in r.iter_content(chunk_size=2000):
|
||||||
|
tree = fromstring(content)
|
||||||
|
title = tree.find(".//title")
|
||||||
|
if title is not None:
|
||||||
|
title = title.text.strip()[:100]
|
||||||
|
print('title: {}'.format(title))
|
||||||
|
similarity = self.bot._similar(title,d_text)
|
||||||
|
if similarity > 0.4:
|
||||||
|
print('wu/tang: similarity')
|
||||||
|
return
|
||||||
|
msg = "\x02\x0302{nick1:}:{nick2:}\x0F\x02\x0304 >> \x0F\x1D\x0314{url:}\x0F\x0304 >> \x0F\x0303{unrolled:} \x0F\x0304>> \x0F\x1D\x0314{title:}\x0F".format(nick1=d_nick,nick2='UNROLLED',url=d_url,unrolled=d_unrolled,title=title)
|
||||||
|
msg = self.bot.emo(msg)
|
||||||
|
self.bot.privmsg(d_target, msg)
|
||||||
|
return
|
||||||
|
read_size = read_size + 2000
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.bot.privmsg(target,'twitter_plugin <> wu/tang: {}'.format(e))
|
self.bot.privmsg("_debug_check_for_url_error: {}".format(e))
|
||||||
except Exception as e:
|
print("original: {} nick: {} url: {} unrolled: {} text: {} error: {}".format(og_tweet,d_nick,d_url,d_unrolled,d_text,e))
|
||||||
_msg = e.message[0]['message']
|
pass
|
||||||
_code = e.message[0]['code']
|
|
||||||
_erid = ''
|
###################################################################################
|
||||||
if _code == 179:
|
###################################################################################
|
||||||
_erid = "PROTECTED TW33T"
|
|
||||||
else:
|
def _check_for_twitter(self, mask=None, data=None, target=None, **kw):
|
||||||
_erid = "DON'T CARE EXCEPTION"
|
match_list = TWITTER_REGEX.findall(data)
|
||||||
msg = "\x02\x0302{} \x0F\x0304> \x0F\x02\x0312{} aka {}\x0F\x0303".format(_code,_msg,_erid)
|
if match_list:
|
||||||
msg = self.bot.emo(msg)
|
status_id = match_list[0][2]
|
||||||
self.bot.privmsg(target, msg)
|
try:
|
||||||
pass
|
tweet = twitter.GetStatus(status_id=status_id)
|
||||||
|
tweet_text = tweet.text
|
||||||
|
user = tweet.user.screen_name
|
||||||
|
fav_count = tweet.favorite_count
|
||||||
|
retweet_count = tweet.retweet_count
|
||||||
|
if tweet.coordinates:
|
||||||
|
location = tweet.coordinates
|
||||||
|
else:
|
||||||
|
location = ""
|
||||||
|
tweet_time = time.strptime(tweet.created_at, '%a %b %d %H:%M:%S +0000 %Y')
|
||||||
|
time_since = timeago.format(time.strftime('%Y-%m-%d %H:%M:%S', tweet_time), datetime.now())
|
||||||
|
msg = "\x02\x0302{} \x0F\x0303>\x0F \x02\x0301{}\x0F\x0314 | Retweets:\x0F \x1D\x0306{}\x0F\x0314 Favorites:\x0F\x1D\x0306 {} \x0F⑆\x1D\x0314\x1D {} {}".format(user, tweet_text, retweet_count, fav_count, time_since, location)
|
||||||
|
msg = self.bot.emo(msg)
|
||||||
|
self.bot.privmsg(target, msg)
|
||||||
|
match_list = URL_REGEX.findall(msg)
|
||||||
|
try:
|
||||||
|
if(match_list):
|
||||||
|
try:
|
||||||
|
if len(tweet.urls) == 0:
|
||||||
|
if tweet.media:
|
||||||
|
for y in range(len(tweet.media)):
|
||||||
|
m_turl = tweet.media[y].url
|
||||||
|
m_murl = tweet.media[y].media_url
|
||||||
|
m_eurl = tweet.media[y].expanded_url
|
||||||
|
msg = "\x02\x0302{nick1:}:{nick2:}\x0F\x02\x0304 >> [media] \x0F\x02\x0312{m_turl:}\x0F\x0304 >> \x0F\x0303{m_murl:} \x0F\x0304>> \x0F\x1D\x0314{m_eurl:}\x0F".format(nick1=user,nick2='UNROLLED',m_turl=m_turl,m_murl=m_murl,m_eurl=m_eurl)
|
||||||
|
msg = self.bot.emo(msg)
|
||||||
|
self.bot.privmsg(target, msg)
|
||||||
|
else:
|
||||||
|
for y in range(len(tweet.urls)):
|
||||||
|
t_turl = tweet.urls[y].url
|
||||||
|
try:
|
||||||
|
match_list.remove(t_turl)
|
||||||
|
except:
|
||||||
|
print('cant remove from matchlist, does not exist')
|
||||||
|
t_eurl = tweet.urls[y].expanded_url
|
||||||
|
|
||||||
#######################################################################################
|
####################
|
||||||
#######################################################################################
|
if SERVICES_YOUTUBE:
|
||||||
|
####################
|
||||||
|
|
||||||
@irc3.event(irc3.rfc.PRIVMSG)
|
yt_match_list = YOUTUBE_REGEX.findall(t_eurl)
|
||||||
def on_privmsg_search_for_twitter(self, mask=None, target=None, data=None, **kw):
|
if yt_match_list:
|
||||||
if data.startswith("?"): return
|
d_video_id = t_eurl.split('=')[1]
|
||||||
if mask.nick.lower() not in self.bot.ignore_list:
|
self.bot.madjust = "{}:UNROLLED".format(user)
|
||||||
self._check_for_twitter(mask, data, target)
|
self.bot.yt(mask,target,{'<keyword>': [d_video_id],'yt': True})
|
||||||
|
self.bot.madjust = ""
|
||||||
|
|
||||||
|
else:
|
||||||
|
if not str(tweet.id) == t_eurl.split('/')[-1]:
|
||||||
|
self.bot._check_for_url(tweet,user,t_turl,t_eurl,tweet_text,target)
|
||||||
|
else:
|
||||||
|
print('bypassing original tweet')
|
||||||
|
try:
|
||||||
|
if len(match_list) > 0:
|
||||||
|
print('items in matchlist remain')
|
||||||
|
print(match_list)
|
||||||
|
except:
|
||||||
|
print('errrororororororo: cant remove from matchlist, does not exist')
|
||||||
|
except Exception as e:
|
||||||
|
self.bot.privmsg(target,'twitter_plugin <> _debug_unrolling -> wu/tang: {}'.format(e))
|
||||||
|
except Exception as e:
|
||||||
|
self.bot.privmsg(target,'twitter_plugin <> wu/tang: {}'.format(e))
|
||||||
|
except Exception as e:
|
||||||
|
_msg = e.message[0]['message']
|
||||||
|
_code = e.message[0]['code']
|
||||||
|
_erid = ''
|
||||||
|
if _code == 179:
|
||||||
|
_erid = "PROTECTED TW33T"
|
||||||
|
else:
|
||||||
|
_erid = "DON'T CARE EXCEPTION"
|
||||||
|
msg = "\x02\x0302{} \x0F\x0304> \x0F\x02\x0312{} aka {}\x0F\x0303".format(_code,_msg,_erid)
|
||||||
|
msg = self.bot.emo(msg)
|
||||||
|
self.bot.privmsg(target, msg)
|
||||||
|
pass
|
||||||
|
|
||||||
|
###################################################################################
|
||||||
|
###################################################################################
|
||||||
|
|
||||||
|
@irc3.event(irc3.rfc.PRIVMSG)
|
||||||
|
def on_privmsg_search_for_twitter(self, mask=None, target=None, data=None, **kw):
|
||||||
|
if data.startswith("?"): return
|
||||||
|
if mask.nick.lower() not in self.bot.ignore_list:
|
||||||
|
self._check_for_twitter(mask, data, target)
|
||||||
|
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
####################################################################################### EOF
|
####################################################################################### EOF
|
||||||
|
@ -17,6 +17,7 @@ includes =
|
|||||||
plugins.fifo_plugin
|
plugins.fifo_plugin
|
||||||
plugins.sasl_custom_plugin
|
plugins.sasl_custom_plugin
|
||||||
plugins.net_hydra_plugin
|
plugins.net_hydra_plugin
|
||||||
|
plugins.tool_log_plugin
|
||||||
plugins.tool_colors_plugin
|
plugins.tool_colors_plugin
|
||||||
|
|
||||||
autojoins =
|
autojoins =
|
||||||
@ -25,7 +26,7 @@ autojoins =
|
|||||||
flood_burst = 0
|
flood_burst = 0
|
||||||
flood_rate = 1
|
flood_rate = 1
|
||||||
flood_rate_delay = 1
|
flood_rate_delay = 1
|
||||||
storage = json://databases/maple_db.json
|
storage = sqlite://databases/maple_db.sqlite
|
||||||
|
|
||||||
[plugins.fifo_plugin]
|
[plugins.fifo_plugin]
|
||||||
runpath = .fifo
|
runpath = .fifo
|
||||||
|
@ -43,6 +43,10 @@
|
|||||||
plugins.whoami_plugin
|
plugins.whoami_plugin
|
||||||
plugins.joke_plugin
|
plugins.joke_plugin
|
||||||
plugins.maple_plugin
|
plugins.maple_plugin
|
||||||
#plugins.net_hydra_plugin
|
plugins.openai_plugin
|
||||||
|
plugins.datetime_plugin
|
||||||
|
plugins.ip_plugin
|
||||||
|
plugins.tool_colors_plugin
|
||||||
|
plugins.tool_log_plugin
|
||||||
|
plugins.net_hydra_plugin
|
||||||
#plugins.ansi_plugin
|
#plugins.ansi_plugin
|
||||||
#plugins.openai_plugin
|
|
||||||
|
@ -1,91 +1,159 @@
|
|||||||
# -*- coding: utf-8 -*- ############################################################### SOF
|
# -*- coding: utf-8 -*- ############################################################### SOF
|
||||||
global SERVICES
|
###########################################################################################
|
||||||
SERVICES=False
|
|
||||||
|
???DISCORD???
|
||||||
|
???TELEGRAM???
|
||||||
|
???MATRIX???
|
||||||
|
|
||||||
|
###########################################################################################
|
||||||
|
###########################################################################################
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import threading
|
import threading
|
||||||
from time import sleep
|
from time import sleep
|
||||||
##################################################channel##################################
|
|
||||||
|
###########################################################################################
|
||||||
|
###########################################################################################
|
||||||
|
|
||||||
|
if SERVICES_MATRIX:
|
||||||
|
from nio import AsyncClient, MatrixRoom, RoomMessageText
|
||||||
|
from plugins.net_matrix_plugin import start_matrixbot
|
||||||
|
|
||||||
|
###########################################################################################
|
||||||
|
###########################################################################################
|
||||||
|
|
||||||
|
if SERVICES_DISCORD:
|
||||||
|
from plugins.net_discord_plugin import start_discordbot
|
||||||
|
|
||||||
|
###########################################################################################
|
||||||
|
###########################################################################################
|
||||||
|
|
||||||
|
if SERVICES_TELEGRAM:
|
||||||
|
from plugins.net_telegram_plugin import start_telegrambot
|
||||||
|
|
||||||
|
###########################################################################################
|
||||||
|
###########################################################################################
|
||||||
|
|
||||||
import irc3
|
import irc3
|
||||||
# from nio import AsyncClient, MatrixRoom, RoomMessageText
|
|
||||||
##################################################channel##################################
|
|
||||||
# from plugins.net_discord_plugin import start_discordbot
|
|
||||||
from plugins.net_irc_plugin import config_ircbot, start_ircbot
|
from plugins.net_irc_plugin import config_ircbot, start_ircbot
|
||||||
# from plugins.net_matrix_plugin import start_matrixbot
|
|
||||||
# from plugins.net_telegram_plugin import start_telegrambot
|
|
||||||
from plugins.tool_bus_plugin import BUS
|
from plugins.tool_bus_plugin import BUS
|
||||||
from plugins.tool_dims_plugin import dims
|
from plugins.tool_dims_plugin import dims
|
||||||
from plugins.tool_guds_plugin import guds
|
from plugins.tool_guds_plugin import guds
|
||||||
#from plugins.tool_colors_plugin import colorform as print
|
from plugins.tool_colors_plugin import colorform as print
|
||||||
##################################################channel##################################
|
from plugins.tool_log_plugin import FOG
|
||||||
|
|
||||||
|
###########################################################################################
|
||||||
|
###########################################################################################
|
||||||
|
|
||||||
|
fog=FOG().fog
|
||||||
|
|
||||||
|
###########################################################################################
|
||||||
|
###########################################################################################
|
||||||
|
|
||||||
class BOTIO:
|
class BOTIO:
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
#######################################################################################
|
||||||
|
|
||||||
verbosity=True
|
verbosity=True
|
||||||
log_exit_level=[]
|
log_exit_level=[]
|
||||||
loop=asyncio.get_event_loop()
|
loop=asyncio.get_event_loop()
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
#######################################################################################
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
print(f'<<< ________botio_class >>> [ instantiated ]')
|
fog(f'instantiated')
|
||||||
self.ircbot=config_ircbot()
|
self.ircbot=config_ircbot()
|
||||||
self._bio=guds.memory('__main__.bio')
|
self._bio=guds.memory('__main__.bio')
|
||||||
self.net_irc=[]
|
self.net_irc=[]
|
||||||
self.net_matrix=[]
|
if SERVICES_MATRIX:
|
||||||
self.net_discord=[]
|
self.net_matrix=[]
|
||||||
self.net_discord_initialized=False
|
if SERVICES_DISCORD:
|
||||||
print(f'<<< ________botio_class >>> [ ircbot configured ]')
|
self.net_discord=[]
|
||||||
|
fog(f'ircbot configured')
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
#######################################################################################
|
||||||
|
|
||||||
def __boot__irc(self):
|
def __boot__irc(self):
|
||||||
print('<<< system_status__info >>> [ booting connection ] - irc')
|
fog('booting connection - irc')
|
||||||
self=start_ircbot(self)
|
self=start_ircbot(self)
|
||||||
# #######################################################################################
|
|
||||||
# def __boot__matrix(self):
|
|
||||||
# print('<<< system_status__info >>> [ booting connection ] - matrix')
|
|
||||||
# self=start_matrixbot(self)
|
|
||||||
# #######################################################################################
|
|
||||||
# def __boot__discord(self):
|
|
||||||
# print('<<< system_status__info >>> [ booting connection ] - discord')
|
|
||||||
# self=start_discordbot(self)
|
|
||||||
# #######################################################################################
|
|
||||||
# def __boot__telegram(self):
|
|
||||||
# print('<<< system_status__info >>> [ booting connection ] - telegram')
|
|
||||||
# self=start_telegrambot(self)
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
#######################################################################################
|
||||||
|
|
||||||
|
def __boot__matrix(self):
|
||||||
|
fog('booting connection - matrix')
|
||||||
|
if SERVICES_MATRIX:
|
||||||
|
self=start_matrixbot(self)
|
||||||
|
|
||||||
|
#######################################################################################
|
||||||
|
#######################################################################################
|
||||||
|
|
||||||
|
def __boot__discord(self):
|
||||||
|
fog('booting connection - discord')
|
||||||
|
if SERVICES_DISCORD:
|
||||||
|
self=start_discordbot(self)
|
||||||
|
|
||||||
|
#######################################################################################
|
||||||
|
#######################################################################################
|
||||||
|
|
||||||
|
def __boot__telegram(self):
|
||||||
|
fog('booting connection - telegram')
|
||||||
|
if SERVICES_TELEGRAM:
|
||||||
|
self=start_telegrambot(self)
|
||||||
|
|
||||||
|
#######################################################################################
|
||||||
|
#######################################################################################
|
||||||
|
|
||||||
def __boot__empty(self):
|
def __boot__empty(self):
|
||||||
print('<<< system_status__info >>> [ booting connection ] - empty')
|
fog('booting connection - empty')
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
#######################################################################################
|
||||||
|
|
||||||
def __main__(self,index):
|
def __main__(self,index):
|
||||||
counter=0
|
counter=0
|
||||||
if index==0:
|
if index==0:
|
||||||
t=threading.Thread(target=self.__boot__irc)
|
t=threading.Thread(target=self.__boot__irc)
|
||||||
print(f'<<< system_status__info >>> [ thread setup ] - irc')
|
fog(f'thread setup - irc')
|
||||||
t.start()
|
t.start()
|
||||||
print(f'<<< system_status__info >>> [ thread started ] - irc')
|
fog(f'thread started - irc')
|
||||||
# elif index==1:
|
elif index==1:
|
||||||
# t=threading.Thread(target=self.__boot__matrix)
|
if SERVICES_MATRIX:
|
||||||
# print(f'<<< system_status__info >>> [ thread setup ] - matrix')
|
t=threading.Thread(target=self.__boot__matrix)
|
||||||
# t.start()
|
fog(f'thread setup - matrix')
|
||||||
# t.join()
|
t.start()
|
||||||
# print(f'<<< system_status__info >>> [ thread started ] - matrix')
|
t.join()
|
||||||
# elif index==2:
|
fog(f'thread started - matrix')
|
||||||
# t=threading.Thread(target=self.__boot__discord)
|
elif index==2:
|
||||||
# print(f'<<< system_status__info >>> [ thread setup ] - discord')
|
if SERVICES_DISCORD:
|
||||||
# t.start()
|
t=threading.Thread(target=self.__boot__discord)
|
||||||
# t.join()
|
fog(f'thread setup - discord')
|
||||||
# print(f'<<< system_status__info >>> [ thread started ] - discord')
|
t.start()
|
||||||
# elif index==3:
|
t.join()
|
||||||
# t=threading.Thread(target=self.__boot__telegram)
|
fog(f'thread started - discord')
|
||||||
# print(f'<<< system_status__info >>> [ thread setup ] - telegram')
|
elif index==3:
|
||||||
# t.start()
|
if SERVICES_MATRIX:
|
||||||
# t.join()
|
t=threading.Thread(target=self.__boot__telegram)
|
||||||
# print(f'<<< system_status__info >>> [ thread started ] - telegram')
|
fog(f'thread setup - telegram')
|
||||||
|
t.start()
|
||||||
|
t.join()
|
||||||
|
fog(f'thread started - telegram')
|
||||||
elif index==4:
|
elif index==4:
|
||||||
t=threading.Thread(target=self.__boot__empty)
|
t=threading.Thread(target=self.__boot__empty)
|
||||||
print(f'<<< system_status__info >>> [ thread setup ] - empty')
|
fog(f'thread setup - empty')
|
||||||
t.start()
|
t.start()
|
||||||
print(f'<<< system_status__info >>> [ thread started ] - empty')
|
fog(f'thread started - empty')
|
||||||
|
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
|
###########################################################################################
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print('<<< system_status__info >>> [ main loop ] - startup')
|
fog('main loop - startup')
|
||||||
bio=BOTIO()
|
bio=BOTIO()
|
||||||
globals()['guds'].memories.append([bio,'maple:__main__.bio'])
|
globals()['guds'].memories.append([bio,'maple:__main__.bio'])
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
@ -94,9 +162,11 @@ if __name__ == '__main__':
|
|||||||
while True:
|
while True:
|
||||||
counter+=1
|
counter+=1
|
||||||
if counter<=3:
|
if counter<=3:
|
||||||
print(f'<<< system_status__info >>> [ eventloop idler thread ] - not ready - system locked for {str(counter).zfill(2)}/3 seconds')
|
fog(f'eventloop idler thread - not ready - system locked for {str(counter).zfill(2)}/3 seconds')
|
||||||
if counter==4:
|
if counter==4:
|
||||||
dims.__boot__()
|
dims.__boot__()
|
||||||
print(f'<<< system_status__info >>> [ eventloop idler thread ] - system ready')
|
fog(f'eventloop idler thread - system ready')
|
||||||
sleep(1)
|
sleep(1)
|
||||||
|
|
||||||
|
###########################################################################################
|
||||||
####################################################################################### EOF
|
####################################################################################### EOF
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
plugins.emote_plugin
|
plugins.emote_plugin
|
||||||
plugins.fifo_plugin
|
plugins.fifo_plugin
|
||||||
plugins.tool_colors_plugin
|
plugins.tool_colors_plugin
|
||||||
|
plugins.tool_log_plugin
|
||||||
plugins.net_hydra_plugin
|
plugins.net_hydra_plugin
|
||||||
# plugins.timezonediff_plugin
|
# plugins.timezonediff_plugin
|
||||||
# plugins.remind_plugin
|
# plugins.remind_plugin
|
||||||
|
@ -1,36 +1,71 @@
|
|||||||
# -*- coding: utf-8 -*- ############################################################### SOF
|
# -*- coding: utf-8 -*- ############################################################### SOF
|
||||||
|
###########################################################################################
|
||||||
|
|
||||||
???DISCORD???
|
???DISCORD???
|
||||||
???TELEGRAM???
|
???TELEGRAM???
|
||||||
???MATRIX???
|
???MATRIX???
|
||||||
|
|
||||||
|
###########################################################################################
|
||||||
|
###########################################################################################
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import threading
|
import threading
|
||||||
from time import sleep
|
from time import sleep
|
||||||
##################################################channel##################################
|
|
||||||
|
###########################################################################################
|
||||||
|
###########################################################################################
|
||||||
|
|
||||||
if SERVICES_MATRIX:
|
if SERVICES_MATRIX:
|
||||||
from nio import AsyncClient, MatrixRoom, RoomMessageText
|
from nio import AsyncClient, MatrixRoom, RoomMessageText
|
||||||
from plugins.net_matrix_plugin import start_matrixbot
|
from plugins.net_matrix_plugin import start_matrixbot
|
||||||
##################################################channel##################################
|
|
||||||
|
###########################################################################################
|
||||||
|
###########################################################################################
|
||||||
|
|
||||||
if SERVICES_DISCORD:
|
if SERVICES_DISCORD:
|
||||||
from plugins.net_discord_plugin import start_discordbot
|
from plugins.net_discord_plugin import start_discordbot
|
||||||
|
|
||||||
|
###########################################################################################
|
||||||
|
###########################################################################################
|
||||||
|
|
||||||
if SERVICES_TELEGRAM:
|
if SERVICES_TELEGRAM:
|
||||||
from plugins.net_telegram_plugin import start_telegrambot
|
from plugins.net_telegram_plugin import start_telegrambot
|
||||||
##################################################channel##################################
|
|
||||||
|
###########################################################################################
|
||||||
|
###########################################################################################
|
||||||
|
|
||||||
import irc3
|
import irc3
|
||||||
from plugins.net_irc_plugin import config_ircbot, start_ircbot
|
from plugins.net_irc_plugin import config_ircbot, start_ircbot
|
||||||
from plugins.tool_bus_plugin import BUS
|
from plugins.tool_bus_plugin import BUS
|
||||||
from plugins.tool_dims_plugin import dims
|
from plugins.tool_dims_plugin import dims
|
||||||
from plugins.tool_guds_plugin import guds
|
from plugins.tool_guds_plugin import guds
|
||||||
#from plugins.tool_colors_plugin import colorform as print
|
from plugins.tool_colors_plugin import colorform as print
|
||||||
##################################################channel##################################
|
from plugins.tool_log_plugin import FOG
|
||||||
|
|
||||||
|
###########################################################################################
|
||||||
|
###########################################################################################
|
||||||
|
|
||||||
|
fog=FOG().fog
|
||||||
|
|
||||||
|
###########################################################################################
|
||||||
|
###########################################################################################
|
||||||
|
|
||||||
class BOTIO:
|
class BOTIO:
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
#######################################################################################
|
||||||
|
|
||||||
verbosity=True
|
verbosity=True
|
||||||
log_exit_level=[]
|
log_exit_level=[]
|
||||||
loop=asyncio.get_event_loop()
|
loop=asyncio.get_event_loop()
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
#######################################################################################
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
print(f'<<< ________botio_class >>> [ instantiated ]')
|
fog(f'instantiated')
|
||||||
self.ircbot=config_ircbot()
|
self.ircbot=config_ircbot()
|
||||||
self._bio=guds.memory('__main__.bio')
|
self._bio=guds.memory('__main__.bio')
|
||||||
self.net_irc=[]
|
self.net_irc=[]
|
||||||
@ -38,67 +73,87 @@ class BOTIO:
|
|||||||
self.net_matrix=[]
|
self.net_matrix=[]
|
||||||
if SERVICES_DISCORD:
|
if SERVICES_DISCORD:
|
||||||
self.net_discord=[]
|
self.net_discord=[]
|
||||||
self.net_discord_initialized=False
|
fog(f'ircbot configured')
|
||||||
print(f'<<< ________botio_class >>> [ ircbot configured ]')
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
#######################################################################################
|
||||||
|
|
||||||
def __boot__irc(self):
|
def __boot__irc(self):
|
||||||
print('<<< system_status__info >>> [ booting connection ] - irc')
|
fog('booting connection - irc')
|
||||||
self=start_ircbot(self)
|
self=start_ircbot(self)
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
#######################################################################################
|
||||||
|
|
||||||
def __boot__matrix(self):
|
def __boot__matrix(self):
|
||||||
print('<<< system_status__info >>> [ booting connection ] - matrix')
|
fog('booting connection - matrix')
|
||||||
if SERVICES_MATRIX:
|
if SERVICES_MATRIX:
|
||||||
self=start_matrixbot(self)
|
self=start_matrixbot(self)
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
#######################################################################################
|
||||||
|
|
||||||
def __boot__discord(self):
|
def __boot__discord(self):
|
||||||
print('<<< system_status__info >>> [ booting connection ] - discord')
|
fog('booting connection - discord')
|
||||||
if SERVICES_DISCORD:
|
if SERVICES_DISCORD:
|
||||||
self=start_discordbot(self)
|
self=start_discordbot(self)
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
#######################################################################################
|
||||||
|
|
||||||
def __boot__telegram(self):
|
def __boot__telegram(self):
|
||||||
print('<<< system_status__info >>> [ booting connection ] - telegram')
|
fog('booting connection - telegram')
|
||||||
if SERVICES_TELEGRAM:
|
if SERVICES_TELEGRAM:
|
||||||
self=start_telegrambot(self)
|
self=start_telegrambot(self)
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
#######################################################################################
|
||||||
|
|
||||||
def __boot__empty(self):
|
def __boot__empty(self):
|
||||||
print('<<< system_status__info >>> [ booting connection ] - empty')
|
fog('booting connection - empty')
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
#######################################################################################
|
||||||
|
|
||||||
def __main__(self,index):
|
def __main__(self,index):
|
||||||
counter=0
|
counter=0
|
||||||
if index==0:
|
if index==0:
|
||||||
t=threading.Thread(target=self.__boot__irc)
|
t=threading.Thread(target=self.__boot__irc)
|
||||||
print(f'<<< system_status__info >>> [ thread setup ] - irc')
|
fog(f'thread setup - irc')
|
||||||
t.start()
|
t.start()
|
||||||
print(f'<<< system_status__info >>> [ thread started ] - irc')
|
fog(f'thread started - irc')
|
||||||
elif index==1:
|
elif index==1:
|
||||||
if SERVICES_MATRIX:
|
if SERVICES_MATRIX:
|
||||||
t=threading.Thread(target=self.__boot__matrix)
|
t=threading.Thread(target=self.__boot__matrix)
|
||||||
print(f'<<< system_status__info >>> [ thread setup ] - matrix')
|
fog(f'thread setup - matrix')
|
||||||
t.start()
|
t.start()
|
||||||
t.join()
|
t.join()
|
||||||
print(f'<<< system_status__info >>> [ thread started ] - matrix')
|
fog(f'thread started - matrix')
|
||||||
elif index==2:
|
elif index==2:
|
||||||
if SERVICES_DISCORD:
|
if SERVICES_DISCORD:
|
||||||
t=threading.Thread(target=self.__boot__discord)
|
t=threading.Thread(target=self.__boot__discord)
|
||||||
print(f'<<< system_status__info >>> [ thread setup ] - discord')
|
fog(f'thread setup - discord')
|
||||||
t.start()
|
t.start()
|
||||||
t.join()
|
t.join()
|
||||||
print(f'<<< system_status__info >>> [ thread started ] - discord')
|
fog(f'thread started - discord')
|
||||||
elif index==3:
|
elif index==3:
|
||||||
if SERVICES_MATRIX:
|
if SERVICES_MATRIX:
|
||||||
t=threading.Thread(target=self.__boot__telegram)
|
t=threading.Thread(target=self.__boot__telegram)
|
||||||
print(f'<<< system_status__info >>> [ thread setup ] - telegram')
|
fog(f'thread setup - telegram')
|
||||||
t.start()
|
t.start()
|
||||||
t.join()
|
t.join()
|
||||||
print(f'<<< system_status__info >>> [ thread started ] - telegram')
|
fog(f'thread started - telegram')
|
||||||
elif index==4:
|
elif index==4:
|
||||||
t=threading.Thread(target=self.__boot__empty)
|
t=threading.Thread(target=self.__boot__empty)
|
||||||
print(f'<<< system_status__info >>> [ thread setup ] - empty')
|
fog(f'thread setup - empty')
|
||||||
t.start()
|
t.start()
|
||||||
print(f'<<< system_status__info >>> [ thread started ] - empty')
|
fog(f'thread started - empty')
|
||||||
|
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
|
###########################################################################################
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print('<<< system_status__info >>> [ main loop ] - startup')
|
fog('main loop - startup')
|
||||||
bio=BOTIO()
|
bio=BOTIO()
|
||||||
globals()['guds'].memories.append([bio,'maple:__main__.bio'])
|
globals()['guds'].memories.append([bio,'maple:__main__.bio'])
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
@ -107,9 +162,11 @@ if __name__ == '__main__':
|
|||||||
while True:
|
while True:
|
||||||
counter+=1
|
counter+=1
|
||||||
if counter<=3:
|
if counter<=3:
|
||||||
print(f'<<< system_status__info >>> [ eventloop idler thread ] - not ready - system locked for {str(counter).zfill(2)}/3 seconds')
|
fog(f'eventloop idler thread - not ready - system locked for {str(counter).zfill(2)}/3 seconds')
|
||||||
if counter==4:
|
if counter==4:
|
||||||
dims.__boot__()
|
dims.__boot__()
|
||||||
print(f'<<< system_status__info >>> [ eventloop idler thread ] - system ready')
|
fog(f'eventloop idler thread - system ready')
|
||||||
sleep(1)
|
sleep(1)
|
||||||
####################################################################################### EOF
|
|
||||||
|
###########################################################################################
|
||||||
|
####################################################################################### EOF
|
||||||
|
@ -44,6 +44,9 @@
|
|||||||
plugins.whoami_plugin
|
plugins.whoami_plugin
|
||||||
plugins.joke_plugin
|
plugins.joke_plugin
|
||||||
plugins.maple_plugin
|
plugins.maple_plugin
|
||||||
|
plugins.openai_plugin
|
||||||
|
plugins.datetime_plugin
|
||||||
|
plugins.ip_plugin
|
||||||
plugins.tool_colors_plugin
|
plugins.tool_colors_plugin
|
||||||
|
plugins.tool_log_plugin
|
||||||
#plugins.ansi_plugin
|
#plugins.ansi_plugin
|
||||||
#plugins.openai_plugin
|
|
||||||
|
Loading…
Reference in New Issue
Block a user