From 17d543e711cd7fb55b5a72a27e781073bd7995ec Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Mon, 26 Nov 2018 20:52:56 +0100 Subject: [PATCH] Updated music interface to the newest version of TeaSpeak --- shared/js/ui/client.ts | 8 ++++---- shared/js/ui/frames/SelectedItemInfo.ts | 12 ++++++------ shared/js/utils/modal.ts | 4 +--- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/shared/js/ui/client.ts b/shared/js/ui/client.ts index 7b00da89..dffbfb10 100644 --- a/shared/js/ui/client.ts +++ b/shared/js/ui/client.ts @@ -788,7 +788,7 @@ class MusicClientProperties extends ClientProperties { } class MusicClientPlayerInfo { - botid: number = 0; + bot_id: number = 0; player_state: number = 0; player_buffered_index: number = 0; @@ -870,7 +870,7 @@ class MusicClientEntry extends ClientEntry { createInputModal("Please enter the URL", "URL:", text => true, result => { if(result) { 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! url: result }).catch(error => { @@ -937,7 +937,7 @@ class MusicClientEntry extends ClientEntry { Modals.spawnYesNo("Are you sure?", $.spawn("div").append(tag), result => { if(result) { 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.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; } } \ No newline at end of file diff --git a/shared/js/ui/frames/SelectedItemInfo.ts b/shared/js/ui/frames/SelectedItemInfo.ts index 7e687532..9db19ba8 100644 --- a/shared/js/ui/frames/SelectedItemInfo.ts +++ b/shared/js/ui/frames/SelectedItemInfo.ts @@ -423,7 +423,7 @@ class MusicInfoManager extends ClientInfoManager { button_play.click(handler => { if(!button_play.hasClass("active")) { this.handle.handle.serverConnection.sendCommand("musicbotplayeraction", { - botid: bot.properties.client_database_id, + bot_id: bot.properties.client_database_id, action: 1 }).then(updated => this.triggerUpdate()).catch(error => { createErrorModal("Failed to execute play", MessageHelper.formatMessage("Failed to execute play.
{}", error)).open(); @@ -436,7 +436,7 @@ class MusicInfoManager extends ClientInfoManager { button_pause.click(handler => { if(!button_pause.hasClass("active")) { this.handle.handle.serverConnection.sendCommand("musicbotplayeraction", { - botid: bot.properties.client_database_id, + bot_id: bot.properties.client_database_id, action: 2 }).then(updated => this.triggerUpdate()).catch(error => { createErrorModal("Failed to execute pause", MessageHelper.formatMessage("Failed to execute pause.
{}", error)).open(); @@ -448,7 +448,7 @@ class MusicInfoManager extends ClientInfoManager { }); button_stop.click(handler => { this.handle.handle.serverConnection.sendCommand("musicbotplayeraction", { - botid: bot.properties.client_database_id, + bot_id: bot.properties.client_database_id, action: 0 }).then(updated => this.triggerUpdate()).catch(error => { createErrorModal("Failed to execute stop", MessageHelper.formatMessage("Failed to execute stop.
{}", error)).open(); @@ -471,7 +471,7 @@ class MusicInfoManager extends ClientInfoManager { { /* Button functions */ _frame.find(".btn-forward").click(() => { this.handle.handle.serverConnection.sendCommand("musicbotplayeraction", { - botid: bot.properties.client_database_id, + bot_id: bot.properties.client_database_id, action: 3 }).then(updated => this.triggerUpdate()).catch(error => { createErrorModal("Failed to execute forward", "Failed to execute pause.
{}".format(error)).open(); @@ -480,7 +480,7 @@ class MusicInfoManager extends ClientInfoManager { }); _frame.find(".btn-rewind").click(() => { this.handle.handle.serverConnection.sendCommand("musicbotplayeraction", { - botid: bot.properties.client_database_id, + bot_id: bot.properties.client_database_id, action: 4 }).then(updated => this.triggerUpdate()).catch(error => { createErrorModal("Failed to execute rewind", "Failed to execute pause.
{}".format(error)).open(); @@ -535,7 +535,7 @@ class MusicInfoManager extends ClientInfoManager { let current_timestamp = info.player_replay_index + Date.now() - timestamp; 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, units: current_timestamp < target_timestamp ? target_timestamp - current_timestamp : current_timestamp - target_timestamp }).then(() => this.triggerUpdate()).catch(error => { diff --git a/shared/js/utils/modal.ts b/shared/js/utils/modal.ts index a9181dc4..f9556cec 100644 --- a/shared/js/utils/modal.ts +++ b/shared/js/utils/modal.ts @@ -71,7 +71,7 @@ class ModalProperties { } } -class Modal extends EventTarget { +class Modal { private _htmlTag: JQuery; properties: ModalProperties; shown: boolean; @@ -79,8 +79,6 @@ class Modal extends EventTarget { close_listener: (() => any)[] = []; constructor(props: ModalProperties) { - super(); - this.properties = props; this.shown = false; }