From d362c96b80ea34ebe4d8aa572b18cca0092b8030 Mon Sep 17 00:00:00 2001 From: chylex Date: Sat, 12 Feb 2022 18:35:47 +0100 Subject: [PATCH] Fix skipping to next channel not working after a Discord update (browser script) --- src/tracker/discord.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/tracker/discord.js b/src/tracker/discord.js index c8acadd..ed4ff31 100644 --- a/src/tracker/discord.js +++ b/src/tracker/discord.js @@ -297,11 +297,15 @@ var DISCORD = (function(){ if (nextChannel === null){ return false; } - else{ - nextChannel.children[0].click(); - nextChannel.scrollIntoView(true); - return true; + + const nextChannelLink = nextChannel.querySelector("a[href^='/channels/']"); + if (!nextChannelLink) { + return false; } + + nextChannelLink.click(); + nextChannel.scrollIntoView(true); + return true; } } };