From 98a0fe235412e6f7de18214321b95082b82e47af Mon Sep 17 00:00:00 2001 From: Soheab_ <33902984+Soheab@users.noreply.github.com> Date: Mon, 23 Jun 2025 00:10:18 +0200 Subject: [PATCH] Define items once --- discord/abc.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/discord/abc.py b/discord/abc.py index e93a881cd..7f2d83158 100644 --- a/discord/abc.py +++ b/discord/abc.py @@ -1785,14 +1785,13 @@ class Messageable: before=time, ) - if data and data["items"]: - items = data["items"] + items = data and data["items"] + if items: if limit is not None: limit -= len(items) time = items[-1]['pinned_at'] - items = data['items'] # Terminate loop on next iteration; there's no data left after this if len(items) < max_limit or not data['has_more']: limit = 0