This commit is contained in:
parent
edf386ebca
commit
6ddd31b03a
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "usetether",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"author": "Braydon (Rainnny) <braydonrainnny@gmail.com>",
|
||||
"description": "An API designed to provide real-time access to a user's Discord data.",
|
||||
"keywords": [
|
||||
@ -10,7 +10,7 @@
|
||||
"restful",
|
||||
"realtime"
|
||||
],
|
||||
"homepage": "https://github.com/Rainnny7/Tether",
|
||||
"homepage": "https://usetether.rest",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Rainnny7/Tether.git"
|
||||
|
@ -2,7 +2,13 @@ import TetherConfig from "@/types/config";
|
||||
import DiscordUser from "@/types/user";
|
||||
import {useEffect, useState} from "react";
|
||||
|
||||
export const useTether = (snowflake: number, {endpoint = "usetether.rest", secure = true, realtime = false}: TetherConfig): DiscordUser | undefined => {
|
||||
export const useTether = (
|
||||
snowflake: number,
|
||||
{endpoint, secure, realtime}: TetherConfig = {
|
||||
endpoint: "usetether.rest",
|
||||
secure: true,
|
||||
realtime: false
|
||||
}): DiscordUser | undefined => {
|
||||
const [user] = useState<DiscordUser | undefined>();
|
||||
|
||||
useEffect(() => {
|
||||
@ -13,11 +19,7 @@ export const useTether = (snowflake: number, {endpoint = "usetether.rest", secur
|
||||
*/
|
||||
const connect = () => {
|
||||
socket = new WebSocket(`ws${secure && "s"}://${endpoint}/gateway`); // Connect to the gateway
|
||||
|
||||
socket.addEventListener("open", () => {
|
||||
console.log("[Tether] WebSocket connection established!");
|
||||
});
|
||||
|
||||
socket.addEventListener("open", () => console.log("[Tether] WebSocket connection established!"));
|
||||
socket.addEventListener("close", connect);
|
||||
|
||||
socket.addEventListener("message", event => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user