import{t as e}from"./config-BYRrjYC5.mjs";import{t}from"./parse-date-BdYTmLpo.mjs";import{t as n}from"./config-not-found-B9AOp828.mjs";import{a as r,i,n as a,r as o}from"./discord-api-CMcqid5c.mjs";import{t as s}from"./message-Ud5lA52G.mjs";const c={path:`/channel/:channelId`,categories:[`social-media`],example:`/discord/channel/950465850056536084`,parameters:{channelId:`Channel ID`},features:{requireConfig:[{name:`DISCORD_AUTHORIZATION`,description:`Discord authorization header from the browser`}],requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},radar:[{source:[`discord.com/channels/:guildId/:channelId/:messageID`,`discord.com/channels/:guildId/:channelId`]}],name:`Channel Messages`,maintainers:[`TonyRL`],handler:l};async function l(c){if(!e.discord||!e.discord.authorization)throw new n(`Discord RSS is disabled due to the lack of <a href="https://docs.rsshub.app/deploy/config#route-specific-configurations">relevant config</a>`);let{authorization:l}=e.discord,u=c.req.param(`channelId`),d=await o(u,l),f=await i(u,l,c.req.query(`limit`)??100),{name:p,topic:m,guild_id:h}=d,g=await r(h,l),{name:_,icon:v}=g,y=f.map(e=>({title:e.content.split(`
`)[0],description:s({message:e,guildInfo:g}),author:`${e.author.global_name??e.author.username}(${e.author.username})`,pubDate:t(e.timestamp),updated:e.edited_timestamp?t(e.edited_timestamp):void 0,category:`#${p}`,link:`${a}/channels/${h}/${u}/${e.id}`}));return{title:`#${p} - ${_} - Discord`,description:m,link:`${a}/channels/${h}/${u}`,image:`https://cdn.discordapp.com/icons/${h}/${v}.webp`,item:y,allowEmpty:!0}}export{c as route};