Created
June 23, 2025 22:21
-
-
Save Vocaned/fddae9819de8bb7c2f0a2bc8d48c6d6f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Set up some prerequisites | |
if (typeof _mods === 'undefined') { | |
var _mods; webpackChunkdiscord_app.push([[Symbol()], {}, r => _mods = r.c]); | |
webpackChunkdiscord_app.pop(); | |
} | |
if (typeof findByProps === 'undefined') { | |
var findByProps = (...props) => { | |
for (let m of Object.values(_mods)) { | |
try { | |
if (!m.exports || m.exports === window) continue; | |
if (props.every((x) => m.exports?.[x])) return m.exports; | |
for (let ex in m.exports) { | |
if (props.every((x) => m.exports?.[ex]?.[x]) && m.exports[ex][Symbol.toStringTag] !== 'IntlMessagesProxy') return m.exports[ex]; | |
} | |
} catch { } | |
} | |
} | |
} | |
let openshock = async (id, token, channels, regex, control, reactions) => { | |
let currentUser = findByProps('getCurrentUser').getCurrentUser().id; | |
let shock = (intensity, duration) => { | |
intensity = Math.min(Math.max(intensity, 0), 100); | |
duration = Math.min(duration, 10000); | |
// Change this if you're selfhosting your own backend | |
fetch('https://api.openshock.app/2/shockers/control', { | |
method: 'POST', | |
headers: { | |
'User-Agent': 'DiscordSnippet/1.0 (.gg/discord-603970300668805120)', | |
'Open-Shock-Token': token, | |
'Content-Type': 'application/json' | |
}, | |
body: { | |
'shocks': [{ | |
'id': id, | |
'type': 'Shock', | |
'intensity': intensity, | |
'duration': duration, | |
}] | |
} | |
}); | |
} | |
// You can change these variables | |
let defaultIntensity = 10; // 0 - 100 | |
let defaultDuration = 1000; // ms | |
findByProps('_dispatch').addInterceptor(e => { | |
try { | |
if (e.type === 'RPC_NOTIFICATION_CREATE') { | |
shock(defaultIntensity, defaultDuration); | |
} else if (e.type === 'MESSAGE_CREATE' && channels.includes(e.channelId) && e.message.author.id !== currentUser) { | |
if (regex && !regex.test(e.message.content)) return; | |
let c = e.message.content.match(/^shock\.(\d+)\.(\d+)$/); | |
if (control && c) shock(parseInt(c[1]), parseInt(c[2])); | |
else shock(defaultIntensity, defaultDuration); | |
} else if (e.type === 'MESSAGE_REACTION_ADD' && reactions && e.messageAuthorId === currentUser) { | |
if (e.reactionType === 0) shock(defaultIntensity, defaultDuration); | |
if (e.reactionType === 1) vibrate(defaultIntensity * 2, defaultDuration * 2); | |
} | |
} catch { } | |
}); | |
} | |
// id, token, channels, regex, control, reactions | |
await openshock( | |
'1fd29d9d-f7cf-41fd-9da9-08ea4f246c79', | |
'BGgmWwM19HKxOnzogLF16kOQP0sQ901sX4BmBcTFihsdFfUarSGNOiNaPnOBnMSo', | |
['867746422027452426'], | |
null, | |
false, | |
true | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment