Skip to content

Instantly share code, notes, and snippets.


Sven Fehler Sv443

View GitHub Profile
Sv443 / serverLocations.js
Last active Jan 18, 2021
[Node.js] Get all currently available location IDs and names of the Discord servers
View serverLocations.js
// By Sv443 ( ) - licensed under the WTFPL license
// >> To use this, you need to install the package "xmlhttprequest" <<
// API reference:
const XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
Sv443 / publish.yml
Last active Nov 24, 2020
GitHub Actions: Publish to NPM and GitHub Package Registry on created release
View publish.yml
# In order for this to work, since GitHub Package Registry likes to be a thorn in your ass, you'll have to follow this guide, otherwise this script will not work:
# >>>> There are two lines that end in four exclamation marks. You will have to enter your usernames there for this script to work.
# Author: Sv443
# License: WTFPL (
name: Publish to NPM and GPR
Sv443 / discord-js-get-all-guild-invites.js
Last active May 29, 2020
Discord.js - Get all invites from all your bot's guilds - only works with Discord.js v11 or lower!
View discord-js-get-all-guild-invites.js
const Discord = require("discord.js");
const dev_ids = ["YOUR_ID(s)_HERE"]; // an array of IDs of the bot's developers - only these people will be able to execute this command
// Note: this snippet requires the variables "client" and "message" to work, these need to be provided by your script
var allowedToUse = false;
dev_ids.forEach(id => {
View nodejs_soft_shutdown.js
// not compatible with ES5, only ES6 and up
process.on('SIGINT', ()=>{
try {
// end your processes here, for example
// http_connection.close();
// or
// mysql_connection.end();
Sv443 / js_audio.js
Last active Oct 24, 2018
[JavaScript] Simple Audio Class
View js_audio.js
// this simple, lightweight, feature-rich and lightning fast Audio class is the perfect way to play an invisible audio file in vanilla JS
// if preloading is set to true, the audio file will play instantly and without buffering
// if the audio is set to loop, it will loop absolutely perfectly and without gaps provided that the audio file itself can loop perfectly
// supported file formats depend on the end user's browser. I have used mp3, wav and ogg before and it worked perfectly on modern browsers
// initialize and preload audio with, "path/to/audio.mp3", preload) - preload has to be true or false
// play with
// pause with Audio.pause(id)
// stop with Audio.stop(id)