Skip to content

Instantly share code, notes, and snippets.

@Blueyescat
Last active February 29, 2024 20:18
Show Gist options
  • Save Blueyescat/5a9750a7aafef28cfc40f9c2eb40aff7 to your computer and use it in GitHub Desktop.
Save Blueyescat/5a9750a7aafef28cfc40f9c2eb40aff7 to your computer and use it in GitHub Desktop.
# If you want to use a font that doesn't exist on the system: https://github.com/Blueyescat/imagesk/wiki/Documentation#register-font
set {_font} to "Dialog"
set {_color} to color rgb(0, 128, 0)
set {_name} to "Blueyescat"
set {_discriminator} to "0733"
set {_avatarURL} to "https://cdn.discordapp.com/avatars/216921412781211648/9f2ea27b7cbc484626286865e14dbdbe.png"
set {_currentExp} to 1621
set {_requiredExp} to 3564
set {_place} to 16
create an image with width 500 and height 150 with background color rgb(54, 57, 63)
get the image from url {_avatarURL} and store it in {_avatar}
resize {_avatar} to width 110 and height 110
make {_avatar} rounded
draw {_avatar} on the image at location 20, 20 # (150 - 110) / 2
create an image text with id "statsCard-%{_name}%" with text {_name}
set {_line} to "statsCard-%{_name}%"
set font of {_line} to {_font}
set color of text {_line} to {_color}
set size of {_line} to 28
set {_discriminatorSize} to 16
set {_discriminatorY} to 40
set {_nameY} to 28
while width of text {_line} is greater than 200: # Max width of the text
remove 1 from size of {_line}
if mod((size of {_line}), 2) is 0:
remove 1 from {_discriminatorSize}
add 1 to {_discriminatorY}
add 1 to {_nameY}
write text {_line} on the image at location 150, {_nameY}
set {_nameWidth} to width of text {_line}
set text of text {_line} to "##%{_discriminator}%"
set size of {_line} to {_discriminatorSize}
set color of text {_line} to color hex "666666"
set bold state of {_line} to on
write text {_line} on the image at location (150 + {_nameWidth} + 1), {_discriminatorY}
set text of text {_line} to "/%{_requiredExp}%xp"
set size of {_line} to 14
set bold state of {_line} to on
set {_requiredExpWidth} to width of text {_line}
write text {_line} on the image at location (480 - {_requiredExpWidth}), 42
set text of text {_line} to "%{_currentExp}%"
set size of {_line} to 14
set color of text {_line} to {_color}
set bold state of {_line} to on
set {_currentExpWidth} to width of text {_line}
write text {_line} on the image at location ((480 - {_currentExpWidth}) - {_requiredExpWidth}), 42
set text of text {_line} to "Place %{_place}%"
set size of {_line} to 15
set color of text {_line} to color hex "666666"
set bold state of {_line} to on
set {_placeWidth} to width of text {_line}
write text {_line} on the image at location (480 - {_placeWidth}), 100
set {_diffPercent} to ({_currentExp} / {_requiredExp}) * 100
set {_progress} to (330 / 100) * {_diffPercent}
draw a rounded rectangle with arc width 15 and height 15 with rectangle width 334 and height 19 with color rgb(80, 80, 80) on the image at location 148, 73
draw a rounded rectangle with arc width 10 and height 10 with rectangle width 330 and height 15 with color rgb(50, 50, 50) on the image at location 150, 75
draw a rounded rectangle with arc width 10 and height 10 with rectangle width {_progress} and height 15 with {_color} on the image at location 150, 75
delete the image text with id {_line}
# That's it, now you can upload the image to Discord using: https://github.com/Blueyescat/imagesk/wiki/Documentation#upload-image-to-discord-vixio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment