summaryrefslogtreecommitdiff
path: root/discord/pylon.lua
diff options
context:
space:
mode:
Diffstat (limited to 'discord/pylon.lua')
-rw-r--r--discord/pylon.lua40
1 files changed, 40 insertions, 0 deletions
diff --git a/discord/pylon.lua b/discord/pylon.lua
new file mode 100644
index 0000000..0200208
--- /dev/null
+++ b/discord/pylon.lua
@@ -0,0 +1,40 @@
+local consts = require'discord.consts'
+local websocket = require'http.websocket'
+local json = require 'dkjson'
+
+local Discord = {}
+
+function Discord.make(wilson,conf)
+ local self = {
+end
+
+
+local function identify_payload(token)
+ local I = consts.intents
+ return json.encode{
+ op = consts.opcodes.identify,
+ d = {
+ properties = {
+ os = "wilson",
+ browser = "wilson",
+ device = "wilson",
+ },
+ intents = I.guilds + I.guild_messages + I.message_content,
+ token = token,
+ }
+ }
+end
+
+local token = 'NzY1NTMyNjgzMTQ4MzI4OTcw.GJCRVk.uvplnizyiRKxONvmKD4b8lq7Ju0QSqoPAmqj1w'
+
+local function connect()
+ local uri = "wss://gateway.discord.gg/?v=10&encoding=json"
+ local ws = websocket.new_from_uri(uri)
+ print(ws:connect())
+ ws:send(identify_payload(token), 'text')
+ for a,b in ws:each() do
+ print('its',a,b)
+ end
+end
+
+connect()