darkside40 107 Posted October 7, 2025 Posted October 7, 2025 (edited) Hi there, maybe someone can point me in the correct direction or simply tell that what i want to achieve does not work. We will see. What do i want to achieve? I want to add a button to the Config Page of my Telegram Notification Plugin that once pressed will hopefully show the Chat ID of the Telegram Bot. I have a working simple sample code put together. Now i ask myself how to integrate it in my Project. That is the codesnippet which does the magic: document.getElementById('fetchButton').addEventListener('click', async function() { try { const response = await fetch('https://api.telegram.org/botID/getUpdates'); if (!response.ok) { throw new Error('Netzwerkantwort war nicht ok'); } const data = await response.json(); // ID aus dem chat-Objekt extrahieren if (data.ok && data.result && data.result.length > 0) { const chatId = data.result[0].message.chat.id; alert('Chat ID: ' + chatId); } else { alert('Keine Daten gefunden'); } } catch (error) { alert('Fehler beim Abrufen der Daten: ' + error.message); } }); The source of my plugin is here: https://codeberg.org/bjoerns1983/Emby.Plugin.TelegramNotification/src/branch/master/Emby.Plugin.TelegramNotification/Configuration I already changed the template html so i have a rather small and ugly button, but it is clickable. but how and where do i insert the JS Snippet into the entryeditor.js? Btw the button has the id fetchbutton? Like i said, is that even possible? Edited October 7, 2025 by darkside40
darkside40 107 Posted October 7, 2025 Author Posted October 7, 2025 Think i found a way, but have to test it. If it works it will be included in the Plugin.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now