Added alert when bot can't access server

This commit is contained in:
Corban-Lee Jones 2024-05-22 16:25:17 +01:00
parent 42aa9a517c
commit 06f972b081
2 changed files with 25 additions and 0 deletions

View File

@ -256,6 +256,7 @@ async function loadChannelOptions(guildId) {
}
if (channels.code === 50001) {
showServerJoinAlert();
throw new Error(
`Unable to retrieve channels from Guild '${guildId}'.
Ensure that @PYRSS is a member with permissions
@ -317,4 +318,16 @@ async function loadFilterOptions(guildId) {
$("#subFilters").prop("disabled", false);
}
}
function showServerJoinAlert() {
const guildId = getCurrentlyActiveServer().guild_id;
const inviteUrl = `https://discord.com/oauth2/authorize
?client_id=1129345991758336020
&permissions=2147534848&scope=bot+applications.commands
&guild_id=${guildId}
&disable_guild_select=true`
$("#serverJoinAlert a.alert-link").attr("href", inviteUrl);
$("#serverJoinAlert").show();
}

View File

@ -37,6 +37,18 @@
</div>
</div>
<div class="col-12 m-0">
<div id="serverJoinAlert" class="alert alert-warning alert-dismissable fade show mt-4 d-flex align-items-center" role="alert" style="display: hidden">
<i class="bi bi-warning"></i>
<span>
<strong>Warning:</strong>
The Bot isn't a member of this server, please <a href="" class="alert-link">invite the bot</a> to use it.
</span>
<button type="button" class="btn-close ms-auto" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
</div>
<div class="col-12">
<div class="d-flex px-3 pt-4 pb-2">
<ul id="serverTabs" class="nav nav-pills me-auto" role="tablist">