Skip to content

Instantly share code, notes, and snippets.

@ghostdevv
Last active October 14, 2025 14:47
Show Gist options
  • Save ghostdevv/029db1614ad8f8e7b74b3e7f28971be3 to your computer and use it in GitHub Desktop.
Save ghostdevv/029db1614ad8f8e7b74b3e7f28971be3 to your computer and use it in GitHub Desktop.
guild to event violent monkey
// ==UserScript==
// @name guild to event
// @namespace Violentmonkey Scripts
// @match https://guild.host/events/*
// @grant none
// @version 1.0
// @author Willow (GHOST)
// @description 14/10/2025, 13:39:18
// ==/UserScript==
const button = document.createElement('button');
button.innerText = 'To Event';
button.style.position = 'fixed';
button.style.right = '16px';
button.style.bottom = '16px';
button.style.zIndex = '100000';
button.style.backgroundColor = '#121214';
button.style.border = '2px solid #2160ec';
button.style.borderRadius = '16px';
button.style.padding = '8px 12px';
button.style.color = '#eeeeee';
document.body.appendChild(button);
const KNOWN_NAMES = {
'Svelte Society - London': 'svelte-london',
'JS Monthly London': 'jsmonthly'
};
function eventName(owner) {
return KNOWN_NAMES[owner] ?? owner.toLowerCase().replaceAll(' ', '-');
}
function fmtDate(date) {
return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
}
function jsonURL(data) {
return URL.createObjectURL(
new Blob([JSON.stringify(data)], { type: 'application/json' }),
);
}
function download(fileName, data) {
return new Promise((resolve) => {
const anchor = document.createElement('a');
anchor.href = data;
anchor.download = fileName;
anchor.click();
resolve();
});
}
button.addEventListener('click', async () => {
button.innerText = 'running...';
button.disabled = true;
const id = location.pathname.replace('/events/', '');
try {
const response = await fetch(`https://guild.host/api/next/events/${id}`);
const data = await response.json();
const eventSlug = `${fmtDate(new Date(data.startAt))}-${eventName(data.owner.name)}`;
const final = {
name: data.name,
place: 'in-person',
type: 'meetup',
url: data.fullUrl,
thumbnail: `$assets/events/${eventSlug}.png`,
start: data.startAt,
end: data.endAt,
};
await download(`${eventSlug}.json`, jsonURL(final));
const imageResponse = await fetch(data.generatedSocialCardURL.replace(/\.svg$/, '.png'));
const imageData = await imageResponse.blob();
await download(`${eventSlug}.png`, URL.createObjectURL(imageData));
button.innerText = 'To Event';
} catch (error) {
console.error('failed to export to event', error);
button.innerText = 'failed';
} finally {
button.disabled = false;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment