invite link when channels load fails
All checks were successful
Build and Push Docker Image / build (push) Successful in 16s
All checks were successful
Build and Push Docker Image / build (push) Successful in 16s
This commit is contained in:
parent
c8bae087f9
commit
56e125c0bf
@ -64,9 +64,9 @@ $(document).on("selectedServerChange", async function() {
|
|||||||
$(".sidebar .sidebar-item").prop("disabled", true);
|
$(".sidebar .sidebar-item").prop("disabled", true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
$(`.sidebar .sidebar-item[data-id="${serverId}"]`).removeClass("is-not-operational");
|
||||||
channels = await ajaxRequest(`/generate-channels?guild=${serverId}`, "GET");
|
channels = await ajaxRequest(`/generate-channels?guild=${serverId}`, "GET");
|
||||||
_loadedChannels[serverId] = channels;
|
_loadedChannels[serverId] = channels;
|
||||||
$(".sidebar .sidebar-item").prop("disabled", false);
|
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
logError(error);
|
logError(error);
|
||||||
@ -74,6 +74,18 @@ $(document).on("selectedServerChange", async function() {
|
|||||||
// Mark the sidebar item as non-operational
|
// Mark the sidebar item as non-operational
|
||||||
$(`.sidebar .sidebar-item[data-id="${serverId}"]`).addClass("is-not-operational");
|
$(`.sidebar .sidebar-item[data-id="${serverId}"]`).addClass("is-not-operational");
|
||||||
|
|
||||||
|
const inviteBotToServer = () => {
|
||||||
|
window.open(
|
||||||
|
`https://discord.com/oauth2/authorize
|
||||||
|
?client_id=${discordClientId}
|
||||||
|
&permissions=2147534848
|
||||||
|
&scope=bot+applications.commands
|
||||||
|
&guild_id=${serverId}
|
||||||
|
&disable_guild_select=true`,
|
||||||
|
"_blank"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Inform the user of the problem
|
// Inform the user of the problem
|
||||||
createModal({
|
createModal({
|
||||||
title: "Failed to Fetch Server Channels",
|
title: "Failed to Fetch Server Channels",
|
||||||
@ -83,14 +95,23 @@ $(document).on("selectedServerChange", async function() {
|
|||||||
],
|
],
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
className: "btn-danger px-4",
|
text: "Invite the Bot",
|
||||||
iconClass: "bi-arrow-return-right",
|
className: "btn-primary me-3",
|
||||||
|
iconClass: "bi-envelope-plus",
|
||||||
closeModal: true,
|
closeModal: true,
|
||||||
onClick: () => { $(".sidebar .sidebar-item").prop("disabled", false); }
|
onClick: inviteBotToServer
|
||||||
|
},
|
||||||
|
{
|
||||||
|
className: "btn-secondary",
|
||||||
|
iconClass: "bi-arrow-return-right",
|
||||||
|
closeModal: true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
$(".sidebar .sidebar-item").prop("disabled", false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user