Skip to content

Commit

Permalink
fix(route): discord maintainer path
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyRL authored and nullqwertyuiop committed Jun 27, 2023
1 parent abf53ab commit ad58d12
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions lib/v2/discord/channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ module.exports = async (ctx) => {
throw Error('Discord RSS is disabled due to the lack of <a href="https://docs.rsshub.app/en/install/#configuration-route-specific-configurations">relevant config</a>');
}
const { authorization } = config.discord;
const { channelID } = ctx.params;
const { channelId } = ctx.params;

const channelInfo = await getChannel(channelID, authorization, ctx.cache.tryGet);
const messagesRaw = await getChannelMessages(channelID, authorization, ctx.cache.tryGet, ctx.query.limit ?? 100);
const { name: channelName, topic: channelTopic, guild_id } = channelInfo;
const channelInfo = await getChannel(channelId, authorization, ctx.cache.tryGet);
const messagesRaw = await getChannelMessages(channelId, authorization, ctx.cache.tryGet, ctx.query.limit ?? 100);
const { name: channelName, topic: channelTopic, guild_id: guildId } = channelInfo;

const guildInfo = await getGuild(guild_id, authorization, ctx.cache.tryGet);
const guildInfo = await getGuild(guildId, authorization, ctx.cache.tryGet);
const { name: guildName, icon: guidIcon } = guildInfo;

const messages = messagesRaw.map((message) => ({
Expand All @@ -25,14 +25,14 @@ module.exports = async (ctx) => {
pubDate: parseDate(message.timestamp),
updated: message.edited_timestamp ? parseDate(message.edited_timestamp) : undefined,
category: `#${channelName}`,
link: `${baseUrl}/channels/${guild_id}/${channelID}/${message.id}`,
link: `${baseUrl}/channels/${guildId}/${channelId}/${message.id}`,
}));

ctx.state.data = {
title: `#${channelName} - ${guildName} - Discord`,
description: channelTopic,
link: `${baseUrl}/channels/${guild_id}/${channelID}`,
image: `https://cdn.discordapp.com/icons/${guild_id}/${guidIcon}.webp`,
link: `${baseUrl}/channels/${guildId}/${channelId}`,
image: `https://cdn.discordapp.com/icons/${guildId}/${guidIcon}.webp`,
item: messages,
};
};
2 changes: 1 addition & 1 deletion lib/v2/discord/maintainer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
'/channel/:channelID': ['TonyRL'],
'/channel/:channelId': ['TonyRL'],
};
4 changes: 2 additions & 2 deletions lib/v2/discord/radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ module.exports = {
{
title: 'Channel Messages',
docs: 'https://docs.rsshub.app/en/social-media.html#discord',
source: ['/channels/:guildId/:channelID/:messageID', '/channels/:guildId/:channelID'],
target: '/discord/channel/:channelID',
source: ['/channels/:guildId/:channelId/:messageID', '/channels/:guildId/:channelId'],
target: '/discord/channel/:channelId',
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion lib/v2/discord/router.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = (router) => {
router.get('/channel/:channelID', require('./channel'));
router.get('/channel/:channelId', require('./channel'));
};

0 comments on commit ad58d12

Please sign in to comment.