Skip to content

Instantly share code, notes, and snippets.

@EntityPlantt
Last active February 21, 2024 19:56
Show Gist options
  • Save EntityPlantt/dbe75a9e1a93706e397a8cf76631930b to your computer and use it in GitHub Desktop.
Save EntityPlantt/dbe75a9e1a93706e397a8cf76631930b to your computer and use it in GitHub Desktop.
Hue rotate PFP for your Discord bot
const {execSync: cmd} = require("child_process"), fs = require("fs");
for (var i = 0; i < 200; i += 10) cmd(`magick og.png -modulate 100,100,${(i + 100) % 200} -quality 85% hue${i}.jpg`);
cmd(`convert -delay 5 -loop 0 ${Array(20).fill(0).map((x, i) => `hue${i * 10}.jpg`).join(" ")} final.gif`);
let data = `{"avatar":"data:image/gif;base64,${fs.readFileSync("final.gif").toString("base64")}"}`;
fs.writeFileSync("final.txt", data);
cmd(`cat final.txt | curl -H "Authorization: Bot $(cat auth.txt)" -H "Content-Type: application/json" -X PATCH --data-binary @- https://discord.com/api/users/@me`);
@EntityPlantt
Copy link
Author

EntityPlantt commented Feb 7, 2024

Creates a hue rotation PFP and sets it automatically on your Discord bot.
Utilization of the new Discord Bot feature.

Prequisities

  • Run Linux
  • Download ImageMagick command-line tool (sudo apt-get install magick, rpm-ostree install magick)
  • Place your Discord token inside auth.txt
  • Place an image in og.png
  • Run node rbpfp

Example

image
final

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment