aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavid <[email protected]>2026-10-13 05:17:15 -0300
committerdavid <[email protected]>2026-10-13 05:17:15 -0300
commit1013d472e65941fcb5e3adfe1d9a7beceb8403e5 (patch)
treea774043593e4e6d0227ffe911460802ad88fa891
parentfec259bb5c485eeae0e175de0d22561e5aa852a5 (diff)
downloadfaggot-chan-1013d472e65941fcb5e3adfe1d9a7beceb8403e5.tar.gz
faggot-chan-1013d472e65941fcb5e3adfe1d9a7beceb8403e5.zip
filter unavailable stickers/emojis in on_random. locked stickers and emojis were still in the guild lists, causing 50081 (cannot use this sticker) and 10014 (unknown emoji) errors and skipping the llm reply
-rw-r--r--bot.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/bot.py b/bot.py
index 02dd4e1..7485ef2 100644
--- a/bot.py
+++ b/bot.py
@@ -261,8 +261,9 @@ async def on_random(message) -> bool:
# single weighted pick between sticker/emoji/media, used as a substitute for an actual
# llm reply — only called once on_message already decided this message gets a response.
# returns True if it fired (caller should skip the llm call), False if it should proceed normally.
- stickers = list(message.guild.stickers)
- emojis = [str(e) for e in message.guild.emojis]
+ # skip locked/role-restricted ones, discord rejects those (50081 / 10014)
+ stickers = [s for s in message.guild.stickers if s.available]
+ emojis = [str(e) for e in message.guild.emojis if e.available and not e.roles]
options = []
if stickers: