dasfdsfa
This commit is contained in:
parent
ecd1fdf001
commit
5c21be10da
4 changed files with 80 additions and 53 deletions
46
.vscode/settings.json
vendored
Normal file
46
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
"Lua.diagnostics.disable": [
|
||||
"unused-local",
|
||||
"lowercase-global",
|
||||
"unused-function"
|
||||
],
|
||||
"Lua.diagnostics.severity": {
|
||||
"redefined-local": "Warning"
|
||||
},
|
||||
"Lua.diagnostics.globals": [
|
||||
"printError",
|
||||
"sleep",
|
||||
"read",
|
||||
"write",
|
||||
"print",
|
||||
"colours",
|
||||
"colors",
|
||||
"commands",
|
||||
"disk",
|
||||
"fs",
|
||||
"gps",
|
||||
"help",
|
||||
"http",
|
||||
"paintutils",
|
||||
"parallel",
|
||||
"peripheral",
|
||||
"rednet",
|
||||
"redstone",
|
||||
"keys",
|
||||
"settings",
|
||||
"shell",
|
||||
"multishell",
|
||||
"term",
|
||||
"textutils",
|
||||
"turtle",
|
||||
"pocket",
|
||||
"vector",
|
||||
"bit32",
|
||||
"window",
|
||||
"_CC_DEFAULT_SETTINGS",
|
||||
"_HOST",
|
||||
"_VERSION",
|
||||
"_"
|
||||
],
|
||||
"Lua.runtime.version": "Lua 5.1",
|
||||
}
|
60
Cargo.lock
generated
60
Cargo.lock
generated
|
@ -46,7 +46,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.38",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -159,17 +159,6 @@ dependencies = [
|
|||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "command_attr"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "07b787d19b9806dd4c9c34b2b4147d1a61d6120d93ee289521ab9b0294d198e4"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
version = "0.9.3"
|
||||
|
@ -345,7 +334,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.38",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -578,12 +567,6 @@ dependencies = [
|
|||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "levenshtein"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db13adb97ab515a3691f56e4dbab09283d0b86cb45abd991d8634a9d6f501760"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.149"
|
||||
|
@ -971,7 +954,7 @@ checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.38",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1010,11 +993,9 @@ dependencies = [
|
|||
"bytes",
|
||||
"cfg-if",
|
||||
"chrono",
|
||||
"command_attr",
|
||||
"dashmap",
|
||||
"flate2",
|
||||
"futures",
|
||||
"levenshtein",
|
||||
"mime",
|
||||
"mime_guess",
|
||||
"parking_lot",
|
||||
|
@ -1023,13 +1004,11 @@ dependencies = [
|
|||
"serde",
|
||||
"serde-value",
|
||||
"serde_json",
|
||||
"static_assertions",
|
||||
"time",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"typemap_rev",
|
||||
"url",
|
||||
"uwl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1101,23 +1080,6 @@ version = "0.9.8"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.109"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.38"
|
||||
|
@ -1167,7 +1129,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.38",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1239,7 +1201,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.38",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1315,7 +1277,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.38",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1445,12 +1407,6 @@ version = "0.7.6"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
|
||||
|
||||
[[package]]
|
||||
name = "uwl"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4bf03e0ca70d626ecc4ba6b0763b934b6f2976e8c744088bb3c1d646fbb1ad0"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
|
@ -1493,7 +1449,7 @@ dependencies = [
|
|||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.38",
|
||||
"syn",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
|
@ -1527,7 +1483,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.38",
|
||||
"syn",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
|
|
@ -10,6 +10,6 @@ anyhow = "1.0.75"
|
|||
parking_lot = "0.12.1"
|
||||
serde = { version = "1.0.190", features = ["derive"] }
|
||||
serde_json = "1.0.107"
|
||||
serenity = "0.11.7"
|
||||
serenity = { version = "0.11.7", default-features = false, features = ["builder", "cache", "chrono", "client", "gateway", "model", "http", "utils", "rustls_backend"] }
|
||||
tokio = { version = "1.33.0", features = ["macros", "rt-multi-thread"] }
|
||||
tokio-tungstenite = "0.20.1"
|
||||
|
|
25
bridge.lua
Normal file
25
bridge.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
local chat = peripheral.find("chatBox")
|
||||
local socket = http.websocket(settings.get("bridge_url"), { ["X-Token"] = settings.get("bridge_token") })
|
||||
|
||||
while true do
|
||||
local eventData = os.pullEvent()
|
||||
local event = eventData[1]
|
||||
|
||||
if event == "websocket_message" then
|
||||
local data = textutils.unserializeJSON(eventData[3])
|
||||
chat.sendMessage(data.message, data.user)
|
||||
elseif event == "chat" then
|
||||
if not eventData[5] then
|
||||
local username = eventData[2]
|
||||
local message = eventData[3]
|
||||
local uuid = eventData[4]
|
||||
|
||||
local serialized = textutils.serialiseJSON({
|
||||
user = username,
|
||||
message = message,
|
||||
user_id = string.gsub(uuid, "-", "")
|
||||
})
|
||||
socket.send(serialized)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue