forked from cadence/out-of-your-element
channel name decoration for threads and voice-text
This commit is contained in:
parent
beeb27bbd8
commit
30bf87b106
2 changed files with 33 additions and 7 deletions
|
@ -36,12 +36,17 @@ function applyKStateDiffToRoom(roomID, kstate) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {{id: string, name: string, topic?: string?}} channel
|
||||
* @param {{id: string, name: string, topic?: string?, type: number}} channel
|
||||
* @param {{id: string}} guild
|
||||
* @param {string?} customName
|
||||
*/
|
||||
function convertNameAndTopic(channel, guild, customName) {
|
||||
const convertedName = customName || channel.name;
|
||||
let channelPrefix =
|
||||
( channel.type === DiscordTypes.ChannelType.PublicThread ? "[⛓️] "
|
||||
: channel.type === DiscordTypes.ChannelType.PrivateThread ? "[🔒⛓️] "
|
||||
: channel.type === DiscordTypes.ChannelType.GuildVoice ? "[🔊] "
|
||||
: "")
|
||||
const chosenName = customName || (channelPrefix + channel.name);
|
||||
const maybeTopicWithPipe = channel.topic ? ` | ${channel.topic}` : '';
|
||||
const maybeTopicWithNewlines = channel.topic ? `${channel.topic}\n\n` : '';
|
||||
const channelIDPart = `Channel ID: ${channel.id}`;
|
||||
|
@ -51,7 +56,7 @@ function convertNameAndTopic(channel, guild, customName) {
|
|||
? `#${channel.name}${maybeTopicWithPipe}\n\n${channelIDPart}\n${guildIDPart}`
|
||||
: `${maybeTopicWithNewlines}${channelIDPart}\n${guildIDPart}`;
|
||||
|
||||
return [convertedName, convertedTopic];
|
||||
return [chosenName, convertedTopic];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue