Expose emoji-only layout and renameChannel for GUI
messageLayoutKind returns emoji-only; renameChannel gossips category/channel name updates for inline sidebar rename. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -224,6 +224,7 @@ function messageLayoutKind (m) {
|
|||||||
if (layout === LAYOUT.HUB) return 'hub'
|
if (layout === LAYOUT.HUB) return 'hub'
|
||||||
if (layout === LAYOUT.COMBO) return 'combo'
|
if (layout === LAYOUT.COMBO) return 'combo'
|
||||||
if (layout === LAYOUT.STICKER_ONLY) return 'sticker-only'
|
if (layout === LAYOUT.STICKER_ONLY) return 'sticker-only'
|
||||||
|
if (layout === LAYOUT.EMOJI_ONLY) return 'emoji-only'
|
||||||
return 'text'
|
return 'text'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8734,6 +8735,27 @@ class PearcordPlatform extends EventEmitter {
|
|||||||
return updated
|
return updated
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async renameChannel ({ channelId, name } = {}) {
|
||||||
|
if (!this.guild) throw new Error('no guild')
|
||||||
|
if (!(await this._hasPerm(PERMISSION.MANAGE_CHANNELS))) {
|
||||||
|
throw new Error('no permission to rename channels')
|
||||||
|
}
|
||||||
|
const trimmed = String(name || '').trim()
|
||||||
|
if (!trimmed) throw new Error('name required')
|
||||||
|
const channels = await this.guild.listChannels()
|
||||||
|
const ch = channels.find((c) => c.id === channelId)
|
||||||
|
if (!ch) throw new Error('channel not found')
|
||||||
|
if (ch.name === trimmed) return ch
|
||||||
|
const updated = await this.guild.updateChannel({ ...ch, name: trimmed })
|
||||||
|
this.guild.gossipChannelUpdate(updated)
|
||||||
|
await this._audit('channel.rename', {
|
||||||
|
guildId: this.guild.guild.id,
|
||||||
|
channelId,
|
||||||
|
name: trimmed
|
||||||
|
})
|
||||||
|
return updated
|
||||||
|
}
|
||||||
|
|
||||||
async reorderCategories ({ categoryIds = [] } = {}) {
|
async reorderCategories ({ categoryIds = [] } = {}) {
|
||||||
if (!this.guild) throw new Error('no guild')
|
if (!this.guild) throw new Error('no guild')
|
||||||
if (!(await this._hasPerm(PERMISSION.MANAGE_CHANNELS))) {
|
if (!(await this._hasPerm(PERMISSION.MANAGE_CHANNELS))) {
|
||||||
|
|||||||
Reference in New Issue
Block a user