forked from lavalink-devs/Lavalink
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Did some basic work on voice connections
- Loading branch information
1 parent
8530f5f
commit 8f8447f
Showing
6 changed files
with
116 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/.idea/ | ||
/Lavalink.iml | ||
/logs/ | ||
/application.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package lavalink.server; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.stereotype.Component; | ||
|
||
@ConfigurationProperties(prefix = "lavalink.server") | ||
@Component | ||
public class Config { | ||
|
||
private String userId; | ||
|
||
public String getUserId() { | ||
return userId; | ||
} | ||
|
||
public void setUserId(String userId) { | ||
this.userId = userId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package lavalink.server.io; | ||
|
||
import org.java_websocket.WebSocket; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class CoreClientImpl implements net.dv8tion.jda.CoreClient { | ||
|
||
private static final Logger log = LoggerFactory.getLogger(CoreClientImpl.class); | ||
|
||
private final WebSocket socket; | ||
|
||
public CoreClientImpl(WebSocket socket) { | ||
this.socket = socket; | ||
} | ||
|
||
@Override | ||
public void sendWS(String s) { | ||
log.info("SEND_WS " + s); | ||
} | ||
|
||
@Override | ||
public boolean isConnected() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean inGuild(String s) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean voiceChannelExists(String s) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean hasPermissionInChannel(String s, long l) { | ||
return true; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package lavalink.server.io; | ||
|
||
import lavalink.server.Launcher; | ||
import net.dv8tion.jda.Core; | ||
import org.java_websocket.WebSocket; | ||
|
||
public class SocketContext { | ||
|
||
private final WebSocket socket; | ||
private final CoreClientImpl coreClient; | ||
private final Core core; | ||
|
||
SocketContext(WebSocket socket) { | ||
this.socket = socket; | ||
this.coreClient = new CoreClientImpl(socket); | ||
this.core = new Core(Launcher.config.getUserId(), coreClient); | ||
} | ||
|
||
public WebSocket getSocket() { | ||
return socket; | ||
} | ||
|
||
public CoreClientImpl getCoreClient() { | ||
return coreClient; | ||
} | ||
|
||
public Core getCore() { | ||
return core; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters