Repository: hikari-py/hikari
Pull request #930 (2021-12-15 19:04:27)

Fix PartialSticker.image_url not passing the hash as a string
### Checklist
<!-- Make sure to tick all the following boxes by putting an `x` in between (like this `[x]`) -->
- [x] I have run `nox` and all the pipelines have passed.
- [x] I have made unittests according to the code I have added/modified/deleted.




Patch:
diff --git a/changes/930.bugfix.md b/changes/930.bugfix.md
new file mode 100644
index 00000000..2759684b
--- /dev/null
+++ b/changes/930.bugfix.md
@@ -0,0 +1,1 @@
+Fix `PartialSticker.image_url` not passing the hash as a string
diff --git a/hikari/internal/routes.py b/hikari/internal/routes.py
index e7b2ab3d..b3cfd8dc 100644
--- a/hikari/internal/routes.py
+++ b/hikari/internal/routes.py
@@ -556,7 +556,7 @@ def compile_to_file(
 # undocumented on the Discord docs.
 CDN_CHANNEL_ICON: typing.Final[CDNRoute] = CDNRoute("/channel-icons/{channel_id}/{hash}", {PNG, *JPEG_JPG, WEBP})
 
-CDN_STICKER: typing.Final[CDNRoute] = CDNRoute("/stickers/{hash}", {PNG, LOTTIE}, sizable=False)
+CDN_STICKER: typing.Final[CDNRoute] = CDNRoute("/stickers/{sticker_id}", {PNG, LOTTIE}, sizable=False)
 CDN_STICKER_PACK_BANNER: typing.Final[CDNRoute] = CDNRoute(
     "/app-assets/710982414301790216/store/{hash}", {PNG, *JPEG_JPG, WEBP}
 )
diff --git a/hikari/stickers.py b/hikari/stickers.py
index 94535778..cc19455f 100644
--- a/hikari/stickers.py
+++ b/hikari/stickers.py
@@ -157,7 +157,7 @@ def image_url(self) -> files.URL:
         """
         ext = "json" if self.format_type is StickerFormatType.LOTTIE else "png"
 
-        return routes.CDN_STICKER.compile_to_file(urls.CDN_URL, hash=self.id, file_format=ext)
+        return routes.CDN_STICKER.compile_to_file(urls.CDN_URL, sticker_id=self.id, file_format=ext)
 
 
 @attr_extensions.with_copy
diff --git a/scripts/deploy.sh b/scripts/deploy.sh
index dcefa33a..16de5ee0 100755
--- a/scripts/deploy.sh
+++ b/scripts/deploy.sh
@@ -21,7 +21,7 @@
 # SOFTWARE.
 set -e
 
-if [ $(ls -1 changes/*.*.md 2>/dev/null | wc -l) = 0]; then
+if [ $(ls -1 changes/*.*.md 2>/dev/null | wc -l) != 0 ]; then
     echo "Cannot create release if CHANGELOG fragment files exist under 'changes/'!"
     exit 1
 fi


Test patch:
diff --git a/tests/hikari/test_stickers.py b/tests/hikari/test_stickers.py
index 5502bca7..b0207317 100644
--- a/tests/hikari/test_stickers.py
+++ b/tests/hikari/test_stickers.py
@@ -73,7 +73,7 @@ def test_image_url(self, model):
         ) as route:
             assert model.image_url == "file"
 
-        route.compile_to_file.assert_called_once_with(urls.CDN_URL, hash=123, file_format="png")
+        route.compile_to_file.assert_called_once_with(urls.CDN_URL, sticker_id=123, file_format="png")
 
     def test_image_url_when_LOTTIE(self, model):
         model.format_type = stickers.StickerFormatType.LOTTIE
@@ -83,4 +83,4 @@ def test_image_url_when_LOTTIE(self, model):
         ) as route:
             assert model.image_url == "file"
 
-        route.compile_to_file.assert_called_once_with(urls.CDN_URL, hash=123, file_format="json")
+        route.compile_to_file.assert_called_once_with(urls.CDN_URL, sticker_id=123, file_format="json")