I got this code
Handler.jl
module WSHandler
include("Logger.jl")
include("../Structs/User.jl")
using Base
using Dates
import .WSLogger
import .User
import JSON
function handleEvent(data, mainClient) # content is the key "d"
eventName = data["t"]
content = data["d"]
#println(content)
if eventName == "READY"
user = content["user"]
username = user["username"]
id = user["id"]
discriminator = user["discriminator"]
avatar = user["avatar"]
bot = user["bot"]
mfa_enabled = user["mfa_enabled"]
locale = user["locale"]
verified = user["verified"]
email = user["email"]
println("WORKES")
userObject = User.Self(user, username, id, discriminator, avatar, bot, mfa_enabled, locale, verified, email)
println("BLOCKED and never executs")
WSLogger.log("Client is ready as: $username", "Log")
mainClient.send(eventName)
end
end
end
And as you can see the userObject blocks the rest of the code and exists without an error and with the output of “WORKS” since I’m printing it when it not blocking
user.jl
module User
mutable struct Self
username::String
id::String
discriminator::String
avatar::String
bot::Bool
mfa_enabled::Bool
locale::String
verified::Bool
email::Any
end
# Returns a Dictionary of the supplied User
function serialize(user)
serialized = Dict()
for i in fieldnames(Self)
value = getfield(user, i)
serialized[i] = value
end
return serialized
end
end