Updated music interface to the newest version of TeaSpeak

This commit is contained in:
WolverinDEV 2018-11-26 20:52:56 +01:00
parent 09ae0503b6
commit 17d543e711
3 changed files with 11 additions and 13 deletions

View file

@ -788,7 +788,7 @@ class MusicClientProperties extends ClientProperties {
} }
class MusicClientPlayerInfo { class MusicClientPlayerInfo {
botid: number = 0; bot_id: number = 0;
player_state: number = 0; player_state: number = 0;
player_buffered_index: number = 0; player_buffered_index: number = 0;
@ -870,7 +870,7 @@ class MusicClientEntry extends ClientEntry {
createInputModal("Please enter the URL", "URL:", text => true, result => { createInputModal("Please enter the URL", "URL:", text => true, result => {
if(result) { if(result) {
this.channelTree.client.serverConnection.sendCommand("musicbotqueueadd", { this.channelTree.client.serverConnection.sendCommand("musicbotqueueadd", {
botid: this.properties.client_database_id, bot_id: this.properties.client_database_id,
type: "yt", //Its a hint not a force! type: "yt", //Its a hint not a force!
url: result url: result
}).catch(error => { }).catch(error => {
@ -937,7 +937,7 @@ class MusicClientEntry extends ClientEntry {
Modals.spawnYesNo("Are you sure?", $.spawn("div").append(tag), result => { Modals.spawnYesNo("Are you sure?", $.spawn("div").append(tag), result => {
if(result) { if(result) {
this.channelTree.client.serverConnection.sendCommand("musicbotdelete", { this.channelTree.client.serverConnection.sendCommand("musicbotdelete", {
botid: this.properties.client_database_id bot_id: this.properties.client_database_id
}); });
} }
}); });
@ -977,7 +977,7 @@ class MusicClientEntry extends ClientEntry {
this._info_promise_resolve = resolve; this._info_promise_resolve = resolve;
}); });
this.channelTree.client.serverConnection.sendCommand("musicbotplayerinfo", {botid: this.properties.client_database_id }); this.channelTree.client.serverConnection.sendCommand("musicbotplayerinfo", {bot_id: this.properties.client_database_id });
return this._info_promise; return this._info_promise;
} }
} }

View file

@ -423,7 +423,7 @@ class MusicInfoManager extends ClientInfoManager {
button_play.click(handler => { button_play.click(handler => {
if(!button_play.hasClass("active")) { if(!button_play.hasClass("active")) {
this.handle.handle.serverConnection.sendCommand("musicbotplayeraction", { this.handle.handle.serverConnection.sendCommand("musicbotplayeraction", {
botid: bot.properties.client_database_id, bot_id: bot.properties.client_database_id,
action: 1 action: 1
}).then(updated => this.triggerUpdate()).catch(error => { }).then(updated => this.triggerUpdate()).catch(error => {
createErrorModal("Failed to execute play", MessageHelper.formatMessage("Failed to execute play.<br>{}", error)).open(); createErrorModal("Failed to execute play", MessageHelper.formatMessage("Failed to execute play.<br>{}", error)).open();
@ -436,7 +436,7 @@ class MusicInfoManager extends ClientInfoManager {
button_pause.click(handler => { button_pause.click(handler => {
if(!button_pause.hasClass("active")) { if(!button_pause.hasClass("active")) {
this.handle.handle.serverConnection.sendCommand("musicbotplayeraction", { this.handle.handle.serverConnection.sendCommand("musicbotplayeraction", {
botid: bot.properties.client_database_id, bot_id: bot.properties.client_database_id,
action: 2 action: 2
}).then(updated => this.triggerUpdate()).catch(error => { }).then(updated => this.triggerUpdate()).catch(error => {
createErrorModal("Failed to execute pause", MessageHelper.formatMessage("Failed to execute pause.<br>{}", error)).open(); createErrorModal("Failed to execute pause", MessageHelper.formatMessage("Failed to execute pause.<br>{}", error)).open();
@ -448,7 +448,7 @@ class MusicInfoManager extends ClientInfoManager {
}); });
button_stop.click(handler => { button_stop.click(handler => {
this.handle.handle.serverConnection.sendCommand("musicbotplayeraction", { this.handle.handle.serverConnection.sendCommand("musicbotplayeraction", {
botid: bot.properties.client_database_id, bot_id: bot.properties.client_database_id,
action: 0 action: 0
}).then(updated => this.triggerUpdate()).catch(error => { }).then(updated => this.triggerUpdate()).catch(error => {
createErrorModal("Failed to execute stop", MessageHelper.formatMessage("Failed to execute stop.<br>{}", error)).open(); createErrorModal("Failed to execute stop", MessageHelper.formatMessage("Failed to execute stop.<br>{}", error)).open();
@ -471,7 +471,7 @@ class MusicInfoManager extends ClientInfoManager {
{ /* Button functions */ { /* Button functions */
_frame.find(".btn-forward").click(() => { _frame.find(".btn-forward").click(() => {
this.handle.handle.serverConnection.sendCommand("musicbotplayeraction", { this.handle.handle.serverConnection.sendCommand("musicbotplayeraction", {
botid: bot.properties.client_database_id, bot_id: bot.properties.client_database_id,
action: 3 action: 3
}).then(updated => this.triggerUpdate()).catch(error => { }).then(updated => this.triggerUpdate()).catch(error => {
createErrorModal("Failed to execute forward", "Failed to execute pause.<br>{}".format(error)).open(); createErrorModal("Failed to execute forward", "Failed to execute pause.<br>{}".format(error)).open();
@ -480,7 +480,7 @@ class MusicInfoManager extends ClientInfoManager {
}); });
_frame.find(".btn-rewind").click(() => { _frame.find(".btn-rewind").click(() => {
this.handle.handle.serverConnection.sendCommand("musicbotplayeraction", { this.handle.handle.serverConnection.sendCommand("musicbotplayeraction", {
botid: bot.properties.client_database_id, bot_id: bot.properties.client_database_id,
action: 4 action: 4
}).then(updated => this.triggerUpdate()).catch(error => { }).then(updated => this.triggerUpdate()).catch(error => {
createErrorModal("Failed to execute rewind", "Failed to execute pause.<br>{}".format(error)).open(); createErrorModal("Failed to execute rewind", "Failed to execute pause.<br>{}".format(error)).open();
@ -535,7 +535,7 @@ class MusicInfoManager extends ClientInfoManager {
let current_timestamp = info.player_replay_index + Date.now() - timestamp; let current_timestamp = info.player_replay_index + Date.now() - timestamp;
this.handle.handle.serverConnection.sendCommand("musicbotplayeraction", { this.handle.handle.serverConnection.sendCommand("musicbotplayeraction", {
botid: bot.properties.client_database_id, bot_id: bot.properties.client_database_id,
action: current_timestamp > target_timestamp ? 6 : 5, action: current_timestamp > target_timestamp ? 6 : 5,
units: current_timestamp < target_timestamp ? target_timestamp - current_timestamp : current_timestamp - target_timestamp units: current_timestamp < target_timestamp ? target_timestamp - current_timestamp : current_timestamp - target_timestamp
}).then(() => this.triggerUpdate()).catch(error => { }).then(() => this.triggerUpdate()).catch(error => {

View file

@ -71,7 +71,7 @@ class ModalProperties {
} }
} }
class Modal extends EventTarget { class Modal {
private _htmlTag: JQuery; private _htmlTag: JQuery;
properties: ModalProperties; properties: ModalProperties;
shown: boolean; shown: boolean;
@ -79,8 +79,6 @@ class Modal extends EventTarget {
close_listener: (() => any)[] = []; close_listener: (() => any)[] = [];
constructor(props: ModalProperties) { constructor(props: ModalProperties) {
super();
this.properties = props; this.properties = props;
this.shown = false; this.shown = false;
} }