Last active
May 9, 2020 18:32
-
-
Save Naranbataar/d5d564024430dda6f1cd394668b5ec02 to your computer and use it in GitHub Desktop.
discord.html working proof of concept (idk)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body> | |
<div id='image'> | |
<h4 class='SITE'>$1</h1> | |
<h2 class='QUERY'>@:2</h1> | |
<h1 class='channel'>CTX[0]</h1> | |
<h4 class='id'>$channel</h1> | |
<input value='id'> | |
<form action='channel' method='get'></form> | |
<output value='nsfw'> | |
<span class='[ "$nsfw" == "false" ]'> | |
<h5 class='SAFE'>rating:safe+</h1> | |
</span> | |
<select class='SITE'> | |
<option value='"gelbooru"'> | |
<h4 class='URL'>https://gelbooru.com/index.php?page=dapi&s=post&q=index&tags=$SAFE$QUERY</h3> | |
<h5 class='GREP'>(?<=file_url=").*?(?=")</h3> | |
</option> | |
<option value='"danbooru"'> | |
<h4 class='URL'>https://danbooru.donmai.us/posts.json?tags=$SAFE$QUERY</h3> | |
<h5 class='GREP'>(?<=file_url":").*?(?=")</h3> | |
</option> | |
</select> | |
<h3 class='FILE'>curl -sL "$URL" | grep -oP "$GREP" | shuf -n 1</h3> | |
<span class='[ -z "$FILE" ]'> | |
<h4 class='content'>\\"I didn't find any image senpai...\\"</h4> | |
<input value='channel content'> | |
<form action='message' method='send'></form> | |
<a href='/dev/null'></a> | |
<script>exit</script> | |
</span> | |
<h4 class='url'>\\"$FILE\\"</h4> | |
<h5 class='text'>"discord.html rules"</h5> | |
<h6 class='color'>16758465</h6> | |
<h3 class='image'>set-args url</h3> | |
<h3 class='footer'>set-args text</h3> | |
<h3 class='embed'>set-args color image footer</h3> | |
<input value='channel embed'> | |
<form action='message' method='send'></form> | |
<a href='/dev/null'></a> | |
</div> | |
</body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PATH="$PATH:$(realpath ./mash/bin)" | |
source commands | |
MASH_AUTH_TOKEN='TOKEN'; export MASH_AUTH_TOKEN | |
MASH_AUTH_BOT=1; export MASH_AUTH_BOT | |
prefix '>' | |
on-ready(){ echo -e "$(echo "$1" | jq -r '.user | .username,.id')"; } | |
on-resume(){ echo "Resumed"; } | |
dispatch READY on-ready | |
dispatch RESUMED on-resume | |
parse-command(){ | |
IFS='>' | |
while read -d '<' ENTITY CONTENT; do | |
CONTENT="${CONTENT//'<'/\<}"; CONTENT="${CONTENT//'>'/\>}" | |
CONTENT="${CONTENT//'&'/\&}"; CONTENT="${CONTENT//'"'/\"}" | |
TAG="${ENTITY%% *}" | |
eval "${ENTITY#"$TAG"}" | |
case "$TAG" in | |
'div') echo "$id(){" ;; | |
'/div') echo '}' ;; | |
'h1') echo "$class=\"\\\"\${$CONTENT}\\\"\"" ;; | |
'h2') echo "$class=\"\${$CONTENT}\"" ;; | |
'h3') echo "$class=\"\$($CONTENT)\"" ;; | |
'h4') echo "$class=\"$CONTENT\"" ;; | |
'h5') echo "$class='$CONTENT'" ;; | |
'h6') echo "$class=$CONTENT" ;; | |
'input') echo -n "eval \"\$(set-args $value " ;; | |
'form') echo -n "| $action $method";; | |
'output') echo "| get-args $value)\"" ;; | |
'a') echo ">> $href )\"" ;; | |
'p') echo "echo \"$CONTENT\"" ;; | |
'select') echo "case \"\$$class\" in" ;; | |
'/select') echo "esac" ;; | |
'option') echo "$value )" ;; | |
'/option') echo ';;' ;; | |
'script') echo "$CONTENT";; | |
'span') echo "if $class; then";; | |
'/span') echo 'fi';; | |
esac | |
done < "$1" | |
} | |
eval "$(parse-command 'image.html')" | |
xcommand image 'im img image' '.channel_id' | |
bot-loop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment