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/sh | |
### Posix compliant script for Discord Rich presence (no need to have python and pypresence) ### | |
#encode opcode and payload length in little-endian format and prepend it with payload | |
encode_data() { | |
op=$1 | |
datalen=${#2} | |
for i in $(seq 0 3); do | |
byte=$(((op >> (i * 8)) & 255)) |