Skip to main content

Posts

How to keep extension service workers alive in Manifest V3

In version 3 of the Chromium extension platform, persistent background scripts were replaced with ephemeral service workers. Their ephemeral nature makes it impossible to retain global variables, with the solution being to use the new Storage APIs to persist data. However, this is not possible with some data (e.g. class instances obtained from another library), and this model also prevents using event listeners from non-Chrome services (such as Firebase's Realtime Database). Luckily, there are many workarounds to this problem. The cleanest one as of Chrome 114 is to create an offscreen document that has access to the chrome.runtime API, allowing it to periodically "ping" the service worker every 25 seconds, just enough to reset the service worker's 30-second idle timeout. Please do note that this solution will only work in Chrome 109 and above. Step 1 Create the HTML and JS file for the offscreen document. offscreen.html <! DOCTYPE html > < html > ...

How to import a custom Curseforge launcher modpack into MultiMC

Do you use the Curseforge launcher to make custom Minecraft modpacks, but despair that you can't use them on Linux? Or just want to switch to MultiMC? This post will detail how you can use packs you made, in MultiMC.

How to write a Discord bot in Python using discord.py

Discord is the biggest chatting platform for all gamers and people in general out there, and there's no doubt that if you have Discord, you've seen a Discord bot. Everyone's seen Dank Memer, Dyno, Carl-bot, Ticket Tool, and many other famous bots, as well as servers' own custom bots, but how do you make one yourself? This article will guide you through making a Discord bot in Python using discord.py, a popular library/wrapper for the Discord API. It's also my first blog post :) Note: this tutorial was written for discord.py 1.7.x. That version is now discontinued, and while it still works as I write, Discord may change things in their API that stop it from working and you'll have to upgrade to v2.0.x (which you should anyway). TLDR; until I update this tutorial, you might want to look somewhere else.