mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
oops
This commit is contained in:
1 parent
68938e0d29
commit
082cdbc3b1
1 file changed
+10
-8
@@ -48,17 +48,19 @@ export class Dashboard {
|
|||||||
|
|
||||||
case "server": {
|
case "server": {
|
||||||
try {
|
try {
|
||||||
const guild = this.remix.client.guilds.get(data.key);
|
const guild = await this.remix.client.guilds.fetch(data.key);
|
||||||
if (!guild) return { error: "Server not found" };
|
if (!guild) return { error: "Server not found" };
|
||||||
const member = await guild.members.fetch(data.accessor).catch(() => null);
|
const member = await guild.members.fetch(data.accessor).catch(() => null);
|
||||||
|
const channels = await guild.fetchChannels(); // execute before converting the guild, see caching
|
||||||
const server = Dashboard.convertServer(guild);
|
const server = Dashboard.convertServer(guild);
|
||||||
if (member) {
|
if (member) {
|
||||||
server.channels = server.channels.filter(c => {
|
server.channels = server.channels.filter(c => {
|
||||||
const ch = guild.channels.get(c.id);
|
const ch = channels.find(cl => c.id === cl.id);
|
||||||
return ch ? ch.permissionsFor?.(member)?.has?.("ViewChannel") ?? true : true;
|
return ch ? ch.permissionsFor?.(member)?.has?.("ViewChannel") ?? true : true;
|
||||||
});
|
});
|
||||||
server.voiceChannels = server.voiceChannels.filter(c => {
|
server.voiceChannels = server.voiceChannels.filter(c => {
|
||||||
const ch = guild.channels.get(c.id);
|
if (c.type !== 2) return false;
|
||||||
|
const ch = channels.find(cl => c.id === cl.id);
|
||||||
return ch ? ch.permissionsFor?.(member)?.has?.("ViewChannel") ?? true : true;
|
return ch ? ch.permissionsFor?.(member)?.has?.("ViewChannel") ?? true : true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -127,7 +129,7 @@ export class Dashboard {
|
|||||||
// Validate textChannel: if it's a voice channel (type === 2) or missing,
|
// Validate textChannel: if it's a voice channel (type === 2) or missing,
|
||||||
// find a suitable text channel from the guild instead
|
// find a suitable text channel from the guild instead
|
||||||
const isText = (ch) => ch && (ch.type === 0 || ch.type === 5 || ch.type === 13 ||
|
const isText = (ch) => ch && (ch.type === 0 || ch.type === 5 || ch.type === 13 ||
|
||||||
(typeof ch.isText === "function" && ch.isText()));
|
(typeof ch.isText === "function" && ch.isText()));
|
||||||
|
|
||||||
if (!isText(textChannel)) {
|
if (!isText(textChannel)) {
|
||||||
// Auto-pick a text channel from the guild
|
// Auto-pick a text channel from the guild
|
||||||
@@ -470,8 +472,8 @@ export class Dashboard {
|
|||||||
// 5=announcement, 13=stage, 15=form, 16=forum, 17=media
|
// 5=announcement, 13=stage, 15=form, 16=forum, 17=media
|
||||||
const isCategory = type === 4;
|
const isCategory = type === 4;
|
||||||
const isText = !isVoice && !isCategory && (
|
const isText = !isVoice && !isCategory && (
|
||||||
type === 0 || type === 5 || type === 13 ||
|
type === 0 || type === 5 || type === 13 ||
|
||||||
(typeof channel.isText === "function" && channel.isText())
|
(typeof channel.isText === "function" && channel.isText())
|
||||||
);
|
);
|
||||||
let voiceParticipants = [];
|
let voiceParticipants = [];
|
||||||
if (isVoice) {
|
if (isVoice) {
|
||||||
@@ -519,8 +521,8 @@ export class Dashboard {
|
|||||||
? [...channelStore.values()]
|
? [...channelStore.values()]
|
||||||
: [];
|
: [];
|
||||||
const allChannels = channelValues
|
const allChannels = channelValues
|
||||||
.map(Dashboard.convertChannel)
|
.map(Dashboard.convertChannel)
|
||||||
.filter(c => !c.isCategory); // exclude categories — they are not joinable
|
.filter(c => !c.isCategory); // exclude categories — they are not joinable
|
||||||
|
|
||||||
// Build icon URL using fluxerusercontent.com CDN pattern
|
// Build icon URL using fluxerusercontent.com CDN pattern
|
||||||
// guild.icon is the icon hash string; guild.id is the server ID
|
// guild.icon is the icon hash string; guild.id is the server ID
|
||||||
|
|||||||
Reference in new issue
Block a user